Tutorial: Add custom gibs to your model: Difference between revisions

From Empires Wiki
Jump to navigation Jump to search
(adding links soon)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Tutorial: Add custom gibs to your model ==
To add gibs you need to know some details:
To add gibs you need to know some details:
Gibs spawn after a model reaches 0 health. Your model needs healthpoints > 0 and it must be vunerable to weapons.
Gibs spawn after a model reaches 0 health. Your model needs healthpoints > 0 and it must be vunerable to weapons.
To set the health of a model and modify weapondamage use the $keyvalues directive.
To set the health of a model and modify weapondamage use the [http://developer.valvesoftware.com/wiki/$keyvalues $keyvalues] directive.
By adding [http://developer.valvesoftware.com/wiki/$collisiontext $collisiontext] you can use custom gibs. Have a look at this example.
By adding [http://developer.valvesoftware.com/wiki/$collisiontext $collisiontext] you can use custom gibs. Have a look at this example.
The 4 gibs are created from the original model called ''cactus1.mdl'' and fit exactly together. Place ''cactus1.mdl'' on the map as prop_physics or prop_dynamic.
The 4 gibs are created from the original model called ''cactus1.mdl'' and fit exactly together. Place ''cactus1.mdl'' on the map as [http://developer.valvesoftware.com/wiki/Prop_physics prop_physics] or [http://developer.valvesoftware.com/wiki/Prop_dynamic prop_dynamic].
 
I created the model and the gibs and saved them as SMD:
cactus1_LOD0.smd
cactus1_LOD1.smd
cactus1_phys.smd
cactus1_gib0.smd
cactus1_gib1.smd
cactus1_gib2.smd
cactus1_gib3.smd


'''This is the .qc code for the gibs.'''  
'''This is the .qc code for the gibs.'''  
Line 27: Line 34:
  }
  }


I replaced the # with the numbers (0-3) and got 4 models named:
I replaced the # with the numbers (0-3) and got 4 models named as followed (by compiling them, see:[[Tutorial: Create your own models]]) :
   
   
  cactus1_gib0.mdl
  cactus1_gib0.mdl
Line 35: Line 42:


'''Compile this model last. The important commands are $keyvalues (and prop_data) and  $collisiontext.'''  
'''Compile this model last. The important commands are $keyvalues (and prop_data) and  $collisiontext.'''  
'''This is the .qc code for the parent model:'''


  $modelname "common\props_foliage\misc\cacti\cactus1.mdl"
  $modelname "common\props_foliage\misc\cacti\cactus1.mdl"
Line 42: Line 51:
   replacemodel "cactus1_LOD0" "cactus1_LOD1.smd"
   replacemodel "cactus1_LOD0" "cactus1_LOD1.smd"
  }
  }
  $keyvalues  
  [http://developer.valvesoftware.com/wiki/$keyvalues $keyvalues]
  {  
  {  
  "prop_data"  
  [http://developer.valvesoftware.com/wiki/Prop_data "prop_data"]
  {  
  {  
  "base" "Flesh.Tiny"  
  "base" "Flesh.Tiny"  
Line 64: Line 73:
  $scale 1
  $scale 1
  $sequence idle "idle.smd"
  $sequence idle "idle.smd"
  $collisiontext  
  [http://developer.valvesoftware.com/wiki/$collisiontext $collisiontext]
  {  
  {  
  break { "model" "\common\props_foliage\cactus1_gib0.mdl" "health" "1" "fadetime" "10"}
  break { "model" "\common\props_foliage\cactus1_gib0.mdl" "health" "1" "fadetime" "10"}
Line 81: Line 90:
  }
  }


'''usage: break { "model" "<path>" options}'''
'''usage: '''[http://developer.valvesoftware.com/wiki/$collisiontext '''break { "model" "<path>" options}''']


  <path> path to the gib
  <path> path to the gib
Line 89: Line 98:


  "fadetime" "10" gib disapears after 10 seconds
  "fadetime" "10" gib disapears after 10 seconds
''more options here''


[http://developer.valvesoftware.com/wiki/Prop_data '''usage prop_data''']
 
Make sure "prop_data" {"base" ###} is equal in all models.
'''usage: '''[http://developer.valvesoftware.com/wiki/Prop_data '''prop_data''']
 
Note: Make sure that the base value of "prop_data" is equal in all models.
 
'''Links:'''
*[http://developer.valvesoftware.com/wiki/Custom_gibs http://developer.valvesoftware.com/wiki/Custom_gibs]
*[http://www.hl2world.com/wiki/index.php/Creating_Breakable_Models http://www.hl2world.com/wiki/index.php/Creating_Breakable_Models]
 
[[Category: Modeling]]

Latest revision as of 15:54, 5 July 2009

To add gibs you need to know some details: Gibs spawn after a model reaches 0 health. Your model needs healthpoints > 0 and it must be vunerable to weapons. To set the health of a model and modify weapondamage use the $keyvalues directive. By adding $collisiontext you can use custom gibs. Have a look at this example. The 4 gibs are created from the original model called cactus1.mdl and fit exactly together. Place cactus1.mdl on the map as prop_physics or prop_dynamic.

I created the model and the gibs and saved them as SMD:

cactus1_LOD0.smd
cactus1_LOD1.smd
cactus1_phys.smd
cactus1_gib0.smd
cactus1_gib1.smd
cactus1_gib2.smd
cactus1_gib3.smd

This is the .qc code for the gibs.

$modelname "common\props_foliage\misc\cacti\cactus1_gib#.mdl"
$model "cactus1_gib0" "cactus1_gib#.smd"
$keyvalues 
{ 
"prop_data" 
{ 
"base" "Flesh.Tiny" 
"health" "1"
} 
}
$cdmaterials "\common\nature\"
$surfaceprop "watermelon"
$scale 1
$sequence	idle	"idle.smd"
$collisionmodel "cactus1_gib#.smd" {
$mass 0.1
}

I replaced the # with the numbers (0-3) and got 4 models named as followed (by compiling them, see:Tutorial: Create your own models) :

cactus1_gib0.mdl
cactus1_gib1.mdl
cactus1_gib2.mdl
cactus1_gib3.mdl

Compile this model last. The important commands are $keyvalues (and prop_data) and $collisiontext.

This is the .qc code for the parent model:

$modelname "common\props_foliage\misc\cacti\cactus1.mdl"
$model "cactus1_LOD0" "cactus1_LOD0.smd"
$lod 100
{
 replacemodel "cactus1_LOD0" "cactus1_LOD1.smd"
}
$keyvalues
{ 
"prop_data"
{ 
"base" "Flesh.Tiny" 
"health" "10"
"dmg.club" "5"
"physicsmode" "1"
"allowstatic" "1"
"multiplayer_break" "both"
"physdamagescale" "5"
} 
fire_interactions
{
explosive_resist   "no" 	// Clamp blast damage so that the prop ignites instead of breaking.
flammable          "yes" 	// Can be ignited by fire and explosions.
}
}
$cdmaterials "\common\nature\"
$surfaceprop "watermelon"
$scale 1
$sequence	idle	"idle.smd"
$collisiontext
{ 
break { "model" "\common\props_foliage\cactus1_gib0.mdl" "health" "1" "fadetime" "10"}
break { "model" "\common\props_foliage\cactus1_gib1.mdl" "health" "1" "fadetime" "5"}
break { "model" "\common\props_foliage\cactus1_gib2.mdl" "health" "1" "fadetime" "5"}
break { "model" "\common\props_foliage\cactus1_gib3.mdl" "health" "1" "fadetime" "10"}
}
$collisionmodel "cactus1_phys.smd" 
{
$concave
$mass 5.0
$inertia 1.00
$damping 0.00
$rotdamping 0.00
$masscenter 0 0 -10
}

usage: break { "model" "<path>" options}

<path> path to the gib

options:

"health" "1" override the gibs health (set to 1)
"fadetime" "10" gib disapears after 10 seconds


usage: prop_data

Note: Make sure that the base value of "prop_data" is equal in all models.

Links: