Frictional Games Forum (read-only)
Monster despawning after following a path - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Monster despawning after following a path (/thread-7606.html)



Monster despawning after following a path - ufando - 04-24-2011

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


RE: Monster despawning after following a path - DamnNoHtml - 04-24-2011

Monsters automatically despawn once they reach the end of their paths and are not visible by the player.


RE: Monster despawning after following a path - ufando - 04-24-2011

(04-24-2011, 11:48 AM)DamnNoHtml Wrote: Monsters automatically despawn once they reach the end of their paths and are not visible by the player.

oh cool, i fixed it now, there was a gap in the wall that i didn't notice at first, so i could still see it.

thanks