Frictional Games Forum (read-only)
Enemies Disappear - 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: Enemies Disappear (/thread-9023.html)



Enemies Disappear - convolution223 - 07-08-2011

hello, this is my first time making a map with HPL2 and I noticed that whenever the player dies and respawns at the level start, all the enemies vanish. I tried putting the following in the .hps file but it doesn't seem to do anything:

Code:
void OnEnter()
{
    if (GetEntityExists("brute1")==false){
        CreateEntityAtArea("brute1", "servant_brute.ent", "brute1_Spawn", true);
    }
    
AddEntityCollideCallback("Player", "script_area2", "CollideAreaTest02", true, 1);
}
Please help me.

EDIT: "brute1" is what i called the brute in the level editor. and "brute1_Spawn" is the script area box i placed in the level editor.


RE: Enemies Disappear - Paulpolska - 07-08-2011

Use "CheckPoint"


RE: Enemies Disappear - convolution223 - 07-08-2011

(07-08-2011, 07:06 PM)Paulpolska Wrote: Use "CheckPoint"

Could you please elaborate? Do I set up a checkpoint for the player to respawn back at the beginning of the level (I don't mind having the player respawn at the beginning, I just want the monsters back)? Or could I put the enemy's name in for "asName"? Or do I need to wrap my mind around "asCallback," like having the code I already have here being used as a Callback? Sorry if this is a lot of questions, I'm at the office and don't have access to my files here.


RE: Enemies Disappear - convolution223 - 07-09-2011

Nevermind, I got it working now. Thanks for the nudge in the right direction.


RE: Enemies Disappear - crosser3x - 07-09-2011

I am having the same trouble.. would you mind telling me what you did to solve the disappearing enemies? I get to spawn where i want to but the enemies and previous areas are already triggered ;S


RE: Enemies Disappear - Im_Sexy - 07-10-2011

Im also interested in this...
How did you do to avoid enemies disappearing when you die?


RE: Enemies Disappear - AlexRobillard - 07-10-2011

I am just taking a guess here, but if you have it as
Code:
////////////////////////////
// Run when entering map
void OnEnter()
{

}
and copy the same codes as before and also add them in there it would work? Don't quote me on this because like I said, I am just taking a guess.


RE: Enemies Disappear - Khyrpa - 07-10-2011

I'll make this simple!

When player comes from where ever to the area where you trigger something that can kill the player, you can put
CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

example script:
///////////////
void OnStart()
{AddEntityCollideCallback("Player", "ScriptArea_1", "KillPlayer", true, 1);}
//////////////
void KillPlayer(string &in asParent, string &in asChild, int alState)
{CheckPoint ("blehblah", "PlayerStartArea_1, "DoSomething", "", "");
GivePlayerDamage(666.0f, "Slash", true, true);
}
//////////////
void DoSomething(string &in asName, int alCount)
{AddEntityCollideCallback("Player", "ScriptArea_1", "KillPlayer", true, 1);}


That would kill the player again and again if he steps into one area.
When AddEntityCollideCallback's
abDeleteOnCollide - determines whether the callback after it was called
is trueTonguelayer triggers the callback when he enters the area only once.
So checkpoint makes sure that callback is called again after its been triggered once already

It works fine with SetEntityActive("yourgruntsname", true); and patrolnodes


RE: Enemies Disappear - Im_Sexy - 07-11-2011

Sorry to sound like an idiot... but where do i put that?
Create a script named "scripedArea_1" and put it in the map hdp file?