Need help with NPC's - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with NPC's (
/showthread.php?tid=470595)
Need help with NPC's -
TonyII - 19.10.2013
Hey, I got a little problem that the bot is running through objects and buildings. The chasing works well but it literally teleports to the playerid once there is a object in between them. I use RNPC
pawn Код:
public BotFunctioning(playerid)
{
new target = GetClosestBot(playerid);
if(GetDistanceBetweenBots(target, playerid) <= 20)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
RNPCRunTo(target,X,Y,Z);
/*if(GetDistanceBetweenBots(target, playerid) <= 1.5)
{
SendClientMessage(playerid, -1,"The bot got you.");
}*/
}
else return 1;
return 1;
}
Re: Need help with NPC's -
Mauzen - 19.10.2013
You cant really fix that. Collision detection doesnt work npcs. There are ways to use a wayfinding algorithm and mapandreas, but it quite complex, and even more complex for custom objects.
Youll have to live with that, or wait if someone releases a script for that some time.
Re: Need help with NPC's -
Pottus - 19.10.2013
We were thinking of making a plugin called "ColAndreas" that uses GTA's collision files and object placements to do collision calculations. The idea is to serve as a complete alternative solution to MapAndreas in a nutshell the only work done so far is reading the collision data.
Re: Need help with NPC's -
TonyII - 19.10.2013
Alright, cool. Is there a way to set hp for bots?
Re: Need help with NPC's -
Pottus - 19.10.2013
https://sampforum.blast.hk/showthread.php?tid=355849&page=61 hit detection code is here you need to write your own HP system.