Inside3D!
     

Respawning dead enemies

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
JasonX



Joined: 21 Apr 2009
Posts: 89

PostPosted: Tue Apr 27, 2010 3:46 pm    Post subject: Respawning dead enemies Reply with quote

I'm trying to write a simple respawning function. If an enemy is killed by the player, after an X amount of seconds another enemy is spawned in a random entity from the map.

Any ideas? Thanks in advance! Wink
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Tue Apr 27, 2010 4:10 pm    Post subject: Reply with quote

I'd say the "any entity" idea is prone to run-time problems like spawning monsters into walls. A more easier to do way would be "any other dead monster", like in doom nightmare mode. Also, you'll need to precache all required monster models and sounds during startup. Otherwise, it's kinda straight code.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
JasonX



Joined: 21 Apr 2009
Posts: 89

PostPosted: Tue Apr 27, 2010 4:22 pm    Post subject: Reply with quote

frag.machine wrote:
I'd say the "any entity" idea is prone to run-time problems like spawning monsters into walls. A more easier to do way would be "any other dead monster", like in doom nightmare mode. Also, you'll need to precache all required monster models and sounds during startup. Otherwise, it's kinda straight code.


Oh, by any entity i meant any "info_mymonster" on the map.

How can i know when the monster is dead, so i can call the monster spawn function again?
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Tue Apr 27, 2010 7:40 pm    Post subject: Reply with quote

From the top of my mind, this should do the trick:
Code:


if ((monster.health <= 0) && (monster.solid == SOLID_NOT)) {
// spawn another monster
}

_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
JasonX



Joined: 21 Apr 2009
Posts: 89

PostPosted: Tue Apr 27, 2010 8:09 pm    Post subject: Reply with quote

What about the random entity info_monster? Laughing
Back to top
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Tue Apr 27, 2010 10:22 pm    Post subject: Reply with quote

I'd do it as part of the monster's death animation. The last death frame for each monster sets nextthink to time + 0.1 and think to SUB_Null. Set think to your respawning function, and nextthink to a random time that you like.
_________________
Apathy Now!
Back to top
View user's profile Send private message
Swift



Joined: 26 Jan 2010
Posts: 44

PostPosted: Thu Apr 29, 2010 5:47 pm    Post subject: Reply with quote

Haha. Idea: Have death animations play in reverse in the respawning function MauveBib described.
Back to top
View user's profile Send private message
Pulseczar



Joined: 12 Aug 2006
Posts: 37

PostPosted: Thu Apr 29, 2010 8:06 pm    Post subject: Reply with quote

Swift wrote:
Haha. Idea: Have death animations play in reverse in the respawning function MauveBib described.

The Gizmo's CustomTF Coop does that when you resurrect/revive a dead player.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group