Gibs: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 9: Line 9:
Next, create your gib models. If you don't know how to model, or your a lazy shit, then you can download a pack of gib models on [http://www.garrysmod.org/downloads/?a=view&id=72352 Garrysmod.org].
Next, create your gib models. If you don't know how to model, or your a lazy shit, then you can download a pack of gib models on [http://www.garrysmod.org/downloads/?a=view&id=72352 Garrysmod.org].


Put those in your mod folder, and in the Event_Killed section, add this under
Put those in your mod folder, and in the Event_Killed section, add this:
<pre>
<pre>
if( info.GetDamageType() & DMG_BUCKSHOT )
if( info.GetDamageType() & DMG_BUCKSHOT )

Revision as of 15:11, 13 February 2010

Hello there people of the coding world. Today, we are going to make gibs for the zombine. This can also work in other NPCs/Players if you do a bit of coding.

Editing Event_Killed

So first, open up the Zombine code (npc_zombine.cpp) and search for the void "Event_Killed" Delete everything in there except for

	BaseClass::Event_Killed( info );

This calls up the Regular Event_Killed so that we can still have a ragdoll and the zombine dies correctly.

Next, create your gib models. If you don't know how to model, or your a lazy shit, then you can download a pack of gib models on Garrysmod.org.

Put those in your mod folder, and in the Event_Killed section, add this:

	if( info.GetDamageType() & DMG_BUCKSHOT )
	{
		SetModel( "models/zombie/classic_legs.mdl" );

		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/pgib_p1.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/pgib_p2.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/pgib_p3.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/pgib_p4.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/pgib_p5.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/hgibs_jaw.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/hgibs_scapula.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/hgibs_scapula.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/rgib_p1.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/rgib_p2.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/rgib_p3.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/rgib_p4.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/rgib_p5.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/rgib_p6.mdl", 5);
		CGib::SpawnSpecificGibs(this, 1, 750, 1500, "models/gibs/gibhead.mdl", 5);
	}

This will make it so that when you shoot the zombie with any gun that uses the Buckshot ammo (Shotgun), he will blow into many peaces, and will lose his torso. There are differant DMGs in shareddefs.h, suck as DMG_BURN, DMG_BULLET, etc., and replace DMG_BUCKSHOT with whatever you want.

Before you compile, make sure that you Precache the models your using, or you will get assfucked with errors.

Editing This Page

If you want to add on to this, feel free to do so. If you use this code in your mod, then give proper credit to me, Gamerman12. Thanks, and happy gibbing! :D