Author Topic: Knockdown Removal  (Read 312 times)

Legacy_DITB123

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Knockdown Removal
« on: August 28, 2011, 02:46:52 am »


               For some reason knockdown can't be removed as an effect if I set it to a specific duration (9999.0 seconds, practically permanent) or duration_type_permanent. I tried using a script that when triggered would take away the knockdown status 10 seconds after the script triggers:

DelayCommand(10.0, RemoveEffect(oTarget, EffectKnockdown()));

Am I doing something wrong, and is there anything that can be done here?

Thanks, DITB
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Knockdown Removal
« Reply #1 on: August 28, 2011, 03:36:21 am »


               The only way to remove effects the object currently has, is to loop through the effects and remove one of them. You can compare certain things to make sure you are removing the right one/s.

This could shed some light on your problem. It also has a sample script that you could use:

www.nwnlexicon.com/compiled/function.removeeffect.html
               
               

               


                     Modifié par GhostOfGod, 28 août 2011 - 02:37 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Knockdown Removal
« Reply #2 on: August 28, 2011, 04:20:21 am »


               

GhostOfGod wrote...

The only way to remove effects the object currently has, is to loop through the effects and remove one of them. You can compare certain things to make sure you are removing the right one/s.

This could shed some light on your problem. It also has a sample script that you could use:

www.nwnlexicon.com/compiled/function.removeeffect.html




There is a second way using pseudoheartbeats, if you are able to store the effect you applied through delayed commands.  However the ability to remove the effect this way depends on when each pseudoheartbeat fires, rather than when an independent script is fired.
               
               

               


                     Modifié par WhiZard, 28 août 2011 - 03:21 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Knockdown Removal
« Reply #3 on: August 28, 2011, 04:27:15 am »


               Ok, I had to do a little searching to refresh my memory on this one.   the problem here comes from per the lexicon.

lexicon...
Knockdown, when removed, shouldl normally stand up, not instantly go to standing. However, the effect type when GetEffectType() is used is 0 - which is the same for a few other effects.


So you can not really remove the effect by Identifying its type. 

The Krits responce to this was.

The_krit...
The jail is an area? (So the area is the object running the OnEnter script you posted above?) As long as the area is not creating other effects, all you have to do is test the effect creator with GetEffectCreator() -- if it's the area the PC is in, then the effect is the knockdown effect you want to remove.
By the way, getting the PC with GetEnteringObject() in the second script looks a bit suspicious. How are you calling this script?


So as long as what ever you have creating the effect is not creating other effects also you can use the creator to ID your knockdown effects to remove.

A post from Funky in the same thread leads me to believe that just using SetCommandable will also work to remove KD.

FunkySwerve...[/b]
...since setcommandable will in fact remove kd, as Moderon said.


               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Knockdown Removal
« Reply #4 on: August 28, 2011, 04:41:21 am »


               @WhiZard: Something like this maybe? I haven't actually tried it but it seems like it should keep the actual effect:


void RemoveEffectIf(object oPC, effect eEffect)
{
    if (GetLocalInt(oPC, "INT_CHECK") == 1)
    RemoveEffect(oPC, eEffect);
    else
    DelayCommand(10.0, RemoveEffectIf(oPC, eEffect));
}

void main()
{
    object oPC = GetLastUsedBy();
    effect eEffect = EffectHaste();
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
    RemoveEffectIf(oPC, eEffect);
}
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Knockdown Removal
« Reply #5 on: August 28, 2011, 04:50:10 am »


               

GhostOfGod wrote...

@WhiZard: Something like this maybe? I haven't actually tried it but it seems like it should keep the actual effect:


void RemoveEffectIf(object oPC, effect eEffect)
{
    if (GetLocalInt(oPC, "INT_CHECK") == 1)
    RemoveEffect(oPC, eEffect);
    else
    DelayCommand(10.0, RemoveEffectIf(oPC, eEffect));
}

void main()
{
    object oPC = GetLastUsedBy();
    effect eEffect = EffectHaste();
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
    RemoveEffectIf(oPC, eEffect);
}


Yep, without local effects and local item properties to store them in I sometimes use the pseudoheartbeats.  I have not tested what would happen if you applied the effect more than once.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Knockdown Removal
« Reply #6 on: August 28, 2011, 04:53:59 am »


               

GhostOfGod wrote...
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);


I'm guessing you meant DURATION_TYPE_PERMANENT, though perhaps INSTANT on error signals permanent, I remember that happening in some cases.
               
               

               
            

Legacy_DITB123

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Knockdown Removal
« Reply #7 on: August 28, 2011, 05:31:46 am »


               Ok, i got it. Thanks everybody for your replies. I just added this piece on the end of the script:

effect eLoop = GetFirstEffect(oDude);

     while (GetIsEffectValid(eLoop))
    {
      if (GetEffectType(eLoop)!=EFFECT_TYPE_BLINDNESS)
        RemoveEffect(oDude, eLoop);

      eLoop=GetNextEffect(oDude);
    }

Thanks again, (especially for the quick responses!) DITB
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Knockdown Removal
« Reply #8 on: August 28, 2011, 06:33:29 am »


               We strip it via NWNX, and GetEffectTrueType from nwnx_structs (linux only) - knockdown is the only effect you need to use that approach on, though as noted SetCommandable should work.

Funky