(06-13-2013, 10:31 PM)Amn Wrote: I mean a timer to repeat the process.
Mostly to keep the grunt controlled.
Because sometimes, as you know, they disappear, get stuck and such. Grunt stuff.
I would make a function that resets the grunt, adds all the pathnodes again and starts a timer to call itself later.
Im going to test the resetprop function on the grunts and see if it works, but here is what I gathered from what you said.
ResetProp("servant_grunt_1");
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "node1", 1.0f, "idle");
AddTimer("gruntPath", 2.0f, "GruntMazePatrol");
Is this the kind of code you meant? (Of course with more nodes that is)
I just wanted to report that I tested out some code (which I am posting below) and it seemed to work. I have no way of knowing if the resetprop function worked, but no errors showed up and the test grunt patrolled the area repeatedly with no problems (I disabled his triggers so I could observe). I am going to try implementing this code with the main grunt and will let you know if it works or not. If I am not doing something right, please respond and let me know.
CODE:
void GruntTest(string &in asParent, string &in asChild, int alState)
{
ResetProp("servant_grunt_2");
SetEnemyDisableTriggers("servant_grunt_2", true);
SetEntityActive("servant_grunt_2", true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_1", 1.0f, "idle");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_2", 1.0f, "idle");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_3", 1.0f, "idle");
AddTimer("gruntPath", 2.0f, "GruntTest");
}
I tested it out and it worked great except for one small error which I believe I know how to fix.
As soon as he reached node 17 (the last node I made) he began to wander around trying to walk through the walls. Since I did not make his path loop back on itself I believe he was trying to walk through the bookshelves to node 1. I will make his path loop back to an area where he can easily walk to node 1. Other than that, I am thankful for all of your help. If I am missing anything or if there are any other suggestions please let me know. I will mark this post as sovled at the end of the day just in case I am missing something.