Author Topic: Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)  (Read 372 times)

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0


               

In a module, the player possess an item called the Ring of Valor which can be used to heal themselves.  But I'm encountering a very weird bug.  Below is a video link -- here's a textual description of the problem:


 


1. I use the ring at the very start of the video


2. I run toward the enemy and get frozen (aka Cutscene Paralyze)


3. I attempt to use the ring while frozen, doesn't work (expected)


4. I thaw and try to use the ring...but nothing happens


5. I move back a step and try to use the ring...but nothing happens


6. I move forward a step and try to use the ring...but nothing happens


7. I attack the enemy


8. I use the ring...and it works (in further testing, I don't even need to actually even SWING at the enemy, simply triggering the attack action from 30 yards away with a melee weapon is enough to make the ring work again)


 


Another method to fix it besides attacking an enemy is to unequip and reequip the item.


 


Video is here.  Thoughts?


 


Thinking I might try to do a ClearAllActions on the player once the stun ends to see if that helps but I'm puzzled why this is happening in the first place.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #1 on: July 02, 2014, 01:00:33 am »


               

Just another vanilla bug. Saw this happen to NPC that didnt even possessed any such talent, she just tried to attack me melee after she released from chaos shield stone effect.


 


I might be able to fix this in my NWNCX_Patch plugin, but I guess thats something you have no desire anyway.


 


Question, do you actually have to use the item while frozen to get bugged?



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #2 on: July 02, 2014, 01:10:06 am »


               

After doing another test, no, you don't even have to try to use the item while "frozen," it seems to bug out regardless.


 



I might be able to fix this in my NWNCX_Patch plugin, but I guess thats something you have no desire anyway.


 


I use NWNCX, I'd have to know more about your Patch plugin thing.


 


Regardless, though, I'd really prefer to make sure I find a solution for this for people who don't have NWNCX in the first place, let alone your plugin.  Going to try clearing actions of the PC as soon as freeze ends and seeing if that helps.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #3 on: July 02, 2014, 01:25:51 am »


               

Edit: This doesn't work all the time, actually, apparently I was lucky.


 


I AssignCommanded the following code onto the cutscene paralyzed PC 0.05 seconds before the paralyze technically should end and it seems to fix the problem.  Still weird, though:



//// Clears the action queue of the subject once they are no longer cutscene paralyzed
void ClearWhenNotParalyzed()
{
    effect eTemp = GetFirstEffect(OBJECT_SELF);
    while (GetIsEffectValid(eTemp))
    {
        if (GetEffectType(eTemp) == EFFECT_TYPE_CUTSCENE_PARALYZE)
        {
            DelayCommand(0.05, ClearWhenNotParalyzed());
            return;
        }

        eTemp = GetNextEffect(OBJECT_SELF);
    }

    ClearAllActions();
}


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #4 on: July 02, 2014, 01:30:19 am »


               

can you verify this happens with normal paralyse effect?



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #5 on: July 02, 2014, 01:54:14 am »


               

Um, let me change the code to test.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #6 on: July 02, 2014, 02:17:25 am »


               

Okay, it DOES happen with the normal Paralyze effect but not as often, it seems.  Best current theory is the main cause is when the action queue gets "clogged" with commands triggered while unable to carry them out and those "invisible" commands cause problems.


 


Absolutely no guarantee that's correct but it seems the most consistent with the tests I'm running of any other idea I've had.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #7 on: July 02, 2014, 03:35:47 am »


               

Further testing shows that fix didn't seem to purely fix it.  Hmm...



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #8 on: July 02, 2014, 04:15:58 am »


               

Try throwing something trivial onto the action queue and see if that resolves it.


 


For example:


 


ActionSpeakString("Trivial action");



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #9 on: July 02, 2014, 04:40:48 am »


               

When I run the below code "Clearing actions" appears but still can't use the ring.



//// Clears the action queue of the subject once they are no longer cutscene paralyzed
void ClearWhenNotParalyzed()
{
    effect eTemp = GetFirstEffect(OBJECT_SELF);
    while (GetIsEffectValid(eTemp))
    {
        if (GetEffectType(eTemp) == EFFECT_TYPE_CUTSCENE_PARALYZE)
        {
            SpeakString("Found stun");
            DelayCommand(0.05, ClearWhenNotParalyzed());
            return;
        }

        eTemp = GetNextEffect(OBJECT_SELF);
    }

    ClearAllActions();
    ActionSpeakString("Clearing actions");
}

When I run the below code "Haven't cleared actions" does NOT appear and still can't use the ring.



//// Clears the action queue of the subject once they are no longer cutscene paralyzed
void ClearWhenNotParalyzed()
{
    effect eTemp = GetFirstEffect(OBJECT_SELF);
    while (GetIsEffectValid(eTemp))
    {
        if (GetEffectType(eTemp) == EFFECT_TYPE_CUTSCENE_PARALYZE)
        {
            SpeakString("Found stun");
            DelayCommand(0.05, ClearWhenNotParalyzed());
            return;
        }

        eTemp = GetNextEffect(OBJECT_SELF);
    }

    ActionSpeakString("Haven't cleared actions");
    ClearAllActions();
}


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #10 on: July 02, 2014, 04:52:01 am »


               

wait, I thought you said the clear action after paralyse ends fixes this?



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #11 on: July 02, 2014, 05:05:12 am »


               

I thought it did but apparently I just got lucky on those tests.


 


Which, of course, is why I kept testing it '<img'>



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #12 on: July 02, 2014, 05:25:53 am »


               

I even tried doing a second ClearAllActions delayed a second after the first...which meant I had the ring queued up, saw the queue get cleared (due to the second call), tried to use the ring again...and nothing.  ClearAllActions does nothing.


 


I have an idea which is to force the PC to attack the enemy and THEN clear actions a split second later -- player shouldn't notice it happened and it may fix the problem.  We'll see.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #13 on: July 02, 2014, 07:56:45 am »


               


I have an idea which is to force the PC to attack the enemy and THEN clear actions a split second later -- player shouldn't notice it happened and it may fix the problem.  We'll see.




 


This seems to work perfectly, though it's still a tentative conclusion.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Unable To Use Item After Being Stunned/Snared/Etc? (Tentatively Solved)
« Reply #14 on: July 04, 2014, 03:28:28 am »


               

Maybe the player can be forced to attack himself. I've done that in game with knockdown to get a good initiative roll before going into battle.


 


EDIT: You may also try ClearAllActions(TRUE);