#how to make a cooldown
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D
Open question: #1372808801354252359
What problem are you having? What code do you already have? We can't help you without enough details.
um I have an abillity which summons lightning that you have a "charge bar" a scoreboard for sneaking and when the score is 100.. it summons lightning and reset the score and now I want to add a cooldown
<@&1166082198152159386> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)
- Add a new scoreboard objective to use for the cooldown
- When the player successfully summons the lightning and gets their score reset, set that cooldown to the desired duration
- In your tick function, remove 1 from that score on all players if that score is 1 or more
- Wherever your lightning ability is handled, make it only work if the player's cooldown score is not 1 or more
I know that but I want the scoreboard to go down in 1 every second not 20
oh mybe I can make an other scoreboard and make it like the same but /20 is there any way to do that?
You can either just use ticks (20 per second) and adjust accordingly (e.g 100 on the scoreboard is 5 seconds), or schedule a function to run every second and subtract one
however I would reccomend just using ticks
how can I use tick?
That’s what you have currently
like how to adjust
20 ticks per second is default
Explain the problem you are facing
I want to have a cooldown wirten on the action bar
Ah on the actionbar you should probably use a scheduled function to run every second and subtract 1
In your load function, just run a function, in that function you can subtract 1 from the scoreboard and then /schedule the same function to run in 1s
I have thought of that but woulden't it cause lag?
No
ok ty
oh