SA-MP Forums Archive
HELP: NPC follow Player using FCNPC. - 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: HELP: NPC follow Player using FCNPC. (/showthread.php?tid=660661)



HELP: NPC follow Player using FCNPC. - bookknp - 09.11.2018

hello friends, I'm trying to get an npc to follow a player using FCNPC but I'm new and I do not know if I'm doing something wrong ... the npc does not follow the player, why is this happening? what is the way the NPC follow the player?

PHP код:
public OnGameModeInit()
 
bot1 FCNPC_Create("Officerino");
    
printf("Officerino: %i"bot1);
public 
Follower(playerid)
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    
FCNPC_GoTo(bot1xyzMOVE_TYPE_SPRINT, .UseMapAndreas true);
    
FCNPC_GoToPlayer(bot1playerid); 



Re: HELP: NPC follow Player using FCNPC. - Freaksken - 09.11.2018

Don't use both functions at the same time.

FCNPC_GoTo:
NPC goes to a point and then stops moving.

FCNPC_GoToPlayer:
NPC goes to a player and keeps following that player, even when that player moves, until it reaches the player and then stops moving.


Re: HELP: NPC follow Player using FCNPC. - bookknp - 09.11.2018

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Don't use both functions at the same time.

FCNPC_GoTo:
NPC goes to a point and then stops moving.

FCNPC_GoToPlayer:
NPC goes to a player and keeps following that player, even when that player moves, until it reaches the player and then stops moving.
Very thx friend!!! Now, I have a problem. When I teleport to see the npc in a position it runs out to the position I've spawned, why does this happen?

PHP код:
public Follower(playerid)
    
FCNPC_GoToPlayer(bot1playeridFCNPC_MOVE_TYPE_AUTOFCNPC_MOVE_TYPE_AUTOfalse0.0true0.01.5250); 



Re: HELP: NPC follow Player using FCNPC. - bookknp - 09.11.2018

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Very thx friend!!! Now, I have a problem. When I teleport to see the npc in a position it runs out to the position I've spawned, why does this happen?

PHP код:
public Follower(playerid)
    
FCNPC_GoToPlayer(bot1playeridFCNPC_MOVE_TYPE_AUTOFCNPC_MOVE_TYPE_AUTOfalse0.0true0.01.5250); 
solve it thx Freaksken