I am trying to do something if the enemy is about to be removed from the battle screen because it was defeated but I can't find anything. Please help me out.
MV Where is the code where the enemy is defeated?
Learning JavascriptThis is from MZ's codebase, since that is what I currently have open, but it should be the same or similar in MV. Here is the function that initiates the removal of the enemy from the screen:
Depending on what it is that you're trying to do, you can either hook into that function, or you can follow the trail backwards (i.e. search for the code that calls that function, and then the code that calls that code, etc.) till you find what you need.
JavaScript:
Game_Enemy.prototype.performCollapse = function() {
Game_Battler.prototype.performCollapse.call(this);
switch (this.collapseType()) {
case 0:
this.requestEffect("collapse");
SoundManager.playEnemyCollapse();
break;
case 1:
this.requestEffect("bossCollapse");
SoundManager.playBossCollapse1();
break;
case 2:
this.requestEffect("instantCollapse");
break;
}
};
Depending on what it is that you're trying to do, you can either hook into that function, or you can follow the trail backwards (i.e. search for the code that calls that function, and then the code that calls that code, etc.) till you find what you need.
Ah! You've helped me! I was able to solve it now in no time.
Original thread: https://forums.rpgmakerweb.com/threads/where-is-the-code-where-the-enemy-is-defeated.149415/