public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

MV OnDeathEval weirdness

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: MV OnDeathEval weirdness
  • Original author: EpicGJG
  • Original date: May 19, 2024
  • Source thread: https://forums.rpgmakerweb.com/threads/ondeatheval-weirdness.168837/
  • Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support

Summary

I am trying to make a state that kills an actor or battler, and then switches which team they are on in following battles (only works on some enemies/actors). This includes having an enemy equivalent to some of the actors in the game. Notable plugins include YEP_BuffsStatesCore and WAY_CustomOnDeathEval. What I'm trying to accomplish is a state using the StateCounter function which, when the state counter reaches 10, kills the affected actor or battler, running a common event with some dialogue specific to what actor or battler died and then...

Archived First Post

I am trying to make a state that kills an actor or battler, and then switches which team they are on in following battles (only works on some enemies/actors). This includes having an enemy equivalent to some of the actors in the game.
Notable plugins include YEP_BuffsStatesCore and WAY_CustomOnDeathEval.
What I'm trying to accomplish is a state using the StateCounter function which, when the state counter reaches 10, kills the affected actor or battler, running a common event with some dialogue specific to what actor or battler died and then either spawning an enemy event or adding them to the party respectively.
Here's the state note:
JavaScript:
<Custom Apply Effect>
target.addStateCounter(8, 1);
$gameVariables.setValue(1, target.actorId());
if ($gameVariables.value(1) >= 1) {
 if (target.getStateCounter(8) >= 10) {
  $gameVariables.setValue(3, 8);
  $gameTemp.reserveCommonEvent($gameVariables.value(1));
 }
}
else if (target.getStateCounter(8) >= 10) {
 $gameVariables.setValue(3, 8);
}
</Custom Apply Effect>
It checks if the target is an actor (and what actor it is) before running a common event for that actor, or if it is an enemy, simply tells the game that variable 3 (my 'cause of death' variable) was state 8.

The skill which applies the state has the damage formula:
JavaScript:
b.addState(8); if (b.getStateCounter(8) >= 10) {b.die()}; a.atk * 0.5
which applies the state, kills the target if it is at 10, and does some damage regardless.
The enemies which are susceptible to this state all have the notetag:
JavaScript:
<Custom On Death Eval>
 $gameVariables.setValue(2, [a number specific to each enemy to ID who died]);
 $gameTemp.reserveCommonEvent(8);
</Custom On Death Eval>
Which does effectively the same thing as the target.actorId() section in the state tag but for enemies.

My problem is that enemies killed by the state aren't triggering the common event. Actors killed by state level 10 will successfully trigger it and subsequently determine whether or not they should be switching teams, and enemies killed before reaching state level 10 are successfully triggering event 8, calling which enemy has died, and declaring that they are not state affected based on variable 3.
For whatever reason, killing an enemy via reaching state level 10 will not trigger any common events I try. They just die and nothing else happens.
I'm a novice at coding and can't figure out why this specific scenario doesn't work. The best guess I have is the order of operations is wrong somehow.

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rpg-maker-archive#js-support

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar