The Quest to AWC-Train SPARK Units

Post Reply
Lyzak
Posts: 81
Joined: Thu May 18, 2017 5:01 pm

The Quest to AWC-Train SPARK Units

Post by Lyzak »

I figured I'd make this its own topic and open it up to any other curious people that are good at fishing around.

My goal is pretty simple: figure out what files need to be modified in order to allow SPARK the ability to train AWC abilities. I've logged my explorative progress so far. If anyone wants to hop in and contribute, sniff around in some files, etc, please do so and let us all know what you find!

AWC Trees
As part of another project (expanding the number of AWC abilities a soldier can train), I went fishing through XComLW_AWCPack.ini and removed this line:

Code: Select all

+ClassCannotGetAWCTraining="Spark"
Commenting this line out was sufficient to get SPARK to generate an AWC tree. From there, I added a lot of exception clauses to prevent SPARK from generating with abilities that hooked specific functionality SPARK doesn't even have access to. By this, I mean: grenades, cover, swords, and so forth. My full list of exceptions for anyone interested is as follows:

Code: Select all

;EDITED - Added restrictions for SPARK class
+AWCRestrictions=(AWCAbility="BiggestBooms_LW", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Blademaster", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Bladestorm", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Bombard_LW", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="DeepCover", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Evasive", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="FieldMedic", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Flashbanger", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="FullKit", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="HardTarget", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="HEATWarheads", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="HeavyFrags", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="LowProfile", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Phantom", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="RapidDeployment", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="RapidReaction", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Sapper", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Sentinel_LW", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Shadowstep", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Shadowstrike_LW", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="SharpshooterAim", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="SmokeGrenade", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="Stealth", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="SwordSlice_LW", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="VolatileMix", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="WilltoSurvive", RestrictedAbility="RobotImmunities")
+AWCRestrictions=(AWCAbility="ReturnFire", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
+AWCRestrictions=(AWCAbility="Quickdraw", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
+AWCRestrictions=(AWCAbility="ClutchShot", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
+AWCRestrictions=(AWCAbility="LightningHands", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
+AWCRestrictions=(AWCAbility="Gunslinger", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
+AWCRestrictions=(AWCAbility="Faceoff", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
+AWCRestrictions=(AWCAbility="FanFire", RestrictedAbility="RobotImmunities")		;This doesn't work yet.
Some of those restrictions are because of actual inability to access the features (grenades, or taking cover); others are just my taste in balance. I don't think SPARK has any business retaining concealment when the squad breaks it, or getting any other concealment-based perks. But you can do whatever you want with that.

It should be noted that, although I restricted SPARK's ability to use any pistol perks (because, no utility slots to hold a pistol), this did literally nothing; SPARK still generated the full pistol-perk tree, for whatever reason. I'm unsure as to why.

Training the Perks
Unfortunately, enabling an AWC tree to be generated is not all it takes. At this point, SPARK is generating an AWC tree, but there's no button in the armory above their tree to train the abilities; if you go to the AWC itself and search the drop-down for your SPARK units, they don't appear. So there's something else going on behind the scenes that's disabling SPARK's ability to train AWC abilities.

I've gone digging through a LOT of files to try and figure out what's going on, and several times I've THOUGHT I've found the "Oh this is what they did to stop SPARK from training," only to discover that there was another catch in some other file trying to do the same thing, in a different way. Here's some examples:

XComClassData.ini

Code: Select all

[Spark X2SoldierClassTemplate]
bMultiplayerOnly=0
ClassPoints=4
IconImage="img:///UILibrary_DLC3Images.class_spark"
NumInForcedDeck=0
NumInDeck=0
KillAssistsPerKill=4
SquaddieLoadout="SquaddieSpark"
;+AllowedWeapons=(SlotType=eInvSlot_PrimaryWeapon, WeaponType="sparkrifle")
;+AllowedWeapons=(SlotType=eInvSlot_SecondaryWeapon, WeaponType="sparkbit")
+AllowedWeapons=(SlotType=eInvSlot_HeavyWeapon, WeaponType="heavy")
+AllowedArmors="spark"
bAllowAWCAbilities=0
Note the very last line, 'bAllowAWCAbilities.' This line is not present in any other class template, so I'm assuming it's a flag, not an integer value. I've tried both commenting out the line, and changing the value to 1; neither had any effect in and of themselves. For all the rest of the files, I've left the line commented out just in case.

X2StrategyElement_AWC_TrainingStaffSlot_LW.uc

Code: Select all

static function bool IsUnitValidForAWCTrainingSlot(XComGameState_StaffSlot SlotState, StaffUnitInfo UnitInfo)
{
	local XComGameState_Unit Unit;
	local bool HasEligibleRegularRank;

	Unit = XComGameState_Unit(`XCOMHISTORY.GetGameStateForObjectID(UnitInfo.UnitRef.ObjectID));

	HasEligibleRegularRank = Unit.GetRank() >= class'LWAWCUtilities'.default.RequiredRankForAWCTraining[1];

	if (Unit.IsASoldier()
		&& !Unit.IsInjured()
		&& !Unit.IsTraining()
		&& !Unit.IsPsiTraining()
		&& !Unit.IsPsiAbilityTraining()
		&& !Unit.CanRankUpSoldier()
		&& HasEligibleRegularRank
		&& Unit.GetStatus() != eStatus_OnMission // don't use DLC helpers here since sparks can't train as officers
		&& Unit.GetSoldierClassTemplate() != none && Unit.GetSoldierClassTemplate().DataName != 'Spark')
	{
		return true;
	}

	return false;
}
I'm unsure about that comment right after the line with 'Unit.GetStatus()' referring to DLC helpers. But the obvious culprit here (I thought) was the condition calling out 'Unit.GetSoldierClassTemplate().DataName' NOT 'Spark.' So I removed that bit. Still, no option to train SPARK in the AWC. I've left that bit of code removed just in case, while I explore other things...

EDIT: So I actually found, in another file, a similar function that checked if the unit was on a mission, using the DLC helper referenced in this file above. So I substituted out the line with the function call 'Unit.GetStatus() !=' for the following:

Code: Select all

&& !class'LWDLCHelpers'.static.IsUnitOnMission(Unit)
It didn't do anything. :?

UIPersonnel_AWC_LW.uc

Code: Select all

for(i = 0; i < HQState.Crew.Length; i++)
	{
		Unit = XComGameState_Unit(`XCOMHISTORY.GetGameStateForObjectID(HQState.Crew[i].ObjectID));
		SlotUnitInfo.UnitRef = Unit.GetReference();

		if(Unit.IsAlive())
		{
			// Cheap way to disable Sparks from AWC training
			if (Unit.IsASoldier() && !Unit.HasSoldierAbility('Overdrive', true))
			{
				//Check StaffSlot Validation function, defined in AWC StaffSlot Template
				if (SlotState.ValidUnitForSlot(SlotUnitInfo))
				{
					if (m_arrNeededTabs.Find(eUIPersonnel_Soldiers) != INDEX_NONE)
					{
						m_arrSoldiers.AddItem(Unit.GetReference());
Hey look, another line deliberately catching and disabling SPARK in the AWC. I tried to remove '&& !Unit.HasSoldierAbility('Overdrive', true)' from that logical if() and, yet again, nothing seems to have changed...

Also, I noticed the comment about StaffSlot validation 'defined in AWC StaffSlot Template,' but doing a search-for-text of every file in the workshop directory, I found that I couldn't find the file where the function, 'ValidUnitForSlot()' was defined. Hrmm... :x
Lyzak
Posts: 81
Joined: Thu May 18, 2017 5:01 pm

Re: The Quest to AWC-Train SPARK Units

Post by Lyzak »

Gonna have to recant some of that. Any and all changes I made to .uc files are moot, the mod would have to be rebuilt. Clearly I have a sound understanding for how Unreal and mods work. :lol:
Post Reply