Multiple Head Definitions for AI

From The DarkMod Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Originally written by Springheel on http://forums.thedarkmod.com/topic/4685


This information is still accurate but it's not really needed now. See Swapping Heads on AI Models.


So it works like this now. In the AI entity def you have a line where you set the default head for a model. If you do nothing than this head is used and no offset is applied. If you want to use a default offset, then you can specify offsetHeadModel and this will be applied to ALL head UNLESS there is a specific key. In order to use a specific value for a given head just use the heads model name as the key and specify the values as a vector. The nice thing is that this took only two lines to add to make it work.

If you don't need it you don't need to set the offsetHeadModel key, so in most cases it will be unneccessary, but since I already implemented it, we can just as well leave it in.

entityDef atdm:ai_builder_guard
{
   "inherit"            "atdm:ai_humanoid"
   "ragdoll"            "guard_base"
   "model"                "builderguard"
   "def_head"            "head_builderguard"
   "head_elitecitywatch"         "0 0 5"
   "tdm_head_young"        "0 0 -7"
   "head_joint"            "Head"

As you can see in the example, if you use head_builderguard as the head, which is the default for this AI, then there is no offset added, as there is no default value set, and also no specific key. If you use the head_elitecitywatch as the head, then it will be moved 5 units upwards, while the tdm_head_young will be moved 7 units down. Any other head will also not be adjusted as there are no keys for them. Of course these numbers are just examples and have to be adjusted.