The plugin is simple: place this somewhere in your combat plugins batch, and in any Actors, Classes or Enemies that need a common event to call on death, add this Note tag:
Code:
<DeathCommonEvent:ID>
ID = the common event ID you wish to call. For example:
<DeathCommonEvent:3>
Common Event #3 will run when this character dies.All it does is make an aliased call to Game_BattlerBase.die that checks if the Battler is an Actor or Enemy. If it is, it checks for the tag in both the Actor or Class, and if it finds one then it runs the common event referenced in the tag. Then it calls the original .die function. Note that because of this, any condition you set to the event will not be checked, same as if you were to use the "Common Event" event action.
If you are utilizing All Ally Dead or All Enemy Dead plugin parameters, you do not need to repeat that event ID in a character's note box. Having a one-member party with the same event as <DeathCommonEvent:ID> will not function -- if you are not using Common Event Queue, only the last common event initialized will be run.
If you are using Hime's Common Event Queue: Place this plugin below Common Event Queue. If you set the 'DCE Fallthrough' parameter to true, if a Class and Actor both have a Death Common Event, then both will run. The same also applies for Any Ally, Any Enemy, All Allies and All Enemy plugin parameters.
If you are not using Hime's Common Event Queue, the furthest Common Event down in the following list will be run:
For Player Characters: [Actor DCE] --> [Class DCE] --> [Any Ally DCE] --> [All Allies DCE (if all allies dead)]
For Enemies: [Enemy DCE] --> [Any Enemy DCE] --> [All Enemies DCE (if all enemies dead)]
Important Note: If you use All Ally Dead DCE, you will need to call Game Over yourself. This is because the Game Over screen would still trigger, even after a revive. I am sorry for the inconvenience. This also leads me to believe that enemies being somehow revived by All Enemy DCE probably won't work. I haven't had time to test this, however.
You can get the latest version of my plugin from my GitHub repository here: https://github.com/chronosv2/Cv2MVPlugins/blob/master/Cv2_DeathCommonEvent.js
Latest Version: 1.2.0 (5:17AM 10/27/2016)
Plugin is free for commercial and non-commercial use. I wrote it for convenience, and the plugin is generic so feel free to use it as you see fit.
Anyway, I hope you find this useful. Have a great day and happy RPG Making!
---
Changelog:
v1.0.0 - Initial version. Death Common Event worked for Actors only.
v1.1.0 - You can now set a Death Common Event to Actors, Enemies or Classes.
v1.1.1 - Added compatibility with Hime's Common Event Queue.
v1.1.2 - No idea why I didn't revert the version number, but I tried to use a filename-less plugin parameter parse and it failed (I clearly did something wrong) so I reverted the code to the old way. I will be revisiting the filename-less parameters system at a later time -- right now rapid development and deployment is a little more important. Sorry for the possible inconvenience.
v1.2.0 - Added 4 new Parameters:
- All Ally Dead DCE: The Event ID to be run when All Allies are dead. This actually runs before Game Over, so it could be used to check for a condition to revive a party member, for example.
- All Enemy Dead DCE: The Event ID to be run when All Enemies are dead. This actually runs before Battle Victory. I'm not exactly sure what this could be used for but it could be useful I'm sure.
- Any Ally Dead DCE: The Event ID to be run when any Ally dies. This will only be run if the actor does not have an Actor or Class DCE. Next version will add the ability for more DCE fallthrough so that "Any" DCE will be run in sequence if Hime's Common Event Queue is loaded and DCE Fallthrough is set to true.
- Any Enemy Dead DCE: The Event ID to be run when any Enemy dies. See above for information about fallthrough.
Caveats: While the new plugin version should open up options for the entire party being KO'ed (or entire enemy group), if you try to use it for a Dragon Quest-like Game Over you will run into problems at worst (it simply won't work if you try and do the transfer on the Battle Screen), and a glitchy looking system (the Status window reappears for a few frames) at best. If you would like defeat to still technically occur while having something secondary still happen, I suggest Tsukihime's Gameover Events plugin.



