I think the subscene approach is a convenient workaround for the battle scene, but it is not ideal. The graphics from your battle scene will still be rendered in the background.
They will be rendered but will not be updated (since the update part is performed by the current scene only), so I think it is fine, especially if the background is blurred with
snapshot_for_background. Though yes in general I should avoid this subscene approach as it will not work as intended if the subscene calls other scenes.
Especially if you are planning to one day allow saving mid-fight, you will likely have to be able to recreate a new scene after loading.
Actually I did implement it in v0.8 ahah (it is part of an addon script with all modifications to allow saving and loading mid tbs battle).
My approach was to save the battle data that was proper to the scene inside $game_temp (attribute is an hash table) such that saving would store the data from $game_temp (not $game_temp itself).
That way, when I load Scene_TBS_Battle (which is the case when loading a save with battle data), if the battle data is not empty, then it will get it and skip some initialization. Overall it seems to work fine, both for the placement phase and even mid battle (I assume though that the save was made during player's turn).
If I load a savefile mid battle, I have an attribute set to true such that terminating Scene_TBS_Battle will skip critical parts (mostly the loading of the original map as it was already changed by the save file loaded).
So I guess I have almost everything to deal with subscene approach in a cleaner way, I would just need to keep $game_temp non empty as long as Scene_TBS_Battle is not the current one (unless the battle ended properly). I do however have some problem if the other scenes are supposed to play with $game_map as it is used by my scene (it can be different from the map calling the battle) and should not be modified.
(That said, I have not really looked into your TBS and don't know what you have written yet, and I cannot really tell why the event callback mix up would possibly happen. It did not happen whenever I tested it in the default battle system.)
It might be an issue on my side, I encountered it once and I am unsure if it wasn't just a mistake from my part. I have trouble understanding how interpreter is handled, even more with save files. I haven't yet reproduced it so maybe I just read my event message poorly.
EDIT: I confirm that I have an issue but it is not consistent, here is my battle event triggering each turn:
(Translation: gives choice to win, end the battle through event calls, lose or continue the battle each turn)
And here is my event:
(translation: start battle with a troop, if victory cries "Victoire !", is escaped says "........", if defeat says "Défaite", and regardless will say "Combat Terminé" afterwards.)
All calls will end the battle, however I observed that sometimes (I will have to test all possibilities with or without scene reloading and exit and check whether it is consistent):
- win battle -> might skip "Victoire" message but still say "Combat Terminée"
- flee or lose -> might call "Victoire" and THEN their own message (.... or défaite) before saying "Combat terminé".
EDIT2:
I managed to isolate a save where this bug is consistently occurring (the victory message then other process):
-if victory -> normal behavior
-else -> victory message then normal process (escape/lose messages)
I checked and regardless:
BattleManager.battle_end(result) is called once with the right parameter, so the victory branch appears for some other condition, it might be that I haven't initialize the value and it's the default behavior? But then why is it called once in the victory case...
EDIT3:
New test made, so actually my saves were bugged all along, though I don't know how. So here is my event in rough code:
Code:
cmd battle (301)
cmd victory? (601)
cmd msg1
cmd escape? (602)
cmd msg2
cmd defeat? (603)
cmd msg3
cmd msg4
One of my save (the one calling the victory branch) has already successfully passed the cmd victory? and is at cmd msg1.
Meaning that when the battle has ended, the end value (0,1,2) will not be tested with command victory, which explains why it is skipped and why the escape and defeat branch are still happening.
For the other save, the command victory has already been skipped and the test is performed on the later two because they were not performed.