GetEffectObject(effect, int)

From NWN Lexicon
Jump to navigationJump to search

Retrieves an object parameter of an effect.

object GetEffectObject(
    effect eEffect,
    int nIndex


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


Get the float parameter of eEffect at nIndex.

nIndex bounds: 0 >= nIndex < 4.

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


This digs into an effect to get some values that are currently set on it. For instance EffectSwarm you can figure out what the current summoned creature tied to the effect is. These objects may dynamically change during runtime.

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

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

The functions this applies to are:


This function was added in 1.83.8193.21 of NWN:EE.


// OnUsed event to tell the person their EffectSwarm summons name.
void main()
    object oUser = GetLastUsedBy();

    effect eEffect = GetFirstEffect(oUser);
        if(GetEffectType(eEffect) == EFFECT_TYPE_SWARM)
            object oSummon = GetEffectObject(eEffect, 0);

            SendMessageToPC(oUser, "Swarm effect found. Current summoned creature is called: [" + GetName(oSummon) + "]");
        eEffect = GetNextEffect(oUser);

See Also


Effect Constructor Fucntions

GetEffectInteger, GetEffectFloat, GetEffectString, GetEffectVector


Various constants, see Effect Constructors.