SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 01/04/2013, 11:42 AM   #21
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,802
Reputation: 1160
Default Re: PathFinder 0.11v by Pamdex

Quote:
Originally Posted by KyleSmith View Post
What is the difference in this than RouteCalculator Plugin?
Uses mapandreas to get average z-height positions (or along the lines) - Gamer_Z's is strictly on AI nodes by gta itself (seems for me, tried making a fast path-finder work on that plugin)
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is online now   Reply With Quote
Old 01/04/2013, 01:05 PM   #22
Mauzen
Banned
 
Join Date: Jun 2007
Location: Western Germany
Posts: 4,899
Reputation: 1597
Default Re: PathFinder by Pamdex

Thats exactly what I planned for RNPC, really nice work. Ill give it a closer look later.
Mauzen is offline   Reply With Quote
Old 01/04/2013, 03:59 PM   #23
AIped
Gangsta
 
AIped's Avatar
 
Join Date: Feb 2011
Location: Netherlands
Posts: 619
Reputation: 46
Default Re: PathFinder by Pamdex

OnPathCalculated is still not working for me. I did update but it doesnt get the succes thingy..
maybe im doing something wrong.
Can you make a small example to make a npc walk from point A to B by using a simple command and without a timer ?
AIped is offline   Reply With Quote
Old 01/04/2013, 04:38 PM   #24
pamdex
Little Clucker
 
pamdex's Avatar
 
Join Date: Jan 2010
Location: Poland
Posts: 40
Reputation: 79
Default Re: PathFinder by Pamdex

@UP
Code:
#include <a_samp>
#include <PathFinder>
#include <rnpc>
public OnPathCalculated(routeid,success,nodes[],nodes_size)
{
	if(success)
	{
		new Float:x,Float:y,Float:z,Float:x1,Float:y1,Float:z1;
		RNPC_CreateBuild(routeid,PLAYER_RECORDING_TYPE_ONFOOT);
		//Bot!
		for(new i; i < nodes_size-1; i++)
		{
			PathFinder_GetNodePos(nodes[i],x,y,z);
			PathFinder_GetNodePos(nodes[i+1],x1,y1,z1);
			RNPC_AddMovement(x,y,z+1,x1,y1,z1+1,RNPC_SPEED_RUN); //crappy :D
		}
		RNPC_FinishBuild();
		RNPC_StartBuildPlayback(routeid);
	}
	else
	{
		new text[50];
		format(text,sizeof(text),"Zombie: %d failed!",routeid);
		SendClientMessageToAll(-1,text);
	}
	return 1;
}
public OnFilterScriptInit()
{
	PathFinder_Init(1.0); //test
	ConnectRNPC("Bot"); //id 0
	return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
	if(!strcmp("/bot_test",cmdtext,true))
	{
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
		PathFinder_FindWay(0,x,y,x+random(100)-50,y+random(100)-50);
		return 1;
	}
	return 0;
}
__________________
...
pamdex is offline   Reply With Quote
Old 01/04/2013, 04:52 PM   #25
AIped
Gangsta
 
AIped's Avatar
 
Join Date: Feb 2011
Location: Netherlands
Posts: 619
Reputation: 46
Default Re: PathFinder by Pamdex

Quote:
Originally Posted by pamdex View Post
@UP
Code:
#include <a_samp>
#include <PathFinder>
#include <rnpc>
public OnPathCalculated(routeid,success,nodes[],nodes_size)
{
	if(success)
	{
		new Float:x,Float:y,Float:z,Float:x1,Float:y1,Float:z1;
		RNPC_CreateBuild(routeid,PLAYER_RECORDING_TYPE_ONFOOT);
		//Bot!
		for(new i; i < nodes_size-1; i++)
		{
			PathFinder_GetNodePos(nodes[i],x,y,z);
			PathFinder_GetNodePos(nodes[i+1],x1,y1,z1);
			RNPC_AddMovement(x,y,z+1,x1,y1,z1+1,RNPC_SPEED_RUN); //crappy :D
		}
		RNPC_FinishBuild();
		RNPC_StartBuildPlayback(routeid);
	}
	else
	{
		new text[50];
		format(text,sizeof(text),"Zombie: %d failed!",routeid);
		SendClientMessageToAll(-1,text);
	}
	return 1;
}
public OnFilterScriptInit()
{
	PathFinder_Init(1.0); //test
	ConnectRNPC("Bot"); //id 0
	return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
	if(!strcmp("/bot_test",cmdtext,true))
	{
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
		PathFinder_FindWay(0,x,y,x+random(100)-50,y+random(100)-50);
		return 1;
	}
	return 0;
}
I just did that.. i went ingame put in the command and it said : Zombie: 0 failed
I have your version 0.12.. what now ?
AIped is offline   Reply With Quote
Old 01/04/2013, 05:07 PM   #26
pamdex
Little Clucker
 
pamdex's Avatar
 
Join Date: Jan 2010
Location: Poland
Posts: 40
Reputation: 79
Default Re: PathFinder by Pamdex

Sometimes calculation fails (e.g. when end point is in water). I tested this plugin on my public server with 5 zombies and it worked fine.

To test use this (previous code isn't good for testing):
Code:
#include <a_samp>
#include <PathFinder>
#include <rnpc>
new Float:Point[MAX_PLAYERS][3];
public OnPathCalculated(routeid,success,nodes[],nodes_size)
{
	if(success)
	{
		new Float:x,Float:y,Float:z,Float:x1,Float:y1,Float:z1;
		RNPC_CreateBuild(routeid,PLAYER_RECORDING_TYPE_ONFOOT);
		//Bot!
		for(new i; i < nodes_size-1; i++)
		{
			PathFinder_GetNodePos(nodes[i],x,y,z);
			PathFinder_GetNodePos(nodes[i+1],x1,y1,z1);
			RNPC_AddMovement(x,y,z+1,x1,y1,z1+1,RNPC_SPEED_RUN); //crappy :D
		}
		RNPC_FinishBuild();
		RNPC_StartBuildPlayback(routeid);
	}
	else
	{
		new text[126];
		format(text,sizeof(text),"Zombie: %d failed!",routeid);
		SendClientMessageToAll(-1,text);
	}
	return 1;
}
public OnFilterScriptInit()
{
	PathFinder_Init(1.0); //test
	ConnectRNPC("Bot"); //id 0
	return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
	if(!strcmp("/bot_test",cmdtext,true))
	{
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
		PathFinder_FindWay(0,x,y,Point[playerid][0],Point[playerid][1]);
		return 1;
	}
	return 0;
}
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
	Point[playerid][0] = fX;
	Point[playerid][1] = fY;
	Point[playerid][2] = fZ;
	return 1;
}
You should set point on map (near you) and use command :P.
__________________
...
pamdex is offline   Reply With Quote
Old 02/04/2013, 09:28 AM   #27
AIped
Gangsta
 
AIped's Avatar
 
Join Date: Feb 2011
Location: Netherlands
Posts: 619
Reputation: 46
Default Re: PathFinder by Pamdex

Iknow..and now i tried yours and i had the same problem..damn i must be doing something wrong but what else can it be.

EDIT: Okay i realize that it does work sometimes.
If i set point on the map and use the command after it mostly fails. But if sometimes after clicking the map and using the command again it does work.
Any ideas why ?

Last edited by AIped; 02/04/2013 at 11:29 AM.
AIped is offline   Reply With Quote
Old 02/04/2013, 11:57 AM   #28
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,338
Reputation: 251
Default Re: PathFinder by Pamdex

Using this plugin for moving the NPCs is quite annoying, cause they go to every point of a node, so they look bugged, I think you can apply the run/sprint/walk animation to make them look smooth.

Edit: Does this detect object collision?
__________________
TheArcher is offline   Reply With Quote
Old 02/04/2013, 12:05 PM   #29
pamdex
Little Clucker
 
pamdex's Avatar
 
Join Date: Jan 2010
Location: Poland
Posts: 40
Reputation: 79
Default Re: PathFinder by Pamdex

@UP Only GTA SA objects (building etc.) - height difference

Quote:
Using this plugin for moving the NPCs is quite annoying
I'm making special function for smooth moving (in PAWN or in RNPC).
__________________
...

Last edited by pamdex; 02/04/2013 at 02:15 PM.
pamdex is offline   Reply With Quote
Old 02/04/2013, 12:13 PM   #30
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,338
Reputation: 251
Default Re: PathFinder by Pamdex

@pamdex awesome! can't wait.
__________________
TheArcher is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 02:41 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.