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
Making an enemy not despawn after dying
Nickshrike Offline
Junior Member

Posts: 30
Threads: 1
Joined: Mar 2012
Reputation: 1
#1
Making an enemy not despawn after dying

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.
(This post was last modified: 04-03-2012, 11:32 AM by Nickshrike.)
04-03-2012, 10:55 AM
Find
heyitsrobert97 Offline
Member

Posts: 68
Threads: 29
Joined: Jan 2012
Reputation: 0
#2
RE: Making an enemy not despawn after dying

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


This Darn House! , Four Doors, Youtube
04-03-2012, 11:05 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#3
RE: Making an enemy not despawn after dying

(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?


Noob scripting tutorial: From Noob to Pro

04-03-2012, 11:14 AM
Find
Nickshrike Offline
Junior Member

Posts: 30
Threads: 1
Joined: Mar 2012
Reputation: 1
#4
RE: Making an enemy not despawn after dying

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
(This post was last modified: 04-03-2012, 11:32 AM by Nickshrike.)
04-03-2012, 11:21 AM
Find




Users browsing this thread: 1 Guest(s)