Making 'Prop' Entities

From The DarkMod Wiki
Revision as of 14:35, 11 August 2009 by Springheel (talk | contribs)
Jump to navigationJump to search

written by Springheel

Although this information is still accurate, there is a new attachment system that is used on most cases now.

Prop entities are stored in tdm_prop_wearable_items.def and tdm_prop_items.def. 'Wearable_items' are things an AI might wear (headgear, belt-buckles, etc), while 'prop_items' are for things an AI would carry or have attached to a belt (weapons, torches, keys, potions, etc).

An entity definition for a prop item looks like this:

entityDef prop_spectacles {
	"inherit"		 "func_static"
	"model"		 "models/darkmod/props/wearables/spectacles.ase"
	"joint"		 "Head"
	"origin"		 "4 -5.5 0"
	"angles"		 "85 -85 3"
	"remove"		 "0"
}


Now, here's what each line means.

entityDef prop_spectacles {

This is where you name your entity. You should use the prefix 'prop' for all attachable objects. If there are multiple versions of the same object, try to be descriptive. For example, prop_spectacles_rhand, or prop_spectacles_brokenskin, etc.

"inherit"		 "func_static"

This just sets the entity as a func_static, so it won't fall off the AI.

"model"		 "models/darkmod/props/wearables/spectacles.ase"

This line points to the model you want to attach. You include the path and filename of the actual model. If you want to use an alternate skin, you can, with a "skin" "[skin name]" line.

"joint"		 "Head"

This sets the joint you want to attach to. For headgear, obviously you'd use the head. "RightHips_Dummy" is a good one for putting things on a belt. You may need to experiment for other places. Remember the object will move the same way the joint moves.

"origin"		 "4 -5.5 0"
"angles"		 "85 -85 3"

These two lines position the object relative to the joint you choose. "Origin" moves the object around, and "angles" tilts it. It's best to play with these values in game so that you can see where the object is. See AI Attachment Ingame Editing for more info. These values will apply to all AI unless you add some lines tweaked for specific AI. See Adding Offset Values for Specific AI for more info.

"remove"		 "0"

If this is set to "1" then the object will fall off the AI when it is killed/KO'd. A value of "0" means it stays attached. Generally only things held in the hand should fall off when the AI is KO'd. AI can notice strange objects lying around, and it isn't fun for the player to have to clean up three or four pieces of clothing every time they KO an AI. (Actually, I have to double-check this..."remove" "1" might actually just make the object disappear on KO, and you would need to spawn a new object to simulate the AI 'dropping' it. Been a while since I've done this)


There are other things you can include in a prop def, but this is enough to get you going.