[Solved]Adding Cooldown to Keybind

Started by xTremQuick on

Topic category: Help with MCreator software

Last seen on 21:29, 30. Aug 2023
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Solved]Adding Cooldown to Keybind
Wed, 07/19/2023 - 20:42 (edited)

Hey there,

So Ive got a Keybind to strike lightning at the pressing of the r key. I dont want players to spam this, so I need a cooldown for this. I have no idea on how to add it, so are there any sugestions? tthanks in advance

Edited by xTremQuick on Wed, 07/19/2023 - 20:42
Last seen on 21:50, 21. May 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This can be accomplished by…
Mon, 07/17/2023 - 00:14

This can be accomplished by using a player lifetime variable that goes down on global trigger player tick update.  If you check if the variable is equal to or less than 0 before using the keybinding, and it sets it to whatever cooldown you want in ticks(20 ticks = 1 second) after you press it, it should work.

Last seen on 21:29, 30. Aug 2023
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I cant figure out on how to…
Mon, 07/17/2023 - 11:48

I cant figure out on how to create the player lifetime variable, asked ChatGPT but I think the answers there are outdated

Last seen on 21:50, 21. May 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is a side tab called…
Mon, 07/17/2023 - 12:00

There is a side tab called variables, when you click on that, the bar at the top of the screen changes to include a button that says 'Add new variable' if you click on that it opens up a menu with three boxes, the top box is where you put the name of the variable, really does not matter, the middle box is a dropdown menu where you can select number variable, and the bottom box is a dropdown menu where you can select player lifetime.

Last seen on 21:50, 21. May 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
To make the timer go down,…
Mon, 07/17/2023 - 12:09

To make the timer go down, create a new procedure, then on the green starting block click the box labeled 'No additional trigger' it will open a dropdown menu that you can select 'On player tick update'(it is a long menu and it may be slightly difficult to find on player tick update, but it does exist in the most recent MCreator version, and has for the last several versions).
After selecting On player tick update, attach the procedure blocks 'Set [timer variable] to:', '[timer variable]'(both under the custom variables tab), you will also need the math block, at first it is set to + but if you click the + you can change it to -, you will also need a static number, 1, the block for it defaults to 0, but you can click it to change it(the second two blocks are under the math tab).
After getting all of the procedure locks, attach them so it is:

"Event trigger - triggered by external call
or when (global trigger): On player tick update

Set [timer variable] to: [timer variable] - 1"

 

that will work to reduce the timer by 20 every second

Last seen on 21:29, 30. Aug 2023
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you very much, solved…
Mon, 07/17/2023 - 12:16

Thank you very much, solved it

Last seen on 16:22, 31. Jul 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can someone screenshot the…
Fri, 07/28/2023 - 16:20

can someone screenshot the procedure? i made all by instructions but nothing happend

Last seen on 21:29, 30. Aug 2023
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Got you: thats the variable…
Sun, 07/30/2023 - 13:31

Got you:

thats the variable

heres the procedure

Last seen on 21:29, 30. Aug 2023
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh and this is the procedure…
Sun, 07/30/2023 - 13:32

Oh and this is the procedure where I count the variable down

Last seen on 15:29, 21. May 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The image is broken, please…
Fri, 10/06/2023 - 09:13

The image is broken, please upload it to the upload pages and send the link

Last seen on 20:03, 27. Nov 2023
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can right-click on the…
Mon, 11/27/2023 - 09:39

You can right-click on the image symbol and hit open in new tab so you can see the image

Last seen on 23:57, 28. Feb 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
where is the "get global"…
Sun, 01/28/2024 - 20:08

where is the "get global" trigger 

Last seen on 23:57, 28. Feb 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nevermind lmao
Sun, 01/28/2024 - 20:13

nevermind lmao