ApplyEffectToObject() NWScript command causes the indicated effect to affect the indicated object for the indicated duration. Not all effects are appropriate for all duration types, but this command does not enforce that; it is left up to the scripter to avoid such things.
This is the primary way to inject effects (other than some visual effects) into the game.
void ApplyEffectToObject (int nDurationType, effect eEffect
object oTarget, float fDuration=0.0
- A DURATION_TYPE_* constant, indicating whether the effect is to be applied instantly (appropriate for some visual effects and damage/death effects), temporarily (appropriate for many spell effects), or permanently (appropriate for special situations).
- The effect that will be applied.
- The object to which the effect will be applied.
- The time (in seconds) for which the effect will persist. This only applies if the duration type is temporary.
An effect is not guaranteed to persist for its entire duration, as there are several means of removing effects in the game. The effect will not persist for longer than the indicated duration, though. Note, however, that some effects have side-effects that will persist after the effect has expired. (In particular, damaging effects get applied instantly, but the damage is not spontaneously healed.)
Static placeables are intended to be unchanged while playing. As such, applying effects to them (i.e. attempting to change them) tends to be futile.