Now, let me say that I'm sure this is really simple and I have just done something silly in my code :3
Quite simply, there is a long corridor with a few rooms on each side allowing you to hide if you are quick enough to get inbetween each one. In this corridor, I have 12 pathnodes for 1 monster, which I want to continuously walk up and down the corridor.
I can get him to the 12th, then back to the 1st, but when he gets back to the 12th, he disappears.
This is my code:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "monsterspawn", true, 1);
}
void monsterspawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 4, "");
for (int i = 1; i < 13; i++)
{
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_"+i, 0, "");
}
}
Of course, I'm nowhere near finished on my CS, this is the first level xP but its not my first, and I'm always looking for improvement.