open.mp icon indicating copy to clipboard operation
open.mp copied to clipboard

NPC Component (WIP)

Open AmyrAhmady opened this issue 2 months ago • 11 comments

Info

This PR is made to follow progress of NPC component development Also creating this PR allows our build CIs to run so people can grab server builds from this PR to test NPCs

(Note: Some stuff are taken from this branch https://github.com/openmultiplayer/open.mp/tree/Alasnkz/npc like NPC network class and some move calculations)

Current Pawn scripting API

Natives:

native NPC_Create(const name[]);
native NPC_Destroy(npcid);
native NPC_IsValid(npcid);
native NPC_Spawn(npcid);
native NPC_SetPos(npcid, Float:x, Float:y, Float:z);
native NPC_GetPos(npcid, &Float:x, &Float:y, &Float:z);
native NPC_SetRot(npcid, Float:x, Float:y, Float:z);
native NPC_GetRot(npcid, &Float:x, &Float:y, &Float:z);
native NPC_SetVirtualWorld(npcid, vw);
native NPC_GetVirtualWorld(npcid, &vw);
native NPC_Move(npcid, Float:x, Float:y, Float:z, moveType);
native NPC_StopMove(npcid);

Callbacks:

forward OnNPCFinishMove(npcid);
forward OnNPCCreate(npcid);
forward OnNPCDestroy(npcid);

Videos:

Short video of basic usage: https://cdn.discordapp.com/attachments/966398440051445790/1229681168878669895/ompnpc.mp4

AmyrAhmady avatar Apr 17 '24 02:04 AmyrAhmady