From NWN Lexicon
Jump to: navigation, search


Create a Poison effect.

effect EffectPoison(
    int nPoisonType



The type of poison to use, as defined in the POISON_* constant group.


Returns a new effect object that when applied to the target will cause them to be Poisoned with the nPoisonType type of poison as defined in the POISON_* constant group.

No more then 1 poison can affect one target at once, and is a game engine limit, not a scripting one. Poisons from Spells and Creature Attacks (or any item with On Hit: Poison) are the same for this basis, and even if only secondary effects are applied, no new poison can be.

The target this effect is applied to must be a creature for it to work. This effect should not be applied instantly or temporarily, only permanently.


Never apply this temporarily, like disease, as the additional saves and additional damage may not work correctly.

Notes: Most Poisons do not do hit point damage (and none do any direct damage). Poison effects do not currently stack, they overwrite each other. If the target makes his Saving Throw for the initial effect, he will by default save against the secondary effect.

See the Poisons.2da for more information about what each poison type does, or the constants list for poisons in the lexicon. You cannot add new poisons, it seems, only edit the existing ones in the 2da file.

Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got separately via. looping valid effects on the target (GetFirst/NextEffect()). See the Effect Tutorial for more details.




     Place this in the OnUsed event of an object.
     It will remove all bad effects and then cause
     a new poison to attempt to infect the user of
     the object each time it is used.
     It loops through all poison defined in the game.
//Returns TRUE if any negative effects are found on the target and removes them.
int RemoveEffects(object oTarget);
void main()
     int nCurrentEffect;
     int nNextEffect;
     effect ePoison;
     object oPC;
     string sPoison;
     nCurrentEffect = GetLocalInt(OBJECT_SELF,"nCurrentEffect");
     ePoison = EffectPoison(nCurrentEffect);
     oPC = GetLastUsedBy();
          SendMessageToPC(oPC,"Negative Effects removed.");
     SendMessageToPC(oPC,"Applying Poison number " + IntToString(nCurrentEffect));
     if( nCurrentEffect == 43)
     SendMessageToPC(oPC,"Next Poison number " + IntToString(nNextEffect));
//Returns TRUE if any negative effects are found on the target and removes them.
int RemoveEffects(object oTarget)
    //Declare major variables
    effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
    int bValid = FALSE;
    effect eBad = GetFirstEffect(oTarget);
    //Search for negative effects
        if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
            GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
            GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
            GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
            GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL ||
            GetEffectType(eBad) == EFFECT_TYPE_FRIGHTENED ||
            GetEffectType(eBad) == EFFECT_TYPE_DAZED ||
            GetEffectType(eBad) == EFFECT_TYPE_CONFUSED ||
            GetEffectType(eBad) == EFFECT_TYPE_POISON ||
            GetEffectType(eBad) == EFFECT_TYPE_DISEASE
                //Remove effect if it is negative.
                RemoveEffect(oTarget, eBad);
                bValid = TRUE;
        eBad = GetNextEffect(oTarget);
         ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget);
    return bValid;

See Also




POISON_* Constants

 author: John Shuell, editors: Jasperre, Mistress, additional contributor: Jasperre