Solved How do i add a 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!

Status
Not open for further replies.

HypixelsFox

Member
Mar 26, 2021
14
1
3
18
I am very new to skript and i am working on a wands skript but i dont know how to add a cooldown

command /wand:
trigger:
player has permission "skript.Wand"
give blaze rod named "&c&lWand" with lore "&kL<reset>" to player

On leftclick:
if held item is a blaze rod:
if lore of item contains "&kL":
shoot fireball

i've tried to google it but had no success so can anyone give the answer please? :emoji_grinning:
 
I am very new to skript and i am working on a wands skript but i dont know how to add a cooldown

command /wand:
trigger:
player has permission "skript.Wand"
give blaze rod named "&c&lWand" with lore "&kL<reset>" to player

On leftclick:
if held item is a blaze rod:
if lore of item contains "&kL":
shoot fireball

i've tried to google it but had no success so can anyone give the answer please? :emoji_grinning:

Code:
command /wand:
    cooldown: 10 seconds
    cooldown message: &cPlease wait
    trigger:
        player has permission "skript.Wand"
        give blaze rod named "&c&lWand"
 
Just add available variable. I recommended declaring it to exact player.
Code:
variables:
  {%player%::fireballavalible} = 1
Then add
Code:
On leftclick:
  if held item is a blaze rod:
    if lore of item contains "&kL":
      if {%player%::fireballavalible} = 1:
        shoot fireball
        set {%player%::fireballavalible} to 0
        wait 10 seconds
        set {%player%::fireballavalible} to 1

You can edit the ten seconds to whatever you want.
 
Just add available variable. I recommended declaring it to exact player.
Code:
variables:
  {%player%::fireballavalible} = 1
Then add
Code:
On leftclick:
  if held item is a blaze rod:
    if lore of item contains "&kL":
      if {%player%::fireballavalible} = 1:
        shoot fireball
        set {%player%::fireballavalible} to 0
        wait 10 seconds
        set {%player%::fireballavalible} to 1

You can edit the ten seconds to whatever you want.
can you help me with my code?
Code:
variables:
    {%player%::guard} = 1

command /npctalk1:
    trigger:
        if {%player%::guard} = 1:
            chance of 50%:
                send "&c&lGuard: &fGet out of here!" to player
                stop
            chance of 50%:
                send "&c&lGuard: &fYou shouldnt be here!" to player
                stop
            chance of 100%:
                send "&c&lGuard: &fI dont have time for this." to player
                stop
            set {%player%::guard} to 0
            wait 5 seconds
            set {%player%::guard} to 1
        if {%player%::guard} = 0:
            cancel event

I dont know how to make it not conflict with the random messages. Thanks
 
can you help me with my code?
Code:
variables:
    {%player%::guard} = 1

command /npctalk1:
    trigger:
        if {%player%::guard} = 1:
            chance of 50%:
                send "&c&lGuard: &fGet out of here!" to player
                stop
            chance of 50%:
                send "&c&lGuard: &fYou shouldnt be here!" to player
                stop
            chance of 100%:
                send "&c&lGuard: &fI dont have time for this." to player
                stop
            set {%player%::guard} to 0
            wait 5 seconds
            set {%player%::guard} to 1
        if {%player%::guard} = 0:
            cancel event
I dont know how to make it not conflict with the random messages. Thanks


View our skunity conversation
[doublepost=1617614571,1617613940][/doublepost]
can you help me with my code?
Code:
variables:
    {%player%::guard} = 1

command /npctalk1:
    trigger:
        if {%player%::guard} = 1:
            chance of 50%:
                send "&c&lGuard: &fGet out of here!" to player
                stop
            chance of 50%:
                send "&c&lGuard: &fYou shouldnt be here!" to player
                stop
            chance of 100%:
                send "&c&lGuard: &fI dont have time for this." to player
                stop
            set {%player%::guard} to 0
            wait 5 seconds
            set {%player%::guard} to 1
        if {%player%::guard} = 0:
            cancel event

I dont know how to make it not conflict with the random messages. Thanks

Working on it...
[doublepost=1617614811][/doublepost]
can you help me with my code?
Code:
variables:
    {%player%::guard} = 1

command /npctalk1:
    trigger:
        if {%player%::guard} = 1:
            chance of 50%:
                send "&c&lGuard: &fGet out of here!" to player
                stop
            chance of 50%:
                send "&c&lGuard: &fYou shouldnt be here!" to player
                stop
            chance of 100%:
                send "&c&lGuard: &fI dont have time for this." to player
                stop
            set {%player%::guard} to 0
            wait 5 seconds
            set {%player%::guard} to 1
        if {%player%::guard} = 0:
            cancel event

I dont know how to make it not conflict with the random messages. Thanks

Well basically the stop stops the command, so the cooldown code wont load. You can fix this by adding the cooldown to every single version of the guard message. The code will look like this
Code:
variables:
    {%player%::guard} = 1
 
command /npctalk1:
    trigger:
        if {%player%::guard} = 1:
            chance of 50%:
                send "&c&lGuard: &fGet out of here!" to player
                set {%player%::guard} to 0
                wait 5 seconds
                set {%player%::guard} to 1
                stop
            chance of 50%:
                send "&c&lGuard: &fYou shouldnt be here!" to player
                set {%player%::guard} to 0
                wait 5 seconds
                set {%player%::guard} to 1
                stop
            chance of 100%:
                send "&c&lGuard: &fI dont have time for this." to player
                set {%player%::guard} to 0
                wait 5 seconds
                set {%player%::guard} to 1
                stop
        else:
            message "Please wait before using the command again"
            stop

Hope i helped :emoji_v:
 
Status
Not open for further replies.