XComStrategyGame.UPK (EU2012)
XComStrategyGame.UPK is a Unreal Engine 3 file used to determine several functions of XCOM: Enemy Unknown related to the strategic layer of the game. XComStrategyGame.UPK is divided into several classes, each related to different aspects of the Geoscape/HQ view and described below. The contents of this file can be visualized using UE Explorer.
A complete catalog of the file can be found here: Nexusmods wiki page on XComStrategyGame.UPK.
This page will focus on the practical aspects of the file and how they affect playing the game. For details on how to mod the game, you're advised to check the XCOM section at the Nexusmods wiki.
XGStrategyAI
XGStrategyAI contains most of the functions used to generate UFOs and missions, determine type and composition of alien squads, panic changes and so on. The class is further subdivided into Structures, Variables, Functions and and Default Values. The most important functions will be mentioned below.
AddAIEvent
AddAIEvent is used to add a game event (kEvent) to the array of events generated each month (THQEvent).
Each kEvent added to the array consists a mission, its target (country) and the number of hours it will be available:
- eMission
- eTarget
- iHours
GetEvents
GetEvents generates the array of events for each month (<THQEvent> arrEvents) and uses AddAIEvent to fill it.
It checks for several conditions:
- If iCouncilCounter > 0, it adds a Council mission to the array using AddAIEvent (11, m_iCouncilCounter / 2, 0)
- If the all the entries on the array of objectives (arrObjectives) are marked as completed it does nothing, otherwise for each uncompleted objective it adds a mission (eMission):
- If objective is 0 (Recon) it doesn't add a mission.
- If objective is 1 (Scout) then eMission = 3 (Crash)
- If objective is 3 (Flyby) and HQ doesn't have Facility 18 (Hyperwave Relay) then eMission = 0 (None), otherwise eMission = 12 (DLC)
- If objective is 4 (Hunt), eMission = 5 (HQAssault)
- If objective is 2 (Harvest), eMission = 4 (LandedUFO)
- If objective is 5 (Abduct), eMission = 2 (Abduction)
- If objective is 6 (Terrorize), eMission = 7 (TerrorSite)
- If there's no last mission (for the month it calls function AddAIEvent(eMission, 0, byte(m_arrObjectives[iObjective].m_iCountryTarget), arrEvents)
- Otherwise, it calls AddAIEvent (eMission, (m_arrObjectives[iObjective].m_iNextMissionTimer - m_iCounter) / 2, byte(m_arrObjectives[iObjective].m_iCountryTarget), arrEvents)
- Function loops until all objectives have a mission added to the array of events
InitNewGame
Used when a new game is started.
- Defines the start date based on the value located on XGDateTime as 00:00:00, January 1st, 2015
- Sets the array arrUFOsShotDown with 10 entries
- Sets the array TObjectives with 8 entries
- Calls BuildObjectives function
- m_kResistance.arrCountries.Add(36);
- m_kResistance.arrNoResistance.Add(36);
- m_kResistance.arrHunted.Add(36);
- LogResistance(HQ().m_arrSatellites[0].iCountry);
- CreateAlienBase - sets location of Alien Base
- Defines TerrorCounter as 2
- If ISCONTROLLED() is negative (no Tutorial active) calls function AIAddNewObjectives
MakeMonthlyPlan
Calls functions EndOfMonth and AIAddNewObjectives
Update
Calls funcions AIUpdateMission and UpdateObjectives
UpdateObjectives
Function defines iNumUnits = 1 and bPaydayUpdate = false
- If each objective (kObjective) on the array arrObjectives hasn't been completed, it calls function Update
- If the array FirstBlitzTargets > 0 (used to define the targets of Abductions)
- FirstBlitzCounter is reduced by 1
- If FirstBlitzCounter <= 0 then starts LaunchBlitz and remove entry from array FirstBlitzTargets
- Calls World, FundingCouncil.UpdateSlingshotMission
- If the counter HQAssaultCounter > 0, it is reduced by 1
- if((m_iHQAssaultCounter < 2) && iNumUnits > 1) then m_iHQAssaultCounter = 2
- If the HQAssaultCounter is 0, and the Geoscape conditions isBusy and GetFinalMission are none, then AIAddNewMission(7, none)
- Otherwise defines HQAssaultCounter = 1
- If PaydayUpdate is false, then calls function EXALT().UpdateObjectives(iNumUnits) and adds 1 to the Counter
CurrentlyHasObjective
For each kObjective on arrObjectives it sees if (GetType) is equal to the eObjective and if so, returns it as true. Otherwise returns false.
AddCouncilMission
Defines the Council counter used on GetEvents, using the values COUNCIL_DAY (20.0) and COUNCIL_RAND_DAYS (7.0) found on XComGame.UPK, XGTacticalGameCore. If the Tutorial isn't activated, the CouncilCounter is defined as:
- CouncilCounter = 20.0 * 48 (converts to half-hours)
- CouncilCounter + random number (7.0 * 48 *2) - random (7.0 *48)
AddHQAssaultMission
Sets counter for the Base Defense mission, using the values HQASSAULT_MAX_DAYS (21) and HQASSAULT_MIN_DAYS (14) found on XComGame.UPK, XGTacticalGameCore.
- HQAssaultCounter = random (HQASSAULT_MAX_DAYS - HQASSAULT_MIN_DAYS) + HQASSAULT_MAX_DAYS
- Multiplies final value by 48 to convert to half-hours.
AddLateMission
Used after the Alien Base is assaulted to add missions, generating the following integers: iNumCouncil, iNumTerror, iNumUFOs, iNumAbductions. It creates a local array of missions (arrMissions) then populates it according to the following:
- If there's no Terror (iNumTerror == 0) mission present, it creates 1 on the array arrMissions
- If there's no Council iNumCouncil == 0) mission present, it creates 1 on the array arrMissions
- If arrAbductionTargets generated by function DetermineBestAbductionTargets => 3, it creates 1 on the array arrMissions
- Roll for LATE_UFO_CHANCE is positive (50% odds) it adds 1 to iNumUFOs
- Afterwards it randomly chooses 1 mission type from arrMissions
- If choice is 9 it calls functions AddNewTerrorMission and DetermineBestTerrorTarget and adds 1 to iNumTerror
- If choice is 11 it calls functions AddCouncilMission and adds 1 to iNumCouncil
- If choice is 2 it adds 1 to iNumAbductions
AIAddNewObjectives
Used by both the MakeMonthlyPlan and Update functions to generate missions using the following integers: iNumCouncil, iNumTerror, iNumUFOs, iNumAbductions.
- Checks for the game month (March = 0)
- If the condition ceil (month, 2) it calls AddCouncilMission and adds to iNumCouncil
- If the TerrorCounter is less or equal to 0 it calls AddNewTerrorMission and DetermineBestTerrorTarget, adds iNumTerror and resets the TerrorCounter to 2.
- Sets both iNumUFOs and iNumAbductions equal to 1
- If item 171 (Hyperwave Beacon) was ever present in storage it calls function AddLateMission
- Otherwise adds iNumAbductions
- If the month is April or May rolls for EARLY_UFO_CHANCE (50%), if successful, it adds again iNumUFOs for a 2nd UFO to appear during the month
- It then runs AddNewAbductions and if the 2nd Abductions mission wasn't added, it adds +1 to iNumUFOs
- It then ensures that the number of UFOs doesn't exceed the limit (2 UFOs), defined on UFO_LIMIT (on XGTacticalGameCore)
- Creates an array of visible targets (with sats deployed) using DetermineBestVisibleTargets
- Runs AddUFOs with the previously defined iNumUFOs and arrVisibleTargets
- Runs AddNewOverseers
GetNumAbductionSites
Sets to maximum limit of Abductions sites to 3.
AddNewAbductions
- Uses DetermineBestAbductionTargets to determine how many possible target countries are present. If there's only 1 or 0 it doesn't add any Abductions.
- If the boolean FirstBlitz is positive, it calls CreateAbductionBlitz (arrAbductionTargets, GetNumAbductionSites(), 1 + Rand(7) and removes 1 from iNumAbductions
- Sets iAbduction = 0 and if(iAbduction < iNumAbductions)
- Defines iNumTargets as the minimum value between the one defined by GetNumAbductionSites and the length of arrAbductionTargets
- If the the length of arrAbductionTargets < 2, removes 1 from iNumAbductions
- Otherwise:
- If playing on the Tutorial the date for the first Abductions is set for the 24th
- If not, the 1st Abductions can take place on the first 8 days (randomly chosen), and the 2nd Abductions on 11 + random 14
- It then calls AddAbductionObjectives with (iNumTargets, iStartDate, arrAbductionTargets) already defined.
AddNewTerrorMission
- Sets iStartDate as 0
- Runs ClearFromAbductionList
- Randomly chooses a city from that country
- Runs AIAddNewObjective and adds entry with the following values (6, iStartDate, CITY(iCityTarget).GetCoords(), eTarget, iCityTarget);
AddHuntTarget
AddHuntTarget is used to add an UFO on a Destroy Satellite mission and to determine the UFO type, depending on the difficulty level.
- Checks IsCountryBeingHunted
- If difficulty <= 1 (Easy/Normal) then iMonthCutoff = 3 (June)
- If difficulty = 2 (Classic) then iMonthCutoff = 2 (May)
- Else (Impossible difficulty) iMonthCutoff = 1 (April)
- If the current month => iMonthCutoff then eHunter (UFO type) = 8 (Battleship)
- Otherwise eHunter (UFO type) = 5 (Large Scout)
- Runs AIAddNewObjective with the following values (4, Rand(5), HQ().m_arrSatellites[HQ().GetSatellite(eTargetCountry)].v2Loc, eTargetCountry, eHunter);
IsCountryBeingHunted
Determines if a country is being targeted for a Destroy Satellite mission.
- If the Type 4 objective (Hunt) on the array of Objectives hasn't been completed and CountryTarget = eTargetCountry returns true.
- If the Type 4 objective (Hunt) on the array of OldObjectives hasn't been completed and CountryTarget = eTargetCountry returns true.
- Otherwise returns false.
ChooseOverseerTarget
- Creates an array of targets (arrVisible) using DetermineBestOverseerTargets
- Randomly chooses 1 target from the array
AddNewOverseers
It is run by AIAddNewObjectives to add Overseer UFOs each month but with a different mission than the one revealed once the Hyperwave Relay is built.
- Checks if Storage ever had item 180 (Psi Link). If positive, it doesn't add any Overseers.
- Uses DetermineBestVisibleTargets to create an array of targets (arrVisible)
- Determines the number of Overseers to be added by choosing the minimum value between 3 and the length of arrVisible
- Sets iMission = 0
- If iMission < number of added Overseers:
- If the game difficulty > 1 (Classic/Impossible) randomly chooses a country (eTargetCountry) from arrVisible and removes the choice from the array
- Else, determines eTargetCountry using ChooseOverseerTarget
- Finally, adds entry using AIAddNewObjective with the following values (3, 5 + (10 * iMission), Country(eTargetCountry).GetCoords(), eTargetCountry, 9) and adds 1 to iMission
- Repeats until iMission = number of added Overseers.
Addendum: When the Overseer is detected by the Hyperwave Relay, it will have the eObjective = 7 "Final Preparations" rather than eObjective = 3 "Target Reconnaissance". This change is made on XGAlienObjective.Init
OnEtherealFlyby
This function is empty and it is only used by OnObjectiveEnded. Basically an Overseer overflying a country will not generate any additional mission.
MakeUFO
MakeUFO creates an entry called kUFO, composed of 2 values:
- eUFO (type of UFO, taken from the EShipType list on XComGame.XGGameData)
- eObj (UFO objective, taken from the EAlienObjective list on XGStrategyActorNativeBase)
FillUFOPool
This function uses both AddUFOToPool and MakeUFO to create a monthly pool of possible UFOs types for the Scout Target and Harvest Live Specimens objectives.
- If iMonth => 0 (March)
- AddUFOToPool(MakeUFO(4, 1))
- AddUFOToPool(MakeUFO(4, 1))
- If iMonth => 1 (April)
- AddUFOToPool(MakeUFO(4, 2))
- AddUFOToPool(MakeUFO(5, 1))
- AddUFOToPool(MakeUFO(5, 1))
- If iMonth => 2 (May)
- AddUFOToPool(MakeUFO(5, 2))
- AddUFOToPool(MakeUFO(6, 1))
- If iMonth => 4 (July)
- AddUFOToPool(MakeUFO(6, 2))
- If iMonth => 5 (August)
- AddUFOToPool(MakeUFO(7, 1))
- If iMonth => 6 (September)
- AddUFOToPool(MakeUFO(7, 2))
- If iMonth => 7 (October)
- AddUFOToPool(MakeUFO(8, 1))
eUFO = 4 (Small Scout), eUFO = 5 (Large Scout), eUFO = 6 (Abductor), eUFO = 7 (Supply Barge), eUFO = 8 (Battleship)
FillDatePool
Adds 2 dates to the array arrDates with the values of 9 and 16.
AddUFOToPool
Adds an entry (kUFO) to the array arrPool, with kUFO consisting of 2 values, eUFO and eObj.
ChooseUFOTarget
Chooses a country (iCountry) for a UFO mission.
- If arrCountries > 0 then makes a 75 roll.
- If positive, the country chosen (iChoice) is the first entry on arrCountries
- Else randomly chooses from all countries present on arrCountries
- Sets iCountry as iChoice
- If arrCountries > 1, it removes iChoice from the array
- If arrCountries = 0 it uses World.GetRandomCouncilCountry to determine iCountry
IsGoodUFOMissionChoice
Checks if the eUFO value on the kUFO different from the one used on the last mission. Used by ChooseUFOMissionTypeto prevent the same UFO type appearing on two consecutive missions.
ChooseUFOMissionType
Checks to see if the UFO alien crew is compatible with the type of UFO.
ChooseUFOMission
Used to determine the iUFOChoice value for ChooseUFO
- Defines iUFO = 0 and iCounter = 4
- If iUFO < length of arrUFOs then
- If the entry on arrUFOs has eObj = 1 (Scout Target) it adds the iUFO value as item to arrShootDowns
- All other entries with eObj different from 1 are added as items to arrLanded
- Adds 1 to iUFO and repeats
- Defines iUFOChoice = -1
- If iUFOChoice = -1 and iCounter > 0
- If length of arrShootDowns > 0 AND a positive roll of UFO_INTERCEPTION_PCT (75%)
- iUFOChoice is determined using ChooseUFOMissionType (arrShootDowns, arrUFOs)
- If length of arrLanded > 0 AND iUFOChoice = -1
- iUFOChoice is determined using ChooseUFOMissionType (arrLanded, arrUFOs)
- If iUFOChoice is still -1
- iUFOChoice is determined choosing randomly from arrUFOs
- If length of arrShootDowns > 0 AND a positive roll of UFO_INTERCEPTION_PCT (75%)
ChooseUFO
Creates UFOs, used by AddUFOs.
- Defines iUFOMission using ChooseUFOMission (using the arrUFOs generated by AddUFOs for the type)
- Defines iDateChoice randomly choosing a date from the arrDates created by FillDatePool
- Determines iCountry using the arrCountries generated by ChooseUFOTarget
- Adds to AIAddNewObjective an entry with the following parameters: arrUFOs[iUFOChoice].eObj, arrDates[iDateChoice], Country(iCountry).GetCoords(), iCountry, arrUFOs[iUFOChoice].eUFO)
- Sets the iChoice entry on arrUFOs as LastUFO
- Removes date and UFO type from arrDates and arrUFOs
AddUFOs
AddUFOs is called by AIAddNewObjectives and uses the iNumUFOs value determined by it, as well as the array arrVisible created by DetermineBestVisibleTargets. AddUFOs generates an array (arrUFOs) of UFOs for each month and uses ChooseUFO to choose from the array and add them to the game (or even adds them directly on the 1st month by using AIAddNewObjectives).
- Uses FillDatePool to create an array of dates (arrDates)
- Checks current month (iMonth)
- If iMonth = 0 (March)
- Runs AIAddNewObjective(0, 0, HQ().GetCoords(), arrVisible[0]) to create the 1st UFO
- Decreases iNumUFOs by 1
- AddUFOToPool(MakeUFO(4, 1))
- If iMonth = 1 (April)
- Adds items to arrUFOs by using MakeUFO(4, 2) and MakeUFO(5, 1)
- Runs ChooseUFO(arrUFOs, arrDates, arrVisible)
- Decreases iNumUFOs by 1
- Runs AddUFOToPool using the remaining entries on arrUFOs
- Runs AddUFOToPool(MakeUFO(5, 1))
- If iMonth = 2 (May)
- Adds items to arrUFOs by using MakeUFO(5, 2) and MakeUFO(6, 1)
- Runs ChooseUFO(arrUFOs, arrDates, arrVisible)
- Decreases iNumUFOs by 1
- Runs AddUFOToPool using the remaining entries on arrUFOs
- If iMonth = 3 (June) it does nothing
- If iMonth = 4 (July)
- Adds items to arrUFOs by using MakeUFO(6, 2)
- Runs ChooseUFO(arrUFOs, arrDates, arrVisible)
- Decreases iNumUFOs by 1
- If iMonth = 5 (August)
- Adds items to arrUFOs by using MakeUFO(7, 1)
- Runs ChooseUFO(arrUFOs, arrDates, arrVisible)
- Decreases iNumUFOs by 1
- If iMonth = 6 (September)
- Adds items to arrUFOs by using MakeUFO(7, 2)
- Runs ChooseUFO(arrUFOs, arrDates, arrVisible)
- Decreases iNumUFOs by 1
- If iMonth = 7 (October)
- Adds items to arrUFOs by using MakeUFO(8, 1)
- Runs ChooseUFO(arrUFOs, arrDates, arrVisible)
- Decreases iNumUFOs by 1
- Sets iUFO = 0
- if iUFO < iNumUFOs
- If m_arrPool has no entries, it runs FillUFOPool
- If arrDates has no entries, it runs FillDatePool
- It then runs ChooseUFO (m_arrPool, arrDates, arrVisible)
- Adds 1 to iUFOs and keeps running until iUFO = iNumUFOs
Notes:
- On March the AI adds automatically the 1st UFO (Flying Small Scout) but it has determined that iNumUFOs is always 1 so that will be the only one seen. However it also adds a Flying Small Scout to the pool.
- On April the AI will choose between a Landed Small Scout or Flying Large Scout from arrUFOs for the 1st UFO encountered. The choice will be removed from arrUFOs.
- If the 2nd UFO is generated it will be chosen from the arrPool, which will have the Flying Small Scout added on March, plus a Flying Large Scout and the discarded choice of arrUFOs (either a Landed Small Scout or Flying Large Scout), removing the choice.
- On May, the choice for the 1st UFO will be between a Landed Large Scout or a Flying Abductor and any arrUFOs entries not used on April.
- If the 2nd UFO is generated it will be chosen from arrPool, which will have added to it the 1st unused entry UFO on arrUFOs.
- On June the choice for the 1st UFO will be from any leftover entries on arrUFOs. If there are none, then the game starts using the entries on arrPool and randomly chooses between them, and removing the choice from arrPool. If the arrPool has no entries it runs AddUFOtoPool and inserts all entries for that month and the previous ones (on June: 2 Flying SS, 1 Landed SS, 2 Flying LS, 1 Landed LS, 1 Flying Abductor).
- From this month onwards, the 2nd UFO will only be generated if the alien base has been assaulted or if there were no 2nd round of Abductions added due to a lack of sufficient countries without sats. The 2nd UFO will also be chosen from arrPool and removed from that list, with the list refreshed when there's no more entries available.
- From July onwards, the 1st UFO will be a specific one (July = Landed Abductor, August = Flying Supply Barge, September = Landed Supply Barge, October = Flying Battleship).
- The AddUFOtoPool also contains entries adding these UFOs to the pool choices on the month they appear.
FilterCountries
Used by PickAbductionTargets
- If there's no entries on arrAvoid, returns arrCountries
Otherwise
- Gets the eCont value on each country on arrCountries
- If it searches eCont in arrAvoid and the result is negative, adds Country to arrFiltered
- Repeats until all countries are checked
- Returns arrFiltered
Note: seems used to ensure that target cities in different continents are selected.
PickAbductionTargets
Used by AddAbductionObjectives and CreateAbductionBlitz.
- Sets the number of iNumberCities = length of arrCountries
- Defines arrFiltered using FilterCountries (arrContinents, arrCountries)
- If length of arrFiltered = 0, then arrFiltered = arrCountries
- Randomly chooses 1 country from arrFiltered
- Gets random city from Country
- Adds choice to arrContinents and arrTargetedCities, removes choice from arrFiltered.
- Repeats the number times defined in iNumberCities
- Returns arrTargetedCities
Note: uses FilterCountries to try to assign different countries (arrFiltered), otherwise uses arrCountries.
AIAddNewObjective
Used by several functions to generate UFOs tasked with filling specific objectives (kObjective).
- Spawns kObjective from the list of objectives at XGAlienObjective
- Each kObjective consists of:
- m_arrTObjectives[eObjective]
- iStartDate
- v2Target
- iCountry
- iCity (optional)
- eUFO (optional)
- Adds kObjective to array arrObjectives
SignPact
Used by OnObjectiveEnded, causes a targeted country to leave the Council, with the corresponding Geoscape alert.
AIAddNewUFO
Adds item kUFO to arrUFOs. Used by XGAlienObjective.LaunchUFO.
Not used by any other function on XGStrategyAI.
AIAddNewMission
Used by OnUFOShotDown to generate the UFO crash mission after its interception and by UpdateObjectives and OnObjectiveEnded.
- If eMissionType = 10 runs CreateTempleMission
- If eMissionType = 9 runs CreateTerrorMission (kUFO)
- If eMissionType = 8 (Alien Base) returns none
- If eMissionType = 4 runs CreateLandedUFOMission (kUFO)
- If eMissionType = 3 runs CreateCrashMission (kUFO)
- If eMissionType = 7 runs CreateHQAssaultMission
- Runs GEOSCAPE().AddMission(kMission)
- Returns kMission
AIUpdateMissions
Used by Geoscape.
RevealBase
Used by Geoscape.
GetAlienBases
Used by Geoscape.
CreateAlienBase
CreateFirstMission
CreateFirstMission_Controlled
CreateAbductionBlitz
Used by AddNewAbductions to create the first Abductions.
- If ISCONTROLLED (Tutorial active)
- randomly chooses 2 cities from N. America and Asia and adds them to arrCities
- Removes choices from arrPossibleTargets
- Sets iStartDate = 1
- Otherwise
- arrCities is chosen using PickAbductionTargets (iNumTargets, arrPossibleTargets)
- Each item on arrCities is added to m_arrFirstBlitzTargets
- Sets m_iFirstBlitzCounter = iStartDate * 48
LaunchBlitz
Used by UpdateObjectives CheatAbduction and CheckForAbductionBlitz.
- If boolean bFirstBlitz is positive, it defines the arrRewards as Credits, Scientists or Engineers
- If boolean bFirstBlitz is negative, it adds Soldier, Credits, Scientists or Engineers) to arrRewards
- For each city on arrTargetCities it randomly chooses a reward and removes it from arrRewards
- Defines eDiff using GetAbductionDifficulty
- Spawns kMission with kDesc, iCity, iCountry, iContinent, iDuration, v2Coords, kAlienSquad (using DetermineAbductionSquad and eDiff), eDiff.
- Determines DetermineAbductionReward (kReward, eDiff, eReward)
- If (ISCONTROLLED)
- Determines either the Tutorial 2 N. America and Asia Pier A maps for the mission, giving each a different reward (engineers, scientists).
- Sets iMissionType on kMission.m_kDesc as 11 (Special)
- Runs GEOSCAPE.AddMission
- Creates kAlert
- Runs GEOSCAPE.Alert(kAlert)
GetAbductionDifficulty
CheckForAbductionBlitz
DetermineAbductionReward
DetermineRandomAbductionReward
BuildObjectives
Used by InitNewGame and EndOfMonth to create a template of objectives and UFO missions assigned to them. The entries appear to be latter overwritten by AIAddNewObjectives. Possibly also used to generate test missions when using the Developer Console.
- BuildObjective(1=Scout, false)
- AddUFOMission(Scout, start day 1, SmallScout, QuickScout, -1 radius, 7 rand days)
- BuildObjective(3=Flyby, false)
- AddUFOMission(Flyby, start day 1, SmallScout, Flyby, -1 radius, 7 rand days)
- BuildObjective(2=Harvest, false)
- AddUFOMission(Harvest, start day 1, SmallScout, QuickSpecimen, -1 radius, 7 rand days)
- BuildObjective(4=Hunt, false)
- AddUFOMission(Hunt, start day 1, LargeScout, Seek, -1 radius, 1 rand days)
- BuildObjective(0=Recon, false)
- AddUFOMission(Recon, start day 10, SmallScout, QuickScout, -1 radius, 5 rand days)
- BuildObjective(5=Abduct, true)
- AddUFOMission(Abduct, start day 1, LargeScout, QuickScout, 500 radius, 1 rand days)
- AddUFOMission(Abduct, start day 3, Abductor, Direct, 0 radius, 0 rand days)
- BuildObjective(6=Terrorize, false)
- AddUFOMission(Terrorize, start day 9, Battleship, Flyby, 100 radius, 3 rand days)
- AddUFOMission(Terrorize, start day 20, Battleship, Direct, 0 radius, 7 rand days)
- BuildObjective(7=Infiltrate, true)
- AddUFOMission(Infiltrate, start day 1, Overseer, LongScout, 100 radius, 0 rand days)
- AddUFOMission(Infiltrate, start day 4, Overseer, Direct, 0 radius, 3 rand days)
The game never generates missions of Objective 7 type.
DetermineBestAbductionTargets
Used by AddNewAbductions and AddLateMission.
- Goes through the all entries on list of countries on XComGame.XGGameData.ECountry and doesn't do anything if the following apply to each country:
- Country does not belong to the Council
- Country has left XCOM
- Country has satellite
- Country has been targeted for Terror mission
- Otherwise, adds country to arrPossibleCountries
- Returns arrPossibleCountries
Note: AddLateMission and AddNewAbductions use this function to generate arrAbductionTargets instead of arrPossibleCountries.
DetermineBestTerrorTarget
SortTerrorTargets
IsTerrorTarget
ClearFromAbductionList
SortUFOTargets
IsGoodOverseerTarget
Used to ensure that Overseers will be generated over countries located in continents with Firestorms assigned. Used by DetermineBestOverseerTargets and XGAlienObjective.LaunchUFO
- If kCountry has SatelliteCoverage it then:
- Checks if arrJets > 0 and if iJet = Firestorm, if positive returns true value
- Otherwise returns false and keeps checking for all continents with countries that have sats deployed
- Otherwise Returns false
DetermineBestOverseerTargets
Used by ChooseOverseerTarget and XGAlienObjective.OverseerUpdate.
- Checks each country with the IsGoodOverseerTarget function
- If true, it adds the eTargetCountry to arrTargets
- After it finishes and if arrTargets length is 0, it determines arrTargets = DetermineBestVisibleTargets(true)
- Returns arrTargets
DetermineBestVisibleTargets
Used by DetermineBestOverseerTargets, AIAddNewObjectives and AddNewOverseers.
- Checks each eTargetCountry with HasSatelliteCoverage
- If true, it adds eTargetCountry to a random position on arrTargets
- After all eTargetsCountry are checked, it sees if boolean bUnsorted is negative, if so, it sorts arrTargets
- Returns arrTargets
DetermineBestHuntTargets
GetNumResistingContinents
BuildObjective
Creates a template of eObjective for arrObjectives, is used by BuildObjectives. Template consists of:
- strName
- eType
- bAbandonMission (boolean, if true the 2nd mission will be aborted if the 1st is shot down)
AddUFOMission
Called by BuildObjectives. Expands the eObjective template used by arrObjectives by adding the following items from several arrays:
- iStartDate from arrStartDates
- eUFO from arrUFOs (defined by ChooseUFO and AddUFOs)
- eMission from arrMissions
- iMissionRadius from arrRadii