Monster despawning after following a path
How can i set it so that after a monster has gone to the last node, it despawns?
My code is
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnMonsterFunction", true, 1);
}
void SpawnMonsterFunction(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", 4, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 2, "");
}
I tried putting;
SetEntityActive("servant_grunt_1", false);
at the end of it, but it happens as soon as i walk into the area, so i tried putting a timer on it
AddTimer("xyz", 6f, "Pathtime");
void Pathtime(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
That caused a fatal error, something about ' ")" or "," expected.
Any help would be apprieciated
|