MZ "Homunculus" Item

Hello,

In the Persona series, the Homunculus Item is a consumable that protects the party/party member from an instance of an instant death attack. If the party has an homunculus in their inventory, and someone is hit with a successful instant death attack, the homunculus will die in the party member's place and the item will be consumed from the inventory.

1710593097800.png



I'm looking for a script that will allow me to recreate this into MZ. Basically, I just want to create a consumable item (not an equip), that will be consumed in the case of instant death being applied to a party member.

I know this script was available for past engines, I believe it was for VX Ace, but I couldn't find anything similar for MZ.
How are you applying the instant death? Is your damage formula b.mhp?

I think you can use Visustella Battle core to put a notetag on the instand death skill:

<JS Pre-Damage>
if ($gameParty.hasItem(itemId, true)) {
value = 0;
$gameParty.loseItem($dataItems[itemId], 1);
};
</JS Pre-Damage>
Just a small correction to what @rpgLord69 gave you - hasItem() also wants the BaseItem object, so you'd do if ($gameParty.hasItem($dataItems[itemId], true)) there.

Also, you need to replace both instances of "itemID" with the ID of your homunculus item, no leading zeros.
How are you applying the instant death? Is your damage formula b.mhp?

I think you can use Visustella Battle core to put a notetag on the instand death skill:

<JS Pre-Damage>
if ($gameParty.hasItem(itemId, true)) {
value = 0;
$gameParty.loseItem($dataItems[itemId], 1);
};
</JS Pre-Damage>

Just by adding the death state via skill settings command.
Then, I think the easiest way to do this is:
- Make a state that has State Resist: 1
- Add a notetag to your skill that applies the new state if the target has the item.

If you're using VisuStella plugins already, you can use the Battle Core's JS Pre-Apply. If you're not, you can grab my Eval Tags plugin from the link in my signature and use the Action Apply Eval:
Code:
<Action Apply Eval>
if ($gameParty.hasItem($dataItems[itemId], true))
{
    $gameParty.loseItem($dataItems[itemId], 1);
    target.addState(stateId);
// Add the script call for showing a message if you like
}
</Action Apply Eval>

Replace itemId with the ID of your homunculus and stateId with the ID of your new state.

Then, in the skill Effects, on the line after Add State for state 1, do Remove State for the new state.
Then, I think the easiest way to do this is:
- Make a state that has State Resist: 1
- Add a notetag to your skill that applies the new state if the target has the item.

If you're using VisuStella plugins already, you can use the Battle Core's JS Pre-Apply. If you're not, you can grab my Eval Tags plugin from the link in my signature and use the Action Apply Eval:
Code:
<Action Apply Eval>
if ($gameParty.hasItem($dataItems[itemId], true))
{
    $gameParty.loseItem($dataItems[itemId], 1);
    target.addState(stateId);
// Add the script call for showing a message if you like
}
</Action Apply Eval>

Replace itemId with the ID of your homunculus and stateId with the ID of your new state.

Then, in the skill Effects, on the line after Add State for state 1, do Remove State for the new state.

Thanks, I think I follow this.

I’ll give it a shot. Do you know the code that pushes a message to the battle log?
Not by memory, but there's a pinned thread of MZ script calls (or it should pop right up on a Google).
Not by memory, but there's a pinned thread of MZ script calls (or it should pop right up on a Google).

Yeah figured I would ask before I went there.

Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/homunculus-item.166863/