Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static event OnLoadedSavedGameToStrategy()
- {
- local XComGameState NewGameState;
- local XComGameStateHistory History;
- local XComGameState_HeadquartersXCom XComHQ;
- local X2ItemTemplateManager ItemTemplateMgr;
- local X2ItemTemplate ItemTemplate;
- local XComGameState_Item NewItemState;
- History = `XCOMHISTORY;
- NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Add Items");
- XComHQ = XComGameState_HeadquartersXCom(History.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom'));
- XComHQ = XComGameState_HeadquartersXCom(NewGameState.CreateStateObject(class'XComGameState_HeadquartersXCom', XComHQ.ObjectID));
- NewGameState.AddStateObject(XComHQ);
- ItemTemplateMgr = class'X2ItemTemplateManager'.static.GetItemTemplateManager();
- // find the template for weapon squad upgrade in engineering
- ItemTemplate = ItemTemplateMgr.FindItemTemplate('SparkRifle_MG_Schematic'); // <<== EDIT THIS TEMPLATE NAME
- if(ItemTemplate != none)
- {
- if (XComHQ.HasItem(ItemTemplate)) // check if that squad upgrade has been purchased
- { // if yes
- // find the template for the weapon that is supposed to be added by this weapon squad upgrade
- ItemTemplate = ItemTemplateMgr.FindItemTemplate('IRI_MEC_Chaingun'); // <<== EDIT THIS TEMPLATE NAME
- if(ItemTemplate != none)
- {
- if (!XComHQ.HasItem(ItemTemplate)) // if HQ inventory doesn't contain the weapon already, add it
- {
- NewItemState = ItemTemplate.CreateInstanceFromTemplate(NewGameState);
- NewGameState.AddStateObject(NewItemState);
- XComHQ.AddItemToHQInventory(NewItemState);
- History.AddGameStateToHistory(NewGameState);
- }
- else // if the weapon is already in the HQ inventory, do nothing
- {
- History.CleanupPendingGameState(NewGameState);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement