Author Topic: Feats being interrupted by damage.  (Read 509 times)

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« on: January 15, 2016, 07:18:00 pm »


               

Im having this issue in my testing module where I am coding AI improvements.


 


I am working on the shapechange AI improvement and noticed that I can iterrupt the dragon shape if I score critical hit. Afaik this should not happen, dragon shape is feat and even the spell that feat triggers doesn't require concentration. Module has no haks and I removed everything from patch, override and reverted game into 1.69 version just to make sure. Still the same issue.


 


ai code snippet



 


    //not in polymorph

    if(!GetLocalInt(OBJECT_SELF,"70_ALLOW_SHAPECHANGE")) return FALSE;//not allowed to polymorph


    if(GetHasFeat(FEAT_EPIC_WILD_SHAPE_DRAGON))

    {SpeakString("turning into dragon");

        ClearAllActions();

        ActionUseFeat(FEAT_EPIC_WILD_SHAPE_DRAGON,OBJECT_SELF);

        return TRUE;

    }

    else if(GetHasFeat(FEAT_EPIC_WILD_SHAPE_UNDEAD))

    {

        ClearAllActions();

        ActionUseFeat(FEAT_EPIC_WILD_SHAPE_UNDEAD,OBJECT_SELF);

        return TRUE;

    }



My test npc will say "talent shapechange" following with "turning into dragon", and uses the feat with the cast animation, then my toon score critical hit and it gets canceled by the classic "interrupt spell noise", then creature prints "talent spell attack" and dragon shape wont happen.


 


Does anyone know hows that possible? Is it bug in ActionUseFeat?



               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #1 on: January 15, 2016, 07:23:49 pm »


               

It's likely a case where the damage event decided that the damager wasn't the current attack target, and thus canceled the current (still in progress) action in order to DetermineCombatRound against the damager, rather than an issue with the feat itself.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #2 on: January 15, 2016, 08:12:03 pm »


               


It's likely a case where the damage event decided that the damager wasn't the current attack target, and thus canceled the current (still in progress) action in order to DetermineCombatRound against the damager, rather than an issue with the feat itself.




Nope, first there is a sound of spell being interrupted - that means this is not done by any other AI calls. Second, once AI performs anything other than actionattack, all ai calls do nothing till the action is done/canceled.


 


But for a case I removed OnDamaged event on this creature. It had no effect as I expected.


 


Also I tried to rewrite the code snipped by this:


 



 


    if(GetHasFeat(FEAT_EPIC_WILD_SHAPE_DRAGON))

    {SpeakString("turning into dragon");

        talent tUse = TalentFeat(FEAT_EPIC_WILD_SHAPE_DRAGON);

        ClearAllActions();

        ActionUseTalentOnObject(tUse,OBJECT_SELF);

        return TRUE;

    }



Yet still I was able to interrupt this with my toon.


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #3 on: January 15, 2016, 10:34:11 pm »


               

Make sure the user type for the spells.2da entry (725) is set to 3, and not set to 1.  Also check the spell script for any ClearAllActions().  The script is for NPC use only, but has a horse check setup as if it applied to PCs, so bugs in the script may not be well noticed.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #4 on: January 15, 2016, 10:35:22 pm »


               

Mystery solved. After hour of fiddling with spells.2da I found out the real cause. Its OnHitCastSpell on skin. Turns out the spell cast after you hit creature with this property on armor/shield/skin is still interruptable with the damage you just caused and can also interrupt anything the creature is currently doing be it an epic spell or dragon shape feat.


 


I will try to look into nwnx if I can fix it, but I dont have much hopes.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #5 on: January 16, 2016, 01:35:26 am »


               

Wouldn't a DelayCommand() then sever the ties to the OnHit property?


 


 


EDIT: Actually is the issue with the OnHit simply that it uses a ClearAllActions() somewhere in it?


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #6 on: January 16, 2016, 02:38:44 am »


               


Wouldn't a DelayCommand() then sever the ties to the OnHit property?




No this is all hardcoded, both the actual spell cast from OnHit and concentration check. I belive that whats happening is that the spell from onhit which is fired instantly without action overwrites the spell datas for currently casting spell and thus if the OnHit spell is interruptable, then anything whats currently cast is considered as interruptable as well.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #7 on: January 16, 2016, 06:48:06 am »


               

But the OnHit:Activate Item/Unique Power is user type 4.  Odd that that setting would be interruptible, as it does not trigger an attack of opportunity, and is usually reserved for things that are instantaneous anyway.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #8 on: January 16, 2016, 07:29:30 am »


               


But the OnHit:Activate Item/Unique Power is user type 4.  Odd that that setting would be interruptible, as it does not trigger an attack of opportunity, and is usually reserved for things that are instantaneous anyway.




It depends on the spell of course. In my situation the skin has OnHitCastSpell: Acid Splash which uses concentration.


 


However when you mentioned unique power, I have to test that too. In theory, if player starts castíng a regular spell and then is hit by attack which triggers OnHitCastSpell on armor/skin/shield, such that doesnt use concentration, that initial casting should become uninterruptable. That would be quite a huge and its weird I didnt noticed because I use unique power on armor to get OnDamaged event for PC. Also there is chaos shield and I never noticed anything. More testing needed.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #9 on: January 17, 2016, 07:12:45 am »


               


It depends on the spell of course. In my situation the skin has OnHitCastSpell: Acid Splash which uses concentration.


 


However when you mentioned unique power, I have to test that too. In theory, if player starts castíng a regular spell and then is hit by attack which triggers OnHitCastSpell on armor/skin/shield, such that doesnt use concentration, that initial casting should become uninterruptable. That would be quite a huge and its weird I didnt noticed because I use unique power on armor to get OnDamaged event for PC. Also there is chaos shield and I never noticed anything. More testing needed.




My suspicion is confirmed. Its huge issue.


 


Simply put, any creature with armor/shield/skin with OnHitCastSpell itemproperty with spell that doesn't use concentration such as Chaotic Shield or Unique Power will be immune to the concentration check when damaged while casting a spell that uses concentration.


 


This is a big problem as there is obviously the chaotic shield. A very useful item for low-ac builds or builds with immunity to critical hits. Such character doesn't need a single point in Concentration at all. But its also problem for anyone like me who is using OnHitCastSpell: unique power to catch the OnDamaged event for players.


 


On the other hand. When I think about it, it actually allows to rescript the concentration check. Many peoples requested softcoding it or raise the limits as there are many problems with very high magic environments since the skills are capped at 127 but the DC is 10+spell level+damage done always, althought it gets bugged in the feedback as there is rollover at 100something.


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #10 on: January 18, 2016, 04:47:27 am »


               


On the other hand. When I think about it, it actually allows to rescript the concentration check. Many peoples requested softcoding it or raise the limits as there are many problems with very high magic environments since the skills are capped at 127 but the DC is 10+spell level+damage done always, althought it gets bugged in the feedback as there is rollover at 100something.




 


True, though this means one has to distinguish between the interruptible and the uninterruptible.  One method is to simply throw a variable in the on-hit, so that the interruption can occur at the spell script level, though this removes the interrupt animation as the spell has already been cast.  Still there is an issue if applied to monsters and NPCs that it would be difficult to distinguish between what is in their spellbook and what is in their special ability list (the latter being uninterruptible even if they have a user type 1).


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Feats being interrupted by damage.
« Reply #11 on: January 19, 2016, 03:31:44 am »


               


True, though this means one has to distinguish between the interruptible and the uninterruptible.  One method is to simply throw a variable in the on-hit, so that the interruption can occur at the spell script level, though this removes the interrupt animation as the spell has already been cast.  Still there is an issue if applied to monsters and NPCs that it would be difficult to distinguish between what is in their spellbook and what is in their special ability list (the latter being uninterruptible even if they have a user type 1).




Yea probably not doable without NWNX at all as there is no access to what PC just casting. Also interrupt the casting action is not so easy as well - clearing all actions will have negative impact on AI which rely on the fact that interrupting spell will still perform next actions in queve.


 


Anyway, I managed to fix this in nwnx. It will appear with next 1.72beta and it will also fix the effect caster level issue with spells from items.