Jump to content

Changing Tygan's Clothes in the Avenger


zingfharn

Recommended Posts

I thought I was getting there. Things were saying they were updating, but Tygan wasn't changing. So I dug a little deeper. Ended up with this.

 

 

local XComGameState_Unit Tygan, UnitState;
local XComGameState UpdatedState;
local int idx;
local array<StateObjectReference> Crew;
`Log("Attempting to dress Tygan");

UpdatedState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Change Tygan");
Crew = `XCOMHQ.Crew;
for(idx = 0; idx < Crew.Length; idx++) {
  UnitState = XComGameState_Unit(`XCOMHistory.GetGameStateForObjectID(Crew[idx].ObjectID));
  if(UnitState != none && UnitState.GetMyTemplateName() == 'HeadScientist') {
    Tygan = UnitState;
  }
}


`Log("HELMET IS " @ Tygan.kAppearance.nmHelmet);
Tygan.kAppearance.nmHelmet = 'Hat_A_Ballcap_M';
Tygan.kAppearance.nmFacePropUpper = 'Monacle_M';
Tygan.SetTAppearance(Tygan.kAppearance);
`Log("HELMET IS " @ Tygan.kAppearance.nmHelmet);
Tygan.StoreAppearance();
UpdatedState.AddStateObject(Tygan);
`XCOMHISTORY.AddGameStateToHistory(UpdatedState);

 

 

But it just crashes to desktop. Clearly I'm doing something critically wrong, but after spending a couple of hours trying to unpick how to put a damn hat on Tygan, I'm at a loss. Can anyone point me in the right direction, please?

Edited by zingfharn
Link to comment
Share on other sites

  • 3 months later...
  • Recently Browsing   0 members

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