Forum

Dead bodies

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Dead bodies

Postby redrum » Sat Oct 20, 2007 10:23 pm

Where is the code that tells how long the dead bodies stay in the game. I looked in player and client.qc but can't find it?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Sat Oct 20, 2007 10:28 pm

There's no time the dead bodies stay in the game.

When a player dies, he copies his frame and model to a global entity called "bodyque_head".
When has more than 4 dead bodies in the server, the oldest body is removed from the queue.

The function is in world.qc, called CopyToBodyQue().
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Sajt » Sat Oct 20, 2007 10:49 pm

If you want to easily increase the size of the bodyque...

Pimp!

It's a tutorial I wrote in 2004, so it's probably rotted since then and probably doesn't compile.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby redrum » Sun Oct 21, 2007 5:51 am

Thanks Sajt! Works great.
I reduced the number to one. Less is more :)
Now, I have dogs in my mod. How can I change them?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Tue Oct 23, 2007 4:30 pm

Bueller? Bueller?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Sajt » Tue Oct 23, 2007 5:12 pm

If dogs are normal monsters then the corpses are permanent.

It shouldn't be hard to remove them after a certain time.

I dunno if this works, but give it a try:
go to the last death frame in each of his death animations, and do something like this

Code: Select all
void() corpse =
{
    self.think = SUB_Remove;
    self.nextthink = time + 10;
};
...
void() dog_die9 = [$death9, corpse] {};
...
void() dog_dieb9 = [$deathb9, corpse] {};






Hmm let's explain. If you don't know how these shortcut 'animation' functions work...

This:

void() dog_die1 = [$death1, dog_die2] {/*code*/};

Is short form (I think!) for this:

void() dog_die1 =
{
self.frame = $death1;
self.think = dog_die2;
self.nextthink = time + 0.1;

/* code */
};

With the added bonus that you don't have to prototype dog_die2 before you use it...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby redrum » Tue Oct 23, 2007 8:01 pm

I'll try it out!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Wed Oct 24, 2007 2:12 am

[drunk mode]
You can use CpoyotBofyReu() too, at ehe very als dog's daetyh farme, bt jsut fcalling it adn cahngin cpoepse to dog-Die9 adn dog-dieb9.
But if you prefer a limitre dtime to a body be romed, vuse the code Saht gav tou.
EDIT: Call a Remove(Serlf); at dog_gdie9 and sog_Dieb9 to ir bw propelr rmobgved.
[/drunk mode]

SAP
SAP EDIT: Call a remove(self); at dog_die9() and dog_bdie9() to it be properly removed.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Wed Oct 24, 2007 2:28 pm

WTF! LOL
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Wed Oct 24, 2007 8:40 pm

When the dogs die, they don't drop to the floor. They remain in their last position for 10 seconds then disappear?
I tried all sorts of different ways with the code but always end up in the same situation.

Code: Select all
void() dog_die1 = [$death1, dog_die2]
{
    self.nextthink = time + 10;
    self.think = SUB_Remove; 
}; 
void() dog_die2 = [$death2, dog_die3]
{
    self.nextthink = time + 10;
    self.think = SUB_Remove;
}; 
void() dog_die3 = [$death3, dog_die4]
{
    self.nextthink = time + 10;
    self.think = SUB_Remove; 
}; 
etc...........
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Wed Oct 24, 2007 9:26 pm

These 2 lines you shouldn't add at every death frame, just in the last.
Remove the lines from all of them unless of the last death frame.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Oct 25, 2007 2:19 am

Ok, thanks. Works great!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest