Improved Gibbable Corpses Tutorial, and "Semisolid"

Discuss programming in the QuakeC language.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Hi there, Seven.

My apologies for the delay, it's been a busy week. The issue you're describing may be engine-related. When I run my version of darkplaces it has problems you don't (axe and lightning gun, etc), but it doesn't have that problem -- I can shoot over bodies just fine.

I suspect your engine may have a minimum size for objects of solid_slidebox, or something else odd is occurring.

-Try changing its solid to SOLID_BBOX.
-Try changing the setsize line to:
setsize (bodyque_head, '-10 -10 -1', '10 10 10');

Let me know if that helps you.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Thank you for your reply Wazat.

My engine of choice is DarkPlaces.
I can shoot "over" the dead soldier body. But I must aim higher than straight to NOT hit the corpse.
If aiming on the floor is 0° and aim straight is 90°, then I must aim around 110° to NOT hit the corpse.
Standing 2-3 meters away from him while doing it.

It suprises me, that you dont have this issue, because I know you use DP as well...


Regarding your suggestions:
1.) bodyque_head.solid = SOLID_BBOX;
No difference to bodyque_head.solid = SOLID_SLIDEBOX;
2.) using setsize (bodyque_head, '-10 -10 -1', '10 10 10');
The corpse falls through the floor.


Anyway thank you for your time and effort.

Have a nice weekend :)
Seven
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

I followed the tutorial on the front page, but obtain the error "worl.qc:270: "hp" is not a type". I must be doing something wrong. Does anyone have the source with this code already implemented (not compiled)? I would like to see if I'm doing something wrong. I'm trying to add this to some of my other mods.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Seven: I need to update my darkplaces and take a look. I'll get back to you on it (sorry I've been so busy lately).

Lightning Hunter: Look at world.qc line 270. What function is that in? Did you miss a step like adding "float hp" to the parameters?

Hopefully I didn't flub the tutorial. If I did though I'll fix it.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Line 270 is the folllowing:

void(entity ent, float hp, hp, headmdl) CopyToBodyQue =
{

I figured this problem was related to the fact that hp was not properly defined... I put the following in defs. Is there somewhere else I was supposed to define it?


// Used for searching for objects that let players past but still block bullets.
// Set "semisolid" to "y" to let players walk through the entity.
.string semisolid;
// Used to store an entity's old solid value between PlayerPreThink and PlayerPostThink
.float oldSolid;
// Functions we use often
void() corpse_die;
void(float hp, string headmdl) CopyMonsterToBodyQue;
void(entity ent, float hp, string headmdl) CopyToBodyQue;
void(string gibname, float dm) ThrowGib;
void(string gibname, float dm) ThrowHead;
void() SemisolidPreThink;
void() SemisolidPostThink;
Chip
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland
Contact:

Post by Chip »

Lightning Hunter wrote:void(entity ent, float hp, hp, headmdl)
Remove the second hp from the parameters. I guess it's overwriting the first one (which is properly declared).
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Chip wrote:
Lightning Hunter wrote:void(entity ent, float hp, hp, headmdl)
Remove the second hp from the parameters. I guess it's overwriting the first one (which is properly declared).
It now says, "headmdl is not a type" for the same line.
Chip
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland
Contact:

Post by Chip »

Lightning Hunter wrote:
Chip wrote:
Lightning Hunter wrote:void(entity ent, float hp, hp, headmdl)
Remove the second hp from the parameters. I guess it's overwriting the first one (which is properly declared).
It now says, "headmdl is not a type" for the same line.
Declare it as "string headmdl" inside your function:

Code: Select all

void(entity ent, float hp, string headmdl)
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Now it says, "type mismatch on redeclaration of CopyToBodyQue" on the same line. :x
Chip
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland
Contact:

Post by Chip »

Lightning Hunter wrote:Now it says, "type mismatch on redeclaration of CopyToBodyQue" on the same line. :x
Delete it from defs.qc. It's declared in 2 places. Keep only the function and delete these lines from defs.qc:

Code: Select all

void(float hp, string headmdl) CopyMonsterToBodyQue;
void(entity ent, float hp, string headmdl) CopyToBodyQue;
:)
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Grr... my mistake. I've fixed the first post (don't know how it ended up as hp hp and missing the string). CopyToBodyQue should look like this:

void(entity ent, float hp, string headmdl) CopyToBodyQue =
{
bodyque_head.angles = ent.angles;
...


However, you shouldn't have to remove it from defs.qc... in fact, it might be needed there. I wonder why it doesn't match...?
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Ok, got it working. Seven seems to be right. You have to aim way above a corpse in order to shoot over it. This gets very annoying when you are trying to kill monsters behind a corpse. Also, corpses seem to fall through elevators. I'm using Qrack. You can download it here:
http://quakeone.com/qrack/dist/qrack2011_3299.zip

I don't think I'll use this until at least the corpse height can be reduced so you can fire over the bodies. I would actually be fine if some sort of universal height could be used on all corpses that was almost flat on the ground. This way, you would have to aim pretty low to hit them.

Edit: Something else I'm trying to figure out as well: I have a mod installed with Quake that randomizes the skins used for the Soldier. Basically, I simply added this below setmodel (self, "progs/soldier.mdl");

self.skin = random () * 10;

The problem with the gib mod is that the Soldier reverts back to the default skin "0" after death. My guess is that any mod that uses the second skin in the mdl file will also have this issue. Any way to fix this?
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Hmm... I'm not sure why the corpses are blocking bullets so high. I could swear that this would drop their height to wafer-thin:

setsize (bodyque_head, '-16 -16 -1', '16 16 1');

Does that work? If so, at least we can work from there. If not, does anyone have any ideas? I haven't had the time to load up Quake and try this lately.

As for skins, just add this to CopyToBodyQue, after the setmodel:

bodyque_head.skin = ent.skin;

That should do it.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

DURRRR.... I feel stupid.

Found some time after all and downloaded the new darkplaces. So, it turns out the bodies sank through the floor for a good reason: they weren't falling through the floor, but the model was sinking just deep enough to look like it. We just need to set a minimum z size, then set the maximum z size based on that.

Replace the setsize section of CopyToBodyQue with this:

// Enforce a minimum size for the corpse, so there's something to shoot
local vector min, max;
min = ent.mins;
max = ent.maxs;
min_z = ent.mins_z;
max_z = ent.mins_z + 4; // set this to how tall you want the corpse hitbox
setsize (bodyque_head, min, max);

I'll update the main page with this fix. Bodies should no longer be so tall they block bullets.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Great, that fixed all those issues! I've noticed one more small problem, however. Sometimes when the Soldier's die, they "hop" back to life for a quick second before going back to dead - almost like a single frame of the death sequence animation is repeated. You only catch a brief glance of the monsters standing again after they have already landed on the floor. Any idea why this is?

Edit: The bodies still seem to sink into the floor every once in a while. It seems to most commonly happen on the slopes of E1m1, toward the end. Try killing lots of Soldiers on the slopes with the light buttons, and near the end slipgate. you are bound to see them disappear in the floor.

Edit#2: I think I may have fixed the problem with the bodies sinking in the floor by increasing the height to about 17. I found another unfortunate side effect of using this mod, however. The head gibs and bodies disappear like normal gibs now! They really need to stick around permanently..
Post Reply