Custom units creation

From War Thunder Wiki
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 an custom units you have to find interesting your 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 a Filter tab which should be placed 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 find this objectGroups
Note: You don't have to type 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 somewhere it's full name and the model's type which can be found in the right top cornet in Properties window

Note: Almost all object types can be used to create objectGroups

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 number control it's 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 is that, 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 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 other folders so it looks like that when you are done 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 your folder where you installed War Thunder
  2. Go to this location: 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 the line under that line mentioned above: base:t="../content/pkg_local/gameData/objectGroups"
  1. Go to this location: WarThunder\WarThunderCDK\dagor3_cdk\bin64\plugins\de3x\missions\
  2. Open config.blk file in notepad or any similar software
  3. At the bottom, below all lines add this line: "@override:units" { "@override:objectGroups" { "@override:classes" { path:t="../content/pkg_local/gameData/objectGroups"; } } }
  1. Open the Mission Editor
  2. Create a new unit
  3. Change it's type to objectGroups
  4. 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

  • 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 runaway

Example:

start:p3=835.0, 0.0, 40.0
  • end: Ending position of the runaway

Example:

end:p3=-835.0, 0.0, 40.0
  • with: Total width of the airfield

Example:

width:r=140.0
  • spawn: Spawn position (in meters)

Example:

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 northernmost or southernmost position (North/South)
  • Second number - Height (shouldn't be used)
  • Third number - Width (East/South)
  • 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 a Filter tab which should be placed 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 this objectGroups
Note: You don't have to type 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 are with a teapot icon next to their name
5. Write down somewhere it's 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 a 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:
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 subclass:
  • radar
  • fortification
  • dynCollisionGeom: Used to disable or enable it's 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 it's destruction
  • hasDmg2: Enables the damage model
  • hasDmg2Collision: Makes it possible to reduce it's 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 armor and set it's 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 other folders so it looks like that 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 one of existing units in game
How to use:
include "[path and .blk name of the weapon or unit as it's written in you weapon preset right now]"
  • override: Overwrites existing values, you need to know how that line is called in order to edit it
How to use:
"Override:[that line which you want to edit]":[correct type of data] = [new value]