WalkMonsterTo
walkMonsterTo
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.
Commands a living server-owned monster to walk to a world position.
Syntax
bool walkMonsterTo(string monsterId, number x, number y, number z)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
monsterId |
string |
yes | The opaque decimal monster identifier returned by spawnMonster or getMonsters.
|
x |
number |
yes | Destination X coordinate in metres. |
y |
number |
yes | Destination Y coordinate in metres. |
z |
number |
yes | Destination Z coordinate in metres. |
Returns
Returns true when the movement command and its server-side route are accepted; otherwise returns false.
Examples
Send a guard creature to a waypoint:
if not walkMonsterTo(monsterId, 25.0, 12.0, 3.0) then
outputDebugString("Monster destination is unreachable", 1)
end
Notes
- Available only in server-side resource scripts.
- This is movement over time, not a teleport. Use
setMonsterPositiononly for an explicit authoritative teleport. - The command clears the current player target. When a nonzero target is cleared, the existing
onMonsterTargetChangeevent is emitted. - Ground-following monsters use the conservative server navigation-blocker layer baked only from explicitly authored unwalkable, NavArea_Null and nav-mesh exclusion geometry. Ordinary terrain and NavArea_Avoid are not guessed to be hard blockers. If no valid path exists, the function returns false and never falls back to a straight segment through a blocker.
- Dynamic character-capsule spacing prevents monsters, NPCs and players from occupying the same space. Additional pursuers select spaced flank positions instead of stacking on the active attacker.
- Flying catalog types use their airborne movement model with three-dimensional clearance checks.