Jump to content

How to apply Shredder Effect to an Ability?


AlexCheux

Recommended Posts

Hi,

 

I have some trouble to include the shredder effect to my ability.

 

My ability do bonus damage on Robots (and stun chance).

 

I want it to have shredder effect if the soldier is in possession of this skill.

 

It works for standard shots, ans it seems that the only line required is:

Template.AddTargetEffect(class'X2Ability_GrenadierAbilitySet'.static.ShredderDamageEffect());

My ability works perfectly fine, but as soon as I add this line to my Ability, the damage output become crazy:

 

My ability damage output is (it's with sniper rifle):

Base damage: 8-10

Bonus damage: +3

So I want to have: 11-13

 

Without the line adding shredder, I have 11-13 so it's ok

With the shredder line, I have: 19-23!!!!! Why??

 

 

I know that it seems to be: (base damage)*2 + (bonus damage), and if it is, I just want to understand why and how do I apply shredder effect to my ability without adding more damage.

 

I hope someone can help me with that.

 

Here is my code:

//-----------------------------------------------------------------------------------------------------------
//EMPROUNDS
//-----------------------------------------------------------------------------------------------------------
static function X2AbilityTemplate EMPRounds()
{
	local X2AbilityTemplate                 Template;	
	local X2AbilityCost_ActionPoints        ActionPointCost;
	local X2AbilityCost_Ammo                AmmoCost;
	local X2AbilityCooldown                 Cooldown;
	local array<name>						SkipExclusions;
	local X2Condition_Visibility            VisibilityCondition;
	local X2Effect_Knockback				KnockbackEffect;
	local X2Effect_ApplyWeaponDamage		WeaponDamageEffect;
	local X2Condition_UnitProperty			UnitCondition;
	local X2Effect_Stunned					StunnedEffect;


// Macro to do localisation and stuffs
	`CREATE_X2ABILITY_TEMPLATE(Template, 'EMPRounds');

/**ICON PROPERTIES*/
	//Active Ability
	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_bulletswarm";
	Template.ShotHUDPriority = class'UIUtilities_Tactical'.const.CLASS_MAJOR_PRIORITY;	//SQUADDIE<CORPORAL<SERGEANT<LIEUTENANT<CAPTAIN<MAJOR<COLONEL
	Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
	Template.DisplayTargetHitChance = true;
	Template.AbilitySourceName = 'eAbilitySource_Standard';	// color of the icon
	Template.Hostility = eHostility_Offensive;

/**ABILITY COST (Ammo, Charges, Cooldown, Action Points, Items...)*/
	// Action Point
	ActionPointCost = new class'X2AbilityCost_ActionPoints';
	ActionPointCost.iNumPoints = 2;
	ActionPointCost.bConsumeAllPoints = true;
	Template.AbilityCosts.AddItem(ActionPointCost);	
	// Ammo (Grenades and MedKits use Ammo and not charges!!)
	AmmoCost = new class'X2AbilityCost_Ammo';	
	AmmoCost.iAmmo = 1;
	Template.AbilityCosts.AddItem(AmmoCost);
	//Cooldown
	Cooldown = new class'X2AbilityCooldown';
	Cooldown.iNumTurns = 3;
	Template.AbilityCooldown = Cooldown;

/**SHOOTER CONDITIONS*/
	SkipExclusions.AddItem(class'X2AbilityTemplateManager'.default.DisorientedName);	// Can't shoot while desoriented
	SkipExclusions.AddItem(class'X2StatusEffects'.default.BurningName);	// Can't shoot while burning
	Template.AddShooterEffectExclusions(SkipExclusions);
	Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);	// Can't shoot while dead

/**ABILITY TRIGGERS*/
	// Activated by a button press; additionally, tells the AI this is an activatable
	Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);

/**ABILITY TARGET STYLE*/
	// Only at single targets that are in range.
	Template.AbilityTargetStyle = default.SimpleSingleTarget;
	Template.bLimitTargetIcons = true; // Will cause the UI to display only valid target icons when this ability is selected.

/**TARGET CONDITIONS*/
	// Can only shoot visible enemies
	VisibilityCondition = new class'X2Condition_Visibility';
	VisibilityCondition.bRequireGameplayVisible = true;
	VisibilityCondition.bAllowSquadsight = true;
	Template.AbilityTargetConditions.AddItem(VisibilityCondition);

	// Can only shoot robots
	
	UnitCondition = new class'X2Condition_UnitProperty';
	UnitCondition.ExcludeOrganic = true;
	UnitCondition.IncludeWeakAgainstTechLikeRobot = default.bEMPROUNDS_IncludeWeakAgainstTechLikeRobot;
	UnitCondition.ExcludeFriendlyToSource = false;
	Template.AbilityTargetConditions.AddItem(UnitCondition);

/**TO HIT CALCULATION*/
	Template.AbilityToHitCalc = default.SimpleStandardAim;	//Depends on the weapon
	Template.AbilityToHitOwnerOnMissCalc = default.SimpleStandardAim;	// If !none, a miss on the main target will apply this chance to hit on the target's owner.

/**ABILITY EFFECT*/
	// Weapon Upgrade Compatibility
	Template.bAllowFreeFireWeaponUpgrade = true;				// Flag that permits action to become 'free action' via 'Hair Trigger' or similar upgrade / effects
	//  Put holo target effect first because if the target dies from this shot, it will be too late to notify the effect.
	Template.AddTargetEffect(class'X2Ability_GrenadierAbilitySet'.static.HoloTargetEffect());
	Template.AssociatedPassives.AddItem('HoloTargeting');
//	Template.AddTargetEffect(class'X2Ability_GrenadierAbilitySet'.static.ShredderDamageEffect());
	Template.bAllowAmmoEffects = true;

	// Damage Effect
	WeaponDamageEffect = new class'X2Effect_ApplyWeaponDamage';
	WeaponDamageEffect.DamageTypes.AddItem('Electrical');
	WeaponDamageEffect.TargetConditions.AddItem(UnitCondition);
	WeaponDamageEffect.bShowImmunityAnyFailure = true;
	WeaponDamageEffect.EffectDamageValue.Damage = default.iEMPROUNDS_DAMAGE_MOD; //This will make weapon damage + set value
	//Stun Effect
	StunnedEffect = class'X2StatusEffects'.static.CreateStunnedStatusEffect(default.iEMP_STUNLVL, default.iEMP_STUNCHANCE);
	StunnedEffect.SetDisplayInfo(ePerkBuff_Penalty, class'X2StatusEffects'.default.RoboticStunnedFriendlyName, class'X2StatusEffects'.default.RoboticStunnedFriendlyDesc, "img:///UILibrary_PerkIcons.UIPerk_stun");
	StunnedEffect.TargetConditions.AddItem(UnitCondition);

	Template.AddTargetEffect(StunnedEffect);
	Template.AddTargetEffect(WeaponDamageEffect);



/**VISUALIZATION*/
	Template.TargetingMethod = class'X2TargetingMethod_OverTheShoulder';
	Template.bUsesFiringCamera = true;
	Template.CinescriptCameraType = "StandardGunFiring";

	KnockbackEffect = new class'X2Effect_Knockback';
	KnockbackEffect.KnockbackDistance = 2;
	KnockbackEffect.bUseTargetLocation = true;
	Template.AddTargetEffect(KnockbackEffect);	

/** MAKE IT LIVE!*/
	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;	
	Template.BuildInterruptGameStateFn = TypicalAbility_BuildInterruptGameState;

	Template.bDisplayInUITooltip = false;
	Template.bDisplayInUITacticalText = false;

	return Template;	
}
Link to comment
Share on other sites

Well, it seems that I found my answer just after this post... Don't know why, I was wondering how to do that since yesterday but...

 

So instead of using

Template.AddTargetEffect(class'X2Ability_GrenadierAbilitySet'.static.ShredderDamageEffect()); 

I replaced it by

	ShredderEffect = new class 'X2Effect_Shredder';		
	ShredderEffect.bIgnoreBaseDamage=true;		
	Template.AddTargetEffect(ShredderEffect);		

And now it works just fine

Link to comment
Share on other sites

  • Recently Browsing   0 members

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