Jump to content

R&D Equipment Loss on Mission Failure BUG


Amineri

Recommended Posts

That's right, an implicit cast right there would save 1 more byte. For a while I was stuck at only 10 bytes recovered, and was scratching my head trying to get the 11th byte to use the boolean test.

 

Thanks again to everyone for all the suggestions on better optimizing the code!

 

P.S. I tested the squad equipment loss fix on the temple ship mission, and it has no issues there.

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

I may have found an issue with the code change.

 

Ran a mission in which I had four soldiers dead, and one critically wounded and bleeding out. (Nine floaters, I killed two, the others fired five shots, and five troopers went down. Truly a stunning exchange). The sixth surviving soldier fled to the Skyranger.

 

The bleeding out soldier had a scope. One of the five down (possibly the bleeding out soldier) had a medkit. Both should have been left behind, but both items were back in my inventory at home.

 

I suspect the bleeding out soldier may have caused the issue -- recall that before this mod that stuff belonging to bleeding-out soldiers would be left behind when survivors aborted in the Skyranger.

Edited by johnnylump
Link to comment
Share on other sites

Hmmm, that is mysterious.

 

None of the dead/bleeding out soldiers were in the skyranger rescue zone?

 

As I recall, when a mission is aborted, there is a loop over all XCOM soldiers, and every soldier has the following assignment made: m_bLeftBehind = !m_bInDropShip.

 

The m_bLeftBehind tag is later translated into the m_bMIA tag back at HQ. How I tried to fix the original bug was to assign every soldier the m_bLeftBehind = true tag if the mission was failed due to all soldier being dead or critically wounded. The assignment in the case of abort I didn't modify at all.

 

I was actually more concerned that all soldiers would lose their gear in the case of an abort than the situation you experienced. Any chance that you can reproduce it?

 

m_bInDropShip is set in an unknown (for me) point of code in Xcom3DCursor, in the functions Touch() and UnTouch(). Based on somewhat shaky premises, it seems only to be checking the position of the unit relative to the DropZone -- there is no apparent check to see if the unit is alive, dead, or critically wounded.

 

If this is (and in your case was) the case, I think I can live with it. Soldiers that die in the dropzone can have their equipment transported back to HQ for re-use. Now, if only there were some way to drag your critically wounded (or stabilized) soldiers back to the dropzone for extraction ...

Link to comment
Share on other sites

Nope, no dead or bleeding out were in the drop zone. It was on the corner-convenience store map (with easy rooftop access, the TV store down the road, and a funky music theme). I wasn't running a specific test -- just playing a mission on a campaign run. I had four dead, the sniper with scope bleeding out, and the surviving rookie ran to the drop zone and aborted. Everybody was near the drop zone, but not within it.

 

I did a regular full abort with six live ones outside the drop zone, and all gear was destroyed, so the mod is in there.

 

If I get the same situation again, I'll test if I can reproduce.

Edited by johnnylump
Link to comment
Share on other sites

  • 6 months later...

So, with Enemy Within released, I've decided to take up modding myself as well. One of my favorite changes was this modlet here. Unfortunately, with Enemy Within... the behavior of Enemy Unknown hasn't changed in that equipment is still recovered from a squad that has wiped.

 

So, after going through the files, attempting to figure out how soldiers are tagged as LeftBehind, I came up with this idea. Essentially, when aborting a mission, any squad member outside of the extraction zone is marked as Left Behind according to the ExitLevel function in XGUnit. Then, in BuildReturningDropshipSoldier in XGBattle_SP, left behind soldiers are officially marked as "bLeftBehind," which the Barracks then destroys that squad member's equipment.

 

Here's my idea. Rather than rewriting the entire IsDefeat function like Amineri did originally, how about we rewrite a section of BuildReturningDropshipSoldier to mark anyone critically wounded or dead to be marked as left behind as well? Essentially, the code would go from this:


if((m_iResult != 1) && kSoldier.IsCriticallyWounded())
    {
        iHP = 0;
        kTransferSoldier.CauseOfDeathString = XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.UnknownCauseOfDeathString;
    }
    // End:0x344
    if(kSoldier.m_bLeftBehind)
    {
        iHP = 0;
        kTransferSoldier.bLeftBehind = true;
        kTransferSoldier.CauseOfDeathString = XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.UnknownCauseOfDeathString;
    }

To this:

if((m_iResult != 1) && (kSoldier.IsCriticallyWounded() || kSoldier.IsDeadOrDying() || kSoldier.m_bLeftBehind()))
    {
        iHP = 0;
        kTransferSoldier.bLeftBehind = true;
        kTransferSoldier.CauseOfDeathString = XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.UnknownCauseOfDeathString;
    }

Now, my knowledge of Unreal Script isn't superb, so I don't know if such a complex 'if' condition is valid. But presumably, this would check that the mission has not succeeded, and then check if the soldier is bleeding out, dead, or simply left behind from an aborted mission, and tag all the above as being bLeftBehind. If that actually works, it should also prevent the need to have such a complex rewrite of the IsDefeat function, too.

 

Hopefully Amineri will see this and doublecheck my idea to see if I'm not totally crazy.

Link to comment
Share on other sites

Am super glad to see others helping to update some of these mods! :D

 

Code-wise I think your concept would run without a problem.

 

There was one particular design issue that I was grappling with when writing the original that this change may miss:

==> If mission is lost due to VIP being killed or something other reason, the m_iResult != 1 will be true, triggering this code. Also if a terror mission is lost because of all civilians killed. There are a few mission failure conditions that can result in not every soldier being killed, and are not originated with the player choosing to abort. In these cases any dead or critically wounded soldier would be killed and marked as left behind, thus resulting in gear loss.

 

 

The problem is that the EBattleResult enum has several options: Uninitialised (0), Victory (1), Defeat (2), Abandoned (3), and Timeout (4), but the game only ever sets the results to 1 or 2, so when building the return soldiers it can't distinguish between cases 2, 3, and 4.

 

At the time I was writing this mod the simplest solution seemed to be to put the LeftBehind code directly into the place where the various defeat conditions can be distinguished -- in IsDefeat(). Now I'd be more inclined to fill out the m_iResult value inside IsDefeat using the extra 2 cases.

 

I think that the most of the "special cases" for mission loss are handled via:

    akSequences = WorldInfo.MyKismetVariableMgr.GetObjectByClass(class'SeqAct_LoseBattle');
    foreach akSequences(kSeq,)
    {
        if(SeqAct_LoseBattle(kSeq).bLoseMission)
        {            
            return true;
        }        
    }    

However I don't know how to distinguish between cases such as:

  1. Bomb Mission failure due to timeout -- all soldier should be killed and gear left behind
  2. Escort Mission failure due to VIP killed -- soldier should not be killed

Part of the problem is how the VIP mission ends. IIRC the mission immediately ends when the VIP is killed, leaving the fate of your XCOM operatives hanging. In my mind what should happen is that the mission is failure but you still have to try and extract your soldiers alive by getting them to the evac zone, and that would determine whether they are alive or dead. Alternatively all aliens could be killed, resulting in any remaining soldier staying alive. Totally not sure how such a thing could be implemented, however.

Link to comment
Share on other sites

Oof. I totally didn't think about that.

 

But wait... the code already checks if m_iResult != 1 and if the soldier is criticially wounded, then kill him off. So if that's the case, shouldn't the game be killing off critically wounded soldiers under those conditions already? The only difference is my code would also mark him as MIA and thus delete his gear, too. Well, besides the obvious fact that I'm throwing dead soldiers and the check for Left Behind in there, too.

 

And actually... those conditions -might- make sense for losing a critically wounded soldier, too. And like I said, it may even already happen. For losing the VIP, I think the assumption is that the area is overrun and XCOM has to flee and leave everything behind. Same with all civilians lost in a terror mission. XCOM isn't going to stick around to reclaim the bodies and put themselves in any further danger if the mission is a bust (apparently they're not marines with "No man left behind" mentality"). Now, if the mission could somehow continue after a defeat and not end until you aborted the mission, AND you could pick up critically wounded soldiers and drag them back to the Skyranger, that'd be ideal. Sadly, though, I don't think that's going to happen.

Edited by SteelShrike
Link to comment
Share on other sites

Looking at your conditional :

if((m_iResult != 1) && (kSoldier.IsCriticallyWounded() || kSoldier.IsDeadOrDying() || kSoldier.m_bLeftBehind()))

again, it looks as though it will evaluate false unless you lost the mission. I think this is fine.

 

However, if the mission is lost then any critically wounded, Dead, or LeftBehind (can only happen on abort) soldier will be marked as MIA.

 

So, in the Escort Mission, if the VIP is killed, ending the mission, any dead/critically wounded soldiers will be marked as MIA and their gear will be lost. Similarly if on a terror mission all 18 civilians are killed.

Link to comment
Share on other sites

Looking at your conditional :

if((m_iResult != 1) && (kSoldier.IsCriticallyWounded() || kSoldier.IsDeadOrDying() || kSoldier.m_bLeftBehind()))

again, it looks as though it will evaluate false unless you lost the mission. I think this is fine.

 

However, if the mission is lost then any critically wounded, Dead, or LeftBehind (can only happen on abort) soldier will be marked as MIA.

 

So, in the Escort Mission, if the VIP is killed, ending the mission, any dead/critically wounded soldiers will be marked as MIA and their gear will be lost. Similarly if on a terror mission all 18 civilians are killed.

 

 

Right, right, I get what you're saying. My point is, I think that'd actually be acceptable. And it may even happen already. I'll have to test, but I think in this situations, the game assumes that the area is overrun and XCOM retreats, leaving wounded soldiers behind.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...