Hi,
The key to realizing this functionality is to do stuff in the
I used ChatGPT to draft the code, which has been an interesting process. ChatGPT does not have any knowledge of this plugin, so it took some effort. I think a certain level of coding expertise is essential to use Chat GPT effectively for game development, what a shame!
I don't have time to test if it works or not. But it seems like it should work:
The key to realizing this functionality is to do stuff in the
Scene_Map.prototype.srpgBattlerDeadAfterBattle method.I used ChatGPT to draft the code, which has been an interesting process. ChatGPT does not have any knowledge of this plugin, so it took some effort. I think a certain level of coding expertise is essential to use Chat GPT effectively for game development, what a shame!
I don't have time to test if it works or not. But it seems like it should work:
JavaScript:
var _Scene_Map_srpgBattlerDeadAfterBattle = Scene_Map.prototype.srpgBattlerDeadAfterBattle;
Scene_Map.prototype.srpgBattlerDeadAfterBattle = function() {
// Erase any summoned events if their summoner is dead
this.eraseSummonedEventsIfSummonerDead();
// Then call the original method
_Scene_Map_srpgBattlerDeadAfterBattle.call(this);
};
Scene_Map.prototype.eraseSummonedEventsIfSummonerDead = function() {
var allEvents = $gameMap.events();
allEvents.forEach(function(event) {
// Check if the event is a Game_SummonEvent and not already erased
if (event instanceof Game_SummonEvent && !event.isErased()) {
var summoner = event.summoner();
// Ensure the summoner exists and is dead before erasing the event
if (summoner && summoner.isDead()) {
// Check if the battler is alive and apply the death state before erasing
var battleArray = $gameSystem.EventToUnit(event.eventId());
if (battleArray && battleArray[1] && battleArray[1].isAlive()) {
battleArray[1].addState(battleArray[1].deathStateId());
// Update game variables for actor or enemy count if necessary
var valueId = battleArray[1].isActor() ? _existActorVarID : _existEnemyVarID;
var oldValue = $gameVariables.value(valueId);
$gameVariables.setValue(valueId, oldValue - 1);
}
// Erase the event after applying the death state
event.erase();
}
}
});
};Also thank you for your awesome plugins