long-war-2 / lwotc

Port of Long War 2 to XCOM 2's War of the Chosen expansion
342 stars 89 forks source link

Reward is not given for enemy VIP if the soldier carrying him is the last one to evac #1342

Open DSeyka opened 3 years ago

DSeyka commented 3 years ago

Hello there! Attaching a save with a bug described above, it's 100% reproducible on my end. save_lost vip_1.zip

Steps to reproduce:

  1. Load the save
  2. Evac everyone except for 'Big Nasty' (the grenadier carrying the enemy VIP)
  3. Evac 'Big Nasty', note Central saying "we've lost the package"
  4. While VIP is still shown at the post-mission screen, observe number of contacts on Avenger to be 5/6
  5. Load the save again
  6. Evac 'Big Nasty' first, then everyone else.
  7. Number of contacts is now 5/7 (mission reward for getting enemy VIP out alive is correctly applied)

I'm using LWOTC Beta 4.1 and no mods whatsoever outside of required ones. Thank you for your attention, and I hope this is helpful.

pledbrook commented 3 years ago

That is so bizarre. The post mission "loot" screen shows the VIP as captured. Will look into it.

DerAva commented 3 years ago

For what it's worth, this is a vanilla wotc/xcom2 bug.

tracktwo commented 3 years ago

This bug has plagued me since XCOM2 first released. I mostly worked around it in evac all, but fixing it completely requires kismet changes for the mission script. I packaged a fixed mission script with the vanilla version of evac all but stopped doing that for the wotc version because it can cause compatibility issues with some other mods that also try to hook that particular mission. If you have already replaced this mission script with a custom one in LWOTC it should be fixable, though.

pledbrook commented 3 years ago

Haven't replaced it yet, but was considering doing so for this issue. But I couldn't work out what the problem is. The debugger didn't trip on the "UnitDied" event listener, but that's the only route through which the "Target lost" voice over is triggered. I didn't even understand why leaving the VIP behind still had "VIP Captured" displayed in the after-mission loot screen.

Do you remember what the workaround/fix was?

tracktwo commented 3 years ago

The problem is that when you evac a soldier that is carrying a VIP both units are processed in the same game state submission. If the very last soldier on the map is carrying the VIP it trips the bug:

In the original Evac All I think I reworked the kismet so that it checked specifically if the VIP was still on the map in addition to either being dead, unconscious, or bleeding out. If they're in one of those states but not on the map then they were evac'd.

For the wotc version of evac all I first tried to tease the game state submissions apart for the VIP and the soldier carrying them, but that wasn't something that was feasible just in Evac All without overrides that I wanted to avoid. This could possibly be more easily solvable in the highlander now, and fixing it there would solve the problem everywhere. OTOH I don't know if there would be other side effects from splitting the carrying/carried evac into two separate states.

What I ultimately decided on for evac all was to split the evac of multiple units into two submissions: first the unit carrying the VIP, then everyone else. The bug still remains in evac all in exactly the same situation it exists in unmodded wotc, but most of the time people bulk evac and it works.

pledbrook commented 3 years ago

Thanks for the explanation. It's really weird, because SeqEvent_EvacActivated clearly handles multiple units evaccing together. I guess the "team out of units" gets triggered as soon as the last soldier is processed. Awkward if that's the case.

DSeyka commented 2 years ago

This is still not fixed in 1.0.2, just so you guys know.