23.06.2013, 19:19
(
Last edited by pamdex; 23/06/2013 at 08:33 PM.
)
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
Parameters:
This function uses built-in MapAndreas (so you must init it - look at example).
Example usage:
Download:
https://dl.dropboxusercontent.com/u/...9/RNPC_032.zip
I'm going to work on RNPC.
RNPC 0.3.2v
- new function RNPC_PathFinderMovement for very smooth movement on calculated path (PathFinder Plugin).
- new NPC speed RNPC_SPEED_FASTWALK - works only in RNPC_PathFinderMovement.
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);
- Float:start_x <- actual NPC X pos
- Float:start_y <- actual NPC Y pos
- Float:start_z <- actual NPC Z pos
- nodes_array[] <- array with path nodes
- nodes_array_size <- size of nodes_array
- Float:speed <- NPC speed
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.