Armor ability that triggers on keybind press

Started by EpicTheJet on

Topic category: Help with modding (Java Edition)

Last seen on 22:05, 3. Feb 2023
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Armor ability that triggers on keybind press

I've been trying to make a procedure that checks that a full set of armor is being worn, then on key press it applies potion effects for a few seconds then goes into a cooldown period. Ive gotten it to work but once the armor set is taken off and put back on, it never allows the player to trigger the ability again Any ideas on what I'm doing wrong?

Procedure that im using

Last seen on 13:09, 14. Apr 2024
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok so I tried this out…
Sat, 01/14/2023 - 13:31

Ok so I tried this out myself and at first i got the exact same issue as you. What i think happened was that you took off the armor while it was still on cooldown and so it didnt get the chance to revert the NBT tag back to false. Taking off the armor when it's inactive but not on cooldown and putting it back on again works just fine. Also, if its broken and you switch dimension, it starts working again. However, I currently still don't know what you can do in the procedure to prevent this from happening entirely

Last seen on 13:09, 14. Apr 2024
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Update: ok so i should've…
Sat, 01/14/2023 - 21:58

Update: ok so i should've found a solution! Instead of using the "wait (x) ticks" and NBT logic tags, i used NBT number tags. You will have to define the same nbt tag on the individual armor pieces' tick update procedures. Make it so that if the number is greater than 0, it will subtract one every tick. Then in the key bind procedure, make the if condition check that all their tags are equal to 0, and make it so after you cast the ability, it sets the number tag to the number of ticks you want the cooldown to be. Idk if that makes sense, I added a picture of the procedure you need to add to every armor piece in their trigger section hopefully that will help