Help with Ability

For technical discussions and help
Post Reply
lynx54321
Posts: 15
Joined: Mon Jul 04, 2016 9:52 pm

Help with Ability

Post by lynx54321 »

Hello I'm hoping I can get some help with a custom perk. It's a passive perk that grants the unit a reduction to incoming damage from reaction fire.

I've made the effect that reduces damage taken by half, but I cannot work out how to create an ability that will ensure the effect is only triggered by reaction fire. Any suggestions?
cerebrawl
Posts: 137
Joined: Mon Jan 30, 2017 10:41 am

Re: Help with Ability

Post by cerebrawl »

Have a look at shadowstep and lightning reflexes, worst case scenario you might need to reverse engineer the reaction fire code to take your perk into account.

Sidenote: a workaround could be to switch it off during the alien turn. For example by making it an effect with 1 turn duration that triggers at the start of the player turn(that's how durations work, 2 turns duration is a full turn, yours and enemy).
User avatar
johnnylump
Site Admin
Posts: 1262
Joined: Wed Nov 11, 2015 4:12 am

Re: Help with Ability

Post by johnnylump »

So you'll indeed want to make a perk with a custom persistent effect. The perk should use the GetDefendingDamageModifier function. You can look at the vanilla X2Effect_MeleeDamageAdjust as an example, but instead of checking the bMeleeAttack flag you can instead check bReactionFire for the type of attack you are facing, and only apply the damage reduction if that is true.
lynx54321
Posts: 15
Joined: Mon Jul 04, 2016 9:52 pm

Re: Help with Ability

Post by lynx54321 »

Thanks for the help guys, in the end I decided to make it an active ability as think this is more engaging for the player, as it forces them to think and decide when to use it rather than always having it there.

http://steamcommunity.com/sharedfiles/f ... earchtext=

Mod released now. Another question though in relation to the sawed-off shotgun. I've received some feedback that the custom shot I've added to it which is based on trench gun and it's cone isn't very accurate. In my own experience I've had to be really close to be able to hit anything so I am not surprised at this feedback.

What is the easiest way to increase the accuracy of this ability? Would simply adding a passive +aim effect to the shot work or do I need to do something with the sawed-offs range and is this possible with a special shot like in this case?
cerebrawl
Posts: 137
Joined: Mon Jan 30, 2017 10:41 am

Re: Help with Ability

Post by cerebrawl »

lynx54321 wrote:Mod released now. Another question though in relation to the sawed-off shotgun. I've received some feedback that the custom shot I've added to it which is based on trench gun and it's cone isn't very accurate. In my own experience I've had to be really close to be able to hit anything so I am not surprised at this feedback.

What is the easiest way to increase the accuracy of this ability? Would simply adding a passive +aim effect to the shot work or do I need to do something with the sawed-offs range and is this possible with a special shot like in this case?
I know it's possible for an ability to alter or use its own custom range profile, the First Strike ability from the Shadow Ops mod does this(specifically it uses the DfA range profile without DfA), you might find an answer just by looking at DfA though.
Post Reply