Instructions for using editor/Dog Fight

From War Thunder Wiki
Revision as of 23:12, 31 August 2018 by patrioticalien (talk | contribs) (Instructions for using editor/Dog Fight migrated)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Creating the airfield

The first thing we’ll do is create an airfield with two pairs of FW-190 fighters. They’ll be ready to take off and will take off 5 minutes after the battle starts. The player will have to land at this same airfield at the end of the mission. Go to the Landscape tab and, using the ‘Select Object By Name’ button, type ‘air’ in the window that appears. Choose the top result, close the search window and press the Z key to center the camera on the selected object. Return to the Mission Editor tab and, using the ‘Create box zone’ button, create a rectangle roughly the same size as the airfield model and place it on the airfield. Select it and open the object’s property window, then change the name to ‘airfield_zone’. Now create two spherical zones using the ‘Create sphere zone’ button. Place one at the start of the airfield and the other at the end. Call the first one ‘airfield_start’ and the second ‘airfield_end’. Right between these two zones, create another four circular zones with the names ‘spawn01’ to ‘spawn04’.

Creating a player airplane

There is a lake near the airfield we created. Make sure that the field to the right of the ‘Create unit’ button is set to ‘armada’ and use the button to create an airplane 3,000 meters above the lake. Call it ‘player_fw’. Choose ‘fw-190-a5’ as the airplane and give it the default weaponry. Choose ‘1’ as the ‘army’, set the number of airplanes at ‘4’ and press the ‘+numInWing’ button and set the number at ‘2’. Open the mission properties and choose the player’s airplane in the ‘player_teamA’ section.

Creating surroundings

In the mission properties window, open the ‘stars’ section and set the date to July 9th, 1943, and the time to 8 a.m. Open the ‘mission’ section and enter the mission’s name. Choose the map to be loaded when the mission begins (Sicily). Indicate that it is a western campaign, that it is a single mission, that it takes place in the morning and that the weather is good.

Activating the mission

Create a new trigger called ‘mission start’ with a single ‘event’: ‘initMission’. Save the mission and launch it to make sure everything is working as intended.

Creating enemy aircraft

Directly ahead of the player’s plane, at a distance of a few kilometers, over the ocean, create another plane and call it ‘usa_aircobra’. Set its army at ‘2’, the number of planes at ‘6’ and the number of planes per wing at ‘2’. Now we need to put these planes to sleep so that they don’t appear before they should. To do this, add a new action to the ‘mission_start’ trigger. Select ‘unitPutToSleep’ and enter ‘usa_aircobra’ as the target.

Creating a flight route

The aim of the player’s flight is to perform a patrol. So let’s give the player a checkpoint to fly to, plus the first task – to reach the checkpoint. To do this, use the ‘Create point zone’ button and create a zone on the shoreline at a height of 3,000 meters. Call it ‘patrol_waypoint’.

Now create a new file in the folder where you saved the mission file. Give it the same name as the mission file with the extension ‘csv’. Inside it, write the line: "doPatrol":"Reach the checkpoint";"Go to the indicated zone";"Проследуйте к отмеченной зоне" and save the file with the UTF-8 encoding.

Now create a new Mission Object in the editor and call it ‘doPatrol’. In the trigger ‘mission_start’, add a new action: ‘missionMarkAsWaypoint’ and enter ‘patrol_waypoint’ as the target. Tick the ‘visible’ and ‘primary’ checkboxes.

Checking whether the checkpoint has been reached

To check whether the player has reached the checkpoint, create a new trigger called ‘check_is_player_in_waypoint’. Leave the ‘Enabled’ box ticked, since we’re already in the air and flying to the checkpoint. Add a check condition, choosing ‘unitDistanceBetween’ from the list with the parameters:

  • In the ‘object’ field, select ‘player’
  • In the ‘target’ field, choose ‘patrol_waypoint’
  • Set the ‘value’ field to 2500
  • Leave the ‘math’ field as ‘2D’

