Making a special crown that gives effects plus a right click dash with cooldown

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

Zephelin

Member
May 22, 2024
4
0
1
29
Code:
Variables:
     {cooldown.%player%} = 20

on armor change:
    if event-item is unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
        while player is wearing unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
            apply strength 2 without particles to player for 1 seconds
            apply hero of the village 3 without particles to player for 1 seconds
            apply resistance 2 without particles to player for 1 seconds
            wait 1 seconds
#--------------------------------------------------------------------------------------------------
#                                        EVENT
#--------------------------------------------------------------------------------------------------
on rightclick:
    while player is wearing unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
        if {cooldown.%player%} is equal to 20:
            push player forwards with force 1.5
            push player upward with force 0.5
            make player execute command "particle minecraft:sweep_attack ^1 ^1 ^0.8"
            make player execute command "particle minecraft:sweep_attack ^ ^1 ^0.8"
            make player execute command "particle minecraft:sweep_attack ^-1 ^1 ^0.8"
            loop 20 times:
                send action bar "&cCooldown until another dash = %{cooldown.%player%}%" to player
                subtract 1 from {cooldown.%player%}
                wait 1 second
        else:
            stop
    else:
        stop
    set {cooldown.%player%} to 20
    send action bar "&a&lDash ready" to player

I receive the following error,

"Line 28: (helmet.sk)
'else' has to be placed just after another 'if' or 'else if' section

Can anyone help me out?
 
Code:
Variables:
     {cooldown.%player%} = 20

on armor change:
    if event-item is unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
        while player is wearing unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
            apply strength 2 without particles to player for 1 seconds
            apply hero of the village 3 without particles to player for 1 seconds
            apply resistance 2 without particles to player for 1 seconds
            wait 1 seconds
#--------------------------------------------------------------------------------------------------
#                                        EVENT
#--------------------------------------------------------------------------------------------------
on rightclick:
    while player is wearing unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
        if {cooldown.%player%} is equal to 20:
            push player forwards with force 1.5
            push player upward with force 0.5
            make player execute command "particle minecraft:sweep_attack ^1 ^1 ^0.8"
            make player execute command "particle minecraft:sweep_attack ^ ^1 ^0.8"
            make player execute command "particle minecraft:sweep_attack ^-1 ^1 ^0.8"
            loop 20 times:
                send action bar "&cCooldown until another dash = %{cooldown.%player%}%" to player
                subtract 1 from {cooldown.%player%}
                wait 1 second
        else:
            stop
    set {cooldown.%player%} to 20
    send action bar "&a&lDash ready" to player
you dont need an else statement after while loop, because its not an if statement
(fixed code)
 
Code:
Variables:
     {cooldown.%player%} = 20

on armor change:
    if event-item is unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
        while player is wearing unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
            apply strength 2 without particles to player for 1 seconds
            apply hero of the village 3 without particles to player for 1 seconds
            apply resistance 2 without particles to player for 1 seconds
            wait 1 seconds
#--------------------------------------------------------------------------------------------------
#                                        EVENT
#--------------------------------------------------------------------------------------------------
on rightclick:
    while player is wearing unbreakable golden helmet named "&x&F&B&E&9&0&0&lᴋ&x&F&B&E&B&1&A&lɪ&x&F&C&E&D&3&3&lɴ&x&F&C&F&0&4&D&lɢ&x&F&D&F&2&6&6&l'&x&F&D&F&4&8&0&ls &x&F&D&F&6&9&9&lᴄ&x&F&E&F&8&B&3&lʀ&x&F&E&F&B&C&C&lᴏ&x&F&F&F&D&E&6&lᴡ&x&F&F&F&F&F&F&lɴ" with custom model data 556:
        if {cooldown.%player%} is equal to 20:
            push player forwards with force 1.5
            push player upward with force 0.5
            make player execute command "particle minecraft:sweep_attack ^1 ^1 ^0.8"
            make player execute command "particle minecraft:sweep_attack ^ ^1 ^0.8"
            make player execute command "particle minecraft:sweep_attack ^-1 ^1 ^0.8"
            loop 20 times:
                send action bar "&cCooldown until another dash = %{cooldown.%player%}%" to player
                subtract 1 from {cooldown.%player%}
                wait 1 second
        else:
            stop
    set {cooldown.%player%} to 20
    send action bar "&a&lDash ready" to player
you dont need an else statement after while loop, because its not an if statement
(fixed code)
Thank You! That mostly worked, so the problem is now, that the ability kinda only works once and then never works again, after it gets to one on the cool down, it just goes away and nothing works until i reload the script and put on a brand new helmet made.
 
Thank You! That mostly worked, so the problem is now, that the ability kinda only works once and then never works again, after it gets to one on the cool down, it just goes away and nothing works until i reload the script and put on a brand new helmet made.
I forgot to state that i want this to work no matter what, if i have just my hand, or my sword or whatever in my hand, the right click ability works!
 
holy fuckin shit-

ok SO:

Your cooldown system is pretty bad, use item cooldowns
why are you declaring the variable in a section
use list variables
PLEASE do your particles with SkBee
use ram variables
store the item in an option so i dont have to see that god awful name more than once
is equal to instead of =
you dont need to have a while loop for every second just give them the effects until they change armor again
why tf are you using a WHILE LOOP for your dash, just use an if statement

ALSO

it won't work if its just your hand because mc cant detect right clicks with your hand, only with blocks, items, and entities, so it'll only work if you're looking at a block or holding an item
 
holy fuckin shit-

ok SO:

Your cooldown system is pretty bad, use item cooldowns
why are you declaring the variable in a section
use list variables
PLEASE do your particles with SkBee
use ram variables
store the item in an option so i dont have to see that god awful name more than once
is equal to instead of =
you dont need to have a while loop for every second just give them the effects until they change armor again
why tf are you using a WHILE LOOP for your dash, just use an if statement

ALSO

it won't work if its just your hand because mc cant detect right clicks with your hand, only with blocks, items, and entities, so it'll only work if you're looking at a block or holding an item
This is my first skript making an item with abilities, so don’t be a shitter and be helpful. Thanks bud.
 
Where in my message was I "a shitter"? I understand my message may be perceived as aggressive by some but I asked genuine questions and gave genuine suggestions.