Ga naar hoofdinhoud

OnNPCFinishNode

waarschuwing

This function was added in omp v1.5.8.3079 and will not work in earlier versions!

Description

This callback is called when an NPC finishes navigating a complete node during node-based movement.

NameDescription
npcidThe ID of the NPC that finished the node
nodeidThe ID of the node that was completed

Examples

public OnNPCFinishNodePoint(npcid, nodeid, pointid)
{
// Notify players tracking this NPC
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if (!IsPlayerConnected(playerid))
continue;

if (PlayerNPC[playerid] == npcid)
{
SendClientMessage(playerid, 0xFFFF00FF, "NPC %d reached node %d point %d", npcid, nodeid, pointid);
}
}
return 1;
}

Notes

  • This callback is only called when NPCs are using node-based navigation via NPC_PlayNode
  • It's called when the NPC has completed navigation through all points in the node
  • The node navigation stops automatically when this callback is triggered

The following functions might be useful, as they're related to this callback in one way or another.