The GetFirstEffect() and GetNextEffect() NWScript commands iterate through all effects on the specified object. This can be useful both for determining if a creature is under the effect of a particular type of effect and for locating an effect that should be removed. As with the other GetFirst*() and GetNext*() pairs of commands, GetFirstEffect() is used to initialize the iterator while GetNextEffect() moves the iterator to the next item.

Definition Edit

effect GetFirstEffect (object oCreature)

effect GetNextEffect (object oCreature)

object oCreature 
The object (not necessarily a creature) whose effects will be examined.

When there are no remaining effects to be returned, an invalid effect will be returned. This commonly leads to scripts that look similar to the following.

effect eSearch = GetFirstEffect(oTarget);
while ( GetIsEffectValid(eSearch) )
    // Do something, often testing the effect first.

    // Update the loop.
    eSearch = GetNextEffect(oTarget);

See also Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.