CoolDown for using npc.

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

Giuliox_Sniper

New Member
Nov 26, 2023
7
0
1
19
Hello. I'm trying to create a cooldown for using an npc, but I can't, can anyone help me?

code_language.skript:
on right click on entity:
    if name of event-entity is "Carlotta":
            if player's held item is crossbow:
                if player's helmet is a feather named "&9Passamontagna":
                    loop players in radius 10 of the player:
                        send "&fAnonimo &8» &7Alt! Ferma, Dammi tutti i soldi!" to loop-player
                        wait 3 seconds
                        send "&d♀ &d&lNegoziante &8• &rCarlotta &8» &rS-Salve. Certamente prel...prelevo subito" to loop-player
                        wait 2 seconds
                        send "&fAnonimo &8» &7Muoviti, non ho tutto il giorno!" to loop-player
                        wait 3 seconds
                        send "&e&l** AZIONE&e: &7&oCarlotta &8▸ &ePrende la chiave della cassa..." to loop-player
                        wait 4 seconds
                        send "&e&l** AZIONE&e: &7&oCarlotta &8▸ &eLa inserisce nella cassa..." to loop-player
                        wait 7 seconds
                        send "&e&l** AZIONE&e: &7&oCarlotta &8▸ &eConsegna i soldi all'anonimo" to loop-player
                        give 3 stick named "&f500€" with custom model data 118 to player


P.S sorry for the language
 
Hey im not sure what cooldown do you have on mind but i would personally try to set cooldown variable before looping and if the variable is more than something it will continu. And on the end of the code i would set the variable of player that you will set to "now" and then check difference before the loop.
 
Hello. I'm trying to create a cooldown for using an npc, but I can't, can anyone help me?

code_language.skript:
on right click on entity:
    if name of event-entity is "Carlotta":
            if player's held item is crossbow:
                if player's helmet is a feather named "&9Passamontagna":
                    loop players in radius 10 of the player:
                        send "&fAnonimo &8» &7Alt! Ferma, Dammi tutti i soldi!" to loop-player
                        wait 3 seconds
                        send "&d♀ &d&lNegoziante &8• &rCarlotta &8» &rS-Salve. Certamente prel...prelevo subito" to loop-player
                        wait 2 seconds
                        send "&fAnonimo &8» &7Muoviti, non ho tutto il giorno!" to loop-player
                        wait 3 seconds
                        send "&e&l** AZIONE&e: &7&oCarlotta &8▸ &ePrende la chiave della cassa..." to loop-player
                        wait 4 seconds
                        send "&e&l** AZIONE&e: &7&oCarlotta &8▸ &eLa inserisce nella cassa..." to loop-player
                        wait 7 seconds
                        send "&e&l** AZIONE&e: &7&oCarlotta &8▸ &eConsegna i soldi all'anonimo" to loop-player
                        give 3 stick named "&f500€" with custom model data 118 to player


P.S sorry for the language
Just set a variable to now and check if the difference between now and that variable >= (cooldown) seconds


Also, that code won't work correctly, what it'll do is loop every player in radius 10 of the player like this:
send message to player #1
wait 3 seconds
send message to player #1
wait 2 seconds
etc.

and after everything is done it will move to player #2 and repeat the waiting again, also did u mean:
give 3 stick named "&f500€" with custom model data 118 to loop-player

because if not, it'll give 3 sticks to the event-player for every player in radius 10
 
How can I enter this variable? I'm trying but I can't
Just set a variable to now and check if the difference between now and that variable >= (cooldown) seconds


Also, that code won't work correctly, what it'll do is loop every player in radius 10 of the player like this:
send message to player #1
wait 3 seconds
send message to player #1
wait 2 seconds
etc.

and after everything is done it will move to player #2 and repeat the waiting again, also did u mean:


because if not, it'll give 3 sticks to the event-player for every player in radius 10