Skip to content

Knockdown

ZephiriusZephirius Member Posts: 411
edited February 2021 in Builders - Scripting
How do you remove EffectKnockdown() DURATION_TYPE_PERMANENT
Since it doesn't use EFFECT_TYPE, I can't use GetEffectType()

I know it's probably simple, but I'm at a loss.
object oPC = GetLastPerceived();

if (!GetIsPC(oPC)) return;

if (!GetLastPerceptionSeen()) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));

if (DoOnce==TRUE) return;

SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);

object oTarget;
oTarget = OBJECT_SELF;

///////////////////////////////

effect eEffect;
eEffect = EffectKnockdown();
while (GetIsEffectValid(eEffect))
   {
   if (GetEffectType(eEffect)==FEAT_KNOCKDOWN)RemoveEffect(oTarget, eEffect);
   eEffect = GetNextEffect(oTarget);

    string sSound = "c_dog_atk1";
   DelayCommand(0.5, AssignCommand(oPC, PlaySound(sSound)));
   }

AdjustReputation(oPC, oTarget, -100);

SetIsTemporaryEnemy(oPC, oTarget);

ActionAttack(oPC);

DetermineCombatRound(oPC);

}

Comments

  • ZephiriusZephirius Member Posts: 411
    I've read through the description of EffectKnockdown - https://nwnlexicon.com/index.php?title=EffectKnockdown - just don't see how to remove it?

  • DazDaz Member Posts: 125
    edited February 2021
    You can give the effect a tag.
    effect eKnockdown = TagEffect(EffectKnockdown(), "KNOCKDOWN_EFFECT");
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eKnockdown, oPlayer);
    

    And to remove it:
    effect e = GetFirstEffect(oPlayer);
    while (GetIsEffectValid(e))
    {
        if (GetEffectTag(e) == "KNOCKDOWN_EFFECT")
        {
            RemoveEffect(oPlayer, e);
        }
                
        e = GetNextEffect(oPlayer);            
    }
    
  • ZephiriusZephirius Member Posts: 411
    Awesome! I love learning this stuff! Thanks Daz.
Sign In or Register to comment.