Spell Functions
This scripting forum is to discuss scripting and for those needing help scripting to get help from others.

Moderators: Mermut, rdjparadis

Post Reply
User avatar
Pstemarie
Posts: 157
Joined: Sun Sep 12, 2010 6:42 pm

Spell Functions

Post 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);
    }
}

Post Reply