In my experience, when you have two nodes named the same thing, the engine only pays attention to the first node created. For example:
You add a node and name it 'A'.
You add a node and name it 'A'.
You add a node and name it 'B'.
You connect them all and Rebuild Paths.
You tell your character to walkToNode( 'A', 'B', 1);
Your character will go to the 'A' node created first (even if he's sitting right on top of the second 'A' node), then meander over to the 'B' node.
In other words, you'll need to name each of your nodes differently if you want everything to behave properly.
To answer your questions about FY_TROOPER_ATTACK_NODE, that is an ID that you can use if you want to track your character's movement. For example, this is a simple script that moves JoeFoe in a triangle from node A to node B to node C to node A etc...
Code:
const WALK_TO_A = 1;
const WALK_TO_B = 2;
const WALK_TO_C = 3;
function joeFoeConstruct(obj)
{
obj.model.on=true;
obj.model.name='JoeFoe';
obj.model.lit=DIM3_MODEL_LIT_VERTEX;
obj.forwardSpeed.walk=35;
obj.forwardSpeed.acceleration=1.0;
}
function joeFoeFinishNodeWalk( obj, id )
{
switch( id )
{
case WALK_TO_A:
obj.motionVector.walkToNode( 'A', 'B', WALK_TO_B );
return;
case WALK_TO_B:
obj.motionVector.walkToNode( 'B', 'C', WALK_TO_C );
return;
case WALK_TO_C:
obj.motionVector.walkToNode( 'C', 'A', WALK_TO_A );
return;
}
}
function event( obj ,mainEvent, subEvent, id, tick)
{
switch( mainEvent )
{
case DIM3_EVENT_CONSTRUCT:
joeFoeConstruct( obj );
return;
case DIM3_EVENT_SPAWN:
obj.motionVector.walkToNode('A','B', WALK_TO_B);
return;
case DIM3_EVENT_PATH:
joeFoeFinishNodeWalk( obj, id );
return;
}
}
You can see that I used the constants WALK_TO_A, WALK_TO_B, and WALK_TO_C to tell where JoeFoe was in his journey. I could have just as easily used integers instead of constants, like so:
Code:
function joeFoeFinishNodeWalk( obj, id )
{
switch( id )
{
case 1:
obj.motionVector.walkToNode( 'A', 'B', 2 );
return;
case 2:
obj.motionVector.walkToNode( 'B', 'C', 3 );
return;
case 3:
obj.motionVector.walkToNode( 'C', 'A', 1);
return;
}
}
But this method makes things harder to read and understand. Constants are there to be your friends and make it so you don't have to remember the event ID's of everything going on in your scripts.
