Need help with NPC's
#1

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;
}
Reply
#2

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.
Reply
#3

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.
Reply
#4

Alright, cool. Is there a way to set hp for bots?
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=355849&page=61 hit detection code is here you need to write your own HP system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)