Frictional Games Forum (read-only)

Full Version: Monster despawning after following a path
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Monsters automatically despawn once they reach the end of their paths and are not visible by the player.
(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