This bug causes crash in siege battle when using some mods such as RTS Camera .
But it also can be reproduced without using any mods.
Reproduce steps:
After player controller is switched to AI, it will be attached to available siege weapons. But when the formation it belongs to stops to use the siege weapon, the agent is not removed from the siege weapon and attached to the formation again because Formation.LeaveDetachment filters out main agent.
Fix:
But it also can be reproduced without using any mods.
Reproduce steps:
- Enable cheat mode. Start the game without using any third-party mods.
- Enter custom battle, choose siege battle and add a ballista (or any siege weapon) for attacker.
- Adjust attacker army size to 1, then starts.
- Begin assault directly.
- Press ctrl + f5 to let AI control the player.
- Before the player agent reaches the siege weapon, press F1 on the siege weapon to let the agent stop using the siege weapon.
- Then crash happens.
After player controller is switched to AI, it will be attached to available siege weapons. But when the formation it belongs to stops to use the siege weapon, the agent is not removed from the siege weapon and attached to the formation again because Formation.LeaveDetachment filters out main agent.
Fix:
- The fix is simple: just replace "!IsMainAgent" in Formation.LeaveDetachment with "IsAIControlled" but it's in official code and hard to be replaced by modders so it can only be accomplished by TaleWorlds.
Last edited: