Jump to content

Modding Terror Missions


Eliijahh

Recommended Posts

Is there a way to make terror missions raise panic level by 3-4, without automatically making the country leave the Xcom project? I've been looking in the xcomstrategy.upk and xcomgame.upk but I can't manage to find the right place where to modify. Some help? :smile:

 


EDIT :

I've found this code that can be the one

 

case 7:
                    kContinent.m_kMonthly.iTerror += 1;
                    kResultContinent.eContinentAffected = byte(kContinent.GetID());
                    kResultCountry.eCountryAffected = byte(kCountry.GetID());
                    // End:0x77A
                    if(bXComSuccess)
                    {
                        kResultCountry.bLeftXCom = CalcTerrorMissionPanicResult(kResultCountry.iPanicChange, kResultContinent.iPanicChange);
                        kResultCountry.iPanicChange = Max(-kCountry.m_iPanic, kResultCountry.iPanicChange);
                        // End:0x777
                        if(!kResultCountry.bLeftXCom)
                        {
                            kContinent.m_kMonthly.iTerrorThwarted += 1;
                        }
                    }
                    // End:0x871
                    else
                    {
                        // End:0x871
                        if(!kResultCountry.bLeftXCom)
                        {
                            kResultContinent.iPanicChange = class'XGTacticalGameCore'.default.PANIC_TERROR_CONTINENT;
                            kResultCountry.iPanicChange = class'XGTacticalGameCore'.default.PANIC_TERROR_COUNTRY;
                            kResultCountry.bLeftXCom = true;
                            kContinent.RecordCountryNotHelped(byte(kMission.GetCountry()));
                        }
                    }

 

This comes from XcomGameStrategy.upk XGStrategyAI >> ApplyMissionPanic

 

The exact line I'm talking about is : kResultCountry.bLeftXCom = true;

If I can change the true into false or just make the code jump that statement, I can probably make after an unsuccesfull terror mission the nation not automatically leave.

 

I found in HEX code that the "true" we're talking about should be 27, how can I modify the true to become false?

Edited by Eliijahh
Link to comment
Share on other sites

XComStrategyGame.upk >> class XGStrategyAI >> CalcTerrorMissionPanicResult

 

This controls panic for terror missions.

 

Try changing the hex

25 04 27 04 28

to

25 04 28 04 28

 

(This is in fact a unique string in the upk)

 

and see if that does the trick. If I'm reading the code right, a terror mission failure that should disable the automatic withdrawal of the country and instead apply the terror mission panic numbers from DefaultGameCore.ini. Please report back if it works!

Edited by johnnylump
Link to comment
Share on other sites

XComStrategyGame.upk >> class XGStrategyAI >> CalcTerrorMissionPanicResult

 

This controls panic for terror missions.

 

Try changing the hex

25 04 27 04 28

to

25 04 28 04 28

 

(This is in fact a unique string in the upk)

 

and see if that does the trick. If I'm reading the code right, a terror mission failure that should disable the automatic withdrawal of the country and instead apply the terror mission panic numbers from DefaultGameCore.ini. Please report back if it works!

 

I think that that file should only modify the panic reduction based on how many civvies you managed to save. I edited the first post, please have a look there.

Link to comment
Share on other sites

Hmm, I think we're both right and you'll have to make two changes.

 

 if(bXComSuccess)
                    {
                  **   #1   kResultCountry.bLeftXCom = CalcTerrorMissionPanicResult(kResultCountry.iPanicChange, kResultContinent.iPanicChange);
                        kResultCountry.iPanicChange = Max(-kCountry.m_iPanic, kResultCountry.iPanicChange);
                        // End:0x777
                        if(!kResultCountry.bLeftXCom)
                        {
                            kContinent.m_kMonthly.iTerrorThwarted += 1;
                        }
                    }
                    // End:0x871
                    else
                    {
                        // End:0x871
                        if(!kResultCountry.bLeftXCom)
                        {
                            kResultContinent.iPanicChange = class'XGTacticalGameCore'.default.PANIC_TERROR_CONTINENT;
                            kResultCountry.iPanicChange = class'XGTacticalGameCore'.default.PANIC_TERROR_COUNTRY;
                        **   #2 kResultCountry.bLeftXCom = true;
                            kContinent.RecordCountryNotHelped(byte(kMission.GetCountry()));
                        }
                    }

#1 is what I was proposing fixing. If you follow the logic of CalcTerrorMissionPanicResult, you'll see it returns true if you don't save any civilians, even if you win the mission by killing all the aliens. The hex change I proposed above changes return true to return false in that case, so that will prevent #1 from returning true.

 

#2 is what you've found. That's if you don't kill all the aliens -- squadwipe or fleeing. True is a 27; False is 28.

 

This should be the hex change, again the original is a unique hex string on xcomstrategygame.upk

Original

14 2d 35 4a 03 00 00 4d 03 00 00 00 01 00 77 43 00 00 27

Changed

14 2d 35 4a 03 00 00 4d 03 00 00 00 01 00 77 43 00 00 28

Link to comment
Share on other sites

  • 1 month later...

I hate to resurrect this thread, but hopefully I have a good enough reason.

 

I tested changing the values posted above by johnnylump, but only #2 (see quote below), and I can confirm it prevents country withdrawal on mission ignore or fail. I don' think there any reason for me to make edit #1 if I only wanted to prevent withdrawal, correct?

 

 

 

#1

Original
25 04 27 04 28
Changed
25 04 28 04 28

 

#2

Original

14 2d 35 4a 03 00 00 4d 03 00 00 00 01 00 77 43 00 00 27

Changed

14 2d 35 4a 03 00 00 4d 03 00 00 00 01 00 77 43 00 00 28

 

 

Many thanks to Eliijahh for asking a so well detailed question, and to johnnylump for taking the time to answer it.

Link to comment
Share on other sites

Have you tested the case where you kill all of the aliens but all civilians are killed? From my quick read the change #1 is supposed to prevent the country from leaving in that situations (which is a pretty rare occurance).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...