OnNpcMoveBlocked
Jump to navigation
Jump to search
onNpcMoveBlocked
AVAILABLE FROM UPDATE 0.1.2
This event is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Triggered once when a resource-owned NPC's direct scripted movement becomes blocked.
Availability
This event is available in server-side scripts.
Callback signature
onNpcMoveBlocked(npcId, reason, blockerType, blockerId)
Parameters
| Name | Type | Description |
|---|---|---|
npcId |
int |
The blocked NPC identifier. |
reason |
string |
The authoritative reason: world-collision or dynamic-collision. |
blockerType |
string |
The blocker kind: world, player, npc, monster or unknown. |
blockerId |
string |
The dynamic blocker identifier, or an empty string for world or unknown blockers. |
Examples
Handle the event:
addEventHandler("onNpcMoveBlocked", resourceRoot, function(npcId, reason, blockerType, blockerId)
outputDebugString("NPC " .. npcId .. " blocked by " .. blockerType .. ":" .. blockerId)
end)
Notes
- This owner-only edge event is delivered to the creating resource's
resourceRoot, not broadcast to unrelated resources. - Continuous blockage emits one event. A later successful movement step re-arms the edge, so a new blockage may emit another event.
- The move goal remains active and continues to be checked against authoritative server collision; use
stopNpcMovementto cancel it.