ApplyEffectAtLocation(int, effect, location, float)

Applies an effect at a location.

void ApplyEffectAtLocation(
    int nDurationType,
    effect eEffect,
    location lLocation,
    float fDuration = 0.0f
);

Parameters

nDurationType

DURATION_TYPE_*

eEffect

The effect you want to apply.

lLocation

The location where you want to apply the effect.

fDuration

The duration (in seconds) of the effect. (Default: 0.0f)


Description

ApplyEffectAtLocation applies an effect at a location, and is most often used to apply EffectVisualEffect and EffectAreaOfEffect.

The nDurationType depends on the Effect you construct; refer to individual effects' reference for details of which duration types can and cannot be used with an effect.

If the nDurationType is DURATION_TYPE_INSTANT or DURATION_TYPE_PERMANENT, then the last parameter, fDuration, is ignored.



Remarks

Since most effects affect objects, many will have no effect when applied at a Location. Use this function to apply Visual and Area of Effect effects, for example, you can use this to apply the visual effect of a spell, where none has been cast.


Known Bugs

The timing element of this function is inoperative with the darkness constant. You can set it for 1 second or set it for 20 seconds, and the effect still plays for the same period of time. However, if you use ApplyEffectToObject the timing element will work.

When used with VFX_DUR_GHOST_SMOKE_2 VFX_DUR_* constant, the effect created is permanent no matter what the nDurationType and fDuration parameters are set to.


Version

1.61

Example

// in a triggers' OnEnter script
// Creates darkness for 10 seconds at the PC's location.
void main() {
  location lPC = GetLocation(GetEnteringPC());
  effect eEffect = EffectVisualEffect(VFX_DUR_DARKNESS);
  ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eEffect, lPC, 10.0);
}

See Also

functions: ApplyEffectToObject | EffectACDecrease | EffectAppear | EffectAreaOfEffect | EffectSpellResistanceIncrease | EffectStunned | EffectSummonCreature | EffectVisualEffect | ExtraordinaryEffect | MagicalEffect
categories: Effects Functions | Lighting Effects Functions | Visual Effects Functions
constants: DURATION_TYPE_* Constants


 author: Iskander Merriman, editor: Charles Feduke, additional contributor(s): Karen Modell, Lilac Soul, Steven Ouellette
 Send comments on this topic.