So I'm trying to figure out how to make a State where anyone who attacks the afflicted creature recovers health. It would basically be like they have a life drain effect, but it only applies when attacking the effected creature.
MZ Create a State where anyone who hurts the effected creature regains health?
RPG Maker MZ SupportYou'll need to use a plugin for this. If you're not already using any, you can add my Eval Tags. If you're using any VisuStella plugins, you'd use their Battle Core.
Using my Eval Tags, you'd give the state the notetag
That would heal the attacker for however much damage they dealt the target with the state. If you want them to heal more or less, perform math on the
Using my Eval Tags, you'd give the state the notetag
Code:
<Action Reaction Eval>
user.gainHp(value);
</Action Reaction Eval>
That would heal the attacker for however much damage they dealt the target with the state. If you want them to heal more or less, perform math on the
value variable.Sorry, forgot to mention that I'm using Battle Core! My bad.
Using <JS Post-Damage as Target> or <JS Post-Damage as User> is applying the healing at the right time, but it's applying the healing to the enemy getting hit, not the person hitting them.
I don't have experience with Visustella's plugins,
but wouldn't using the <JS Post-Damage as User> notetag and replacing the 'user' part in the code with 'target' work?
JavaScript:
target.gainHp(value);
Code:
<JS Post-Damage as User>
target.gainHp(value);
</JS Post-Damage as User>
Makes it so enemies affected by the State will heal anyone they hit for the amount of damage they would've done. If I change it to <JS Post-Damage as Target> then anyone affected by the state gets healed when they get hit instead of taking damage.
So, I feel like we're getting closer but still haven't found it. I need to target the attacker, not the person with the state.[/code]
Hmmm, isn't it a state on the enemy with:
EDIT: Are you confused with the popup? It doesn't move with the attacker (at least with my not-updated plugins) when the actor moves back after attacking, instead staying close to the enemy.
EDIT2: If you want it to move (and if updated VS plugins aren't handling it), I guess you need to add to the Sprite_Damage.prototype.updateChild (or some other method, I haven't checked how the damage sprites are handled) to change the x too. Like make it follow the attacker's position.
EDIT3: You might also add wait time 60 to the action sequences in case that state is in effect, before the attackers move back.
<JS Post-Damage as Target>user.gainHp(value);</JS Post-Damage as Target>EDIT: Are you confused with the popup? It doesn't move with the attacker (at least with my not-updated plugins) when the actor moves back after attacking, instead staying close to the enemy.
EDIT2: If you want it to move (and if updated VS plugins aren't handling it), I guess you need to add to the Sprite_Damage.prototype.updateChild (or some other method, I haven't checked how the damage sprites are handled) to change the x too. Like make it follow the attacker's position.
EDIT3: You might also add wait time 60 to the action sequences in case that state is in effect, before the attackers move back.
user is always the battler whose turn it is, and target is always the target of the current action.You're totally right, actually, that DOES work. I must've just been getting confused by the popup locations. Thank you so much!
Original thread: https://forums.rpgmakerweb.com/threads/create-a-state-where-anyone-who-hurts-the-effected-creature-regains-health.182129/