How to make armour hurt player once when worn?

Started by Spyjetray on Wed, 07/03/2019 - 08:58

Topic category: Bugs and solutions

Last seen on 12:46, 23. Jul 2019
Joined Jul 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How to make armour hurt player once when worn?
Wed, 07/03/2019 - 08:58

So for my mod, I need the chest piece of armour to hurt the player when they put it on but only once when wearing it but it hurts them each time they equip it.

https://imgur.com/a/QnxlM5d

This is the code I have so far but it does not work.

I have tried a global world variable to turn on and off the part that deals damage but it does not work.

Can someone tell me where I have gone wrong?

Thanks.

0Upvote this forum topic
Trigger this procedure using…
Wed, 07/03/2019 - 10:15

Trigger this procedure using global player tick trigger. If you trigger this using armor tick event, your variable will not be reset once the player takes the armor down as once the armor is no on the player, this procedure won't be called anymore.

0Upvote this forum topic
Last seen on 12:46, 23. Jul 2019
Joined Jul 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
It worked perfectly, thanks!
Wed, 07/03/2019 - 13:10

It worked perfectly, thanks!

0Upvote this forum topic
Last seen on 21:39, 21. Nov 2019
Joined Jun 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I have wanted to try this,…
Wed, 11/06/2019 - 22:49

I have wanted to try this, but have a delay before it does damage (it's for a suggestion for a horror movie mod that includes Jigsaw, involving traps, in particular the reverse beartrap and flytrap traps).  The aforementioned traps would be armor equipped in the head slot, and after a certain amount of time, they'd deal fatal damage (20 damage, or 10 hearts).  They're meant to be part of a generated structure, where the player must possess a key and right-click it to remove the curse of binding enchantment from it (which serves as the "lock") to escape the trap.

0Upvote this forum topic
Use a global timer system to…
Thu, 11/07/2019 - 09:48

Use a global timer system to add delay, or count the given status variable to a certain value to add N ticks delay, before you trigger your hurt action.

0Upvote this forum topic