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 community!

    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.
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?
This whole thing is being started right when the item projectile is shot. If you want the shot projectile to constantly keep looping for nearby players, do something like this.
code_language.skript:
set {_t} to true
while {_t} is true:
    if {_n} < 101:
        if block 0.3 meters below shot projectile is not air:
            set {_t} to false
        else:
            add 1 to {_n}
        loop players in radius 1 around shot projectile:
            set {_check} to loop-player
            if {_check} is set:
                set {_t} to false
                # damage loop-player
        else:
            add 1 to {_n}
    else:
        set {_t} to false
    wait 1 tick
 
Now the nether star doesnt shoot, but 0 errors so far,

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
        set {_t} to true
        while {_t} is true:
            if {_n} < 101:
                if block 0.3 meters below shot projectile is not air:
                    set {_t} to false
                else:
                    add 1 to {n}
                    loop players in radius 1 around shot projectile:
                        set {_check} to loop-player
                        if {_check} is set:
                            set {_t} to false
                            damage loop-player by 2 hearts
                        else:
                            set {_t} to false
                            wait 1 tick
 
I'm not saying my example code will 100% work. My example code is to give you an idea of how you could do damaging with falling blocks or item projectiles.
 
Status
Not open for further replies.