key bind cooldown

Started by luv_heart_mcreator on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
key bind cooldown

I'm trying to add a dash mechanic to my mod, but I don't want people to be able to spam it and just keep dashing.

If anyone has ideas please let me know

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'd check this out for a…
Thu, 07/20/2023 - 03:29

I'd check this out for a dash mechanic: https://mcreator.net/forum/69055/how-does-one-send-player-direction-hes-looking


To add a cooldown upon keybind I'd use a player_persistent global variable. Have it so when the keybind is pressed it sets the number to however many ticks you want the cooldown to be. Then in another procedure tracking player ticks, have it check if the variable is greater than 0 it will make it go down by 1. The keybind should also only activate if that global variable is 0 for the target.

 

Also! You could make it so if the number is greater than 0 when the keybind is pressed it sends a message to the player telling them how long they have left.