CDK Mission Editor: Multiplayer missions / game modes
This article will explain how to create custom missions with some of the available game modes, for example the Free For All game mode where there is no teams and everyone fights against each other, or the Race game mode where you can race against other players.
Basic knowledge about multiplayer mission creation is required, you will also find there how to add slots for players which will not be explained here.
Contents
Game modes
Free For All (FFA)
In this game mode there are no teams and everyone is fighting against each other, depending on the mission settings it is or not possible to respawn during the battle. In the statistics list there is only one long list of all players and they are sorted by the kills amount. This is the most basic and simplest to make game mode, you only need to enable the special setting in the mission editor and then add spawn zones around the map. It works for all unit types. Players will not be in the same team even after switching the team to the same one in the custom battles lobby screen.
Setting up the mission settings
- 1. Enable the FFA option
- Go to Mission Settings → mission
- Make sure that the type is set to domination
- Enable gt_ffa_deathmatch in Game type params
- It enables the FFA mode.
- GT_FFA can also be used and the only difference between them is lack of the kill counter at the top of the screen.
- 2. Select unit types available for the mission
- Go to Versus params and press allowedUnitTypes
- Select the unit type which you want to be playable in the mission
- Airplanes, Tanks, Ships or Helicopters, you can see more than one type.
- 3. Set the tickets limit
- Go to Versus params and press scoreLimit
- Set the score limit to the number you want
- By default with this option disabled it is 500, one kill in game reduces the number by 100 but it can be changed in deathPenaltyMul setting which sets a multiplier of the default number, so for example when it is set to 0.1 every death will decrease the tickets amount by 10.
Creating spawns
- 1. Create areas
- Create lots of sphere areas, depending on for how many players you want it to playable
- Set their name to something short like for example air_spawn_01, air_spawn_02 etc.
- Create a squad unit and put all the units there
- Remember to not put them close to each other, especially if it will be for tanks or ships only, then after the spawn units should not be able to see each other for at least 20 seconds. There is an option which let you put the an objects which check the visibility from the certain point (its position), it can be accessed by pressing the Create view point which is located next to the icon for creating waypoints, then put in on the ground and press the F1 button to enable it.
- 2. Set up the trigger
- Create a new trigger and call it mission_init
- Set the Events to initMission
- It will make the spawns selectable right after the mission start
- Create a new action called missionMarkAsRespawnPoint
- Add the squad unit that was created before as the target
- Enable canSpawnOnNeutral and set the team to Both
- These two options need to be enabled in order to make this game mode work.
- Enable tags at the bottom for the units that you set in allowedUnitTypes
Race
Race game mode is a mission type where all players are flying, driving or sailing through the circles, the first player to reach the final circle wins. At the top of the screen there is a time counter and a number that shows your place. It can be made for all available units types. There are no teams, all players are flying are each other.
Setting up the mission settings
- 1. Enable the Race option
- Go to Mission Settings → mission
- Set the type to domination
- Enable gt_race in Game type params
- It enables the Race game mode.
- 2. Select unit types available for the mission
- Go to Versus params and press allowedUnitTypes
- Select the unit type which you want to be playable in the mission
- Airplanes, Tanks, Ships or Helicopters, you can see more than one type.
- 2. (Optional) Disable the ability to shoot during the mission
- Go to Race params
- Enable raceForceCannotShoot
- 2. Add the mission tags
- Save the mission, close the mission editor and open its BLK file
- Copy the code below into the mission{ block
missionType{ _Dom:b=no _Conq:b=no _CnvA:b=no _CnvB:b=no _ArtDA:b=no _ArtDB:b=no _Bttl:b=no _DBttlA:b=no _DBttlB:b=no _Bto:b=no _Flc:b=no _v1_race_straight:b=yes _v1_race_inverted:b=yes _v2_race_straight:b=no _v2_race_inverted:b=no _Conq1:b=no _Conq2:b=no _Conq3:b=no _Conq4:b=no _Conq5:b=no _Conq6:b=no }
- It will be later used to set different spawn for the normal and reversed track version.
- Make sure that you have a squad unit with all players units in it.
Creating waypoints
Waypoints in this game mode are used to set the race track, if you want to make a track that is supposed to have more than one lap then the last waypoint should be close to the first one.
- 1. Create areas
- Create sphere areas, at least 10 of them
- Set their size to at least 100 if the mission is for planes, 40 for ships and 20 for tanks
- Change their name to something short like for example race_waypoint_01, race_waypoint_02
- All of them need to start with the same name and have the number at the end, their order also matters, they can not be placed in order like 01 → 03 → 02.
Creating spawns for players
- 1. Create areas
- Place the sphere area close to the first waypoint
- Spawns need to be placed just before the first waypoint and their direction should be set towards it.
- Set its size to 5 if the mission is for the planes or ships and 2.5 if it is for tanks
- Place them in a similar way that is shown in the screenshot to the right
- Create another set of sphere areas that is placed in front of the last waypoint
- You can just copy the first set and in the Clone window set the name to spawn_reversed_01, they will be named automatically after that.
- This set will be used for the "reversed" configuration.
- Create two new Area_Squad units
- Set the name of the first one to normal_race_spawn and add the first set of areas there
- Set the name of the second one to reversed_race_spawn and do the same
- 2. Create first two triggers and add spawn actions
- Create two triggers
- Set their names to mis_init_normal and mis_init_reversed
- Set the Events in both triggers to initMission
- Add a new condition called missionNamePostfix
- This condition refers to the missionType{ code block.
- In mis_init_normal trigger set the postfix to _v1_race_straight
- Now do the same in the mis_init_reversed trigger but set the postfix to _v1_race_inverted instead
- It will allow the game to use specific spawn zones sets for both configurations, it can be done so there is the same spawn zone for both but it can cause some issues.
- Select mis_init_normal and add a new action called missionMarkAsRespawnPoint
- Set normal_race_spawn as the target
- Set the team to both and enable tags for unit types that you selected in allowedUnitTypes
- Select mis_init_reversed trigger and set it up like the trigger above but use reversed_race_spawn as the target for spawns instead
- Now it should be possible to select a different spawn in the normal and reversed version.
Setting up the triggers
The next step is to assign all created areas for the track to an action.
- 1. Create two new triggers to launch the race mode
- Create two triggers
- Set their names to race_start_normal and race_start_reversed
- Set the Events in both to periodicEvent and set it to 0.01
- Add a missionNamePostfix condition for both
- Set the postfix in race_start_normal to _v1_race_straight and in race_start_reversed to _v1_race_inverted
- 2. Set up the basic options
- Add missionSetTimeSpeed to both triggers
- Set the speed to 0.01 and realtimeTriggers to true
- This is a preliminary set up to show the time counter.
- 3. Add an action to begin the race mode
- Add a new action called beginRaceMode to race_start_normal trigger
- Enable tankRace option if you want the mission to be for ships or tanks and leave it disabled if it is for the airplanes
- Set the checkAreaPrefix and waypointPrefix to the name of track's waypoints, in this case it should be race_waypoint_
- Enable doubleWaypoints
- If enabled it will allow the player to see two waypoints at the same time, the one that is the closest and the next one.
- Set the waypointScale
- It controls how big will be the waypoint marker (circle for planes, arrow with a circle under it for ships and tanks).
- Set the respawnVerticalOffset and respawnForwardOffset to 0
- It sets the respawn position offset after the player dies, makes the vehicle appear in front of the waypoint.
- Enable statisticScreenAfterFinish
- 4. Copy the beginRaceMode action
- Copy the beginRaceMode action to race_start_reversed trigger
- Enable the reverse option
- It will allow the mission to load the track's waypoint in the reversed order.
The next needed trigger is a trigger that checks if there are any active players.
- 1. Create a trigger that check for active players
- Create a new trigger and set its name to a_player_is_active_requirement
- Disable the Enabled option that is located under the trigger's name
- Set the Events to periodicEvent and set its value to 0.10
- Add a new condition called unitWhenStatus and select it
- Set the object to a squad that contains all player units (t1_player01 etc.)
- Set the object_type to isActive
- Set the check_object to any
- Now this condition will check if there are any active players in this session
- 2. Add new actions to enable a_player_is_active_requirement trigger
- Go back to previously created triggers, race_start_normal and race_start_reversed
- Add a new action called triggerEnable at the bottom in both of them
- Set the target to a_player_is_active_requirement in both
Another thing that is required to make everything work is a time counter that shows when the race will begin.
This part is a little harder because the next trigger will use two variables.
- 1. Create two new variables
- Create a new string variable in Properties → Variables window
- Set the name to start_hint_string and leave the value empty
- Create a new integer variable
- Set the name to start_time_integer and set the value to 20
- 2. Create a new trigger for the time counter
- Create a new trigger and set its name to race_start_timer
- Disable the Enabled option
- Go back to the previous trigger (a_player_is_active_requirement) and add a new action called triggerEnable there, then set the target to race_start_timer
- This will make the trigger activate when there are active players in the session.
- Select back the race_start_timer trigger
- Add following conditions and actions:
- Trigger name = "race_start_timer"
- Events
- Periodic Event = 1.00
- Needs to be set to 1 to make it subtract the start_time_integer value by 1 every second.
- Conditions
- varCompareInt (var_value = start_time_integer, value = 0, comparison_func = notLess)
- This condition will keep changing the number of start_time_integer variable until it reaches 0, at the start of the mission it should be set to 20.
- Actions
- Everything from this part will be repeated until the integer number reaches 0.
- varSetString (value = "hints/ffa_race_starts_in_", var ="start_hint_string")
- This will set the value of the start_hint_string string to the text that is stored in the main game's CSV file, in this case it will be Race starts in: .
- varModify (operator = "subAB", value = 1, var = "start_time_integer")
- This variable will be subtracting the start_time_integer variable's value by 1.
- varAddString (var = "start_time_string", value = "@start_hint_integer", digits = 2)
- This will add the number to the text which will be shown on the screen, in this case it will add current number from start_time_integer, for example 3, to the start_time_string value, so it will shown as Race starts in: 3 in game.
- playHint (name = @start_time_integer)
- Used to show the text in game.
- Everything from this part will be repeated until the integer number reaches 0.
- Else
- Everything from there will be activated when the integer number reaches 0.
- unitSetProperties (object = all_players_squad, persistentAerobaticsSmoke = true)
- Optional and only for planes, it will make it so all players will have a smoke effect coming from the their wing tips, you can find that option under the Visual params.
- missionSetTimeSpeed (speed = 1, realtimeTriggers = true)
- Reverts the in game time speed to the default value so players can fly
- wait (time = 2)
- A short delay.
- playHint (name = )
- Set to empty value to hide the text.
- triggerDisable (target = "race_start_timer")
- Disables this trigger.
- Everything from there will be activated when the integer number reaches 0.
- 3. Disable shooting during the race
- Create a new trigger, call it race_shooting_disabled and select it
- Disable the Enabled option under its name
- Set the object to the squad with all player units in it
- Press and disable the cannonShoot option under the Attack params tab
- Switch back to the previous trigger and add a new ElseAction between the missionSetTimeSpeed and wait triggers