Page 1 of 1

Spell Functions

Posted: Sun Sep 12, 2010 6:52 pm
by Pstemarie
This is a handy little variation on the Bioware RemoveSpellEffects function, but does not require the caster as an input. Handy in spell scripts for preventing stacking.

Code: Select all

void RemoveEffectFromSpellID(int nSpell_ID, object oTarget)
{
    //Declare major variables
    effect eRemove = GetFirstEffect(oTarget);
    while (GetIsEffectValid(eRemove))
    {
        //If the effect was created by the spell then remove it
        if(GetEffectSpellId(eRemove) == nSpell_ID)
        {
            RemoveEffect(oTarget, eRemove);
        }
        eRemove = GetNextEffect(oTarget);
    }
}