In this tutorial I'll teach you how to code model variants. I'll show you how to code 3 modelvariants, but you can add as many as you like.
Step 1: XML editting
1. Go to the main .xml (=Codename.xml)
Change 'Adult' in this line to 'Base':
<on>
<event msg="ZT_SETPLACEMENTOBJECT" data="BFString" string="Codename_Adult_F" />
</on>
You'll get this:
<on>
<event msg="ZT_SETPLACEMENTOBJECT" data="BFString" string="Codename_Base_F" />
</on>
2. Go to Codename_Adult.xml
Remove this: s_MorphMessage="zoomessages:AnimalPuberty" f_MorphMessagePriority="1" f_MorphMessageDuration="30" from the BFAIEntityDataShared line
Copy and remove these two Binders as well (this is not always neccesary, sometimes they're not present)
<BFNamedBinder binderName="texController" required="1">
<instance>
<BFAITextureController currState="well" defaultState="well">
<attribList>
<health/>
<hygiene/>
</attribList>
<stateList>
<sickanddirty>
<attribData>
<health minRange="70" maxRange="101"/>
<hygiene minRange="70" maxRange="101"/>
</attribData>
<textureData mergeKey="material">
<mainObj material="Codename" image="entities\units\animals\Codename\Codename_Adult_F.dds"/>
</textureData>
</sickanddirty>
<sick>
<attribData>
<health minRange="70" maxRange="101"/>
</attribData>
<textureData mergeKey="material">
<mainObj material="Codename" image="entities\units\animals\Codename\Codename_Adult_F.dds"/>
</textureData>
</sick>
<dirty>
<attribData>
<hygiene minRange="70" maxRange="101"/>
</attribData>
<textureData mergeKey="material">
<mainObj material="Codename" image="entities\units\animals\Codename\Codename_Adult_F.dds"/>
</textureData>
</dirty>
<well>
<textureData mergeKey="material">
<mainObj material="Codename" image="entities\units\animals\Codename\Codename_Adult_F.dds"/>
</textureData>
</well>
</stateList>
</BFAITextureController>
</instance>
</BFNamedBinder>
<BFNamedBinder binderName="mainObj">
<instance>
<BFPhysObj>
<BFActorComponent actorfile="entities/units/animals/Codename/Codename_Adult_F.bfm" scale="1.0" switch="0 15 30 60" />
</BFPhysObj>
</instance>
</BFNamedBinder>
3. Now paste the two binders you just copied in Codename_Adult_F.xml and Codename_Adult_M.xml. Paste it directly underneath <binder>
If the two Binders are already present you don't have to paste them.
Paste this in the Codename_Adult_F.xml
<UIToggleButton template="adopt">
<UIAspect>
<default image="entities\units\animals\Codename\Codename_icon.dds" />
</UIAspect>
<on>
<event msg="ZT_SETPLACEMENTOBJECT" data="BFString" string="Codename_Base_F" />
</on>
</UIToggleButton>
and this in the Codename_Adult_M.xml
<UIToggleButton template="adopt">
<UIAspect>
<default image="entities\units\animals\Codename\Codename_icon.dds" />
</UIAspect>
<on>
<event msg="ZT_SETPLACEMENTOBJECT" data="BFString" string="Codename_Base_M" />
</on>
</UIToggleButton>
It has to be directly underneath this:
<instance>
<BFGEntity />
</instance>
<shared>
If the code is already present you must to replace it with this code.
4. Now duplicate Codename_Adult.xml, Codename_Adult_F.xml and Codename_Adult_M.xml.
Rename them to Codename_Base.xml, Codename_Base_F.xml and Codename_Base_M.xml.
Go to Codename_Base.xml and edit the following:
<BFTypedBinder binderType="Codename_Adult" abstract="true">
has to be:
<BFTypedBinder binderType="Codename_Base" abstract="true">
And
<Codename>
<Codename_Adult/>
</Codename>
has to be:
<Codename>
<Codename_Base/>
</Codename>
Add this line: <ZTDevComponent /> directly underneath:
</BFGEntity>
</instance>
<shared>
Go to Codename_Base_F.xml and edit the following:
<BFTypedBinder binderType="Codename_Adult_F" abstract="true">
has to be:
<BFTypedBinder binderType="Codename_Base_F" abstract="true">
And
<Codename>
<Codename_Adult>
<Codename_Adult_F />
</Codename_Adult>
</Codename>
has to be
<Codename>
<Codename_Base>
<Codename_Base_F />
</Codename_Base>
</Codename>
Change 'Adult' to 'Base' in the Codename_Base_M.xml as well.
5. Duplicate Codename_Adult_F and Codename_Adult_M two times. Name them Codename_Adult_F_1 and Codename_Adult_F_2 and Codename_Adult_M_1 and Codename_Adult_M_2
Change: <BFTypedBinder binderType="Codename_Adult_F">
to <BFTypedBinder binderType="Codename_Adult_F_1"> and <BFTypedBinder binderType="Codename_Adult_F_2">
And change: <BFTypedBinder binderType="Codename_Adult_M">
to <BFTypedBinder binderType="Codename_Adult_M_1"> and <BFTypedBinder binderType="Codename_Adult_M_2">
Make sure this (example from Codename_Adult_F_1.xml):
<Codename>
<Codename_Adult>
<Codename_Adult_F/>
</Codename_Adult>
</Codename>
becomes this:
<Codename>
<Codename_Adult>
<Codename_Adult_F>
<Codename_Adult_F_1 />
</Codename_Adult_F>
</Codename_Adult>
</Codename>
Remove these lines in the female xmls:
<on>
<event msg="ZT_SETPLACEMENTOBJECT" data="BFString" string="Codename_Base_F"/>
</on>
and these lines in the male xmls:
<on>
<event msg="ZT_SETPLACEMENTOBJECT" data="BFString" string="Codename_Base_M"/>
</on>
Add this line: <ZTDevComponent /> in all 4 xmls
It has to be directly underneath :
<instance>
<BFGEntity />
</instance>
In the female xmls change:
<BFActorComponent actorfile="entities/units/animals/Codename/Codename_Adult_F.bfm" scale="1.0" switch="0 15 30 60" />
to:
<BFActorComponent actorfile="entities/units/animals/Codename/Codename_Adult_F_1.bfm" scale="1.0" switch="0 15 30 60" />
And in the male xmls change
<BFActorComponent actorfile="entities/units/animals/Codename/Codename_Adult_M.bfm" scale="1.0" switch="0 15 30 60" />
to:
<BFActorComponent actorfile="entities/units/animals/Codename/Codename_Adult_M_1.bfm" scale="1.0" switch="0 15 30 60" />