This will mean that when we’re 2,500 meters away from the patrol checkpoint, the trigger will go into effect. At that point, we’ll need to mark the task as complete. To do this, add an action. Choose ‘moSetObjectiveStatus’ from the list and set the ‘doPatrol’ task as the target. Set the status at ‘2’, which means that the task is complete. We also need to hide the waypoint so that it no longer displays on the screen and map. To do this, add a new ‘missionMarkAsWaypoint’ action, setting the target as ‘patrol_waypoint’ and disabling the ‘visible’ box.

Waking up enemy fighters

It’s time to wake up the enemy fighters and make them attack the player. To do this, create a ‘unitWakeUp’ action in the ‘check_is_player_in_waypoint’ trigger. Select the enemy airplanes (‘usa_aircobra’) as the target. Add a new ‘unitAttackTarget’ action right away. Select the American plane as the object and the enemy plane as the target. Enable ‘fireRandom’ and ‘playerAttracted’, setting ‘playerAttractedCount’ to 2. This will make the enemy airplanes attack the player’s airplane, and a minimum of 2 airplanes will always try to destroy the player himself.

Assigning a new task

Open the mission’s csv file and add a line to it: "holdOn";"Hold on until reinforcements arrive";"Продержитесь до подхода самолетов подкрепления" then save the file. Go to the ‘check_is_player_in_waypoint’ trigger and add a 3-second ‘wait’ action. After this, add a new Mission Objective to the mission and name it ‘holdOn’, ticking the ‘enabled’ checkbox. Go back to the ‘check_is_player_in_waypoint’ and add an action, choosing ‘moAddObjectiveStatus’ from the list and selecting ‘holdOn’ as the target.

Placing markers on enemy fighters

After assigning the task, it would be good to show the player exactly what to be afraid of by marking the enemy airplanes. To do this, add a ‘unitSetIndication’ action to the ‘check_is_player_in_waypoint’ trigger. Select ‘usa_aircobra’ as the target. Now markers have appeared above the enemy airplanes and they’re easier to keep track of.

Enemy aircraft counter icon

It would also be nice to show the player the number of enemy airplanes attacking him and regularly update this information. To do this, you must create a new trigger called ‘update_indicator’ and tick its ‘Enabled’ box. To make sure this trigger doesn’t stop working after it first completes, you must tick ‘enableAfterComplete’. Add a ‘missionSetTargetsIndicator’ action to this trigger with the parameters:

  • In the ‘target’ field, choose ‘usa_aircobra’
  • In the ‘icon’ field, choose ‘air’
  • In the ‘icon_army’ field, choose ‘2’

Now launch this trigger from the ‘check_is_player_in_waypoint’ trigger using ‘triggerEnable’.


Secondary task

It’s time to assign the player a secondary task. If the player’s main task is to hold on until reinforcements arrive, their secondary task can be considered to be the destruction of all the enemy airplanes. Open the mission’s csv file and add a line to it: "destroyAllEnemies";"Destroy all enemy fighters";"Уничтожте все вражеские истребители". After this, create a new Mission Objective with the name ‘destroyAllEnemies’. Uncheck ‘Enabled’ and ‘isPrimary’. Now let’s assign this task in the trigger ‘check_is_player_in_waypoint’. First add a 3-second ‘wait’ action to make a pause between assigning the main task and the second one, then add a ‘moAddObjectiveStatus’ action, setting ‘destroyAllEnemies’ as the target.


Checking whether the secondary task has been completed

Let’s make a check for whether the secondary task has been completed. To do this, add a new trigger: ‘check_for_all_enemies_died’, and check the ‘Enabled’ box. Go to the ‘check_is_player_in_waypoint’ trigger and add a call for the ‘check_for_all_enemies_died’ trigger using ‘triggerEnable’.

Return to the ‘check_for_all_enemies_died’ trigger and add a ‘unitWhenStatus’ condition to it. Set ‘usa_aircobra’ as the object and ‘isKilled’ as the object_type. Select set check_objects as ‘all’. Now add an action to complete the additional task. Select ‘moSetObjectiveStatus’ from the list. Set the target as ‘destroyAllEnemies’ and the status as ‘2’. This will allow the task to be marked as complete.

