cant understand expression?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
22
Code:
code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        while ground state of shot projectile is false:
            set {_block} to the block at location 0.3 below the projectile
            loop {_block::*}:
                if {_block} is air:
                    delete projectile
                    stop loop
                    
            set {_entity} to player at location 0.1 around the projectile
            loop {_entities::*}:
                if {_entity} is player:
                    damage {_entity} by 2 hearts
                    stop loop

The part it can not understand is:
set {_entity} to player at location 0.1 around the projectile, can anyone explain? Not looking for someone to write my code, just asking why it doesnt understand it
[doublepost=1501894896,1501894827][/doublepost]
set {_entity} to player at location 0.1 around the projectile
 
I believe the issue is that location is a set of coordinates, not a singular number. I think you need a radius or a distance
 
Ok, to my understanding, the code isnt picking up a "Projectile" do I have to put an else in the code too?

Code:
code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        while ground state of shot projectile is false:
            set {_block} to the block at location 0.3 below the projectile
            loop {_block::*}:
                if {_block} is air:
                    delete projectile
                    stop loop
                    
            set {_entity} to player in radius 1 around the projectile
            loop {_entity::*}:
                if {_entity} is player:
                    damage {_entity} by 2 hearts
                    stop loop
 
Ok, so do variables have to be named specific names like {_block} when setting the value to that of blocks?
It appears that the variable is more than one object?

Here is what i have:
code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        while ground state of shot projectile is false:
            set {_block} to the block at location 0.3 below the shot projectile
            loop {_block::*}:
                if {_block} is air:
                    delete projectile
                    stop loop

            set {_entity} to entity in radius 1 around the shot projectile
            loop {_entity::*}:
                if {_entity} is player:
                    damage {_entity} by 2 hearts
                    stop loop

It says this:
[21:19:33 ERROR]: {_entity} can only be set to one object, not more (Kits.sk, line 340: set {_entity} to entity in radius 1 around the shot projectile')
[21:19:33 INFO]: [Skript] Encountered 1 error while reloading Kits.sk!
 
they can be named anything, but you changed it from player to entity, so it doesn't know what entity you want. That's why it's saying you can only set it to one thing.
 
Hmm, so what would be a solution to it? Could you rephrase this plz? I didnt get what you said.
they can be named anything, but you changed it from player to entity, so it doesn't know what entity you want. That's why it's saying you can only set it to one thing.
 
When you say "set {entity} to entity in radius..." it could mean any entity in that radius. Your variable can only be set to one. I would keep it as a player.
 
Hmm, still says only 1 object..
code_language.skript:
            set {player} to entity in radius 1 around the shot projectile
            loop {_player::*}:
                if {_player} is player:
                    damage {_player} by 2 hearts
                    stop loop
 
You still have it as entity x3
ce9c57a8dc.png

Switch that out and let me know if it throws a different error
[doublepost=1501897440,1501897339][/doublepost]the variable here can be anything. {_entity}, {_player},{_banana} whatever you like.
This little bugger, switch him out:
e1ff6047d8.png
 
Ok, 1 error,
ERROR:
[21:44:39 INFO]: [Skript] Reloading Kits.sk...
[21:44:49 ERROR]: Can't understand this expression: 'player in radius 1 around the shot projectile' (Kits.sk, line 340: set {_player} to player in radius 1 around the shot projectile')
code_language.skript:
            set {_player} to player in radius 1 around the shot projectile
            loop {_player::*}:
                if {_player} is player:
                    damage {_player} by 2 hearts
                    stop loop
[21:44:50 INFO]: [Skript] Encountered 1 error while reloading Kits.sk!

Code:
 
Ok, thanks for believing in me.. Imma keep trying
[doublepost=1501898108,1501897598][/doublepost]Ok, I am getting closer. With some variable testing, I found out that the problem is with my "to player" part

[21:54:22 INFO]: [Skript] Reloading Kits.sk...
[21:54:28 ERROR]: '::%player%} in radius 1 around the shot projectile' is not a valid item data (Kits.sk, line 340: set {_player} to {XD::%player%} in radius 1 around the shot projectile')
[21:54:28 INFO]: [Skript] Encountered 1 error while reloading Kits.sk!
[doublepost=1501899991][/doublepost]Am I just derping out? I have been trying for 30 minutes and still cant get it. Could one of you give me a hint?

Code:
code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        while ground state of shot projectile is false:
            set {_block} to the block at location 0.3 below the shot projectile
            loop {_block::*}:
                if {_block} is air:
                    delete projectile
                    stop loop
            loop players in radius 1 around the shot projectile:
                set {_player} to loop-players in radius 1 around the shot projectile
                if {_player} is player:
                    damage {_player} by 2 hearts
                    stop loop
[22:26:25 INFO]: [Skript] Reloading Kits.sk...
[22:26:31 ERROR]: There's no loop that matches 'loop-players in radius 1 around the shot projectile' (Kits.sk, line 340: set {_player} to loop-players in radius 1 around the shot projectile')
[22:26:31 INFO]: [Skript] Encountered 1 error while reloading Kits.sk!
 
  • Like
Reactions: Wynnevir
Basic stuff bud. Also, you are looping players in radius 1, so why do you need to set it as a variable when you can just do "loop-player." For instance, "if loop-player is a player" or something like that.
 
Hmm, am I using the wrong damage event?
I checked the docs out and it appears that this is how to do it?

Code:
code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        while ground state of shot projectile is false:
            set {_block} to the block at location 0.3 below the shot projectile
            loop {_block::*}:
                if {_block} is air:
                    delete projectile
                    stop loop

    while ground state of shot projectile is false:
        if shot projectile is nether star:
            loop players in radius 1 of the shot projectile:
                if loop-player is a player:
                    wait 1 tick
                    damage loop-player by 2 hearts
                    stop loop
 
Don't use ground state for doing things like that.

If the player takes the projectile before his ground state is true , it will infinity do the loop.
 
Still, once I remove it, the damage is not done to the user...

code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        set {_block} to the block at location 0.3 below the shot projectile
        loop {_block::*}:
            if {_block} is air:
                delete projectile
                stop loop
        wait 1 tick
        loop players in radius 1 of the shot projectile:
            if loop-player is a player:
                wait 1 tick
                damage loop-player by 2 hearts
                stop loop
Do i have to stop the loop b4 the dmg is done?
 
Still, once I remove it, the damage is not done to the user...

code_language.skript:
on rightclick with nether star:
    if the name of player's tool is "&eShuriken &7(Right Click)":
        make the player shoot an item projectile of 1 nether star at speed 1.2
        wait 1 tick
        set {_block} to the block at location 0.3 below the shot projectile
        loop {_block::*}:
            if {_block} is air:
                delete projectile
                stop loop
        wait 1 tick
        loop players in radius 1 of the shot projectile:
            if loop-player is a player:
                wait 1 tick
                damage loop-player by 2 hearts
                stop loop
Do i have to stop the loop b4 the dmg is done?

What skript version are you using? Still mc 1.8.8?
 
Status
Not open for further replies.