25.06.2013, 07:45
Quote:
I made new version of RNPC.
RNPC 0.3.2v
When you use RNPC_SPEED_WALK in RNPC_PathFinderMovement NPC doesn't walk properly. RNPC_PathFinderMovement Code:
native RNPC_PathFinderMovement(Float:start_x, Float:start_y, Float:start_z, nodes_array[], nodes_array_size, Float:speed=RNPC_SPEED_RUN);
This function uses built-in MapAndreas (so you must init it - look at example). Example usage: Code:
public OnFilterScriptInit() { MapAndreas_Init(MAP_ANDREAS_MODE_NOBUFFER); for(new i; i < 50; i++) { new NPCNAME[MAX_PLAYER_NAME]; format(NPCNAME, sizeof(NPCNAME), "(TEST)_%i", i); ConnectRNPC(NPCNAME); } PathFinder_Init(2.0); } CMD:onefollow(playerid, arg[]) { new Float:x, Float:y, Float:z; new Float:x1, Float:y1; GetPlayerPos(0, x, y, z); //NPC GetPlayerPos(playerid, x1, y1, z); PathFinder_FindWay(0, x, y, x1, y1); return 1; } public OnPathCalculated(routeid,success,nodes[],nodes_size) { if(success) { RNPC_StopPlayback(routeid); new Float:x, Float:y, Float:z; RNPC_CreateBuild(routeid,PLAYER_RECORDING_TYPE_ONFOOT); //MOVE GetPlayerPos(routeid,x,y,z); //NPC RNPC_PathFinderMovement(x,y,z,nodes,nodes_size,RNPC_SPEED_RUN + (random(12) * 0.0001)); //------------------------ RNPC_FinishBuild(); RNPC_StartBuildPlayback(routeid); return 1; } } https://dl.dropboxusercontent.com/u/...9/RNPC_032.zip I'm going to work on RNPC. |