AttachZoneToEntity
Lets a zone ride an entity - a moving target, a zone around a cart.
Every tick the zone’s centre is put ox, oy, oz metres from the entity’s position: a prop, an actor, a horse, a cart.
nil as the entity leaves the zone where it is. A destroyed entity leaves the zone where it last was.
Syntax
Section titled “Syntax”AttachZoneToEntity(id, entity [, ox, oy, oz])| Parameter | Type | |
|---|---|---|
id |
number | the zone |
entity |
number | nil | the entity; nil detaches the zone |
ox |
number | the offset from the entity, metres (0 by default) (optional) |
oy |
number | metres (optional) |
oz |
number | metres (optional) |
Returns
Section titled “Returns”boolean - false when there is no such zone or entity
Example
Section titled “Example”-- a running target: a ball over a horse's backlocal horse = CreateHorse(1280, 1120, 26.5, 90)local target = CreateSphereZone(0, 0, 0, 0.5)AttachZoneToEntity(target, horse, 0, 0, 1.6)SetZoneHittable(target, true)See also
Section titled “See also”CreateSphereZone · SetZoneHittable · GetZoneInfo · the Zones group of the index
