Custom units creation
This page will explain step by step how to create custom units that can be used in singleplayer missions using existing assets which can be accessed through the CDK.
Contents
Creating objectGroups
In order to make a custom unit you have to find interesting assets in the Asset Viewer, then use their names to create a custom BLK file. It is possible to put multiple objects and textures into a single BLK file and make for example an airfield. In most cases objectGroups can't be destroyed, sometimes they have a very simple damage model, but their HP amount can't be adjusted.
Finding objects using CDK tools
- Open the Asset Viewer which can be found in WarThunder\WarThunderCDK\assetviewer.cmd
- Find the Filter tab which should be located in the left bottom corner, it can be used to find objects
- As an example type det_trench_half_c there and wait until the Asset Viewer finds this objectGroup
- Note: You don't have to type the whole name of object if you want to find it, you can just type trench and it will show lots of objects that contain this name
- You should see a couple of objects, the ones that you need are with a tree icon next to their name
- Write down its full name somewhere and the model's type which can be found in the right top corner in the Properties window
Note: Almost all object types can be used to create objectGroups, but ships and tanks (high quality models) might have some issues with textures.
Creating a BLK file
- 1. Create a new file with *.blk extension
- 2. Copy all this code below to the BLK file and use it as a template:
className:t="composit" node{ type:t="" name:t="" tm:m=[[1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] [0.0, 0.0, 0.0]] }
- className: Object type
- name: Name of the object
- tm: Position and rotation, three last numbers control its position (west/east | up/down | north/south - all of them in meters)
- If you add "$%" before the name it will make it possible to move the object vertically
- Example:
name:t="$%det_trench_half_c"
- 3. Add the name of object from the Asset Viewer
- To do that you have to know what kind of object it is, you could check model's type in the Properties window, then add a proper type of this object (dynObject or rendInst or some other)
- 4. Move your file to a proper folder to make the game and Mission Editor able to use it
- Go to your game location
- Find content folder and open it
- Check if there's a pkg_local folder, if not then create it
- Inside, create a gamedata folder and then an objectGroups folder, so that your final filepath should be WarThunder\content\pkg_local\gamedata\objectGroups\
- Move your custom object to the objectGroups folder
- 5. Find your custom object in the Mission Editor
- Open the Mission Editor
- Create a new unit
- Change its type to objectGroups
- Find your object on the list of available objects in class tab, it should use the name of BLK file that contains it
Creating more advanced objectgroups
Airfields
Description Example Code for adding airfields airfield{ start:p3=0.0, 0.0, 0.0 end:p3=0.0, 0.0, 0.0 width:r=0.0 spawn:p3=0.0, 0.0, 0.0 repairTags{ type_attack_helicopter:b=no type_utility_helicopter:b=no }
start: Starting position of the runway start:p3=835.0, 0.0, 40.0
end: Ending position of the runway end:p3=-835.0, 0.0, 40.0
width: Total width of the airfield width:r=140.0
spawn: Spawn position(s) (in metres) spawn:p3=720.0, 0.0, 30.5 spawn:p3=720.0, 0.0, 50.5 spawn:p3=720.0, 0.0, 10.5 spawn:p3=700.0, 0.0, 30.5 spawn:p3=700.0, 0.0, 50.5 spawn:p3=700.0, 0.0, 10.5 spawn:p3=680.0, 0.0, 30.5 spawn:p3=680.0, 0.0, 50.5 spawn:p3=680.0, 0.0, 10.5 spawn:p3=660.0, 0.0, 30.5 spawn:p3=660.0, 0.0, 50.5 spawn:p3=660.0, 0.0, 10.5 spawn:p3=720.0, 0.0, 70.5 spawn:p3=700.0, 0.0, 70.5 spawn:p3=680.0, 0.0, 70.5 spawn:p3=720.0, 0.0, -9.5 spawn:p3=700.0, 0.0, -9.5 spawn:p3=680.0, 0.0, -9.5
- Meaning of numbers in start, end and spawn lines:
- First number - The north/south position
- Second number - Height (shouldn't be used)
- Third number - The east/west position
- repairTags: Used to disable repairing of certain vehicle types
- Available types:
- type_fighter
- type_assault
- type_bomber
- type_attack_helicopter
- type_utility_helicopter
Creating structures
Structures are similar objects to objectGroups, but unlike them they can be destroyed, you can give them a real damage model and adjust it. Structures also support effects, for example objects can start to smoke after being hit, or they will explode after being destroyed.
Finding objects using CDK tools
- Open the Asset Viewer which can be found in WarThunder\WarThunderCDK\assetviewer.cmd
- Find the Filter tab which should be located in the left bottom corner, it can be used to find objects
- As an example type berlin_bridge_01_a there and wait until the Asset Viewer find the objectGroup
- Note: you don't have to type the whole name of object if you want to find it, you can just type bridge and it will show lots of objects that contain this name
- You should see a couple of objects, the ones that you need have a teapot icon next to their name
- Write down its full name and the model's type which can be found in the right top cornet in Properties window
Note: Only dynModel objects can be used to create objectGroups because of one requirement - it needs to have collision and skeleton models to which the damage model can be assigned
Creating a BLK file
- 1. Create a new file with .blk extension
- 2. Copy all this code below to the BLK file and use it as a template:
Code model:t="" subclass:t="fortification" dynCollisionGeom:b=yes hasExpl:b=yes hasDmg2:b=yes hasDmg2Collision:b=yes hasDmg:b=no damageableByGun:b=no expClass:t="" renderInWaterReflection:b=yes toGround:b=no
DamageParts{ armor45{ // armor type body_dm{ // armor plate hp:r=100.0 } } }
DamageEffects{ part{ name:t="body_dm" onKill{ expl:r=1.0 } onHit{ smoke:r=0.0 fire:r=0.0 } } }
- model: Name of the object
- subclass: Sets the object's subclass
- List of available subclasses:
- radar
- fortification
- dynCollisionGeom: Used to disable or enable its physical collision model, so it won't be possible to fly or drive through it
- hasExpl: If set to yes it will show explosion effect after its destruction
- hasDmg2: Enables the damage model
- hasDmg2Collision: Makes it possible to reduce its HP amount by just crashing your plane into it
- damageableByGun: If set to yes it will be possible to damage the object using guns, machine guns, cannons etc.
- expClass: Assigns a specific unit type to the object
- List of available expClasses:
- exp_zero
- exp_bridge
- exp_tank
- exp_radar
- exp_ai_tank
- toGround: Enables or disables the ability to move the object vertically
- DamageParts: Used to give the object armour and set its HP value
- Some of available armor types:
- armor10
- armor45
- steel
- wood
- dural
- glass
- brick
- concrete
- armored_glass
- tank_structural_steel
- RHA_tank
- CHA_tank
- Alternative code for the DamageParts:
Code DamageParts{ formatVersion:i=2 armorClass:t="armor45" hp:r=100 body_dm{ // part name armorThickness:r=45.0 } }
- Note: Part names can be found in the collision model in the Asset Viewer
- DamageEffects: Used to give the object various graphical effects when it is damaged or destroyed
- 3. Add the name of object from the Asset Viewer
- 4. Move your file to a proper folder to make the game and Mission Editor be able to use it
- Go to your game location
- Find content folder and open it
- Check if there's a pkg_local folder, if not then create it
- Create more folders so that looks like this when you are done WarThunder\content\pkg_local\gamedata\units\structures\
- Move your custom object to the structures folder
- 5. Find your custom object in the Mission Editor
Other ways of creating units and modifying them
It is possible to make a custom unit based on any other unit in game and modify it a bit. To do that you have to:
- Create a new BLK file and give it unique name
- Place the BLK in the correct folder depending on what kind of unit you want to edit
- WarThunder\content\pkg_local\gamedata\flightModels - planes
- WarThunder\content\pkg_local\gamedata\objectGroups - static objects
- WarThunder\content\pkg_local\gamedata\units\air_defence - stationary AAA units
- WarThunder\content\pkg_local\gamedata\units\structures - bridges, artillery units and other stationary objects that can be destroyed
- WarThunder\content\pkg_local\gamedata\units\tankmodels - tanks
- WarThunder\content\pkg_local\gamedata\units\tracked_vehicles - AI low quality tracked vehicles
- WarThunder\content\pkg_local\gamedata\units\wheeled_vehicles - AI low quality wheeled vehicles
- WarThunder\content\pkg_local\gamedata\units\ships - boats and ships
- WarThunder\content\pkg_local\gamedata\weapons - weapons
- Open the BLK file
- Paste the code below and use it as a template
include "#/develop/gameBase/gameData/Weapons/gunBrowning50_turret_late.blk" "@override:aimMaxDist":r = 100000
- include: Imports all the code from an existing unit in-game
- include "[path and .blk name of the weapon or unit as it is written in your weapon preset]"
- override: Overwrites existing values, you need to know how that line is called in order to edit it
- "@override:[the line which you want to edit]":[correct datatype] = [new value]
If you want to edit a line that is located in the code block you should write it like this:
"@override:texStreaming" { "@override:biasGroup[1]" { "@override:lqMipBiasHQ":i=3 } }
It will change set the lqMipBiasHQ to 3 in the BLK file where the code structure looks like this:
texStreaming{ biasGroup{ lqMipBiasHq:i=3 } }
The number 1 in @override:biasGroup[1] parameter refers to the block number, it should be used when there is more than one block with the same name, for example most of in game vehicles use more than one weapons{ block, one for the main cannon and the other for their machine guns or any other secondary weapons.
Applying custom skins to existing units
- 1. Create a new text file in the following directory if you want to make it for a plane, helicopter, tank or ship
- Plane: WarThunder\content\pkg_local\gameData\flightModels
- Helicopter: WarThunder\content\pkg_local\gameData\flightModels
- Tank: WarThunder\content\pkg_local\gameData\units\tankModels
- Ship: WarThunder\content\pkg_local\gameData\units\ships
- 2. Change its name to for example custom_unit_a_4b and then file extension to .blk
- 3. Open the text file and then copy this code there:
include "#/develop/gameBase/gameData/" skin{ name:t="" replace_tex{ from:t="*" to:t="UserSkins\" } replace_tex{ from:t="*" to:t="UserSkins\" } replace_tex{ from:t="*" to:t="UserSkins\" } replace_tex{ from:t="*" to:t="UserSkins\" } }
- include line is used to import everything from one of existing units' blk file, for example if you want to import everything from the A-4B's blk file you will need to set its directory to "#/develop/gameBase/gameData/flightModels/a_4b.blk".
- Unit's blk file are stored here:
- Planes: "#/develop/gameBase/gameData/flightModels/unit_name.blk"
- Helicopter: "#/develop/gameBase/gameData/flightModels/unit_name.blk"
- Tanks: "#/develop/gameBase/gameData/units/tankModels/unit_name.blk"
- Ships: "#/develop/gameBase/gameData/units/ships/unit_name.blk"
- You can find all unit names in CDK Reference article
- skin part is basically what you can find in zip archives of skins which you can download from live.warthunder.com.
- In order to make it work you need to set the first line to skin{ then copy all code which is used to replace existing textures (replace_tex), of course to make it work properly you need to point at proper directory, for example:
skin{ name:t="custom_a_4b_skin" replace_tex{ from:t="a_4b_c*" to:t="UserSkins\A-4B NOD\a_4b.dds" } replace_tex{ from:t="a_4b_c_dmg*" to:t="UserSkins\A-4B NOD\a_4b_c_dmg.dds" } replace_tex{ from:t="a_4b_n*" to:t="UserSkins\A-4B NOD\a_4b_n.dds" } replace_tex{ from:t="a_4b_n_dmg*" to:t="UserSkins\A-4B NOD\a_4b_n_dmg.dds" } }
- Name line is used to set the skin's name to make it usable in the Mission Editor and custom missions.
- 4. Open the Mission Editor
- 5. Create a new unit and set its class to your unit's name
- 6. Open the Object Properties window by pressing P and then set its skin name to the name that you set in name:t=""
- Note: You can find Skin tab at the bottom, if it is not there then you need to edit it manually in the mission file, add skin:t="" with your skin name under props{ block
Note: If you want this unit to be attacked by other AI units you will need to add expClass:t="" line at the bottom of your file with the custom unit, you also need to set it for a proper unit type:
- Tanks: expClass:t="exp_tank"
- Tank destroyers: expClass:t="exp_tank_destroyer"
- SPAAGs: expClass:t="exp_SPAA"
- Heavy tanks: expClass:t="exp_heavy_tank"
- Bombers: expClass:t="exp_bomber"
- Attackers: expClass:t="exp_assault"
- Fighters: expClass:t="exp_fighter"
- Various ships types:
- expClass:t="exp_torpedo_boat"
- expClass:t="exp_gun_boat"
- expClass:t="exp_torpedo_gun_boat"
- expClass:t="exp_submarine_chaser"
- expClass:t="exp_destroyer"
- expClass:t="exp_cruiser"
- expClass:t="exp_naval_ferry_barge"
- Similar method but explained by using images
Removing physical parts from existing units
Some parts in existing tanks or ships can be removed by using hidenode line, as an example it is possible to move the main cannon or turret from the tank's 3d model.
- 1. Create a new text file in the following directory if you want to make it for a plane, helicopter, tank or ship
- Plane: WarThunder\content\pkg_local\gameData\flightModels
- Helicopter: WarThunder\content\pkg_local\gameData\flightModels
- Tank: WarThunder\content\pkg_local\gameData\units\tankModels
- Ship: WarThunder\content\pkg_local\gameData\units\ships
- 2. Change its name to for example custom_unit_tiger and then file extension to .blk
- 3. Open the text file and then copy this code there:
include "#/develop/gameBase/gameData/" "@override:weapon_presets" { preset { name:t="your_weapon_preset_name"; blk:t="gameData/flightModels/weaponPresets/custom_preset_file.blk"; } }
Example of use |
---|
include "#/develop/gameBase/gameData/units/tankModels/germ_pzkpfw_V_ausf_G_panther.blk" "@override:weapon_presets" { preset { name:t="panther_no_tracks"; blk:t="gameData/units/tankModels/weaponPresets/custom_preset_without_tracks.blk"; } } |
- include line is used to import everything from one of existing units' blk file, for example if you want to import everything from the A-4B's blk file you will need to set its directory to "#/develop/gameBase/gameData/flightModels/a_4b.blk".
- Unit's blk file are stored here:
- Planes: "#/develop/gameBase/gameData/flightModels/unit_name.blk"
- Helicopter: "#/develop/gameBase/gameData/flightModels/unit_name.blk"
- Tanks: "#/develop/gameBase/gameData/units/tankModels/unit_name.blk"
- Ships: "#/develop/gameBase/gameData/units/ships/unit_name.blk"
- You can find all unit names in CDK Reference article
- 4. Create a folder called weaponPresets in that directory with your unit's blk file
- 5. Open that folder and create a new blk file there, set its name to for example custom_weapon_preset.blk and copy this code there:
hideNodes{ node:t="node_name" }
- Note: Don't forget to change the directory from the main file (blk:t=) to match the one where you created your weapon preset
- hideNodes is usually used to hide some parts in planes, helicopters, tanks or ships that are not used, for example pylons when you select its default preset that has fixed guns only and no bombs or other similar weapons. In tank and ship models it is possible to remove way more parts than in planes, for example their turrets, guns, external equipment, some wheels, tracks that are used as an additional armor etc.
- In order to hide one of parts you need to:
- 1. Open the Asset Viewer
- 2. In Filter tab which is located in the left bottom corner type unit's name which you want to edit
- 3. Select its dynModel (green "teapot") model and check the window on the right side, then scroll down there until you see Node visibility tab (you can check their names there and also toggle them to check which name is assigned to what part)
- 4. Add nodes in node line
- As an example this is how it is done for the Panther G tank:
hideNodes{ node:t="ex_armor_turret_l_01" node:t="ex_armor_turret_l_02" node:t="ex_armor_turret_l_03" node:t="ex_armor_turret_l_04" node:t="ex_armor_turret_l_05" node:t="ex_armor_turret_r_01" node:t="ex_armor_turret_r_02" node:t="ex_armor_turret_r_03" node:t="ex_armor_turret_r_04" node:t="ex_armor_turret_r_05" }
- It removes all tracks that are used as an additional armor
- Note: Removing nodes also removes them from the damage model
- 4. Open the Mission Editor
- 5. Create a new unit and set its class to your unit's name
- 6. Scroll down and set its weapon preset in the weapons tab to the custom one that you just created