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
Monsters don't disappear when die
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#4
RE: Monsters don't disappear when die

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;

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:

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.
11-15-2012, 03:04 PM
Website Find


Messages In This Thread
Monsters don't disappear when die - by Storfigge - 11-15-2012, 09:25 AM
RE: Monsters don't disappear when die - by Mackiiboy - 11-15-2012, 03:04 PM



Users browsing this thread: 1 Guest(s)