GetEffectInteger(effect, int)

From NWN Lexicon
Jump to: navigation, search

Retrieves an integer parameter of an effect.

int GetEffectInteger(
    effect eEffect,
    int nIndex


The effect to check a parameter of
The index of the parameter. Valid values 0 through 7.


Get the integer parameter of eEffect at nIndex.

nIndex bounds: 0 >= nIndex < 8.

Returns: the value or 0 on error/when not set.


This digs into an effect to get some values that are currently set on it. For instance EffectDamageResistance you can figure out what damage is being resisted, by what amount and if there is a limit. These numbers may dynamically change during runtime (such as damage resistance running out).

See the other types of effect values with GetEffectFloat, GetEffectString, GetEffectObject and GetEffectVector.

The experimentation of this function has been documented on the lexicon; you can find GetEffectInteger information on the Effect Constructor Functions.

You can get integer information from the vast majority of effects:

The "Stateful" effects have mostly just their internal state effect ID. If one of these is applied the highest numbered one takes effect (eg; Sleep is higher priority then Daze, so if sleep is applied the dazed person then sleeps).

Finally there are a few "hidden" engine-only effects without effect constructor function pages, eg; Wounding (which is detected as EFFECT_TYPE_INVALIDEFFECT), which oddly is also set to GetEffectSubType value of 0.

nIndex Parameter Value Description and Notes
0 Amount of damage being applied The damage is EffectDamage but essentially DAMAGE_TYPE_PHYSICAL with no penetration (DAMAGE_POWER_NORMAL).
1 Day damage last applied
1 Time in milliseconds damage was last applied Needs to be 6000 later to apply another round of damage.


This function was added in 1.83.8193.21 of NWN:EE.

Known Bugs

The index is between 0 and 7 but EffectDamage uses parameters up to 15. However you can't get this effect after application, so you should know what parameters you're adding to it.


// OnUsed event to tell the person their EffectDamageResistance properties.
void main()
    object oUser = GetLastUsedBy();
    effect eEffect = GetFirstEffect(oUser);
        if(GetEffectType(eEffect) == EFFECT_TYPE_DAMAGE_RESISTANCE)
            int nDamageType = GetEffectInteger(eEffect, 0);
            int nAmount = GetEffectInteger(eEffect, 1);
            int nLimit = GetEffectInteger(eEffect, 2);
            SendMessageToPC(oUser, "Damage Resistance Found. Damage Type: [" + IntToString(nDamageType) + "] Amount: [" + IntToString(nAmount) + "] Limit Remaining: [" + IntToString(nLimit) + "]");
        eEffect = GetNextEffect(oUser);

See Also


Effect Constructor Functions

GetEffectFloat, GetEffectString, GetEffectObject, GetEffectVector


Various constants, see Effect Constructors.