SetEncounterActive(int, object)

Sets an encounter to active or inactive.

void SetEncounterActive(
    int bNewValue,
    object oEncounter = OBJECT_SELF
);

Parameters

bNewValue

TRUE if the encounter is active, otherwise FALSE.

oEncounter

The encounter to set active or inactive. (Default: OBJECT_SELF)


Description

Set oEncounter's active state to nNewValue.

When an encounter is exhausted it will set itself to be "not active".

If your encounter is set for "Continuous" respawns, it will reset itself to "active" each time the Respawn Time lapses.

If you want to use the SetEncounterActive function to control exactly when the encounter is active then you need to use the "Single Shot" setting on the encounter.



Remarks

From Victor Morales:

I have tried the SetEncounterActive function to spawn creatures at different times of the day. For example, I only wanted the undead in a cemetery to spawn if it was nighttime.

If the encounter active flag is set to FALSE to begin with (in the encounter GUI window when the encounter is created) then the SetEncounterActive function will spawn them properly the first time. It seems that the creatures are set to spawn before the OnEnter event is checked for validity. In addition, once the active flag is set it won't revert until the next time the encounter is triggered.

So I would have undead that would spawn at night properly, but once they spawned - if the time changed to day they would spawn at least one more time during daylight hours. Then the trigger would work properly again.

I tried to make it reset the active flag to active OnEnter, then the creatures would spawn, and to reset it to inactive OnExit. However, that didn't work either and the behavior stayed the same.


Version

1.28

See Also

functions: GetEncounterActive | GetEncounterSpawnsCurrent
categories: Encounter Functions


 author: Tom Cassiotis, editor: Charles Feduke, additional contributor(s): Victor Morales, Paul Haynes
 Send comments on this topic.