SetMonsterMoveGoal

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

setMonsterMoveGoal

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.

Assigns one direct, collision-checked movement goal to a resource-owned ground monster in scripted navigation mode.

Syntax

bool setMonsterMoveGoal(string monsterId, number x, number y, number z [, table options])

Parameters

Name Type Required Description
monsterId string yes The opaque decimal monster identifier returned by spawnMonster or getMonsters.
x number yes Goal X coordinate in metres.
y number yes Goal Y coordinate in metres.
z number yes Ground-location Z reference in metres.
options table no Optional { speedScale = number, arrivalRadius = number }. speedScale must be greater than 0 and no greater than 1 and defaults to 1. arrivalRadius is measured in metres, must be 0.01-5, and defaults to 0.2.

Returns

Returns true when the complete goal is accepted; otherwise returns false.

Examples

Walk directly toward a scripted guard position at half catalog speed:

setMonsterNavigationMode(monsterId, "scripted")
setMonsterMoveGoal(monsterId, 25.0, 12.0, 3.0, {
    speedScale = 0.5,
    arrivalRadius = 0.25,
})

Notes

  • Available only in server-side resource scripts.
  • Only the owning resource may set a goal, and the monster must be alive, ground-following and already in "scripted" mode.
  • The goal is a direct segment. Scripted mode does not invoke built-in path finding, avoidance, automatic detours, return-home movement or formation positioning.
  • Static world blockers and authoritative player, NPC and monster capsules remain hard constraints. A blocked goal is retained and retried; the server never walks through a blocker.
  • The owning resource receives one onMonsterMoveBlocked edge when continuous blockage begins and one onMonsterMoveComplete event when the arrival radius is reached.
  • Movement is ground-only. The Z value must describe a plausible nearby ground location; this API does not control flying, vertical velocity or moving platforms.
  • Target selection and authoritative attacks continue while navigation is scripted, although built-in movement toward the target is bypassed.