Gaming
 

Effect

From NWNWiki

Game effects help to describe the results of a character's interaction with the game environment, creatures, and items. The most common sources of game effects are spells, spell-like abilities and equipped magic items. Bonuses from various sources can stack with each other but the same bonus or negative modifier can never be applied twice from the same source.

  • For example the spell bull's strength provides a temporary bonus to strength. The character can never have two bonuses applied from bull's strength at the same time even if the caster cast the spell twice. However if the character had a +3 bonus to strength from bull's strength and a +2 bonus from a magical ring then these would stack to give the character a +5 total bonus to strength.

Bonuses applied from the same source do not stack; the highest value is applied.

  • So if the character had bull's strength cast on him twice for a bonus of +5 and +2 respectively then the +5 would apply even if it were not the last spell cast.

Refer to the stack article for more information on what effects do and do not stack with each other.

[edit] Scripting

In NWScript, effects are represented by variables of the type effect. Variables of this type are instances of effects, with the (unintuitive to some) consequence that two effect variables are only equal if both refer to the same instance of an effect; it is not sufficient for both variables to refer to the same kind of effect. Thus, for example, it is possible for two effect variables to both be assigned a charmed effect, yet not have the variables be equal. Generally, two effect variables are only equal if they were assigned the return value of the same, single function call. For example, the following script will cause the caller to say "The effects are not equal." and "The third equals the second."

void main()
{
    effect eCharm1 = EffectCharmed();
    effect eCharm2 = EffectCharmed();
    effect eCharm3 = eCharm2;

    // Compare same kind of effect, but different sources.
    if ( eCharm1 == eCharm2 )
        SpeakString("Charmed is charmed.");
    else
        SpeakString("The effects are not equal.");

    // Compare effects from the same source.
    if ( eCharm2 == eCharm3 )
        SpeakString("The third equals the second.");
    else
        SpeakString("The third charm was tried.");
}