Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 1.83 KB

File metadata and controls

57 lines (43 loc) · 1.83 KB
title OnNPCFinishMovePathPoint
sidebar_label OnNPCFinishMovePathPoint
description Called when an NPC finishes moving to a specific point in a path.
tags
npc
path
movement

Description

This callback is called when an NPC finishes moving to a specific point in a path.

Name Description
npcid The ID of the NPC that finished the path point
pathid The ID of the path being followed
pointid The index of the point that was reached

Examples

public OnNPCFinishMovePathPoint(npcid, pathid, pointid)
{
    // Find all 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 point %d on path %d", npcid, pointid, pathid);
        }
    }
    return 1;
}

Notes

  • This callback is triggered for each point in the path
  • Use OnNPCFinishMovePath to detect when the entire path is completed
  • The NPC must be moving along a path using NPC_MoveByPath

Related Functions

Related Callbacks