Forum

Respawning dead enemies

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Respawning dead enemies

Postby JasonX » Tue Apr 27, 2010 3:46 pm

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:
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm

Postby frag.machine » Tue Apr 27, 2010 4:10 pm

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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby JasonX » Tue Apr 27, 2010 4:22 pm

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?
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm

Postby frag.machine » Tue Apr 27, 2010 7:40 pm

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

if ((monster.health <= 0) && (monster.solid == SOLID_NOT)) {
// spawn another monster
}
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby JasonX » Tue Apr 27, 2010 8:09 pm

What about the random entity info_monster? :lol:
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm

Postby MauveBib » Tue Apr 27, 2010 10:22 pm

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!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby Swift » Thu Apr 29, 2010 5:47 pm

Haha. Idea: Have death animations play in reverse in the respawning function MauveBib described.
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Postby Pulseczar » Thu Apr 29, 2010 8:06 pm

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.
User avatar
Pulseczar
 
Posts: 37
Joined: Sat Aug 12, 2006 6:45 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest