GetNthActiveEffectCode

From the Oblivion ConstructionSet Wiki
Revision as of 01:00, 27 November 2007 by imported>Haama (→‎Notes: Better scripted effect info)
Jump to navigation Jump to search

A command for Oblivion Script Extender

Syntax:

(effectCode:long) reference.GetNthActiveEffectCode whichEffect:long
(effectCode:long) reference.GetNthAECode whichEffect:long

Returns the effect of the Nth Active Effect on the reference.

Example

long EffectCode
set EffectCode to (player.GetNthActiveEffectCode 0)

If the player currently has the effects Shield, Restore Health, and Shield, in that order, this will return the code for Shield (code for Restore Health if whichEffect is 1, and code for Shield if whichEffect is 2).

Notes

  • Active Effects from different sources are counted as unique Active Effects, even if they are the same. For example, a Shield effect from a potion, a Shield effect from another potion, and a Shield effect from a spell, each one will return their own magnitude.
    • If the Magic Item has 2 of the same effect, they will be counted separately.
    • If the effect is from the same Magic Item (i.e., 2 instances of DrinkAle), it will still count as 2 separate Active Effects.
      • While counted separately, if there are multiple scripted effects with the same script generally only the first one's data (i.e., Magic Item Index, Caster) will be returned (i.e., GetNthActiveEffectMagicItemIndex, GetNthActiveEffectCaster).

See Also