LWoTC Officer-Related Crashes Fix

If you liked this item, please rate it up on Steam Workshop page.

Author: Tedster

Last revision: 20 Apr, 2023 at 00:17 UTC (3)

File size: 78.85 KB

On Steam Workshop

Description:

So I was digging into the "Crash at end of missions" issue that plagues LWoTC. Through some black magic, I got something useful out of a launch log, finding some bad code that dates to Pavonis’s original LW2 officer abilities doing a big no-no by caching a GameState on a template.

Per Xymanek, it does the following:
1) state reference in a template
2) template modification during gameplay

From Rusty:
>yes, and even more of the issue is they are storing the variable (dynamic) on the template (static)
>as the effect is a template of the effect not the singular effect (gamestate)

This was causing a critical error during the garbage collection at the end of the mission causing a crash. This affects the Defilade, Fire Discipline, and Combined Arms abilities, so you don’t see it until later in a campaign when you have higher level officers, with one exception: the Advent General at the end of every HQ assault has Fire Discipline and Defilade, so a cause is present on every HQ.

I’m going to trust him and Rusty on why this is bad, so I set out to try and fix it.

This mod hard overrides the following:
X2Effect_LWOfficerCommandAura: contains this bad reference by making a copy of it and removing the GameState caching at the source of the issue.
X2Effect_Defilade: fix incorrect behavior with the Defilade ability.

Now done with OPTC instead, so no more MCOs.

I have no clue if this will solve all crashes, but it definitely solves some of them 🙂

Long War of the Chosen is a hard requirement for this. It might work with the LW Leader Pack but I built the mod against LWoTC so I make no guarantees.

Thanks to Xymanek and RustyDios for helping me look through the log and explaining what was actually wrong, LordAbizi, MrCloista, and the rest of the MEME community for help learning how to actually do things, and those on the LWoTC discord for helping me with some officer background history investigation.

Download
Required DLC:

These DLC should be installed in order to use this item.


XCOM 2: War of the Chosen
Required items:

Click the title to search on this site.


Long War of the ChosenSteam Workshop
Revisions:

Old revisions of this mod are available below. Click the link to download.