Talk:Creating custom gibs

From Valve Developer Community
Revision as of 10:41, 23 May 2008 by Rayne (talk | contribs)
Jump to navigation Jump to search

I'm not having much luck getting my gibs to work. The models are valid and can be spawned directly, but won't appear when the prop is destroyed. The QC:

$collisiontext
{
	break { model "props_escape/plate_gibs-small" placementattachment placementOrigin health 1 fadetime 0 }
	break { model "props_escape/plate_gibs-big" placementattachment placementOrigin health 1 fadetime 0 }
}

It's nothing to do with the lack of quote marks. :-) --TomEdwards 10:06, 19 Nov 2007 (PST)

I have no idea what I did, but it's now working. --TomEdwards 13:18, 19 Nov 2007 (PST)
You're talking to yourself mate. ;-) (Keep us posted) --wisemx 15:57, 19 Nov 2007 (PST)

1) I am looking to give my gibs more spread, currently they spawn in one heap where the original object is. Would burst give them a larger range, and how would I call it? (burst "5" ?) --Rayne 13:38, 21 May 2008 (PDT)

Sounds like a good plan; well worth a try. For syntax see $collisiontext. If it works please add a note of your observations to that page ;-)--Beeswax 08:01, 23 May 2008 (PDT)
Followup: I didn't get anything with burst, but I did use $origin x y z rotationZ to manually place the pieces. I get the feeling that I'm not going to get so much a physics based arc-and-fall as just a model swap. --Rayne 10:41, 23 May 2008 (PDT)

2) Only one instance of each gib is spawning, how could I spawn multiples of types A&B while still keeping C&D unique? --Rayne 13:38, 21 May 2008 (PDT)

I guess if you just repeated your break {"model" "gibs/gibA" ...} line in the $collisiontext you'll get two gibA's spawning in the same place... you might get away with that. Otherwise you might try the $collisiontext "offset" parameter on one of them ? (probably XYZ coords from either model $origin or the gib.mdl's position). Again, if it works please share ;-) --Beeswax 08:01, 23 May 2008 (PDT)
Followup: The break{"model"} didn't appear to work, but it could be spawning 2 instances in the exact same place. One solution is to clone the files of gibA and make it gibE (and gibF, gibG and so on) with different $origin x y z rotationZ values, but it's clunky. --Rayne 10:41, 23 May 2008 (PDT)

Here are my .qc files- I would have posted them earlier but I had a problem with the spawned gibs allowing further breaking into generic HL2 bits on hit. Now fixed, although the gibs don't respect their collisions and so allow the player to frollic through the models.

Breakable Object .QC:

   $scale 1.0
   $modelname trashcan\trashcan_breakable.mdl
   $body "Body" "trashcan.smd"
   $cdmaterials models\trashcan
   $surfaceprop "wood"
   //Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. Seems obvious, but held me up for a day since two of my items were actually metal, and listed as such.
   $sequence idle "trashcan" loop fps 15
   $keyvalues { "prop_data" { "base" "Wooden.Medium" "health" "10"} }
   //Health is the damage required to break the item, 0 will make it invincible.
   $collisiontext
   {
   break
       {
           "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15"
       }
   break
       {
           "model" "trashcan/trashcan_piece_b.mdl" "fadetime" "15"
       }
   }
   $collisionmodel "trashcan_collision.SMD"  {
   $concave
   $mass 100.000
   }

Custom Gib .QC:

   $scale 1.0
   $modelname trashcan\trashcan_piece_a.mdl
   $keyvalues { "prop_data" { "base" "Wooden.Small" "health" "0" } }
   //Health 0 makes it invulnerable. Not having this or setting it to another value allows the gib to be busted into more gibs. Small wood bits, in this case. 
   $body studio "trashcan_piece_a"
   $cdmaterials models\trashcan
   $staticprop
   $surfaceprop "wood"
   //Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. Seems obvious, but held me up for a day since two of my items were actually metal, and listed as such.
   $sequence idle "trashcan_piece_a" loop fps 15
   $origin -24.043 -24.066 2.166 0
   // values are X Y Z rotationZ, without they will spawn in one large heap if their origins are the same. If the objects are exported at non-origin values they would spawn there, unless this is called.
   $collisionmodel "trashcan_piece_a_collision.SMD"
   //This is not being respected, while hitting the object with a weapon such as a crowbar results in movement and seems to use the collision, the object is able to be walked through.
   {
   $automass
   }

Also posting this on the main page, now that I've figured out how to use the quote/code border. --Rayne 10:41, 23 May 2008 (PDT)