I would guess that the error has to be here
if((hero.z > 50) && (hero.z > my.z)) // player is above
// bottom of tower, and monster
{
pathSetNum = 2;
path_setter();
}
if((my.z >= 47) && (my.z <= 49)) // once on bottom of
// tower, monster faces and runs toward player
{
path_set(my,NULL);
vec_set(temp.x, player.x);
vec_sub(temp.x, my.x);
vec_to_angle(my.pan, temp); // rotate the enemy towards the player
}
However if you manually control my.NODE_NEXT, you can use the same path. Can't you set_nodenext(my,-1,1);
However in state 2 , set my.NODE_NEXT to last node, then manually subtract -1 from it. This should cause the monster to travel backward up path_001 without the need of another path.
if at node 1 use as written, to reverse
stop getting path_nextnode, instead manual sub from my.NODE_NEXT-=1; then plug the new ,backward node into path_getnode(my,my.NODE_NEXT,vec_next_node,NULL);
Here is the new code
action path_setter()
{
VECTOR vec_next_node;
path_set(my,NULL);
path_set(demon,"path_001");
my.NODE_NEXT=path_nextnode(my,1,1); // SET THE NODE
while(1)
{
// PATH NODE DETECTION AND FACING //////////////////////////////////
if(vec_dist(my.x,vec_next_node.x) < 80)
{
if(pathSetNum == 1) // whatever path is set here does not allow monster to
{
my.NODE_NEXT=path_nextnode(my,my.NODE_NEXT,1); // Grab Next node on
// path
}
if(pathSetNum == 2) // whatever path is set here does not allow monster to
// move past second node
{
my.NODE_NEXT-=1;
if(my.NODE_NEXT<1)
my.NODE_NEXT=1;
// limit node not to fall below 0 or maybe that will auto revrse
}
}
path_getnode(my,my.NODE_NEXT,vec_next_node,NULL); // Get next node actual vector location
vec_to_angle(my.pan,vec_diff(NULL,vec_next_node,my.x)); // face the new node
DEBUG_VAR(my.NODE_NEXT,500);
wait(1);
}
}
Give that a look and a run, I can't test it.
Mal
LOL are you detaching when you reach node 2 by calling path_set(my,NULL);
to many times?
IF my.NODE_NEXT is dropping to 0 then you be.
Ok bye now
Mal