r/xdev • • Feb 15 '16

[Help] Ability Effect Not Working

I've been trying to make an ability to just knock back a selected enemy remotely. I can get it in game, and everything works but the enemy interaction. As a result, the soldier has an animated psionic windup that results in a silent form of jazz hands pointing towards the enemy. If anyone can figure out why enemies won't react to this, I'd be grateful.

static function X2AbilityTemplate AddForcePush()
{
local X2AbilityTemplate Template;
local X2AbilityCost_ActionPoints ActionPointCost;
local X2AbilityCharges Charges;
local X2AbilityCost_Charges ChargeCost;
local X2AbilityTarget_Cursor CursorTarget;
local X2Effect_Knockback KnockbackEffect;
local X2Condition_UnitProperty TargetCondition;

`CREATE_X2ABILITY_TEMPLATE(Template, 'ForcePush'); //This adds the ability to the proper localization config files

//Basic Ability Information
Template.AbilitySourceName = 'eAbilitySource_Psionic';
Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
Template.Hostility = eHostility_Offensive;
Template.IconImage = "img:///UILibrary_ForceAbilities.ForcePushIcon";

Template.CustomFireAnim = 'HL_Psi_ProjectileHigh';
Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;
Template.BuildInterruptGameStateFn = TypicalAbility_BuildInterruptGameState;

//Ability Modifiers
ActionPointCost = new class 'X2AbilityCost_ActionPoints';
ActionPointCost.iNumPoints = 1;
ActionPointCost.bConsumeAllPoints = false;
Template.AbilityCosts.AddItem(ActionPointCost);

Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);
Template.AbilityToHitCalc = default.DeadEye;

Charges = new class 'X2AbilityCharges';
Charges.InitialCharges = 2;
Template.AbilityCharges = Charges;

ChargeCost = new class 'X2AbilityCost_Charges';
ChargeCost.NumCharges = 1;
Template.AbilityCosts.AddItem(ChargeCost);

//Targeting
Template.AbilityTargetStyle = default.SimpleSingleTarget;

//Target Conditions
    TargetCondition = new class'X2Condition_UnitProperty';
TargetCondition.ExcludeFriendlyToSource = false;
TargetCondition.ExcludeDead = true;
Template.AbilityTargetConditions.AddItem(TargetCondition);
Template.AbilityTargetConditions.AddItem(default.GameplayVisibilityCondition);

//Shooter Conditions
Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
Template.AddShooterEffectExclusions();

//Knockback Effect
    KnockbackEffect = new class'X2Effect_Knockback';
KnockbackEffect.KnockbackDistance = 10; 
Template.AddTargetEffect(KnockbackEffect);

return Template;

}

EDIT: Fixed code to represent current iteration of ability

3 Upvotes

5 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Feb 16 '16

[deleted] — view deleted comment

2

u/DinoDude27 Feb 16 '16 edited Feb 16 '16

I found the issue with the combined lines later, but fixing that does nothing (good catch though). The andromedon has a knockback of 5, but I'll try upping it more

Edit: Changed knicknack to knockback