Jump to content

Unable to use DetectionModifier effect during attack ability


Gawesome

Recommended Posts

Could use some advice for a custom ability.

 

I'm trying to apply this effect at the beginning of a sword attack ability:

 

PersistentEffect = new class'X2Effect_PersistentStatChange';
PersistentEffect.BuildPersistentEffect(1, false, false);
PersistentEffect.AddPersistentStatChange(eStat_DetectionModifier, 1.0f);
PersistentEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage,,,Template.AbilitySourceName);
Template.AddShooterEffect(PersistentEffect);
I've read that, when attaching enemy detection radius modifiers to an activated attack ability, the actual detection radius change won't take place during the attack, and this bears out in my testing.
Is there another method I can use to accomplish this? I'm trying to make a sword attack ability that, for the duration of the attack, reduces enemy detection radius to 0 (though I'm willing to accept the effect lasting for a full turn, as it is currently set up to do). The goal is to give concealed players the ability to stay in concealment if the attack results in a kill. Everything I've set up works for this attack, but I can't figure out a way to get the enemy detection aspect to activate during the attack.
Link to comment
Share on other sites

AbilityTemplates already have a setting to indicate concealment handling during an attack. You should just set the field for this attack to eConceal_KillShot (I believe - I don't have code in front of me at the moment) and it should keep the unit concealed if it is already concealed and it makes a kill shot.

Link to comment
Share on other sites

fxsjosh, the issue is that without reducing enemy detection radius, concealed players will always be spotted by enemies as they close in for a sword attack, which thus ends concealment. AFAIK, eConceal_KillShot requires you to be concealed at the time of the kill.

Link to comment
Share on other sites

In that case what you probably need to do is set it up as two abilities. The first ability applies the detection change. The second ability listens for the first ability, and is the actual attack. Rapid Fire and Chain Shot both use this method to setup the second attack.

Link to comment
Share on other sites

fxsjosh, I spent a little time trying your method, and it doesn't seem to work. I set up the ability such that player picks the enemy target. It then uses Ability A (modifies detection radius) first, before triggering Ability B (the attack).

 

Immediately as Ability A is used, the player is spotted by the enemy. I think the game determines whether or not the player is spotted immediately after an ability that has selected an enemy target fires. That's my guess, since I know that running a different ability that I created which targets the player and reduces detection radius to 0 works just fine.

 

This isn't a problem I need to solve at the moment, but just wanted to follow up.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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