GetEffectType(effect)

From NWN Lexicon
Jump to: navigation, search
Red bug icon.png Warning: This function has a known bug and may not work as expected in some situations. See Known Bugs for details.

Get the type constant of the effect.

int GetEffectType(
    effect eEffect
);

Parameters

eEffect
The effect to compare or examine.

Description

Returns the effect type (EFFECT_TYPE_*) of the effect being examined.

Return EFFECT_TYPE_INVALIDEFFECT if effect is invalid or one of several effect types (see Known Bugs).

Remarks

You must first get the effect you wish to examine into a variable before calling this function. Useful when you need to check if a player is under the effects of a certain type before doing something else to them with your scripts. A good example would be checking for protection from evil effects before allowing an evil creature to close to them.

You can also check effects that are created using an effect function, such as how Bioware checks for effects to make sure a PC is not dominated in nw_i0_spells.

Note: Permanent item effects - eg Haste, Regenerate, Attack Bonuses can't be retrieved from parsing the creature effects. It only returns temporarily applied ones. To find these loop the equipped items and check the item properties (although you won't be able to easily see if some non-stacking properties need to be counted against each other).

Known Bugs

There are a number of effects which return EFFECT_TYPE_INVALID, as well as those created in the game engine by feats. Examples of temporary/permanent ones are:

  • EffectKnockdown is EFFECT_TYPE_INVALID in all use cases
    • FEAT_KNOCKDOWN applies a (default 4.5 second duration) EffectKnockdown() with effect subtype 0 (not Magic, Supernatural or Extraordinary) which is EFFECT_TYPE_INVALID
  • Taunt applies a (default 30 second duration) medley of effects with effect subtype 0 which is EFFECT_TYPE_INVALID
  • EffectSummonCreature for some reason doesn't have any effect type, even though EffectSwarm does.
  • EffectModifyAttacks has no type assigned

Some instantly-applied effects should be checkable when constructed (eg; eDaze = EffectDaze(); GetEffectType(eDaze) == EFFECT_TYPE_DAZED) but are returned as invalid:

Version

1.61

See Also

functions: 

RemoveEffect

constants: 

EFFECT_TYPE_* Constants


 author: John Shuell, editor: Lilac Soul