To reproduce it(in practice it's very, very hard to reproduce so it's better to talk about this theoretically):
1. Play with Active TPBS
2. Select an actor with very low hp and be ready to input actions at any time
3. Right when an enemy starts to execute an action, immediately open the skill window for the actor that's about to die
4. Repeat 3 until the enemy action does hit and kill that actor
5. If you're making a command(attack, guard, confirm targets, select skill/item) right at the moment that actor just died(the exact same frame), the game will just crash due to null BattleManager.inputtingAction() in Scene_Battle.prototype.commandAttack, Scene_Battle.prototype.commandGuard, Scene_Battle.prototype.onActorOk, Scene_Battle.prototype.onEnemyOk, Scene_Battle.prototype.onSkillOk, Scene_Battle.prototype.onItemOk and Scene_Battle.prototype.onSelectAction and these methods demand BattleManager.inputtingAction() to return a valid action.
Unfortunately, there's really only 1 easy, simple and small way to fix the bug: For all those Scene Battle methods calling BattleManager.inputtingAction(), check whether it returns null and stop executing the rest of those methods if it's indeed null.
Any other fix will only lead to even more troubles, because of the following sequence per frame:
1. The input window states(whether it's active and/or open) update -> Action execution effects update(on targets) -> Player input command update(what pressed keys are handled by which Scene_Battle methods)
2. If the action execution effects and player input command take place in the exact same frame, and the currently selected inputting actor dies because of those effects, there's no way to stop the Scene_Battle methods from entering invalid states(they need an existing inputting actor but that actor just died)
3. Therefore, the only way to fix the bug is to stop executing the rest of the method as soon as invalid states are detected, and in this case, it's to check whether BattleManager.inputtingAction() returns null
Obviously, it makes no sense to change this frame execution sequence just to fix this extremely rare but fatal active TPBS bug, so the aforementioned BattleManager.inputtingAction() nullability check should be used 😛
Nevertheless, it's still a minefield waiting to explode, and I'm sure I won't be the only one stepped on this minefield in the default RMMZ codebase, so this bug should still be fixed before more and more users report bugs seemingly coming out of nowhere 🙂
On a side note: I wanted to make some screenshots/videos on this, but I think they're nearly useless in this very special case anyway, as this bug is a result of very unlucky timing combinations, which can't be effectively or efficiently shown by any screenshot/video 🙂
1. Play with Active TPBS
2. Select an actor with very low hp and be ready to input actions at any time
3. Right when an enemy starts to execute an action, immediately open the skill window for the actor that's about to die
4. Repeat 3 until the enemy action does hit and kill that actor
5. If you're making a command(attack, guard, confirm targets, select skill/item) right at the moment that actor just died(the exact same frame), the game will just crash due to null BattleManager.inputtingAction() in Scene_Battle.prototype.commandAttack, Scene_Battle.prototype.commandGuard, Scene_Battle.prototype.onActorOk, Scene_Battle.prototype.onEnemyOk, Scene_Battle.prototype.onSkillOk, Scene_Battle.prototype.onItemOk and Scene_Battle.prototype.onSelectAction and these methods demand BattleManager.inputtingAction() to return a valid action.
Unfortunately, there's really only 1 easy, simple and small way to fix the bug: For all those Scene Battle methods calling BattleManager.inputtingAction(), check whether it returns null and stop executing the rest of those methods if it's indeed null.
Any other fix will only lead to even more troubles, because of the following sequence per frame:
1. The input window states(whether it's active and/or open) update -> Action execution effects update(on targets) -> Player input command update(what pressed keys are handled by which Scene_Battle methods)
2. If the action execution effects and player input command take place in the exact same frame, and the currently selected inputting actor dies because of those effects, there's no way to stop the Scene_Battle methods from entering invalid states(they need an existing inputting actor but that actor just died)
3. Therefore, the only way to fix the bug is to stop executing the rest of the method as soon as invalid states are detected, and in this case, it's to check whether BattleManager.inputtingAction() returns null
Obviously, it makes no sense to change this frame execution sequence just to fix this extremely rare but fatal active TPBS bug, so the aforementioned BattleManager.inputtingAction() nullability check should be used 😛
Nevertheless, it's still a minefield waiting to explode, and I'm sure I won't be the only one stepped on this minefield in the default RMMZ codebase, so this bug should still be fixed before more and more users report bugs seemingly coming out of nowhere 🙂
On a side note: I wanted to make some screenshots/videos on this, but I think they're nearly useless in this very special case anyway, as this bug is a result of very unlucky timing combinations, which can't be effectively or efficiently shown by any screenshot/video 🙂