Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enemies Disappear
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#1
Enemies Disappear

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:

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.
(This post was last modified: 07-08-2011, 06:55 PM by convolution223.)
07-08-2011, 06:53 PM
Find
Paulpolska Offline
Member

Posts: 144
Threads: 29
Joined: Jun 2011
Reputation: 0
#2
RE: Enemies Disappear

Use "CheckPoint"

MY CUSTOM STORY - - STILL ALIVE - -
http://www.moddb.com/mods/still-alive
07-08-2011, 07:06 PM
Find
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#3
RE: Enemies Disappear

(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.
07-08-2011, 09:34 PM
Find
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#4
RE: Enemies Disappear

Nevermind, I got it working now. Thanks for the nudge in the right direction.
07-09-2011, 05:22 AM
Find
crosser3x Offline
Junior Member

Posts: 1
Threads: 0
Joined: Jul 2011
Reputation: 0
#5
RE: Enemies Disappear

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
07-09-2011, 10:13 PM
Find
Im_Sexy Offline
Member

Posts: 157
Threads: 21
Joined: Apr 2008
Reputation: 0
#6
RE: Enemies Disappear

Im also interested in this...
How did you do to avoid enemies disappearing when you die?
(This post was last modified: 07-10-2011, 12:19 AM by Im_Sexy.)
07-10-2011, 12:18 AM
Find
AlexRobillard Offline
Junior Member

Posts: 41
Threads: 5
Joined: Jun 2011
Reputation: 0
#7
RE: Enemies Disappear

I am just taking a guess here, but if you have it as
////////////////////////////
// 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.

07-10-2011, 08:51 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#8
RE: Enemies Disappear

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
(This post was last modified: 07-10-2011, 09:31 PM by Khyrpa.)
07-10-2011, 09:30 PM
Find
Im_Sexy Offline
Member

Posts: 157
Threads: 21
Joined: Apr 2008
Reputation: 0
#9
RE: Enemies Disappear

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?
(This post was last modified: 07-11-2011, 09:52 PM by Im_Sexy.)
07-11-2011, 09:52 PM
Find




Users browsing this thread: 1 Guest(s)