Zone
A zone is a named polygonal region defined in an area. Zones are used to provide script triggers based on player or entity movement. Zones can have a limited height or can ignore the up axis entirely. Each entity is considered to be in at most one zone at a time. If multiple zones overlapped an entity is considers only in the first zone (by the order stored in the area file).
Zones can have an associated ambiance, fog distance and/or fog-color, which will be activated when the player enters the zone as if the zoneparam ambiance
command was called. Leaving a zone does not restore the original ambiance or fog settings.
When the player or a non-mega-hidden item or NPC enters or leaves a zone, it receives the enterzone
or leavezone
events respectively with the zone name as the first parameter.
A zone can have a controlling entity (set using setcontrolledzone
and removed using unsetcontrolledzone
) which will receive controlledzone_enter
or controlledzone_leave
events when any entity enters or leaves that zone, with the entity ID as the first parameter and the zone name as the second parameter.
The enterzone
and controlledzone_enter
events are repeated when the visibility for an entity already inside a zone changes. leavezone
and controlledzone_leave
events are not sent when an entity inside a zone becomes mega-hidden.
The sendevent
script command can be used to send an event to all items, NPCs and/or props inside a zone.