Frictional Games Forum (read-only)
Making an enemy not despawn after dying - 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: Making an enemy not despawn after dying (/thread-14463.html)



Making an enemy not despawn after dying - Nickshrike - 04-03-2012

If an enemy kills the player in my custom story the enemy tends to disappear afterwards, is there any particular way to get the enemy to stay after you die and respawn?

I don't really want the player to simply run into a monster and die to progress easily without hassle.

Thanks.


RE: Making an enemy not despawn after dying - heyitsrobert97 - 04-03-2012

you could create a checkpoint
{
CheckPoint ("checkpoint1", "playerstart_2", "enemykill", "", "";
}

void enemykill(string &in asName, int alCount)

{
SetEntityActive("monster2", true);
SetEntityActive("monster", false);

}

Then Create another monster called monster2 and set him as inactive.
so the callback will set that monster active when you die.and the false one will
delete the first monster if he stayed spawned




RE: Making an enemy not despawn after dying - Cranky Old Man - 04-03-2012

(04-03-2012, 11:05 AM)heyitsrobert97 Wrote: you could create a checkpoint
{
CheckPoint ("checkpoint1", "playerstart_2", "enemykill", "", "";
}

void enemykill(string &in asName, int alCount)

{
SetEntityActive("monster2", true);
SetEntityActive("monster", false);

}

Then Create another monster called monster2 and set him as inactive.
so the callback will set that monster active when you die.and the false one will
delete the first monster if he stayed spawned
That seems like a finite list. Sure, if you make ten monsters and number them 1-10, the players won't bother dying ten times over, but it's not an ideal solution.
A hunch: Does "SetEntityActive("monster", true);" after death, make the monster respawn in its spawn position?




RE: Making an enemy not despawn after dying - Nickshrike - 04-03-2012

Im getting an error with the code you provided

I added a bracket in at the end of checkpoint as you appear to have forgot one there and some of the errors went away.
But im also getting an error saying "expected ("
Apparently it wants me to put a bracket here like this: void (enemykill(string &in asName, int alCount) which doesn't make sense o_o

EDIT: Ah, it's a function in a function and that may not be possible. I removed the void but im still getting an error telling me to put a bracket here now:
enemykill(string (&in asName, int alCount)

EDIT2: Fixed it, I put the function in a stupid place.

And yes, it works perfectly and respawns every time the player dies so I don't have to make tons of inactive monsters ^^

Thanks for the help Big Grin