I'm getting this error "Cannot read property 'actorId' of undefined when removing a character during battle. It is a summoned character so when it dies, it automatically remove itself from the party. But whenever that happens, I get this error. Fortunately, I know the cause and it is the script below.
It is a script from here https://forums.rpgmakerweb.com/index.php?threads/yr-plugins.69148/ "BattlerChange" is the script name by YoraeRasante. I'll attach the files. If anyone can help fix the script, it would be very helpful. Thanks in advance.
var DB_GP_removeActor = Game_Party.prototype.removeActor;
Game_Party.prototype.removeActor = function(actorId) {
if (this.inBattle()) var i = this.battleMembers().indexOf($gameActors._data[actorId]);
DB_GP_removeActor.call(this, actorId);
if (this.inBattle()) {
SceneManager._scene.actorsToRefresh = SceneManager._scene.actorsToRefresh || [];
for (; i < this.battleMembers().length; i++) {
SceneManager._scene.actorsToRefresh.push(this.battleMembers().actorId());
}
}
It is a script from here https://forums.rpgmakerweb.com/index.php?threads/yr-plugins.69148/ "BattlerChange" is the script name by YoraeRasante. I'll attach the files. If anyone can help fix the script, it would be very helpful. Thanks in advance.
var DB_GP_removeActor = Game_Party.prototype.removeActor;
Game_Party.prototype.removeActor = function(actorId) {
if (this.inBattle()) var i = this.battleMembers().indexOf($gameActors._data[actorId]);
DB_GP_removeActor.call(this, actorId);
if (this.inBattle()) {
SceneManager._scene.actorsToRefresh = SceneManager._scene.actorsToRefresh || [];
for (; i < this.battleMembers().length; i++) {
SceneManager._scene.actorsToRefresh.push(this.battleMembers().actorId());
}
}