Created from
this thread.
Version 2.0.1:
Github Link
Description
This plugin allows the user to run common events after any Actor or Enemy dies.
Installation
Either right click the Github link above and save as "DeathCommonEvent.js", or create a new text file called "DeathCommonEvent.js" and copy-paste the text from the link into it.
Move the file into your project's js/plugins folder.
Instructions
The plugin includes some logic to assign values to game variables that may be useful when writing common events, such as the Id and index of the last battler to act, the Id and index of the battler that just died, and the Id and type of the last skill or item used. By default:
- The Id of the Actor or Enemy that died is variable 1
- The index in either battleMembers or gameTroop of the Actor or Enemy that just died is variable 2
- The array of states the Actor or Enemy that died had before dying is variable 3
- The Id of the last Actor or Enemy to act is variable 4
- The index in either battleMembers or gameTroop of the Actor or Enemy that last acted is variable 5
- The Id of the last skill or item used is variable 6
- The type of the last action ("skill" or "item") is variable 7.
A quirk of common events is that their execution is queued up instead of immediately executed. By default, if you kill the last Enemy or the last Actor dies, then the common event is queued up, but not actually executed until after the battle is over.
There are two parameters you can change to affect this behavior - Run At Battle End will force your common event to be called just before the victory logic runs. Run After Battle will let your common event get called with the default behavior. If you turn both of them off, then the common event will not be called if the Actor or Enemy who dies would trigger the battle to be over.
Example
Spoiler: If skill 10 kills an enemy and the killer has state 4, apply state 11
Terms of Use
This Plugin is available for commercial and non-commercial use, as long as credit is given to the author listed in the @ author section of the Plugin. Credit must be listed in-game, as well as in any additional credits documentation provided with the game.
This Plugin may be modified in any way by any author, most notably for compatibility fixes with specific projects or other Plugins, as long as credit is provided to the original author and to whichever author made said modifications, according to the above-stated rules.
本贴来自国际rpgmaker官方论坛作者:Zevia处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/actor-and-enemy-death-common-events-v2-0-1.104429/