Custom Item problems

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

JarBinks

Member
Jun 28, 2023
17
0
1
24
Hi, I am having some problems with my skript. The problem im having is that when i loop all the players and push them back / ignite them it is pushing/igniting the player who used the ability as well which I don't want to happen.
Here is my skript:
code_language.skript:
#summon lightning at an area nearby.
on rightclick with a golden axe:
    if player is holding a golden axe named "&6&l&o&kHH&e&l&oThor's Hammer&6&l&o&kHH":
        if {thundercooldown::%player%} is not set:
            if player is not sneaking:
                strike lightning at the targeted block
                set {thundercooldown::%player%} to true
                wait 7 seconds
                clear {thundercooldown::%player%}
            else: #right click while sneaking to push players around you back
                loop all players in radius 5 around player:
                    push loop-player backwards at speed 5
                set {knockcooldown::%player%} to true
                wait 10 seconds
                clear {knockcooldown::%player%}
        if {thundercooldown::%player%} is set:
            send "&4This ability is on cooldown."

# make players around you burst into flames.
on rightclick with a iron sword:
    if player is holding a iron sword named "&4»&c»&6»Blazing Blade&6«&c«&4«":
        if {blazingcooldown::%player%} is not set:
            loop all players in radius 3 around player:
                ignite loop-player for 30 seconds
            loop all blocks in radius 3 around player:
                lerp 5 of flame at loop-block with offset vector(0, 1, 0) with extra 0.05
            set {blazingcooldown::%player%} to true
            wait 15 seconds
            clear {blazingcooldown::%player%}
        if {blazingcooldown::%player%} is set:
            send "&4This ability is on cooldown."
 
Hi, I am having some problems with my skript. The problem im having is that when i loop all the players and push them back / ignite them it is pushing/igniting the player who used the ability as well which I don't want to happen.
Here is my skript:
code_language.skript:
#summon lightning at an area nearby.
on rightclick with a golden axe:
    if player is holding a golden axe named "&6&l&o&kHH&e&l&oThor's Hammer&6&l&o&kHH":
        if {thundercooldown::%player%} is not set:
            if player is not sneaking:
                strike lightning at the targeted block
                set {thundercooldown::%player%} to true
                wait 7 seconds
                clear {thundercooldown::%player%}
            else: #right click while sneaking to push players around you back
                loop all players in radius 5 around player:
                    push loop-player backwards at speed 5
                set {knockcooldown::%player%} to true
                wait 10 seconds
                clear {knockcooldown::%player%}
        if {thundercooldown::%player%} is set:
            send "&4This ability is on cooldown."

# make players around you burst into flames.
on rightclick with a iron sword:
    if player is holding a iron sword named "&4»&c»&6»Blazing Blade&6«&c«&4«":
        if {blazingcooldown::%player%} is not set:
            loop all players in radius 3 around player:
                ignite loop-player for 30 seconds
            loop all blocks in radius 3 around player:
                lerp 5 of flame at loop-block with offset vector(0, 1, 0) with extra 0.05
            set {blazingcooldown::%player%} to true
            wait 15 seconds
            clear {blazingcooldown::%player%}
        if {blazingcooldown::%player%} is set:
            send "&4This ability is on cooldown."
You code's issue is that it does not account for the player as being a loop-player. To resolve this try adding:
Code:
if loop-player is not player:
You would add this to your loops which involves damaging other players. I haven't tested it but it should work.
 
  • Like
Reactions: Doodle