A Scenario is an asset file type which allows you to define a series of missions that can the player have to complete in a game. Since it’s an asset file, a scenario can be easily used in multiple maps.
To create a new scenario, right-click with the mouse in the project tab and click on: Create -> RTS Engine -> Scenario. An asset file will be then created, select it and define the scenario info from the inspector.
Overview of the scenario asset file inspector:
Scenario General Settings:
- Code: Each scenario must be assigned a unique code that identifies it.
- Name: The name of the scenario which will appear in the game’s scenario UI menu.
- Description: Short description of the scenario which is shown in the campaign menu.
To add a new mission for the scenario, you can simply click the button “Add” which also displays the current mission count. To navigate between missions, you can use both the “<<” (go to previous mission) or the “>>” (go to next mission) buttons. The mission ID that you are currently configuring will be displayed right under the navigation buttons. Right after the mission settings, a “Remove” button will delete the displayed mission when clicked.
General Mission Settings:
The first tab presents fields which apply to all mission types.
- Code: Assign a unique code for each mission
- Type: Pick one of the following types:
- Collect Resource: Player will have to collect a certain amount of a resource type in order to complete this mission.
- Eliminate: Player will have to eliminate certain faction entities (units and/or buildings) in order to complete this mission.
- Produce: Player will have to produce certain faction entities (units and/or buildings) in order to complete this mission.
- Custom: You’ll be able to control the mission’s completion/forfeit conditions through your own components. All custom events and unity events will be triggered to allow to identify the start, completion or failure of the mission.
- Name: The name of the mission which will appear in the scenario’s UI menu when the mission is active.
- Description: The description of the mission which will appear in the scenario’s UI menu when the mission is active.
- Icon: The icon of the mission which will appear in the scenario’s UI menu when the mission is active.
- Survival Time: When enabled, you can input survival time (in seconds) which represents the time that the player requires to survive (not lose the game) when the mission is active in order to complete it. If the player reaches the mission’s objective or the survival time is over and the player’s faction hasn’t been defeated, the mission will be completed, so whichever comes first. In order to have a survival only mission (with no additional objectives), set the mission type to custom.
- Time Limit: When enabled, you can input the time limit (in seconds) which represents the time in which the player has to complete the mission’s objective before it is forfeited.
- Defend Faction Entities: Input the codes/categories of the faction entities (units and/or buildings) that, when dead (only if they belong to the player faction), the player fails the mission.
- Complete Audio: Audio clip played when the player completes this mission.
Custom Mission Settings:
The second tab represents settings which differ from one mission type to another.
- Resource Collection Mission:
- Target Resource: The Resource Type Info asset file that defines the resource type to collect.
- Target Amount: Player needs to collect this amount from the above resource type to complete the mission.
- Elimination/Production Mission:
- Target Code: A list of faction entity (units and/or buildings) codes and/or categories which the player needs to either produce or eliminate.
- Target Amount: The amount of the above faction entity types that need to be either produced or eliminated.
Mission Event Settings:
In addition to the custom events provided for missions in the RTS Engine. You can trigger events for each mission independently by using the following unity event triggers:
- Start Event: Invoked when the mission is started
- Complete Event: Invoked when the mission is completed
- Fail Event: Invoked when the mission is failed.