Enabling the countdown timer

The player must be given a certain time before the support planes will appear in the air. To do this, create a variable and call it ‘holdOnTimer’. Set the variable’s type at ‘Integer’. Select the variable and set its value at 300. The variable’s value can be changed in the field with the name of the variable located below the list of mission variables. To change the variable, we must create a new trigger named ‘hold_on_time_add’, check its ‘Enabled’ checkbox and enable ‘enableAfterComplete’. Add a new action to this trigger, choosing ‘varModify’ from the list and giving it the parameters:

  • In the ‘var’ field, choose the ‘holdOnTimer’ variable
  • In the ‘operator’ field, choose ‘add’
  • Leave the ‘value’ field at -1

This will mean that each second, the value of our variable will reduce by 1. Go to the ‘check_is_player_in_waypoint’ trigger and add a ‘hold_on_time_add’ call to the already existing ‘triggerEnable’.

Checking whether the countdown timer has ended

Create a new trigger called ‘check_for_hold_on_timer’ and untick the ‘Enabled’ checkbox. Using the already enabled ‘triggerEnable’, add a call for this trigger to the ‘check_is_player_in_waypoint’ trigger.

Add a new ‘varComponent’ condition to ‘check_for_hold_on_timer’. Set ‘var_value’ as the ‘holdOnTimer’ variable, and leave all the other fields unchanged. As the first action, add a ‘triggerDisable’ where we’ll forbid subsequent calls of the ‘hold_on_time_add’ trigger. We’ll stop working on the trigger here for now and get started on creating the support fighters.

Creating support fighters

Using the ‘Create unit’ button, create a new fighter over the same lake the player appears above. Put it in the same army as the player and set the fighter’s class to ‘bf-109g-2’. Change its name to ‘support_fighters’ and give it the default weaponry. Also set the number of new fighters to 8 and the number per wing to 2.

Putting the support fighters to sleep

The fighters will be created at the start of the mission, so let’s put them to sleep. To do this, add the newly created fighters to the already existing ‘unitPutToSleep’ in the ‘mission_start’ trigger.

Waking up support fighters

The support fighters should wake up when the ‘holdOnTimer’ variable goes below zero. We’ve already created the ‘check_for_hold_on_timer’ to keep track of this event. Open this trigger and add a ‘unitWakeUp’ action to it, setting the escort fighters ‘support_fighters’ as the target.

Assigning a task to the support fighters

Now that the fighters have woken up, it’s time to give them a task. To do this, add an action to the ‘check_for_hold_on_timer’ trigger. Select ‘unitMoveTo’ from the list and set the parameters:

  • In the ‘object’ field, choose ‘support_fighters’
  • In the ‘target’ field, choose ‘player_fw’
  • Check ‘follow_target’ and ‘shouldKeepFormation’

Checking main mission completion

The main mission will be completed when the reinforcement aircraft reach the player’s aircraft. To check this event, create a new ‘check_for_support_near’ trigger and uncheck ‘Enabled’. Add ‘unitDistanceBetween’ as the condition with the parameters:

  • In the ‘object’ field, choose ‘support_fighters’
  • In the ‘target’ field, choose ‘player_fw’
  • Set the ‘value’ field at 500
  • Leave the other fields unchanged

Add a call for this trigger to the ‘check_for_hold_on_timer’ trigger using ‘triggerEnable’.

Creating a short video clip

Before the end of the mission, let’s show the player a short video clip. To do this, create an action in the ‘check_for_support_near’ trigger. Choose ‘missionStartCutscene’ from the list with the parameters:

  • In the ‘target’ field, choose ‘support_fighters’
  • In the ‘second_target’ field, choose ‘player_fw’
  • Set the ‘duration’ field to 15 seconds
  • In the ‘camera_type’ field, choose ‘two_obj’

Immediately after this, add an ‘moSetObjectiveStatus’ action. Set the target to ‘holdOn’ and the status to ‘2’. Add a ‘wait’ for 3 seconds and a ‘missionCompleted’.