Jump to content

How can I add another ability to DefaultAbilitySet


raistca

Recommended Posts

Or perhaps there is another way that I'm not seeing. I would like to add another default ability that is available to everyone, but I can't seem to find where X2Ability_DefaultAbilitySet's DefaultAbilitySet array is initialized or modified. It has some entries in the defaultproperties:

defaultproperties
{
DefaultAbilitySet(0)="StandardMove"
DefaultAbilitySet(1)="Interact"
DefaultAbilitySet(2)="Interact_OpenDoor"
DefaultAbilitySet(3)="Interact_OpenChest"


EvacThisTurnName="EvacThisTurn"
ImmobilizedValueName="Immobilized"
ConcealedOverwatchTurn="ConcealedOverwatch"
}

But adding in my ability:

defaultproperties
{
DefaultAbilitySet(0)="StandardMove"
DefaultAbilitySet(1)="Interact"
DefaultAbilitySet(2)="Interact_OpenDoor"
DefaultAbilitySet(3)="Interact_OpenChest"
DefaultAbilitySet(4)="FieldStabilize"


EvacThisTurnName="EvacThisTurn"
ImmobilizedValueName="Immobilized"
ConcealedOverwatchTurn="ConcealedOverwatch"
}

Doesn't seem to have any effect.

 

Here's the ability that I'm trying to add in (basically to let anyone stabilize a bleeding out ally without a medikit).

 

static function X2AbilityTemplate AddFieldStabilize()
{
local X2AbilityTemplate                 Template;
local X2AbilityCost_ActionPoints        ActionPointCost;
local X2AbilityTarget_Single            SingleTarget;
local X2Condition_UnitProperty          UnitPropertyCondition;
local X2AbilityTrigger_PlayerInput      InputTrigger;
local X2Effect_RemoveEffects            RemoveEffects;


`CREATE_X2ABILITY_TEMPLATE(Template, 'FieldStabilize');


ActionPointCost = new class'X2AbilityCost_ActionPoints';
ActionPointCost.iNumPoints = 1;
Template.AbilityCosts.AddItem(ActionPointCost);


Template.AbilityToHitCalc = default.Deadeye;


SingleTarget = new class'X2AbilityTarget_Single';
Template.AbilityTargetStyle = SingleTarget;


UnitPropertyCondition = new class'X2Condition_UnitProperty';
UnitPropertyCondition.ExcludeDead = true;
Template.AbilityShooterConditions.AddItem(UnitPropertyCondition);


UnitPropertyCondition = new class'X2Condition_UnitProperty';
UnitPropertyCondition.ExcludeDead = false;
UnitPropertyCondition.ExcludeAlive = false;
UnitPropertyCondition.ExcludeHostileToSource = true;
UnitPropertyCondition.ExcludeFriendlyToSource = false;
UnitPropertyCondition.IsBleedingOut = true;
Template.AbilityTargetConditions.AddItem(UnitPropertyCondition);


RemoveEffects = new class'X2Effect_RemoveEffects';
RemoveEffects.EffectNamesToRemove.AddItem(class'X2StatusEffects'.default.BleedingOutName);
Template.AddTargetEffect(RemoveEffects);
Template.AddTargetEffect(class'X2StatusEffects'.static.CreateUnconsciousStatusEffect());


InputTrigger = new class'X2AbilityTrigger_PlayerInput';
Template.AbilityTriggers.AddItem(InputTrigger);


Template.AbilitySourceName = 'eAbilitySource_Standard';
Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_stabilize";
Template.ShotHUDPriority = class'UIUtilities_Tactical'.const.STABILIZE_PRIORITY;
Template.Hostility = eHostility_Defensive;
Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
Template.bAllowedByDefault = true;
Template.bLimitTargetIcons = true;


Template.ActivationSpeech = 'StabilizingAlly';


Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;


return Template;
}

Does anyone know how to do this?

 

Thanks

Link to comment
Share on other sites

Thanks I'll check that out!

 

Edit: So it looks like it's the right place, should I be extending X2Character_DefaultCharacters and overwriting CreateSoldierTemplate or is there another way? When I tried to do that I got a whole bunch of rejecting template name already in use errors.

Edited by raistca
Link to comment
Share on other sites

No, i don't think you should override anything. You should probably setup a screenlistener that will modify Soldier template when the game launches. The problem is that character templates are created with difficulty variants. Amineri posted a sample code of how to deal with that (the example uses ItemTemplateManager, where you should be using X2CharacterTemplateManager, but the principle is the same)

 

http://forums.nexusmods.com/index.php?/topic/3771570-overriding-vanilla-content/?p=34270720

Link to comment
Share on other sites

Yeah, but IIRC, you were hooking onto CreateTemplates() function, right?

So far I've tried several Template "hacks", and all of them from the main menu via screen listener route, which worked fine, as far as I can tell. So, I am kinda curious what is the advantage of doing it earlier than that?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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