Jump to content

Change character traits with armor


Maclimes

Recommended Posts

I want to change certain details of a soldier while wearing my new armor.

 

In specific, I want to change some of the movement (for example, can't climb ladders while in my armor) and change the archetype (in order to facilitate custom animations).

 

Both can be set in the Character Template:

CharTemplate.bCanUse_eTraversal_ClimbLadder = true;

or

CharTemplate.strPawnArchetypes.AddItem("GameUnit_AdvCaptain.ARC_GameUnit_AdvCaptainM1_M");

But is there a way to alter these things dependent on when the soldier changes armor?

 

 

Link to comment
Share on other sites

Yep. But it ain't pretty.

 

You can either replace the customiser so when they fiddle with loadout, it does it automatically, or set up a screen listener in the armory which changes those values on the fly based on their loadout (and remember to change them back/check that troops not wearing it *can* climb those walls/have the right archetype).

 

Does that help? If not, I'll write more tomorrow, but just running out of the door now. Sorry!

Link to comment
Share on other sites

 

Does that help?

 

I want to say, "Yes", because it gives me a starting point. But almost every word went over my head. I'm traditionally an art guy, not a code guy. But it gives me something to poke at, so thanks!

Edited by Maclimes
Link to comment
Share on other sites

Alright. Screen Listeners. Presume you're comfortable setting them up? Hook it to the armoury, using ScreenClass = 'whatever' in default variables (hook it to none and log the screen from oninit to find the actual name if you don't have it).

 

 

Then, probably in a function like OnRemoved(UIScreen S) { }, you want to check the following.

local i, l;
local XComGameState_Unit Soldier;local XComGameState MessingWithArmour;


MessingWithArmour = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Rejigging based on armour choices");

l = `XCOMHQ.Crew.Length;
for(i = 0; i < l; i++) {
  Soldier = XComGameState_Unit(`XCOMHistory.GetGameStateForObjectID(Crew[i].ObjectID));
  if(Soldier.kAppearance.nmTorso == 'whatever') {
    // Get the template.
    // Mess with it.

    // Probably update the unit too.

    // Commit changes
    MessingWithArmour.AddStateObject(Soldier);


  }
  else {
    // make sure any soldier who had it on has had those effects reset.
  }
  `XCOMHISTORY.AddGameStateToHistory(MessingWithArmour);}

That's off the top of my head, so might be riddled with errors, but should point you in the general direction. There also might be a much more elegant way to do (like having the armour add abilities or something, in the way the warsuit/spidersuit do - except instead of active which do stuff, they're passive which prevent stuff).

Edited by zingfharn
Link to comment
Share on other sites

  • Recently Browsing   0 members

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