CreateAiNavigationBlocker
createAiNavigationBlocker
AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Creates a resource-owned static navigation blocker used by server-simulated NPCs and monsters.
Syntax
string|false createAiNavigationBlocker(table definition)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
definition |
table |
yes | A validated box, cylinder, or convex polygon definition in metres.
|
Returns
Returns a new opaque decimal blocker ID string, or false when the definition is invalid or a bounded resource/server limit is reached.
Examples
Block a rotated doorway volume:
local blockerId = createAiNavigationBlocker({
shape = "box",
x = 125.0, y = -48.0, z = 2.0,
width = 2.5, depth = 0.8, height = 4.0,
yaw = 30,
})
Notes
- Available only in server-side resource scripts.
- All coordinates and dimensions use metres. A box uses centre
x/y/z,width,depth,height, and optional yaw in degrees. A cylinder uses centrex/y/z,radius, andheight. Each dimension must be 0.01-10000 metres. - A polygon uses
points = {{x=...,y=...}, ...}with 3-16 vertices plusminZandmaxZ. It must be finite, simple and convex; clockwise input is normalized. Coordinates are limited to +/-100000 metres. - Optional
enableddefaults to true. The server permits at most 4096 blockers per resource and 16384 total, and also bounds spatial-index growth. - The blocker is visible to every AI entity whose collision mode includes the custom layer, not only entities owned by the creating resource. Only the creating resource may inspect, update, enable, disable or destroy it.
- Stopping or restarting the owning resource removes all of its blockers automatically. Dynamic player, NPC and monster capsule collision is separate and always remains active.
- Use custom blockers for static geometry and occasional changes such as opening or closing a gate. Moving or toggling blockers every server tick is unsupported; moving characters already use the mandatory dynamic capsule layer.
- Expanded limits apply from update 0.1.3 BUILD81. See Scripting limits; earlier 0.1.3 binaries retain their old limits.