Frictional Games Forum (read-only)
Monsters don't disappear when die - 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: Monsters don't disappear when die (/thread-19229.html)



Monsters don't disappear when die - Storfigge - 11-15-2012

When you play amnesia and die from a monster all the monsters that have spawned will disappear. I have a water_lurker and what I want is that if it kills me I don't want it to go away.


RE: Monsters don't disappear when die - FlawlessHappiness - 11-15-2012

Use the search button. This question has been asked several times before.


RE: Monsters don't disappear when die - Storfigge - 11-15-2012

(11-15-2012, 09:26 AM)beecake Wrote: Use the search button. This question has been asked several times before.
I did search but didn't find anything that would help me. Maybe I'm not searching hard enough but all I found was something about making a checkpoint but i didn't quite understand as I'm a noob when it comes to programming. I need to know pretty much exactly what to do. Sad

Ok I figured it out sorry for posting an already existing subject.


RE: Monsters don't disappear when die - Mackiiboy - 11-15-2012

Every time you use some kind of enemies or if it is possible to die in one or another way, checkpoints is a great feature to use to have control over spawning areas and things that should happen after death.

A smart way would be to put a checkpoint function in your function that activates your enemy.
Then you would use;

Code:
void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

asName - the internal name
asStartPos - the name of the StartPos in the editor
asCallback - the function to call when the player dies/respawns
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file

Do not forget that the callback syntax is void asCallback(string &in asName, int alCount), where asCallback is the name of your callback-function (the function that will be called after death).
It is this function you will need to use to respawn your enemy and it could have the same content as your enemy-function with the checkpoint to respawn your enemy.

Here is an example of how it could like like:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Enemy_Area", "Enemy_Function", true, 1);
}

void Enemy_Function(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy", true);
for(int i=1;i<=10;i++) AddEnemyPatrolNode("Enemy", "PathNodeArea_"+i, 0.001f, "");
CheckPoint("checkpoint_enemy1", "Spawnarea_1", "DeathFunction1", "DeathHint", "Death1");
}

void DeathFunction1(string &in asName, int alCount)
{
SetEntityActive("Enemy", true);
for(int i=1;i<=10;i++) AddEnemyPatrolNode("Enemy", "PathNodeArea_"+i, 0.001f, "");
CheckPoint("checkpoint_enemy1", "Spawnarea_1", "DeathFunction1", "DeathHint", "Death1");
}
.
(11-15-2012, 09:42 AM)Storfigge Wrote: I did search but didn't find anything that would help me. Maybe I'm not searching hard enough but all I found was something about making a checkpoint but i didn't quite understand as I'm a noob when it comes to programming. I need to know pretty much exactly what to do. Sad

Ok I figured it out sorry for posting an already existing subject.



RE: Monsters don't disappear when die - Storfigge - 11-16-2012

Ty a lot I'm going to try this out Smile