Frictional Games Forum (read-only)
make a monster de-spawn? - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: make a monster de-spawn? (/thread-9617.html)



make a monster de-spawn? - Synestral - 08-06-2011

i dont know how to make a monster de-spawn. i have tried a few things, but it doesnt work. how do you make a monster disappear after walking a path?

this is my code
Code:
void OnStart()
{
SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
}

void Spawn_Monster(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
GiveSanityDamage(5.0f, true);
AddEnemyPatrolNode("servant_grunt_1", "Node_1", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_6", 5,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
}



RE: make a monster de-spawn? - TFEF - 08-06-2011

They should disappear after they've run their pathnodes, unless the player is too close.

Although, if you really want to be sure, you can use this script function:

Code:
void SetEnemyDisabled(string& asName, bool abDisabled);

string& asName = Monster's name
bool abDisabled = True or false as to whether the enemy is disabled or not


RE: make a monster de-spawn? - Your Computer - 08-06-2011

(08-06-2011, 02:35 AM)TFEF Wrote: Although, if you really want to be sure, you can use this script function:

Code:
void SetEnemyDisabled(string& asName, bool abDisabled);

string& asName = Monster's name
bool abDisabled = True or false as to whether the enemy is disabled or not

It might be better if he went with SetEntityActive().


RE: make a monster de-spawn? - TFEF - 08-06-2011

(08-06-2011, 07:29 AM)Your Computer Wrote: It might be better if he went with SetEntityActive().

True, that. It's been a while since I've done anything for custom stories. Tongue


RE: make a monster de-spawn? - Roenlond - 08-06-2011

It might be even better to use FadeEnemyToSmoke(string& asName, bool abPlaySound); if you want effects as well. With SetEntityActive(), he'd simply disappear into thin area whereas FadeEnemyToSmoke will create a smoke and play a sound if the bool is set to true.


RE: make a monster de-spawn? - xtron - 08-06-2011

anyhow...Create an area on the last pathnode and name it something (ex: MonsterDespawn)
And add a collidecallback and a function and it'll look something like this maybe:

Code:
void OnStart()
{
AddEntityCollideCallback("MONSTERNAME", "MonsterDespawn", "MonsterDespawnFunc", true, 1);
SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
}

void Spawn_Monster(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
GiveSanityDamage(5.0f, true);
AddEnemyPatrolNode("servant_grunt_1", "Node_1", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_6", 5,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
}

void MonsterDespawnFunc(string &in asParent, string &in asChild, int alState)
{
FadeEnemyToSmoke("MONSTERNAME", true);
}

Change MONSTERNAME to your monsters name.
Change MonsterDespawn to your areas name.