Attaching Props to AI

From The DarkMod Wiki
Jump to navigationJump to search

Attaching things to AI is an important way to make your AI unique.

There are two ways to attach things (hereafter referred to as 'props') to AI. Each has its strengths and weaknesses.

1. Using Def_Attach

Benefits: The mapper can easily attach pre-existing prop entities; no fiddling with positions or rotations. More importantly, def_attached entities often adjusts AI animations appropriately (eg, def_attaching a torch automatically makes the AI use the 'torch' animations).


Weaknesses: It is time-consuming to make prop entities that don't already exist. Def_attached objects will not be visible in DR.


Each AI has a set of pre-determined coordinates (attachment points). The mapper can attach things to these points by using the following spawnargs in an AI's entity window:

"def_attach5"  "[entity name]"
"pos_attach5"  "[attachment point name]" 

The number is arbitrary. As long as both lines have the same number, you could use 999. Best to stay away from numbers 1-5, however, as some AI come with default props (pauldrons, weapons, etc), and you could overwrite them.

[entity name] is the entity that you want to attach, like "atdm:prop_torch_gothic_on". You can find a list of preset attachable objects in prop_items.def and prop_wearable_items.def. Or see the quick list below.

[attachment point name] is the name of the predefined point you want to attach the object to, like "hand_l". See the list of preset attachment points below.


This image indicates some common attachment points. You can cut and paste the names below:

attachment_points.jpg

1. "hip_sheath_l"

This is designed for sheathed weapons on the hip.

2. "hand_l"

The left hand, used for torches, bottles, etc. You can attach a weapon to this hand but AI will not attack with it.

3. "belt_back_right"

This is on the back of the belt on the right hand side, designed for purses, keys, or other things players may want to pickpocket.

4. "hand_r"

The right hand. Generally reserved for weapon use.

5. "slung_across_back_rl"

This is primarily used for weapons worn on the back, like hammers or bows.

List of Attachable Objects

You can attach any existing entity, but the entities below have spawnargs that position them properly. For information on making new attachment points, or positioning new entities, see Attachment Positions.

Torches:

"def_attach5"  "atdm:prop_torch_on"
"pos_attach5"  "hand_l"
"def_attach5"   "atdm:prop_torch_gothic_on"
"pos_attach5"  "hand_l"

Belt Objects:

"def_attach6"  "atdm:prop_lootbag"  (used for loot)
"pos_attach6"  "belt_back_right"
"def_attach6"   "atdm:prop_belt_pouch"  (used for decoration)
"pos_attach6"   "belt_back_right"
"def_attach6"   "atdm:prop_goldkey"
"pos_attach6"   "belt_back_right"
"def_attach6"   "atdm:prop_silverkey"
"pos_attach6"  "belt_back_right"
"def_attach6"   "atdm:prop_key_padlock"
"pos_attach6"  "belt_back_right"
"def_attach6"   "atdm:prop_key_simple"
"pos_attach6"  "belt_back_right"
"def_attach6"   "atdm:prop_key_fancy01"
"pos_attach6"  "belt_back_right"
"def_attach6"   "atdm:prop_potion_healing"
"pos_attach6"  "belt_back_right"
"def_attach6"   "atdm:prop_smithyhammer"  (decorative only atm)
"pos_attach6"  "hip_sheath_l"


Other

"def_attach5"   "atdm:prop_halberd"  (decorative only--does not work well in combat)
"pos_attach5"   "hand_l"

2. Using def_attach

See Making 'Prop' Entities.

3. Binding

See Attaching Items.