| 46 | |
| 47 | |
| 48 | You might want to use this image to keep overview:[[BR]] |
| 49 | |
| 50 | [[Image(http://i.imgur.com/hnASqn2.png)]] |
| 51 | [[BR]] |
| 52 | [[BR]] |
| 53 | |
| 54 | '''Setting up a template'''[[BR]] |
| 55 | Good. Now let's head over to the template. In <simulation\templates\units>, create a file called |
| 56 | “gaul_champion_axeman.xml” and open it in a text editor of your choice. Finally paste the |
| 57 | following code in it: |
| 58 | {{{ |
| 59 | #!div style="font-size: 80%" |
| 60 | Code highlighting: |
| 61 | {{{#!xml |
| 62 | <?xml version="1.0" encoding="utf-8"?> |
| 63 | <Entity parent="template_unit_champion_infantry_swordsman"> |
| 64 | <Cost> |
| 65 | <Resources> |
| 66 | <metal>75</metal> |
| 67 | </Resources> |
| 68 | </Cost> |
| 69 | <Attack> |
| 70 | <Melee> |
| 71 | <Hack>20.0</Hack> |
| 72 | <Pierce>0.0</Pierce> |
| 73 | <Crush>0.0</Crush> |
| 74 | </Melee> |
| 75 | <Charge> |
| 76 | <Hack>30.0</Hack> |
| 77 | <Pierce>0.0</Pierce> |
| 78 | <Crush>0.0</Crush> |
| 79 | </Charge> |
| 80 | </Attack> |
| 81 | <Identity> |
| 82 | <Civ>gaul</Civ> |
| 83 | <GenericName>Heavy Infantry</GenericName> |
| 84 | <SpecificName>Gaul Axeman</SpecificName> |
| 85 | <History>?</History> |
| 86 | <Icon>units/celt_champion_infantry_gaul.png</Icon> |
| 87 | <RequiredTechnology>unlock_champion_units</RequiredTechnology> |
| 88 | <SelectionGroupName>units/gaul_champion_axeman</SelectionGroupName> |
| 89 | </Identity> |
| 90 | <UnitMotion> |
| 91 | <WalkSpeed>7.0</WalkSpeed> |
| 92 | <Run> |
| 93 | <Speed>21.0</Speed> |
| 94 | </Run> |
| 95 | </UnitMotion> |
| 96 | <VisualActor> |
| 97 | <Actor>units/gaul/champion_axeman.xml</Actor> |
| 98 | </VisualActor> |
| 99 | </Entity> |
| 100 | }}} |
| 101 | }}} |
| 102 | |
| 103 | Let me explain the most important tags to you.[[BR]] |
| 104 | |
| 105 | At the second line you see something saying about a parent xml file. Everything about templates in |
| 106 | 0 A.D. Is working with parents and children. That is why we do not need to have every single tag in |
| 107 | our file: it only overrides what is in the parent file. |
| 108 | |
| 109 | |
| 110 | In the <Cost> tag the training costs are defined, we did set the metal costs to 75. The other costs |
| 111 | are defined in the parent file. |
| 112 | |
| 113 | |
| 114 | In <Identity> all info about the unit is explained. You might notice that we called the unit “Gaul |
| 115 | Axeman” and that we are requiring a technology to be researched before the Axeman gets |
| 116 | trainable. |
| 117 | |
| 118 | |
| 119 | Lastly we see the <VisualActor>. This is a link to an actor file in which the visuals are defined. In the |
| 120 | template we just created, all the rest is defined.[[BR]] |
| 121 | [[BR]] |
| 122 | |
| 123 | '''Setting up an actor'''[[BR]] |
| 124 | Now, let's go to <\art\actors\units\gaul> and create the actor file we defined above. |
| 125 | Paste this code into the file: |
| 126 | |
| 127 | {{{ |
| 128 | #!div style="font-size: 80%" |
| 129 | Code highlighting: |
| 130 | {{{#!xml |
| 131 | <?xml version="1.0" encoding="utf-8"?> |
| 132 | <actor version="1"> |
| 133 | <castshadow/> |
| 134 | <group> |
| 135 | <variant frequency="1" name="Base"> |
| 136 | <animations> |
| 137 | <animation file="biped/inf_sword_ready_e.dae" name="Idle" speed="100"/> |
| 138 | <animation file="biped/inf_sword_ready_e.dae" name="Idle" speed="90"/> |
| 139 | <animation file="biped/inf_sword_ready_e.dae" name="Idle" speed="85"/> |
| 140 | <animation file="biped/inf_sword_ready_e.dae" name="Idle" speed="75"/> |
| 141 | <animation file="biped/inf_sword_ready_e.dae" name="Idle" speed="110"/> |
| 142 | <animation file="biped/dudewalk_swordshield.psa" name="Walk" speed="110"/> |
| 143 | <animation file="infantry/sword/move/run/isw_s_off_01.psa" name="Run" speed="8"/> |
| 144 | <animation file="infantry/sword/move/run/isw_s_em_03.psa" name="Run" speed="8"/> |
| 145 | <animation event="0.5" file="biped/inf_2_hand_sword_attack_b.dae" name="attack_melee" speed="150"/> |
| 146 | <animation file="infantry/general/death/inf_01.psa" name="Death" speed="200"/> |
| 147 | <animation file="infantry/general/death/inf_02.psa" name="Death" speed="400"/> |
| 148 | <animation file="infantry/general/death/inf_03.psa" name="Death" speed="200"/> |
| 149 | </animations> |
| 150 | <mesh>skeletal/m_pants_tunic.dae</mesh> |
| 151 | <props> |
| 152 | <prop actor="props/units/heads/celt_helmet_b.xml" attachpoint="helmet"/> |
| 153 | <prop actor="props/units/heads/head_celt.xml" attachpoint="head"/> |
| 154 | <prop actor="props/units/shields/celt_round_b.xml" attachpoint="shield"/> |
| 155 | <prop actor="props/units/weapons/axe_single.xml" attachpoint="r_hand"/> |
| 156 | </props> |
| 157 | </variant> |
| 158 | </group> |
| 159 | <group> |
| 160 | <variant frequency="1" name="chainmail-1"> |
| 161 | <textures><texture file="skeletal/celt_su3_soldurii_1.dds" name="baseTex"/></textures> |
| 162 | </variant> |
| 163 | <variant frequency="1" name="chainmail-2"> |
| 164 | <textures><texture file="skeletal/celt_su3_soldurii_2.dds" name="baseTex"/></textures> |
| 165 | </variant> |
| 166 | <variant frequency="1" name="chainmail-3"> |
| 167 | <textures><texture file="skeletal/celt_su3_soldurii_3.dds" name="baseTex"/></textures> |
| 168 | </variant> |
| 169 | </group> |
| 170 | <material>player_trans.xml</material> |
| 171 | </actor> |
| 172 | }}} |
| 173 | }}} |
| 174 | |
| 175 | Above you see the animations, the props and the textures defined. With props you should think of |
| 176 | small stuff like shields, helmets and weapons (in case of unit props).[[BR]] |
| 177 | [[BR]] |
| 178 | |
| 179 | '''Make the unit trainable''' [[BR]] |
| 180 | So far, so good. We now have the stats ánd the visuals. Now let's think of a location to train the |
| 181 | unit. I'm choosing the barracks. Therefore I need to copy the “gaul_barracks.xml” from |
| 182 | <simulation\templates\structures> and copy it in the right folder in our own testmod. |
| 183 | |
| 184 | Edit the file by adding “units/gaul_champion_axeman” (this is your template file) to |
| 185 | <ProductionQueue>.[[BR]] |
| 186 | |
| 187 | [[Image(http://i.imgur.com/qE7NIOP.png)]] |
| 188 | [[BR]] |
| 189 | [[BR]] |
| 190 | |
| 191 | '''Result'''[[BR]] |
| 192 | Well done, you made it to complete the tutorial! Run the game using your shortcut. The result |
| 193 | should be like below. If it gives some errors than likely you made some spelling errors. Go back and |
| 194 | fix them accordingly to the errors. You might not like everything, but don't hesitate to change |
| 195 | things to your own flavor.[[BR]] |
| 196 | |
| 197 | [[Image(http://i.imgur.com/W5TtIAL.png)]] |
| 198 | |
| 199 | Well done, you made it to create your own soldier! Since you have come this far, you have learned |
| 200 | the basics from template modding and reusing existing art. You should even be capable of creating |
| 201 | your own civilization now (from the template's point of view)! |