跳到主要内容

OnNPCFinishNodePoint

注意

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 reaches a specific point during node-based navigation.

NameDescription
npcidThe ID of the NPC that reached the node point
nodeidThe ID of the node being navigated
pointidThe ID of the specific point that was reached

Examples

public OnNPCFinishNode(npcid, nodeid)
{
printf("[NPC] NPC %d finished node %d", npcid, nodeid);

// Notify players tracking this NPC
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if (!IsPlayerConnected(playerid))
continue;

if (PlayerNPC[playerid] == npcid)
{
SendClientMessage(playerid, 0x00FF00FF, "NPC %d finished node %d", npcid, nodeid);
}
}
return 1;
}

Notes

  • This callback is only called when NPCs are using node-based navigation via NPC_PlayNode
  • It's called each time the NPC reaches a waypoint within the node
  • The pointid corresponds to the specific waypoint index within the node file

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