Custom units creation

From War Thunder Wiki
Revision as of 02:44, 28 March 2020 by RideR2 (talk | contribs) (Changed some parts to make them look better, added wikitables.)

Jump to: navigation, search

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.

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's 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 and when it's possible they have a very simple damage model and their HP amount can't be adjusted.

Finding objects using CDK tools

  1. Open the Asset Viewer which can be found in WarThunder\WarThunderCDK\assetviewer.cmd
  2. Find the Filter tab which should be located in the left bottom corner, it can be used to find objects
  3. 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
  4. You should see a couple of objects, the ones that you need are with a tree icon next to their name
  5. 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
By default it's not possible to see objectGroups in the mission but it can be fixed
  1. Open the War Thunder game folder
  2. Go to WarThunder\WarThunderCDK\
  3. Open application.blk file in notepad or any similar software
  4. Find this line: base:t="../content/pkg_local/gameData/units/structures"
  5. Paste under the line above: base:t="../content/pkg_local/gameData/objectGroups"
  6. Go to this location: WarThunder\WarThunderCDK\dagor3_cdk\bin64\plugins\de3x\missions\
  7. Open config.blk file in notepad or any similar software
  8. At the bottom, below all lines, add: "@override:units" { "@override:objectGroups" { "@override:classes" { path:t="../content/pkg_local/gameData/objectGroups"; } } }
  9. Open the Mission Editor
  10. Create a new unit
  11. Change its type to objectGroups
  12. 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

  1. Open the Asset Viewer which can be found in WarThunder\WarThunderCDK\assetviewer.cmd
  2. Find the Filter tab which should be located in the left bottom corner, it can be used to find objects
  3. 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
  4. You should see a couple of objects, the ones that you need have a teapot icon next to their name
  5. 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{ body_dm{ hp:r=100.0 } } }
DamageEffects{ part{ name:t="body_dm" onKill{ expl:r=1.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
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's 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's possible to make a custom unit based on any other unit in game and modify it a bit. To do that you have to:

  1. Create a new BLK file and give it unique name
  2. Place the BLK in the correct folder depending what kind of 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
  3. Open the BLK file
  4. 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's 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]