Difference between revisions of "Instructions for using the Mission Editor / Tank Missions"

From War Thunder Wiki
Jump to: navigation, search
m
m (Setting up the ground units: Added another note)
Line 293: Line 293:
  
 
Note: If you are planning to use artillery units from '''structures''' type then keep in mind that they can damage only lightly armoured vehicles, and it is required to add an '''unitAttackTarget''' action to make them shoot at other units.
 
Note: If you are planning to use artillery units from '''structures''' type then keep in mind that they can damage only lightly armoured vehicles, and it is required to add an '''unitAttackTarget''' action to make them shoot at other units.
 +
 +
Note 2: Maximum shooting range of all high quality ground units is by default reduced to 1000m against other ground units and can not be increased, some postwar vehicles like the ZSU-23-4 or the American M247 have can fire at a targets that are further away, but only planes.
  
 
== Making the enemy tanks move towards the player ==
 
== Making the enemy tanks move towards the player ==

Revision as of 10:24, 8 June 2020

Creating the mission

Basics

Open the Mission Editor and when the location selection window appears select the avg_hurtgen map, all map names that start with avg are made mainly for tanks and ground battles.
After that the tab to Mission Editor which is located near the top left corner of the mission editor window, the bar under it should update itself and new icons that are available for the mission editor appear.
On the right side of screen there should be a Properties window, if it is not there then press the Properties and Trigger/MissionObj info icon which is located at the end of the most bottom bar (if your screen width resolution is lower than 1400 pixels you won't be able to see it,
but you can just press this tab using your middle mouse button and while holding it drag it to the left).
First and the most important part of making the mission is giving it a proper name, location and type in the Properties window.

1. Go to Properties → Mission Settings → mission
2. Set the locName to the mission name that you want to appear in the game later
  • LocName is a name that is shown in the User Missions tab in game, you can use spaces.
3. Set the locDesc to the mission description that you want to appear in game later
  • locDesc is a description that is shown in the User Missions tab in game after selecting the mission.
4. Set the type to singleMission
  • Type set to singleMission makes it so the custom mission is able to appear in the User Missions window in game.
5. Set the level' to level/avg_hurtgen
  • It is important to set the level to the same map that you set at the start in the location selection window, otherwise some not intended things can happen like units appearing at wrong position etc.
  • There is another way of adding a mission name and description, it is possible by creating a special CSV file which stores all text that will be shown during the mission and since it will be needed later you should create one.
1. Save your mission in the Mission Editor (it is located in the most top bar) → Save mission
2. Sets it name to for example tank_battle.blk
  • Remember to set its extension to .blk because it is the format that the game can read, otherwise your mission won't be visible in game.
3. Save it in WarThunder/userMissions directory
  • If the userMissions folder isn't there in your folder with installed War Thunder then create it.
