From NWN Lexicon
Jump to: navigation, search

Create a Dispel Magic Best effect.

effect EffectDispelMagicBest(
    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 the single highest "best" spell on the target. This is done by the caster level set on each effect - although an unknown order if two are equal (may be first applied). For instance if you've cast Stoneskin as a level 10 Wizard on yourself, and your level 5 Cleric ally has also cast Bless, it will consider the Stoneskin (caster level 10) the "best" and try to dispel that first, then if it fails to dispel it will attempt to dispel the Bless spell (caster level 5).

Dispel magic checks are meant to be 20 + nCasterLevel, versus each spell's effects (good or bad) on the target, until one is passed and a spell removed. 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.

This version of dispel magic is used for Area-of-effect hits.

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.

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 Best (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 eDispelBest = EffectDispelMagicBest(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, eDispelBest, oTarget);

See Also

functions: EffectDispelMagicAll

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