Weird situation - encountering an enemy party with no troops

Users who are viewing this thread

So someone reported a bug on Surrender Tweaks where after winning a battle a menu comes up with the options "Capture the enemy", "Try to get away" and "Surrender". This is the first time it has ever been reported and I suspect it could be due to a particular combination of mods. The user did not provide a save file and I was unable to replicate the bug on my end.

After digging a little through the game code, I found that those menu options can only appear if the player is on the defending side. Later on, @MRay advised that this could occur if all the members of the enemy parties were wounded. Surrender Tweaks does not cause any casualties in enemy parties, but there is a part which calls DestroyPartyAction.Apply(), and I suspected it could be the cause.

I was able to replicate the bug:

unknown.png


However, in the same method, I also call PlayerEncounter.LeaveEncounter = true, which makes the player leave the encounter; therefore they will never see those menu options.

Can I confirm that this is the case?
 
Hey, i have been trying to reproduce the issue but i was unable to, this suggest that the bug is fixed with previously released pathces. Please let us know if you encounter any other issues.
 
Upvote 0
Hey, i have been trying to reproduce the issue but i was unable to, this suggest that the bug is fixed with previously released pathces. Please let us know if you encounter any other issues.
I have found out that the bug was caused by a mod called True Battle Loot, and because it is no longer maintained and the author has granted me permission to maintain it, I have pinpointed the cause of the bug and fixed it in the latest version.

Basically, the mod has an option to add an extra menu after battles to allow the player to choose how to distribute the loot. In rare situations which I have been unable to replicate, the menu will fail to open causing the bug to occur:

C#:
                        if (Support.companionsAvailable || Support.troopsAvailable)
                            GameMenu.ActivateGameMenu("hlc_true_battle_loot_postmenu");
                        else
                        {
                            if (Support.alliesLootAvailable || Support.alliedHeroesLootAvailable || Support.heroesLootAvailable || Support.ownLootAvailable)
                                GameMenu.ActivateGameMenu("hlc_true_battle_loot_postmenu2");
                            else
                            {
                                Support.menuOpen = false;
                                skip = true;
                            }
                        }

I tweaked this code and added a fallback in the event where the menu fails to open, and the bug should be fixed now.
 
Upvote 0
Back
Top Bottom