[Solved]Adding Cooldown to Keybind

Started by xTremQuick on

Topic category: Help with MCreator software

Active 1 year ago
Joined Jul 2023
Points:
162

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
[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
Active 2 hours ago
Joined Apr 2023
Points:
506

User statistics:

  • Modifications: 3
  • Forum topics: 19
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 402
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.

Active 1 year ago
Joined Jul 2023
Points:
162

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
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

Active 2 hours ago
Joined Apr 2023
Points:
506

User statistics:

  • Modifications: 3
  • Forum topics: 19
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 402
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.

Active 2 hours ago
Joined Apr 2023
Points:
506

User statistics:

  • Modifications: 3
  • Forum topics: 19
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 402
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

Active 1 year ago
Joined Jul 2023
Points:
162

User statistics:

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

Thank you very much, solved it

Active 1 year ago
Joined Dec 2021
Points:
551

User statistics:

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

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

Active 1 year ago
Joined Jul 2023
Points:
162

User statistics:

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

Got you:

thats the variable

heres the procedure

Active 1 year ago
Joined Jul 2023
Points:
162

User statistics:

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

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

Active 8 months ago
Joined Feb 2023
Points:
220

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
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

Active 1 year ago
Joined Nov 2023
Points:
94

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
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

Active 4 weeks ago
Joined May 2022
Points:
415

User statistics:

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

where is the "get global" trigger 

Active 4 weeks ago
Joined May 2022
Points:
415

User statistics:

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

nevermind lmao

Active 9 months ago
Joined Jul 2024
Points:
43

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
This hasn't worked for me? 
Fri, 07/05/2024 - 08:16

This hasn't worked for me? 

Active 9 months ago
Joined Jul 2024
Points:
43

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
I ended up using a logic…
Fri, 07/05/2024 - 08:57

I ended up using a logic variable instead.