How do I...make an item that automatically saves a fallen party member from a KO state?

Basically, I want to make a totem-like item.

As long as the party has it in their inventory, if a party member is to be put in a KO state during the turn, the item automatically intersects, and lets them survive at 1 HP.


How would I go about eventing/making this sort of thing happen?
This one
What @SGHarlekin suggested with Auto-Life Trick is a good start, but your premise of it being powered by simply owning an item makes both the code and implementation a bit different. If you wanted to use the item as a consumable to create the state, then you could just duplicate that code.

But for what you asked, you'd have to have a passive state on each actor.

You give that passive state a Custom Passive Condition:
Code:
condition=$gameParty.numItems($dataItems[ID])>0;
where ID is the database ID of your protection item.

Then you put the Auto-Life code in it, and add a line after the last line of code, before the closing bracket:
Code:
$gameParty.loseItem($dataItems[ID], 1);
Oh yeah, the state. Totally forgot about that, oops.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-an-item-that-automatically-saves-a-fallen-party-member-from-a-ko-state.157079/