4. Go to the location where you saved your mission file and then open it
5. Find mission{ block and paste this line under it so it looks like on the screenshot to the right
Name mission file.JPG
name:t="hurtgen_forest_battle"
  • This line is used to assign the CSV file to your mission
6. Create a new text file with the .csv extension and set its name to usr_yourMissionName.csv
  • More information about CSV files you can find here


Important note: Remember to regularly save your mission, sometimes the Mission Editor can crash itself and you will lose all your work (there is an autosave function which makes a copy of your mission but it can also fail, although it should).

Weather settings

The Mission Editor allows you to change time in your mission and other settings like weather - how many clouds appear over the map, wind - can affect planes and some effects like smoke and clouds (doesn't affect bullets), there are also settings that control the temperature and air pressure (it can affect the shell's ballistic and planes).

1. Go to Properties → Mission Settings → mission
2. Press atmosphere which is located at the top, you can change the temperature and air pressure there
  • Default values are used in multiplayer in random Ground Forces battles.
3. Go to Properties → Mission Settings → mission → weather params
You can set the wind, time and the amount of clouds there.
  • environment: Controls mission time
  • weather: Controls mission's weather
  • By default every time when you load the mission it will generate new clouds position based on current setting, to prevent that you need to set two options:
  • forceSkiesInitialRandomSeed: If checked will make it so the clouds position will never change after reloading the mission
  • skiesInitialRandomSeed: Sets the random clouds position, clouds that you can see in the mission editor will appear at the same position in game
  • stars: Controls stars position, useful only in night missions
  • windSpeed: Sets the wind speed (in meters per second)
  • windDirection: Sets the wind direction (in degrees)


Other settings

If you want your mission to be played only on specific difficulty settings then you can set some options to make it playable for example with realistic battles difficulty only.

1. Go to Properties → Mission Settings → mission → Common params
  • Two first options don't do anything in missions for tanks, they were intended for use with planes only.
  • openDifLevels - If left unchecked (must be selected in order to add this line to the mission) makes it so the mission difficulty can't be adjusted in the mission's options selection screen
2. Go to Properties → Mission Settings → mission → Singleplayer params
3. Press the difficulty tab, after that it will be possible to select one of in game difficulties
  • It is possible to use custom difficulty settings by adding the netDifficultyBlk script, its functionality is explained here, some options from it are not available in the in game Custom Difficulty window.
  • campaign - Controls under which tab your mission will be shown in User Missions window in game
  • It is possible to create your own tab in CSV files, but you will need to edit your mission manually and it is explained here


Creating the player's unit

First part is to create a new unit:

1. Press Create unit icon MissionEditor CreateUnitIcon Wiki.jpg which is located on the most bottom bar
2. Hover your cursor over the window which shows currently selected map, you should see a white dot on the ground, then press the ground somewhere on the map
3. Your unit should be selected now, if yes then press the Drop object icon MissionEditor DropObjectIcon Wiki.jpg on the most bottom bar, it should put your unit on the ground
  • You can change the unit's position by selecting your unit and then pressing Ctrl + Alt + W buttons, after that there should appear three arrows, by pressing one of them and moving while holding it you can move your unit. It also can be done by pressing Move over surface icon MissionEditor MoveOverSurfaceIcon Wiki.jpg which is located on the most bottom bar.
    Mission editor moving units.JPG
    There is a second method of moving units, instead of using an arrow point the cursor at the corner of the square shown to the right, then when its color turns to yellow click on it and just simply move your unit while holding the left mouse button.
Pressed icons.jpg
  • When you notice that moving units is not precise and it is being done in 100 meter steps then make sure that icons shown to the right are not pressed.
  • It is also possible to rotate units, all you need to do is just to press E to switch to rotate mode, two circles should appear, rotating works like moving units, it is done by pressing the circle and moving the cursor while holding the left mouse button. It also can be done by pressing Rotate icon MissionEditor RotateIcon Wiki.jpg which is located on the most bottom bar.
  • Red line shows the unit's direction.
4. While your unit is still selected press P button to show the 'Object properties' window
  • Here you can select your unit's type, class and other settings.
  • Remember that a player's unit needs to be something that is already bought, it is not possible to play not researched vehicles. It is possible to use custom user made models.
5. Set your unit's class to for example the germ_pzkpfw_II_ausf_F and its name to player_unit
6. In the Properties window scroll down to Weapons & Bullets tab, then press it
  • Weapons & Bullets tab allows you to give the player's unit specific ammo and change the ammount of carried ammunition.
7. Change the bullet 0 to 20mm_ger_kwk30_APCR and then set the Bullets Count 0 to 180
8. Open the Modifications tab and then in the first two tabs select tank_tool_kit and manual_extinguisher
  • By default the FPE and Parts modifications are disabled, you have to enable them manually every time, it is also the same with modifications like the NVD or Laser rangefinder, overall everything that is not a performance modification (Tracks, Engine etc.).


Second part is to assign this unit as a player's unit:

1. Go to Properties → Mission Settings → mission → player_teamA
  • Here you can select which unit will be used by the player
2. Press 'Wing' and then select that tank which you added before, in this case it should be player_unit


If you have done everything correctly so far then at this point your mission should work without any issues and you should be able to drive around the map.

Creating the spawn zone

This part will explain everything related to spawning in singleplayer missions.


The first method of spawning at the start of the mission is to simply add your unit on the map, what was explained above.
The second method is to create a zone and use it as a spawn at the beginning of the mission.

1. Press the Create sphere zone icon MissionEditor SphereZoneIcon Wiki.jpg which is located on the most bottom bar
2. Create a new zone by clicking on the ground and dragging it while you hold left mouse button, by doing that it is possible to change its size
3. After creating it set its name to spawn_zone
4. Create a new trigger in Properties → Trigger / Mission Obj. Navigation window by pressing Trigger button
5. Change the trigger name to mission_start, press periodicEvent and then press a big, wide bar with the same name and at the bottom and switch it to initMission
  • It needs to be done this way if you want the player's unit spawn right after launching the mission.
6. Create a new action by pressing Action button, find one that is called unitRespawn and select it
7. Set the object to player's unit, in this case it should be player_unit, then select spawn_zone as the target
  • Now the game should spawn the player's unit at the spawn_zone after launching it.


By default after player's death it will be possible to respawn the vehicle three times at the same position, it can be changed, all you need to do is go to Properties → Mission Settings → mission → Singleplayer params and then press restoreType. This option controls respawn during the mission, when set to the first option attempts it will work like explained before, it's a default setting, the amount of attempts can be changed in the missionAttempts action. Tactical control uses bots from the same unit as a replacement of player's unit after death, basically after you run out of units from your unit you won't be able to spawn anymore. The third option, manual lets you spawn the player's unit manually using the method above.

Creating waypoints

Compared to missions for planes it is slightly harder to add waypoints, because that action which is used for flying units does not look so nice on the ground, it is needed to add them manually instead by adding an effect on the ground and then an icon on the map.


To create waypoints you have to add a custom effect first:

1. Create a new sphere zone (area), put on on the road and change its name to waypoint_01, then copy it and change its name to waypoint_02 and move it 300 meters further
  • You can make a copy of existing units by switching to Move (W button), Move over surface (Ctrl + Alt + W buttons), or Rotate (E button) mode and then pressing arrows or circles around the unit while holding shift button.
2. Create a new trigger and change its name to waypoint_01
3. Add unitPlayEffect action in this new trigger
  • It will be used to show a waypoint on the ground
4. Set its target to the sphere zone that you created, in this case it should be waypoint_01
5. Make sure that the efect_type is set to specific
6. Type waypoint_ground under effect
  • It is an effect that will be visible in game, an arrow pointing at the ground with a circle under it.
7. Make sure that show, attach and mustExist are checked


The next part is creating an icon that will be visible on the map:

8. Add missionShowMapIcon action in waypoint_01 trigger
9. Check the first option called show
10. Paste ui/gameuiskin#radar_object_waypoint to tab under the iconName
  • This icon is a simple yellow circle, normally it is used by missionMarkAsWaypoint action
11. Select the first waypoint (waypoint_01) in the tab next to the areaName
Waypoints trigger


Adding more waypoints:

1. Create a new trigger and change its name to waypoint_02
2. At the top unmark the Enabled option
  • Prevents the trigger from performing its actions right after mission start
3. Add a new condition - unitWhenInArea
4. Click on it and set the object to player_unit and the target to waypoint_01
  • Makes it so the trigger will be activated only after reaching waypoint_01 area
5. Copy unitPlayEffect and missionShowMapIcon action from the previous trigger by using Copy and then Paste ... buttons which are located at the bottom of Trigger / Mission Obj. Info window under elements:
  • To copy them you have to click on the action, then press the Copy button, then do the same with the other action. After that click on waypoint_02 trigger and press Paste ..., in that new window switch Paste action: from Paste current to Paste all and press Ok.
6. Click on unitPlayEffect in waypoint_02 trigger and uncheck show, attach, mustExist
7. Click on missionShowMapIcon in waypoint_02 trigger and uncheck show
  • Makes existing effect and icon from the first waypoint disappear.


Adding a new effect and icon for the next waypoint:

8. Paste both actions to the waypoint_02 trigger again
9. Change the areaName to waypoint_02 in missionShowMapIcon action and the target to waypoint_02 in unitPlayEffect action
10. Go back to the previous trigger (waypoint_01) and then add a new action called triggerEnable
11. In triggerEnable set the target to waypoint_02
  • Activates waypoint_02 trigger and only one waypoint at the same time (player won't be able to skip them).


You can use this method to create more waypoints, also you can copy existing triggers to make it faster, to do that use the Copy and Paste buttons which are located under the list of triggers.

Screenshot

Mission editor waypoints.JPG


Creating ground units

Artillery units

1. Press the Create unit icon MissionEditor CreateUnitIcon Wiki.jpg on the the most bottom bar
2. Create a new unit, drop it on the ground by using Drop object icon MissionEditor DropObjectIcon Wiki.jpg
3. Change its type to tankModels and class to uk_at_gun_qf6pounder
  • Create at least 5 units
  • All artillery units from tankModels type have similar names, they start with the nation prefix (for example, germ = Germany, uk = United Kingdom) and the next part is _at_gun and after that cannon name. There is more artillery units and they are marked as the structures type, most of them can't damage playable tanks because they are intended for use in battles for the airplanes, but there are some like ussr_122mm_m30_smoke, it can use smoke shells, and some other like streakartillery_203mm_r150m can be used as a long range artillery.
4. Place them in the position near the place where the player is supposed to drive by, make sure that their field of view is not blocked by bushes or other objects
Screenshot

Mission editor artillery.JPG


Tank units

1. Press the Create unit icon MissionEditor CreateUnitIcon Wiki.jpg on the the most bottom bar
2. Create a new unit, drop it on the ground by using Drop object icon MissionEditor DropObjectIcon Wiki.jpg
3. Change its type to tankModels and class to fr_hotchkiss_h39
  • Create at least 6 units, set their class to fr_hotchkiss_h39 and fr_renualt_r39
Screenshot

Progress so far.JPG


Squad units

Squads are used to store lots of units in groups and by doing that make operating on them using triggers and actions easier.

1. Press the Create unit icon MissionEditor CreateUnitIcon Wiki.jpg on the the most bottom bar
2. Place it somewhere on the map
  • Since squad units are often being modified when you want to add more units it is the best to not place it close to other units.
3. Select the created unit, change its name to t1_arty_squad and then type to squad
4. At the bottom there is a tab called Properties, you can add existing units there, for this mission add all existing t1_arty_xx units
5. Create another squad unit and add all existing tank units there (except for the player's unit)
Screenshot

Mission editor squad.JPG


Adding a tank that will follow the player

1. Press the Create unit icon MissionEditor CreateUnitIcon Wiki.jpg on the the most bottom bar
2. Place it 20 meters behind the player's unit
3. Set its name to t2_tank_01, change type to tankModels and class to germ_pzkpfw_II_ausf_C

Setting up the ground units

Create two new triggers and change their names to basic_properties and follow_player

Setting up the basic properties for all ground units:

1. Select the basic_properties trigger
2. Add a new action called unitSetProperties and select it
3. Set the object to t1_tank_squad, add another object by pressing the tab with the same name and then add t1_arty_squad and t2_tank_01
4. Set the following options:
Under Unit status params
  • destroyRIByCollision - enabled
Makes it for the AI units possible to destroy some objects like fences.
Under Attack params
  • accuracy - 0.7
To not make the AI's fire so accurate.
  • maxDeviationAngle - 1.5
Makes the AI not shoot all over the place, it happens when you lower the accuracy
  • checkVisibilityTarget - enabled
  • visibilityTreeTransparencyThreshold - 0.01
Very important option, makes the AI not shoot through trees, bushes, buildings and other similar objects.
  • adaptiveAccuracyTime - 0.15
Makes the AI miss some of the first shots.
Under Movement params
  • advencedCollisionAvoidance - enabled
Makes the AI avoid obstacles like buildings.
  • ignoreCollisions - disabled
  • ignoresObstaclesAfterTime - disabled
Under Collision params
  • registerCollisions - enabled

Making the AI ally tank follow the player's unit:

1. Select the follow_player trigger
2. Enable enableAfterComplete option
3. Make sure that the periodicEvent is set to 1
4. Add a new condition called unitDistanceBetween
5. Set the Object to t2_tank_01, value to 15, target to player_unit and math to 3D
  • Condition will be checking if the AI is less or more than 15 meters from the player's unit.
6. Add a new action called unitSetProperties and select it
7. Go to Movement params, set the object to t2_tank_01, scroll down to Movement params, click on that tab, set the move_type to stand and speed to 0
  • AI unit will stop when it is closer than 15 meters.
8. Create a new else action (elseAction button), set the object to t2_tank_01, target to player_unit and move_type to navmesh
  • Forces the AI unit to follow the player's unit and it will use navmeshes (roads) when it is possible.

Special settings for the enemy units:

1. Select the basic_properties trigger
2. Add a new action called unitSetProperties and select it
3. Set the object to t1_tank_squad
4. Set the following options:
Under Movement params
  • moveSpeedKAtShooting - 0
Makes the AI stop the vehicle when it starts shooting.
  • slowWhenEnemyNear - 0.5
Sets the multiplier of the speed that it is supposed to keep when it is moving, in this case it will be 0.5x slower.
  • slowWhenEnemyNearDistance - 500
Sets the distance between the AI and enemy units when it is supposed to slow down.

Note: If you are planning to use artillery units from structures type then keep in mind that they can damage only lightly armoured vehicles, and it is required to add an unitAttackTarget action to make them shoot at other units.

Note 2: Maximum shooting range of all high quality ground units is by default reduced to 1000m against other ground units and can not be increased, some postwar vehicles like the ZSU-23-4 or the American M247 have can fire at a targets that are further away, but only planes.

Making the enemy tanks move towards the player

There are two ways of making the ground units move, first and the simplest one is by creating waypoints, second one is by using unitMove action.
In the first case you can make them move by selecting the unit and then creating waypoints by using Create waypoint icon MissionEditor OnlyWaypointsIcon Wiki.jpg.
It is also possible to make predefined waypoints that can be assigned to more units, not only just one. You can create them by using Create way icon which is located next to the Create waypoint icon.
They can be assigned to units manually by selecting the unit, then selecting it in Way Name tab, or by adding a new action called unitSetRoute where the object is the unit that you want to move and route is the name of the waypoint (the first one).
Second method is based on the unitMove action, it allows units to move on predefined waypoints called splines and the navmesh, the first one can be found on maps that are designed primarily for airplanes, the second one is used only on maps for tanks and ships, it makes the AI use more random routes.

For this mission we will use the navmesh and waypoint areas to trigger the AI to move:

1. Create a new trigger and change its name to enemy_attack_player_01
2. Add a new condition called unitWhenInArea and select it
3. Set player_unit as the object and waypoint_02 as the target
4. Add a new action called unitMoveTo and select it
5. Set two units that are the closest to the waypoint from unitWhenInArea condition as the object and then set player_unit as the target
6. Press move_type and select the navmesh and enable follow_target
  • This will make the AI use navmesh to get to the player

Now create another trigger called enemy_attack_player_02 and set it up like it is explained above but select the next waypoint (waypoint_03) in the unitWhenInArea condition and the rest of tanks (03, 04, 05, 06) as the object, this will make move all other AI tanks when the player reaches the next waypoint.

Reducing the map area

Reducing the map area is useful when you do not want the player to have access to the entire map and during making more linear missions which look more like a corridor.
First you need to create an area which will indicate where the player is supposed to be able to drive, then make a new action:

1. Create a new area using Create box zone icon MissionEditor BoxZoneIcon Wiki.jpg and change its name to battle_area
  • Press the place on the ground where you want to start creating it, then move the mouse to set the length of one side, then press the left mouse button to set the length of its second size and press for the last time to set its height.
2. Select the mission_start trigger
3. Add a new action called missionBattleArea and select it
4. Set the area to battle_area, then enable ground and killOutOfBattleArea
  • This will limit the map size for this mission, it is possible to add multiple areas to the same action, or even update it during the mission to make it more dynamic, but this requires adding a new trigger and action.
Screenshot

Mission editor battle area.JPG


Adding objectives

To let the player know what are the mission's tasks you have to create some objectives, first one to make the player follow waypoints and the other one to destroy all ground units.

1. Press Mission Obj at the bottom of Triggers / Mission Obj. Navigation category
  • By doing that a new objective will be created.
2. A new objective should appear under Mission objectives, select it and change its name to follow_waypoint, then uncheck the Enabled option
  • Unchecking that option will make it not appear right after the start of the mission.
3. Create another objective and change its name to destroy_enemy_units
4. Select the first trigger - mission_start
5. Add a new action called wait and select it
6. Set its time to 10
7. Add two new actions called moAddMissionObjective, in the first one set follow_waypoint as the target, in the second one set it to destroy_enemy_units
8. Add another wait action, set its time to 3 and then move by using Up button it so it is between two moAddMissionObjective actions
  • Makes both objectives appear 10 seconds after the start of mission, but the second one will appear 3 seconds after than the first one.

To mark the follow waypoints objective as completed:

1. Create a new trigger and set its name to reached_final_waypoint, uncheck the enabled option
2. Add a new condition unitWhenInArea and select it
3. Change the object to player_unit and target to the last waypoint, in this case waypoint_05
4. Add a new action moSetObjectiveStatus and select it
5. Set the target as follow_waypoint and then switch status to 2
  • Status set to 2 marks the objective as completed.
6. Select the last waypoint trigger, in this case it should be waypoint_05
7. Add a new action triggerEnable and set the target to reached_final_waypoint
  • Enables that trigger with the objective after reaching the last waypoint so the player won't be able to skip the entire mission.
Screenshot

Progress so far 02.JPG


Checking whether all the enemy ground units have been killed

1. Create a new trigger and set its name to all_enemy_units_destroyed
2. Add a new condition unitWhenCountMatches and select it
3. Set the object to t1_arty_squad and t1_tank_squad
4. Switch the object_type to isAlive
5. Switch the func to less
6. Set the value to 1
  • This condition will check if there is less than 1 of enemy units alive,
7. Add a new action moSetObjectiveStatus and select it
8. Set the target as destroy_enemy_units and then switch status to 2

Mission completion

To make the mission end by completing all objectives:

1. Create a new trigger and set its name to mission_completed
2. Add two new misObjStatus conditions
3. Set the target in the first one to destroy_enemy_units and the second one to follow_waypoint
4. In both conditions set the status to completed
  • Makes the action activate when both objectives are completed
5. Add a new action called missionCompleted
  • This action ends the mission and shows the mission completed message

Mission failed

To make the mission end when the player dies and show the mission failed message:

1. Create a new trigger and set its name to mission_failed
2. Add a new unitWhenStatus conditions
3. Set the target to player_unit
4. Switch the object_type to isKilled

Triggers window when everything is done:
All triggers.JPG

CSV file

To show the objectives properly the CSV file needs to be set up correctly.

1. Open the CSV file which creation was explained at the top in Basics section
2. Copy this code below:
"<ID|readonly|noverify>";"<english>";

"missions/mission_name/date";day + month + year;;

"missions/mission_name";"mission name";;

"missions/mission_name/objective";"mission description";;

"objective_01";"objective name 01";;

"objective_02";"objective name 02";;

  • mission_name - Mission name that you set in the mission's blk file in name:t="" line
  • objective_01 - Needs to match the objective that is set in the mission file

For this mission it should look like that:

...
"<ID|readonly|noverify>";"<english>";

"missions/hurtgen_forrest_battle/date";1940;;

"missions/hurtgen_forrest_battle";"Hurtgen Battle";;

"missions/hurtgen_forrest_battle/objective";"Battle in the Hurtgen forest against French forces";;

"follow_waypoint";"Follow the objective";;

"destroy_enemy_units";"Destroy all the enemy ground units";;

Optional / Additional information

Adding hints

It is possible to add text that will shown on the center of screen, for example a warning, for this mission make it appear when the player reaches one of waypoints and warns about the enemy forces.

1. Select the enemy_attack_player_01 or waypoint_03 depending where you added the unitWhenInArea condition with the waypoint_02 target
2. Add a new action called playHint and select it
3. Set the hintType to standard
4. In the name tab add the warning: Enemy forces have been spotted
5. Set the time to 5
  • Hints will be shown at the center of screen after reaching the second waypoint and it be visible for 5 seconds.

Making the tank use its smoke grenades

It is possible to make the AI use smoke grenades, it can be done by using the unitSetProperties action.

1. Add a new unitSetProperties action
2. Set the unit that you want to use its smoke grenades as the object
3. Click on the controls bar and then after some new options appear select weaponTriggers
  • A new textbox should appear, you can set it to for example a "trigger" that uses smoke grenades.
4. Type gunner2 in the textbox
For the Panzer III F it is gunner2 and can be different for other units.
5. Enable the Set option
  • Now the AI should start using its smoke grenades as soon as the trigger with this action is activated.

Mission examples

-


More information about the CDK:
- Instructions for Using the Mission Editor
- Triggers
- Multiplayer mission creation