So I finally figured out how to add gibs


(Catscratch) #1

And when me and a friend were testing it out, I noticed that when you are wounded waiting for a medic and a grenade is tossed on you, you completely disappear when the grenade explodes. No blood. No gibs. All that’s left is the burn mark on the ground. I thought I had screwed up something when adding the gibs, but this also occurs in etmain. It’s funny that I’ve never noticed this before. Is this a bug or was it meant to do this?

BTW, if anyone wants the code for adding gibs, let me know. :slight_smile:


(ikanatto) #2

IIRC etpro already has those gibs generated when corpse destroyed. Of course I’d appreciate to see it in another mod or something new gibs models(corpse gets skeltal or whatever).


(Jaquboss) #3

lol , I just declared gib models and used current gib function ( which however was character based , but there was nothing in character code to allow it… )


(FREAK!!!) #4

plz make your code public and post it here.


(Jaquboss) #5

ok , so find CG_GibPlayer()
there are things like this :

character->gibModels[gibIndex]

so replace them with :

cgs.media.gibModels[gibIndex]

and then just declare gibmodels :slight_smile:
i use RTCW ones from ETPro pack
my list in cg_main.c


	cgs.media.gibModels[0]	= trap_R_RegisterModel	( "models/gibs/foot.md3"	);
	cgs.media.gibModels[1]	= trap_R_RegisterModel	( "models/gibs/foot.md3"			);
	cgs.media.gibModels[2]	= trap_R_RegisterModel	( "models/gibs/leg.md3"		);
	cgs.media.gibModels[3]	= trap_R_RegisterModel	( "models/gibs/leg.md3"		);
	cgs.media.gibModels[4]	= trap_R_RegisterModel	( "models/gibs/abdomen.md3"		);
	cgs.media.gibModels[5]	= trap_R_RegisterModel	( "models/gibs/intestine.md3"		);
	cgs.media.gibModels[6]	= trap_R_RegisterModel	( "models/gibs/forearm.md3"		);
	cgs.media.gibModels[7]	= trap_R_RegisterModel	( "models/gibs/forearm.md3"		);
	cgs.media.gibModels[8]	= trap_R_RegisterModel	( "models/gibs/skull.md3"			);
	cgs.media.gibModels[9]	= trap_R_RegisterModel	( "models/gibs/abdomen.md3"		);


also dont forget about declaration in cgs.media ( in cg_local.h )


	qhandle_t	gibModels[MAX_GIB_MODELS];

of course if you want you can use character->gibModels[] , but you must have something to define them…


(Catscratch) #6

Hey, Jaquboss, did you fix that “bug” I mentioned?


(Jaquboss) #7

Hmm , if you mean dissappearing after beign gibbed : NO !
In normal ET there should be tossed helmet and blood splats , there can be bugs around player gibbing…
Make sure when limbo without corpse is called player is also gibbed…


(Catscratch) #8

Okay, in g_active.c I found

if( client->ps.stats[STAT_HEALTH] <= 0 ) {

	// DHM - Nerve
	WolfFindMedic( ent );

	// See if we need to hop to limbo
	if( level.timeCurrent > client->respawnTime && !(ent->client->ps.pm_flags & PMF_LIMBO) ) {
		if( ucmd->upmove > 0 ) {
			if( g_gametype.integer == GT_WOLF_LMS || client->ps.persistant[PERS_RESPAWNS_LEFT] >= 0 ) {
				trap_SendServerCommand( ent-g_entities, "reqforcespawn" );
			} else {
				limbo( ent, ( client->ps.stats[STAT_HEALTH] > GIB_HEALTH ) );
			}
		}

		if((g_forcerespawn.integer > 0 && level.timeCurrent - client->respawnTime > g_forcerespawn.integer * 1000) || client->ps.stats[STAT_HEALTH] <= GIB_HEALTH) {
			limbo(ent, (client->ps.stats[STAT_HEALTH] > GIB_HEALTH));
		}
	}

	return;
}

I changed that to

