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

Started by yeetermod on Wed, 02/12/2020 - 13:43

Topic category: Help with modding

Last seen on 18:42, 14. Feb 2020
Joined Feb 2020
User points:

User statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
  • Mods of the week:
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
1Upvote this forum topic
Last seen on 13:15, 16. Feb 2020
Joined Dec 2017
User points:

User statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
  • Mods of the week:
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

0Upvote this forum topic
Last seen on 11:24, 15. Feb 2020
Joined Nov 2019
User points:

User statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
  • Mods of the week:
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.

0Upvote this forum topic
Last seen on 11:24, 15. Feb 2020
Joined Nov 2019
User points:

User statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
  • Mods of the week:
Also, name the tag like …
Fri, 02/14/2020 - 07:10

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

0Upvote this forum topic
Last seen on 18:42, 14. Feb 2020
Joined Feb 2020
User points:

User statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
  • Mods of the week:
Okay thank you guys, managed…
Fri, 02/14/2020 - 18:44

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

0Upvote this forum topic