So I was helping someone out on Discord yesterday resolve an issue with their TTB maps not clearing away enemies upon player death, and then restarting the same (or new) TTB.
The solution they tried was to reset_map upon defeat.
This lead to finding some weird behavior if you do so.
Does the issue occur in the editor or during gameplay? If it occurs during gameplay, please specify which movement system is being used (free movement or grid movement):
Gameplay. Grid & Tactical Turn Battles
Briefly describe the issue you're experiencing:
If you place a reset_map("battle_map")
function inside a script placed on "defeat" event of a TTB, the following odd behavior is found to occur.
- If you (player) DO NOT move at all during the TTB and just let the enemy walk over and kill you, the reset_map process will work fine and you will be able to move around on the overworld map afterward.
- if you (player) make ANY movements (but especially if you move on the turn you die), then when the map resets on defeat, you will find the player will just play the walk animation but stay in place (like walking on a treadmill).
I helped them to find a solution but this also lead to another weird isue with reset_map!!
SOLUTION (for now):
Instead of reset_map on defeat, reset_map in a script that also starts the battle immediately after resetting and putting this on "Character Interact" event.
reset_map("battle_map");
start_battle("battle1");
This works fine and served as a reasonable solution for their issue.
However...we then found this issue....
- if you die during TTB, when you retun to the overworld map, if you click the same enemy imeediately again, without moving (in the overworld, grid move map), you will then be stuck in the TTB map, or it will crash.
Are there any errors in the in-game debug console or external console window?
It spams the terminal window with this stream of errors when you are stuck walking in place on the overworld map.

Provide the steps necessary to reproduce ISSUE #1
- Create a Bare Bones project
- Add a Asset Library NPC
- Create a second map for the TTB
- Create a TTB with the NPC
- Place reset_map("2nd map") inside a script assigned to defeat event of above battle
TEST 1
- Fight the NPC but don't move at all!
- Let youself be defeated,
- Try moving around and then start the fight again [should work]
TEST 2
- Fight the NPC and move duing a turn, at least once.
- Let yourself be defeated.
- Try moving around.....[should be stuck or crash]
Provide the steps necessary to reproduce ISSUE #2
- Unassign the defeat script
- Make a script that resets the 2nd map first, before starting the battle
- Assign that script to Interacts of the NPC
- Make the NPC stationary for testing purposes
- Walk up to and interact with NPC.
- fight the NPC normally, including moving during your turn, but let yourself be defeated
TEST 1
- Move around on the overworld map first, then fight the npc again. [Should have no issues]
TEST 2
- Upon defeat and as soon as back on the overworld map, don't move, just click the NPC again to reset map and start the battle.
- Try moving during your turn. [should have issues or crash]
Provide a download link to the bare bones project (if applicable):
If you deem it necessry, I will do a follow-up post sharing a project link, and a walkthrough of how to test the setup.
However, it should be fairly easy to replicate with a bare bones project.
It's a very odd issue.
If you reset a battle map upon defeat, if you have moved at all during the battle, it will stick you in place on the overworld map.
If you reset a battle map before each battle, if you dont move at all on the overworld map, it will then stick you in place in the battle map. lol!