Need help on create manual/auto item

I need help on this revive item. struggling with using both formula and notepad.
this item, on death > revive. the note using yep action sequence.

so I tried to create this revive item shown below:
target = knockout > remove knockout state + restore Hp
and if not knockout: target add state 10 (which is autolife or auto revive on death)

formula use:
if (b.isStateAffected(1)) b.removeState(1); b.gainHp(mhp*0.5) else b.addState(10)

Untitled.png
I dont know if you require formula if you use notebox though.

but you miss stuff inside the target action, but it should look more like this:

<target action>
if (b.isStateAffected(1) {
b.removeState(1) && b.gainHp.(mhp*0.05);
} else {
b.addSate(10);
end
</target action>

now keep in mind that the above isn't 100% correct as well, but I do not know
what you plugin you use or how the lunatic code works for those specific plugin.
Try this in the skill's formula box:
JavaScript:
if (b.isStateAffected(1)) { b.removeState(1); b.gainHp(Math.round(b.mhp/2)); } else b.addState(10); 0
I replaced mhp (undefined) with b.mhp (max HP of target), added a Math.round in there to ensure the heal is a whole number, and put a 0 at the end just in case (formula result should always be a number).

Also I'd suggest removing the <target action> tag from the note box. Action sequences have their own custom syntax; I imagine the notetag as you've written it is failing silently, causing the skill to do nothing in that action phase.

Note that by default there is no "living or dead ally" action scope. There's a free plugin called DeadOrAliveItem you might find helpful for that; check your RMMV install folder under dlc/KadokawaPlugins. That said, I think I remember it conflicting with some of Yanfly's stuff...if so, maybe there's an alternative? 😴
Try this in the skill's formula box:
JavaScript:
if (b.isStateAffected(1)) { b.removeState(1); b.gainHp(Math.round(b.mhp/2)); } else b.addState(10); 0
I replaced mhp (undefined) with b.mhp (max HP of target), added a Math.round in there to ensure the heal is a whole number, and put a 0 at the end just in case (formula result should always be a number).

Also I'd suggest removing the <target action> tag from the note box. Action sequences have their own custom syntax; I imagine the notetag as you've written it is failing silently, causing the skill to do nothing in that action phase.

Note that by default there is no "living or dead ally" action scope. There's a free plugin called DeadOrAliveItem you might find helpful for that; check your RMMV install folder under dlc/KadokawaPlugins. That said, I think I remember it conflicting with some of Yanfly's stuff...if so, maybe there's an alternative? 😴
test out and the formula work (even thou that hasn't test the revive one). but oh well, thank you for your help.

how could didn't mention your plugin that fix DeadOrAliveItem so it can compatible with yep plugin? at the same time, I'm also wrong that didn't mention using DeadOrAliveItem. but anyway, also Thank you for the fixed plugin.
@tyranzero 👋 I forgot I wrote that compatibility patch, thanks for the reminder! Hopefully it works for you. Here's a link in case anyone else is interested:

Original thread: https://forums.rpgmakerweb.com/threads/need-help-on-create-manual-auto-item.130139/