Help: FCNPC_GoTo dude
#1

Hello friends, I have a question, how can I use FCNPC_GoTo in two different directions?, that is, when I finish arriving at point "A" go to point "B" (im using timers but dont like it)

PHP код:
public move()
{
    
    
FCNPC_GoTo(bot1,-2463.5054,140.4829,35.17190FCNPC_MOVE_TYPE_AUTOtrue0.0true0.0250);
    
SetTimer("move1"25000false);
}
public 
move1()
{
    
    
FCNPC_GoTo(bot1,-2463.6243,175.9550,35.10940FCNPC_MOVE_TYPE_AUTOtrue0.0true0.0250);
    
SetTimer("move"25000false);

Reply
#2

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Hello friends, I have a question, how can I use FCNPC_GoTo in two different directions?, that is, when I finish arriving at point "A" go to point "B" (im using timers but dont like it)

PHP код:
public move()
{
    
    
FCNPC_GoTo(bot1,-2463.5054,140.4829,35.17190FCNPC_MOVE_TYPE_AUTOtrue0.0true0.0250);
    
SetTimer("move1"25000false);
}
public 
move1()
{
    
    
FCNPC_GoTo(bot1,-2463.6243,175.9550,35.10940FCNPC_MOVE_TYPE_AUTOtrue0.0true0.0250);
    
SetTimer("move"25000false);

guys, Someone can help me?
Reply
#3

The 2 timers are activated at the same time fix your code. I do something similar but with actors to make them walk. Maybe you should put a timer when spawnea the bot
Reply
#4

Understand what I say? you must give the bot some time to get to point B then you should redirect it by activating the other timer "move1"
Reply
#5

Quote:
Originally Posted by DIRTYBYT3
Посмотреть сообщение
Understand what I say? you must give the bot some time to get to point B then you should redirect it by activating the other timer "move1"
Hello friend, for me it works perfectly the code that I posted but I do not like. Can you give me an example without timers or is it necessary to use timers?
Reply
#6

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Hello friend, for me it works perfectly the code that I posted but I do not like. Can you give me an example without timers or is it necessary to use timers?
I do not use npc for me they are unnecessary and I consume slots instead I use actors. As I said in my case when spawn the actor in OnActorSpawn I use a timer to start walking and then another to redirect it by changing its angle
Reply
#7

Quote:
Originally Posted by bookknp
Посмотреть сообщение
when I finish arriving at point "A" go to point "B"
That's exactly what move paths are for.

EDIT:
We fixed some crashes with move paths in the in development v2.0 version, so if you get crashes with the 1.8.2 version, that's why.
Reply
#8

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
That's exactly what move paths are for.

EDIT:
We fixed some crashes with move paths in the in development v2.0 version, so if you get crashes with the 1.8.2 version, that's why.
Very thx Freaksken!!!! Can you give an example for add paths?
Reply
#9

Код:
//Create a path:
new movePath = FCNPC_CreateMovePath();
FCNPC_AddPointToPath(movePath, x1, y1, z1); //Renamed to FCNPC_AddPointToMovePath in FCNPC 2.0
FCNPC_AddPointToPath(movePath, x2, y2, z2); //Renamed to FCNPC_AddPointToMovePath in FCNPC 2.0

//Destroy a path:
FCNPC_DestroyMovePath(movePath);
movePath = FCNPC_INVALID_MOVEPATH_ID;

//Use a path:
FCNPC_GoByMovePath(npcid, movePath);
Reply
#10

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Код:
//Create a path:
new movePath = FCNPC_CreateMovePath();
FCNPC_AddPointToPath(movePath, x1, y1, z1); //Renamed to FCNPC_AddPointToMovePath in FCNPC 2.0
FCNPC_AddPointToPath(movePath, x2, y2, z2); //Renamed to FCNPC_AddPointToMovePath in FCNPC 2.0

//Destroy a path:
FCNPC_DestroyMovePath(movePath);
movePath = FCNPC_INVALID_MOVEPATH_ID;

//Use a path:
FCNPC_GoByMovePath(npcid, movePath);
Thank you very much Freaksken!!!, I have another question, how can I repeat the path infinitely? +rep
Reply
#11

Quote:
Originally Posted by bookknp
View Post
Thank you very much Freaksken!!!, I have another question, how can I repeat the path infinitely? +rep
There are two callbacks for move paths you can use for this:

Code:
FCNPC_OnFinishMovePath(npcid, pathid); // Called when the whole path ends
FCNPC_OnFinishMovePathPoint(npcid, pathid, pointid); // Called for each node that was reached
You can just restart the Node Playback in FCNPC_OnFinishMovePath

There's also a callback for simple FCNPC_GoTo if you should ever need it:

Code:
FCNPC_OnReachDestination(npcid);
Check the GitHub page for all natives and callbacks.
Reply
#12

Quote:
Originally Posted by NaS
View Post
There are two callbacks for move paths you can use for this:

Code:
FCNPC_OnFinishMovePath(npcid, pathid); // Called when the whole path ends
FCNPC_OnFinishMovePathPoint(npcid, pathid, pointid); // Called for each node that was reached
You can just restart the Node Playback in FCNPC_OnFinishMovePath

There's also a callback for simple FCNPC_GoTo if you should ever need it:

Code:
FCNPC_OnReachDestination(npcid);
Check the GitHub page for all natives and callbacks.
Very thx friend , I am learning with you a lot. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)