Getting a NPC to follow me
#1

After seeing Mo3's Intelligent NPCs and studying his scripts, it gave me a idea on how to make a NPC to follow me...

The problem is, The Animation of the Walk Walks a few steps forward then resets itself back to the base x,y,z where the NPC spawns..

Here is my script:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new JackID = GetPlayerID("Jack");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(JackID,x,y,z);
    if(IsPlayerFacingPlayer(playerid,JackID,10.0))
    {
        if(strfind(text, "Follow me") != -1 && IsPlayerInRangeOfPoint(playerid,5.0,x,y,z))
        {
            SetPlayerChatBubble(JackID,"Ok!",white, 100.0, 5000);
            SetTimerEx("GetJackToFolow",100,1,"i",playerid);
            ApplyAnimation(JackID,"PED","WALK_PLAYER",4.1,1,1,1,1,0);
            return 1;
        }
    }
    return 1;
}
And the timer:
pawn Код:
forward GetJackToFolow(playerid);
public GetJackToFolow(playerid)
{
    new JackID = GetPlayerID("Jack");
    SetPlayerFacingPlayer(JackID, playerid);
}
I've never done anything that uses animations...
Any ideas on what is causing the animation to keep repeating other than keep on going?
Reply
#2

yea the 100 timer make it somthing like 5000 and set the animation timer to 5000 per animation.
Reply
#3

Still does the same thing
Reply
#4

Quote:
Originally Posted by Miokie*
Still does the same thing
its probably your record file is just replaying.
Reply
#5

Ahh Good thinking!
I'm going to record it to make it much longer and see if it works any better.

Still The Same Problem...
Reply
#6

Quote:
Originally Posted by Miokie*
Ahh Good thinking!
I'm going to record it to make it much longer and see if it works any better.

Still The Same Problem...
yea i'm testing it and i'm getting the same problem i will post as soon as i fix it.
Reply
#7

Quote:
Originally Posted by Shady91
Quote:
Originally Posted by Miokie*
Ahh Good thinking!
I'm going to record it to make it much longer and see if it works any better.

Still The Same Problem...
yea i'm testing it and i'm getting the same problem i will post as soon as i fix it.
Ok Cool, I'm going to bed now, It's almost 1am and I have school in the morning, Ill look up this topic in the morning.
Thanks for helping me out.
Reply
#8

try putting param 6 and 7 to 0, not sure though.
Reply
#9

i can make it follow but not by using the animation everytime he walks he just goes back again but i have another way it don't look to good tho.
Reply
#10

Quote:
Originally Posted by Shady91
i can make it follow but not by using the animation everytime he walks he just goes back again but i have another way it don't look to good tho.
What is this other way? Maybe I can build on the idea...
Reply


Forum Jump:


Users browsing this thread: