Help, i want to make a onetime action after equipping my armor.

Started by yeetermod on

Topic category: Help with modding (Java Edition)

Last seen on 10:59, 9. Jul 2023
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help, i want to make a onetime action after equipping my armor.
Wed, 02/12/2020 - 14:21 (edited)

So basically i created a full armor set.And if worn it gives some potion effects.So far everything seems to be working.

Now i want to add for example a single lightning strike when equipping the full item set.I tried a lot already and im clueless now, since its looping because of the tick event i guess...

I would appreciate any help :).

Edited by yeetermod on Wed, 02/12/2020 - 14:21
Last seen on 08:13, 21. Jun 2021
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could make a global bool…
Wed, 02/12/2020 - 15:11

You could make a global bool variable that is primairly set to true, and put the lightning strike in a block if that variable is true. then you make it so after you struck the lightning you set the variable to false. if you want it to play everytime the player equips it, try to find an event when the armor isn't on it will set the variable to true

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In your armor update tick…
Fri, 02/14/2020 - 07:08

In your armor update tick procedure, use "Get/Set entity NBT logic tag" from your player entity, or "Get/Set item NBT logic tag" from the armor item. In the armor update tick event, check if the NBT logic tag is false, if so, strike lightning and set the NBT tag to true.

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, name the tag like …
Fri, 02/14/2020 - 07:10

Also, name the tag like "hasBeenWorn" or something like that

Last seen on 10:59, 9. Jul 2023
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay thank you guys, managed…
Fri, 02/14/2020 - 18:44

Okay thank you guys, managed to get it working ! :D