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
make a monster de-spawn?
Synestral Offline
Junior Member

Posts: 4
Threads: 3
Joined: Aug 2011
Reputation: 0
#1
make a monster de-spawn?

i dont know how to make a monster de-spawn. i have tried a few things, but it doesnt work. how do you make a monster disappear after walking a path?

this is my code
void OnStart()
{
SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
}

void Spawn_Monster(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
GiveSanityDamage(5.0f, true);
AddEnemyPatrolNode("servant_grunt_1", "Node_1", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_6", 5,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
}
08-06-2011, 02:21 AM
Find
TFEF Offline
Member

Posts: 143
Threads: 0
Joined: Feb 2011
Reputation: 1
#2
RE: make a monster de-spawn?

They should disappear after they've run their pathnodes, unless the player is too close.

Although, if you really want to be sure, you can use this script function:

void SetEnemyDisabled(string& asName, bool abDisabled);

string& asName = Monster's name
bool abDisabled = True or false as to whether the enemy is disabled or not

My YouTube Channel - Filled with gaming videos and LP's.
Steam ID: TheTFEF
(This post was last modified: 08-06-2011, 02:37 AM by TFEF.)
08-06-2011, 02:35 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#3
RE: make a monster de-spawn?

(08-06-2011, 02:35 AM)TFEF Wrote: Although, if you really want to be sure, you can use this script function:

void SetEnemyDisabled(string& asName, bool abDisabled);

string& asName = Monster's name
bool abDisabled = True or false as to whether the enemy is disabled or not

It might be better if he went with SetEntityActive().

Tutorials: From Noob to Pro
(This post was last modified: 08-06-2011, 07:29 AM by Your Computer.)
08-06-2011, 07:29 AM
Website Find
TFEF Offline
Member

Posts: 143
Threads: 0
Joined: Feb 2011
Reputation: 1
#4
RE: make a monster de-spawn?

(08-06-2011, 07:29 AM)Your Computer Wrote: It might be better if he went with SetEntityActive().

True, that. It's been a while since I've done anything for custom stories. Tongue

My YouTube Channel - Filled with gaming videos and LP's.
Steam ID: TheTFEF
08-06-2011, 08:21 AM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#5
RE: make a monster de-spawn?

It might be even better to use FadeEnemyToSmoke(string& asName, bool abPlaySound); if you want effects as well. With SetEntityActive(), he'd simply disappear into thin area whereas FadeEnemyToSmoke will create a smoke and play a sound if the bool is set to true.
08-06-2011, 12:29 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#6
RE: make a monster de-spawn?

anyhow...Create an area on the last pathnode and name it something (ex: MonsterDespawn)
And add a collidecallback and a function and it'll look something like this maybe:

void OnStart()
{
AddEntityCollideCallback("MONSTERNAME", "MonsterDespawn", "MonsterDespawnFunc", true, 1);
SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
}

void Spawn_Monster(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
GiveSanityDamage(5.0f, true);
AddEnemyPatrolNode("servant_grunt_1", "Node_1", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_6", 5,"");
AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
}

void MonsterDespawnFunc(string &in asParent, string &in asChild, int alState)
{
FadeEnemyToSmoke("MONSTERNAME", true);
}

Change MONSTERNAME to your monsters name.
Change MonsterDespawn to your areas name.
(This post was last modified: 08-06-2011, 12:49 PM by xtron.)
08-06-2011, 12:47 PM
Find




Users browsing this thread: 1 Guest(s)