HELP: NPC follow Player using FCNPC.
#1

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

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

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); 
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)