CoolDown on item doesn't disable procedures

Started by Mando1mS on

Topic category: Help with modding (Java Edition)

Last seen on 17:56, 25. Aug 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
CoolDown on item doesn't disable procedures
Tue, 08/25/2020 - 17:33 (edited)

I'm trying to make an item that heals you when you are low hp. The problem is that I need a cooldown for that heal or it would be too op.

I issued a cooldown on the item when healed but that cooldown only disables the item not the procedure where he heals.

So I tried to do this but its not working... I think its because the NBT Tag that I put is not the same for item stack (CoolDownActivated) or maybe this is not the way to verify if it has cooldown

Procedure

If you could help me I would appreciate.

Edited by Mando1mS on Tue, 08/25/2020 - 17:33
Last seen on 17:49, 25. Mar 2021
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The cooldown makes you…
Tue, 08/25/2020 - 17:24

The cooldown makes you unable to use an item, basically disabling right-click. I doubt there is a vanilla NBT tag for checking for cooldown, and if there is one, it surely is named differently.

If you want the item to heal you on right-click, the cooldown works just fine. If you want it to work automatically, you would have to create a manual kind of cooldown.

You could either have a custom cooldown potion effect (so the procedure could check if the player has that effect active) or create a new player nbt variable.

When the item heals the player, the variable is set to 6000. Each tick the variable automatically decreases by one (by using a global trigger like "on player tick").

You could still have the visual item cooldown (besides the nbt variable) so the player knows if the item can be used again :)

Last seen on 17:56, 25. Aug 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nice point. I think I will…
Tue, 08/25/2020 - 17:30

Nice point. I think I will do that with the potion effect its even better because the player can see how much cooldown is left. Thank you for your help

 

Last seen on 17:49, 25. Mar 2021
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No problem :)
Wed, 08/26/2020 - 07:22

No problem :)