Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.42 KB

File metadata and controls

56 lines (40 loc) · 1.42 KB
title NPC_CreatePath
sidebar_label NPC_CreatePath
description Creates a new NPC path.
tags
npc
path

Description

Creates a new path that can be used for NPC navigation.

Returns

Returns the ID of the created path.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/createpatrol", true))
    {
        new pathid = NPC_CreatePath();
        g_PatrolPath = pathid;

        // If you wanted, you could already add points to the path here
        // NPC_AddPointToPath(g_PatrolPath, x, y, z, 1.5)
        // NPC_AddPointToPath(g_PatrolPath, x1, y1, z1, 1.5)
        // NPC_AddPointToPath(g_PatrolPath, x2, y2, z2, 1.5)

        SendClientMessage(playerid, 0x00FF00FF, "Created a patrol path %d", g_PatrolPath);

        return 1;
    }
    return 0;
}

Notes

  • The path is always created empty, use NPC_AddPointToPath to add waypoints
  • Multiple NPCs can use the same path simultaneously
  • Paths remain valid until destroyed with NPC_DestroyPath

Related Functions

Related Callbacks