From NWN Lexicon
Revision as of 17:11, 13 March 2021 by Jasperre (talk | contribs) (See Also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Create a Dispel Magic All effect.

effect EffectDispelMagicAll(
    int nCasterLevel = USE_CREATURE_LEVEL


The caster level of the dispeller (OBJECT_SELF). If no parameter is specified, USE_CREATURE_LEVEL will be used. This will cause the dispel effect to use the level of the creature that created the effect.


Returns a new effect object that when applied to a target will attempt to dispel each and every magical effect on the target. Spells which apply two separate unlinked effects (such as Aid, which applies temporary HP separately) can have odd cases where half the spells effects are dispelled.

Dispel magic checks are meant to be 20 + nCasterLevel, versus each spell's effects (good or bad) on the target. The DC is 11 + the effects caster level. Therefore, lesser dispel with a maximum caster bonus of +5, could never dispel anything cast by a level 14 mage.

For instance if you've cast Stoneskin as a level 10 Wizard on yourself, and your level 5 Cleric ally has also cast Bless, the checks are done for each of the 2 spells against a DC of 21 and DC of 16 respectively.

The target this effect is applied to must be a creature for it to work. This effect can only be applied instantly.


Supernatural and Extraordinary subtype effects can never be dispelled.

It should know, by the use of Linking effects, what are separate effects from different castings of the spells - such as someone having sets of Bless cast on them.

Also, it is likely not important who the creator of the effect is, except for the messages displayed - there is no way to set an effect so it cannot be dispelled by race, alignment or level.

Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare effects, and apply them using an ApplyEffectToObject Command. See the Effect tutorial for more details.

Effect Breakdown

This is applied instantly so it is reasonably simple.

As above the effects all store a caster level (you can find this number yourself with GetEffectCasterLevel). It will iterate over each effect which is magical and test nCasterLevel against the given effect with a 1d20 roll added on versus 11 + caster level on the effect. If the roll is successful RemoveEffect is used on the effect (removing all linked effects).

Linked effects are only tested once, but multiple effects split up from each other are tested individually (eg; SPELL_AID will add a linked positive effect for attack increase etc., but also a second one for the temporary HP).

There are obvious bugs; see Known Bugs; but this is more around the effects not getting the correct caster level set than this effect itself.

nIndex Parameter Value Description and Notes
0 nCasterLevel Defaults to USE_CREATURE_LEVEL

Known Bugs

The previous bug with nCasterLevel is now working according to how it is documented, in the 1.64 patch. It will report the correct spells being removed, and nCasterLevel is used, not any other number.

NWN:EE corrects the check to be d20 + Caster Level against a DC of 11 + Caster Level. Equal or beating it will now properly remove effects.

There are still bugs regarding how the caster level set on an effect is calculated, in regards to items and feats. See this bug post for further details.




// Sample code for applying Dispel Magic All (level 10) to a target
void main()
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
    // Create the effect to apply
    effect eDispelAll = EffectDispelMagicAll(10);
    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_DISPEL);
    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object   
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDispelAll, oTarget);

See Also

functions: EffectDispelMagicBest



 author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre