#how to make a cooldown

1 messages · Page 1 of 1 (latest)

pliant marten
#

um I have a problem with the schedule command and I want to make a cooldown for abillity that will show in action bar and it woudnt hurt to also have like the 0.1 but its not nessery

midnight sageBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 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

#
⚠️ You already have a question open!

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

sand plume
#

What problem are you having? What code do you already have? We can't help you without enough details.

pliant marten
#

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

midnight sageBOT
# midnight sage <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

🙇 Helpers Arise!

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)

next crypt
#
  1. Add a new scoreboard objective to use for the cooldown
  2. When the player successfully summons the lightning and gets their score reset, set that cooldown to the desired duration
  3. In your tick function, remove 1 from that score on all players if that score is 1 or more
  4. Wherever your lightning ability is handled, make it only work if the player's cooldown score is not 1 or more
pliant marten
#

I know that but I want the scoreboard to go down in 1 every second not 20

pliant marten
#

oh mybe I can make an other scoreboard and make it like the same but /20 is there any way to do that?

ornate ferry
#

however I would reccomend just using ticks

pliant marten
#

how can I use tick?

ornate ferry
#

That’s what you have currently

pliant marten
#

like how to adjust

ornate ferry
#

20 ticks per second is default

ornate ferry
pliant marten
#

I want to have a cooldown wirten on the action bar

ornate ferry
#

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

pliant marten
#

I have thought of that but woulden't it cause lag?

ornate ferry
#

No

pliant marten
#

ok ty

ornate ferry
#

Doing it in your tick function would be more laggy

#

Although both are negligible

pliant marten
#

oh