if( client->ps.stats[STAT_HEALTH] <= 0 ) {

	// DHM - Nerve
	WolfFindMedic( ent );

	// See if we need to hop to limbo
	if( level.timeCurrent > client->respawnTime && !(ent->client->ps.pm_flags & PMF_LIMBO) ) {
		if( ucmd->upmove > 0 ) {
			if( g_gametype.integer == GT_WOLF_LMS || client->ps.persistant[PERS_RESPAWNS_LEFT] >= 0 ) {
				trap_SendServerCommand( ent-g_entities, "reqforcespawn" );
			} else {
				limbo( ent, ( client->ps.stats[STAT_HEALTH] > GIB_HEALTH ) );
				GibEntity( ent, 0 ); // gibs
			}
		}

		if((g_forcerespawn.integer > 0 && level.timeCurrent - client->respawnTime > g_forcerespawn.integer * 1000) || client->ps.stats[STAT_HEALTH] <= GIB_HEALTH) {
			limbo(ent, (client->ps.stats[STAT_HEALTH] > GIB_HEALTH));
			GibEntity( ent, 0 ); // gibs
		}
	}

	return;
}

and above client think I added

extern void GibEntity( gentity_t *self, int killer );

Now that seems to sorta work, but of course if your health is greater than 0 you are gibbed twice. Am I on the right track here or should I be looking in g_combat.c?


(Jaquboss) #9
limbo( ent, ( client->ps.stats[STAT_HEALTH] > GIB_HEALTH ) ); 

as you see this dont make corpse if health is same or lower than GIB_HEALTH
But you ALWAYS do gibs , becasue you hav GibEntity there …
So place there

 if ( client->ps.stats[STAT_HEALTH] <= GIB_HEALTH ) {}

and it may work…


(Catscratch) #10

Yeah, I knew I needed that second bit of code you posted in there, but even with that code you are gibbed twice depending: once in g_damage and then again here in clientthink.

But isn’t this fun?! :banana:


(Jaquboss) #11

um , then you need to make code in g_damage to gib only corpses … that can work…


(KillerWhale) #12

There should be no serverside change needed to implement gibs.

Do as on Jaquboss’s first post.
But you should also re-enable the code disabled code (the part between #if 0 and #endif) in CG_AddFragment.


(Catscratch) #13

Gibs themselves work fine. The problem I’ve found is when you’re health is less than or equal to 0 and greater than FORCE_LIMBO_HEALTH there are no gibs. This does in fact occur in etmain too. So if you’re wounded doing sit-ups waiting for a medic and someone tosses a grenade on you, you completely vanish when the grenade explodes. This is the part that I’m trying to fix.


(P4nth3r) #14

Hi,

I know this topic is kinda old, but I tried to implant some gibs in my mod, but I don’t know where to put some of the commands in the code.
Can somebody plz gimme some kind of location of where to put:

cgs.media.gibModels[0] = trap_R_RegisterModel ( “models/gibs/foot.md3” );

and

qhandle_t gibModels[MAX_GIB_MODELS];

Thnx & Greetz Panther aka Way2Evil


(*Shadow* Commando) #15

Place

cgs.media.gibModels[0] = trap_R_RegisterModel ( "models/gibs/foot.md3" ); 

And all other models in cg_main.c
You can put it under:

cgs.media.panzerfaustBrassModel = trap_R_RegisterModel( "models/weapons2/shells/pf_shell.md3" );

And place

qhandle_t		gibModels[MAX_GIB_MODELS]; 

In cg_local.h cgmedia_t
Under:

qhandle_t		fireteamicons[6];

Good luck


(P4nth3r) #16

thnx I’ll try that asap.

Greetz Panther aka Way2Evil


(P4nth3r) #17

Well I tried and I con’t get any errors now.
But I don’t get any gibs neither =(
I implented Jaquboss code in mine and I put the gibs from etpro/rtcw in the right map etc.
But when I compile and test it keeps only showing blood and black. =/

I don’t get it. Help!!

Thnx & Greetz Panther


(Jaquboss) #18
  1. make sure you have done all that my post tell
  2. make sure you have cg_gibs 1
  3. make sure yoe are loading gibs models and use them ( read post again )
make sure you have tried that

(P4nth3r) #19
  1. check
  2. check
  3. not sure, but I don’t get any errors about it. (btw the gib files are all mdc but your load codes says md3 is that right??)
    I’ve noticed this happends more often in ET so I think it shouldn’t be a problem.
  4. I think the problem is there. (how do I re-enable that part ofthe code?)
    Should I just remove the #if and the #endif??

Thnx & Greetz Panther


(kamikazee) #20

You could remove the #if and #endif or put “//” in front of it. “//” (double slash) means that the rest of the line are comments.