Death Common Events

What Will the Script Do?

I need a script that makes a common event activate when an actor dies. I would also like the script to be customizable so that a different common event will be activated for each actor that dies. Here is how it would work in my game:

Mario uses a skill to change himself into Fire Mario. That skill changed his name, actor graphic, and applied a state to him.

When he dies, the state is removed, but the name and graphic is not reverted back.

This leads to a "Fire Mario" with the attributes of a regular Mario.

With the script, it will make it possible to fix that by starting a common event when Mario dies to change his actor graphic and name back so Mario will have his "Mario" actor graphic and the "Mario" name and not the Fire Mario stuff.

What Customization Options Do I Need?

The script does not need excessive customization options. I only need one with the option to have a different customization option for each player. For example, Common Event X activates when Mario dies, and Common Event Y activates when Luigi dies.

EDIT: I don't care how you implement this, though it would be nice to do so through actor notetags.

What Scripts Would I Like This Script to Work With?

Here are the battle scripts that I would like this script to work with:

A slightly modified version of Fomar0153's Sideview Battle Script (the whole script is in this spoiler):

Spoiler
=begin
Sprite Based Side View Battle Script
by Fomar0153
Version 1.0
=end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● Rewrites use_sprite?
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# ● New Method screen_x
#--------------------------------------------------------------------------
def screen_x
return 400 + self.index * 35
end
#--------------------------------------------------------------------------
# ● New Method screen_y
#--------------------------------------------------------------------------
def screen_y
return 235 + self.index * 40
end
#--------------------------------------------------------------------------
# ● New Method screen_z
#--------------------------------------------------------------------------
def screen_z
return 300
end
end

class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Rewrites create_actors
#--------------------------------------------------------------------------
def create_actors
@actor_sprites = $game_party.battle_members.reverse.collect do |actor|
Sprite_Battler.new(@viewport1, actor)
end
end
end

class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# * Update Transfer Origin Bitmap
#--------------------------------------------------------------------------
alias sbb_update_bitmap update_bitmap
def update_bitmap
if @battler.is_a?(Game_Actor)
char_bitmap = Cache.character(@battler.character_name)
sign = @battler.character_name[/^./]
if sign && sign.include?('$')
cw = char_bitmap.width / 3
ch = char_bitmap.height / 4
else
cw = char_bitmap.width / 3
ch = char_bitmap.height / 2
end
new_bitmap = Bitmap.new(cw, ch)
sx = (@battler.character_index % 4 * 3 + 1) * cw
sy = (@battler.character_index / 4 * 4 + 1) * ch
new_bitmap.blt(0, 0, char_bitmap, Rect.new(sx, sy, cw, ch))
if bitmap != new_bitmap
self.bitmap = new_bitmap
init_visibility
end
else
sbb_update_bitmap
end
end
end
DiamondandPlatinum3's Actor Voices In Battle

http://forums.rpgmakerweb.com/index.php?/topic/6853-actor-voices-in-battle/

Vlue's Critical Flash + SE

http://www.rpgmakervxace.net/topic/3241-critical-flash-se/

Vlue's Basic Enemy HP Bars (I use the regular version, not Lite)

http://www.rpgmakervxace.net/topic/8618-basic-enemy-hp-bars/

EDIT: I feel the most important script to look at for compatibility is with the Sideview battle, as I had a previous script to help with this, though it crashed the game since it messed with an actor's self.index value.
There are numerous scripts that run a common event upon death. Try Yanfly's and see if that works best for your setup.
Thanks, I had trouble finding something like this!
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/death-common-events.41892/