ModifyEarnedSoldierAbilities

Tracking Issue: #409

This allows mods to add to or otherwise modify earned abilities for units. For example, the Officer Pack can use this to attach learned officer abilities to the unit.

Note: abilities added this way will not be picked up by XComGameState_Unit::HasSoldierAbility()

Elements of the EarnedAbilities array are structs of type SoldierClassAbilityType. Each element has the following parameters: * AbilityName - template name of the ability that should be added to the unit. * ApplyToWeaponSlot - inventory slot of the item that this ability should be attached to. Being attached to the correct item is critical for abilities that rely on the source item, for example abilities that deal damage of the weapon they are attached to. * UtilityCat - used only if ApplyToWeaponSlot = eInvSlot_Utility. Optional. If specified, the ability will be initialized for the unit when they enter tactical combat only if they have a weapon with the specified weapon category in one of their utility slots.

local SoldierClassAbilityType NewAbility;

NewAbility.AbilityName = 'PrimaryWeapon_AbilityTemplateName';
NewAbility.ApplyToWeaponSlot = eInvSlot_Primary;

EarnedAbilities.AddItem(NewAbility);

NewAbility.AbilityName = 'UtilityItem_AbilityTemplateName';
NewAbility.ApplyToWeaponSlot = eInvSlot_Utility;
NewAbility.UtilityCat = 'UtilityItemWeaponCategory';

EarnedAbilities.AddItem(NewAbility);

Source code references