Scenario Framework Setup Tutorial – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add more steps)
m (Little changes)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}
The '''Scenario Framework''' is a framework that allows quick scenario creation with a variety of tasks, based on specified, adjustable conditions.
This Tutorial will quickly show you how to setup ScenarioFramework for a new world and create simple scenario.


It is also highly recommended to read through the {{Link|Arma Reforger:Scenario Framework|Scenario Framework}} documentation or have it open and ready.
== World Setup ==


== Principle ==
Open {{Link|Arma Reforger:World Editor}} and load the world of your choice with '''File > Load World''' (or {{Controls|Ctrl|O}}).


The game mode entity's component instanciates all the found areas of action and, depending on their settings, activate layers. The activated layers then live their life and can later activate other layers, depending on actions in the world.
For the purposes of this tutorial, we will use {{Link|enfusion://WorldEditor/worlds/Arland/Arland.ent|Arland}}.


Create a new world using '''File > New World''' (or {{Controls|Ctrl|N}}); in the popup window, select "Sub-scene (of current world)" and click OK.


== Components ==
Once the process is done, save the file using '''File > Save World''' (or {{Controls|Ctrl|S}}), save in the directory of your choice.


{{Feature|informative|All Scenario Framework components can be found in {{hl|Prefabs/ScenarioFramework}}.}}
Try and use the same directory structure as {{armaR}} has, so e.g {{hl|MyModDirectory\worlds\WorldName\WorldName.ent}}.
== Scenario Framework Setup ==


=== Scenario Framework Game Mode Component ===
Once we have that, we need to setup necessary things for the Scenario Framework to work.


The {{Link|enfusion://ScriptEditor/scripts/Game/ScenarioFramework/GameMode/SCR_GameModeSFManager.c|SCR_GameModeSFManager}} game mode component is the scripted component that will manage all the areas.
Open the Game Mode Setup plugin through '''Plugins > Game Mode Setup'''.
{{Feature|informative|
The {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/GameModeSF.et|GameModeSF.et}} game mode prefab is already setup to work with the Scenario Framework.
}}


Areas, layers, slots are Generic Entities with a scripted component where all the settings are. All of them have the following properties:
# Use the two dots (..) in the Template field to target {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/Workbench/GameModeSetup/ScenarioFramework.conf}}. Once done, click Next.
# The '''World Scan''' screen appears asking if you want to scan the world for proper game mode setup. As this is a clean copy of a world, this is not required - click Skip.
# The '''World Configuration''' screen appears to ask if you want to create required entities - click Create entities this time to generate all the required entities.
# The '''World Configuration Completed''' screen appears now, with a potential list of issues to fix; click Next.
# The '''Mission Header''' screen asks about creating a mission header in order for the scenario to appear in the main menu's scenario list - click Create header to do so, then Next on its confirmation and Close on the ending screen.


==== Children ====
Once you are finished, you can find the created entities in the current layer.
'''Spawn Children''' is the children spawning mode and conditions:
== Scenario Framework Usage ==
* ALL: Default option, all layers nested under the current one are spawned
* RANDOM_ONE: Only one child is selected randomly
* RANDOM_MULTIPLE: Multiple children are spawned, based on the Random Percent
* RANDOM_BASED_ON_PLAYERS_COUNT: Children spawning is balanced based on players ratio (connected / max players), the maximum players in the game mode being defined by the mission header


'''Random Percent''' is the spawn chance; it is only used along the {{hl|RANDOM_MULTIPLE}} Spawn Children setting.
=== Spawn Area Creation ===


==== Debug ====
Before we start creating all the fancy tasks and scenario workflows, we need to add a spawn for the player.
'''Show Debug Shapes During Runtime''' Allows to display the debug sphere while playing for debug purpose.


==== Activation ====
# To keep things organised, we create a layer: right-click on the world's subscene (named as the created world, at the bottom of the Hierarchy panel) and we name it "Start".
'''Activation Type''' tells the framework when the component should be initiated:
# Then we make it the active layer by right-clicking on it and choosing "Set as active" (a double-click on it does the same thing).
* ON_INIT: the component is initiated on the start of the game mode. Basically all the Area components in the world are initiated recursively; this means the Area and everything nested under it is checked for its Activation Type and initiated if the activation event is the same as the activation type defined in this attribute
# Then we add a Scenario Framework Area by going to the {{hl|ArmaReforger/Prefabs/ScenarioFramework/Components}} directory and drag and dropping it into the scene ({{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Components/Area.et}})
* ON_TASKS_INIT: used by Areas to let know Layers of type Task to initiate
# Then drag a Layer, but this time drop it on the Area in the Hierarchy panel in order to have it as a child entity of the Area
* ON_TRIGGER_ACTIVATION: the component is initiated by another component - usually another component or a logic initiates the component based on a condition; for example a player stepped into the trigger; this trigger initiates another component which will spawn an object
# Then drag a Slot on the previously created Layer so it looks like this:<br>[[File:armaR-scenario_framework_tutorial_hierarchy.png]]
* ON_AREA_TRIGGER_ACTIVATION: issued by the special type of the Area trigger
# Now, select the Slot ("Slot1") in the Hierarchy tab and find the {{Link/Enfusion|armaR|SCR_ScenarioFrameworkSlotBase}} component to click on it in the '''Object Properties''' panel.
* SAME_AS_PARENT: the activation type is the same as the parent of the component 
# Under the Asset category, we click on two dots (..) for the '''Object To Spawn''' attribute to assign it the {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/MP/Spawning/SpawnPoint_US.et}} Prefab. That way, we have added spawning Spawnpoint for the US Faction using the Scenario Framework.
* CUSTOM1-4: predefined for custom events, anyone can use it for its own purpose


=== Area ===
Press {{Controls|Ctrl|S}} to save the world.


An '''area''' is the topmost container to any other framework component. It can contain '''layers''' as well as '''slots'''.
You can already try if it is working for you and if you will get spawned on the position where you put that Slot which holds the Spawnpoint by pressing the World Editor's Play button (or {{Controls|F5}}).
{{Feature|important|Only Areas and their content will be detected by the framework. Any layer/slot that is not contained in an area will be ignored.}}


=== Layer ===


A '''layer''' can be seen as a main task container. It can contain other layers as well as '''slots'''. It has the following properties:
Let's add another Slot under the same Layer to give players the Arsenal in order for them to customise their loadout.


=== Slot ===
We will do it the same way as with the SpawnPoint but using {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Props/Military/Arsenal/ArsenalBoxes/US/ArsenalBox_US.et}} (the one in {{hl|Prefabs/Props/Military/Arsenal/ArsenalBoxes/US/}}) for the '''Object To Spawn''' attribute.


A '''slot''' is a layer's information - it can be seen as a task's parameter. It has events that can perform actions. It has the following properties:
In order to give a player some vehicle to move around, we will add a third slot and use the {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Vehicles/Wheeled/M998/M1025.et}} Prefab (or the {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Vehicles/Wheeled/M998/M1025_MERDC.et}} for the camo version).


==== Asset ====
In a similar fashion, you can build up your starting area any way you like.
'''Object To Spawn''' points to an {{hl|.et}} file to create the entity to be picked up (then delivered). It will be created upon slot's activation.


Ticking '''Use Existing World Asset''' will instead use an existing prefab by finding all entities of '''Object To Spawn''' type in a 2.5m range and registers it to the slot. 
The end result should look like this:
This is useful in cases the slot is used as a subject to task ( i.e. destroy the radar ) or if someone needs to assign a name to the existing asset without changing the original (see ID)
:: [[File:armaR-scenario_framework_tutorial_hierarchy_complete.png]]


'''Faction''' sets the {{hl|#Extraction Slot}} trigger's side detection - it is not used anywhere else for now.
=== Add a Move Task ===


'''ID''' is used to either target the existing world asset (if it does not have a prefab) or to name the spawned object.
Now is the time for some Tasks to be created.


=== Action ===
For starters, we will create one of the most simple task that is Task Move.


An '''action''' is an effect that happens on Slot update, whether it is created, failed, progressed, updated or finished.
# Before we start, it is good to organise these things via layers in a similar fashion as the Start layer, so we will create the FirstTask layer and set it as active (see {{Link|#Spawn Area Creation}} above for a reminder of how to create a layer and set it as current).
# Then we find a suitable location and we create an Area there by drag and dropping it from the Components folder the same way we did with the spawn area.
# But then, instead of the Layer, we will find the {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Components/LayerTaskMove.et}}, drag and drop it in the freshly created Area (Area2 if you did not rename any).
# Then, we drag and drop a {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Components/SlotMoveTo.et}} into this LayerTaskMove.
# Notice that the slot's sphere is larger. This visualises the trigger radius for the Task Move you just created.
# All you have to do now is launch the game (Play button or {{Controls|F5}}), open the map and then open the Task List (default {{Controls|J}}) to see the Task.


=== Getter ===
And when you move your character in the trigger, you will complete the objective.


A '''getter''' is a class used by actions to determine an action's target, depending on the chosen getter and its provided parameters.
=== Add a Random Destroy Task ===


{| class="wikitable"
Since this was pretty easy, let's expand this scenario a little bit by adding a Task Destroy vehicle once you complete the Task Move.
! Getter
! Description
! Parameter
! Return Value
|-
| CP_Get
| Not to be used - it is the parent class.
|
|
|-
| CP_GetCountEntitiesInTrigger
| Returns the number of objects in the given trigger
| Name of the trigger object
| int
|-
| CP_GetEntityByName
| Returns the ( pointer to ) object specified in the name
| Name of the object
| IEntity
|-
| CP_GetLastFinishedTaskEntity
| The SF game mode remembers the last finished task. This action returns the task entity of the last finished task  
|
| IEntity
|-
| CP_GetListEntitiesInTrigger
| Returns array of entities located in the trigger area.
| Name of the trigger object
| array<IEntity>
|-
| CP_GetPlayerEntity
| Returns the player
|
| IEntity
|-
| CP_GetTask
| Returns the task object specified by the name of the Layer Task
| Name of the task layer
| IEntity
|}


# To keep things organised, we create another layer and name it SecondTask, then set it as active.
# Again, we create an Area, but to make it more interesting, we will randomise the kind of vehicle we will want to destroy.<br><!--
-->It can be achieved in various ways but the safest approach is to put a {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Components/LayerTaskDestroy.et}} under Area3 hierarchy
# After selecting the ''SCR_ScenarioFrameworkLayerTaskDestroy'' component, set its '''Spawn Children''' attribute value to {{hl|RANDOM_ONE}} and change the '''Activation Type''' to {{hl|ON_TRIGGER_ACTIVATION}}
# Now, add two Layers under this hierarchy
# Under each of these Layers, add a {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Components/SlotDestroy.et}} Prefab
# Now let's define what we want to destroy. In SlotDestroy1 we will put {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Vehicles/Wheeled/UAZ469/UAZ469.et}} and in the SlotDestroy2 {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Vehicles/Wheeled/Ural4320/Ural4320_transport_covered.et}} as '''Object To Spawn'''.
# Then we will head back to the FirstTask layer where we added the Task Move, select the LayerTaskMove1, click on its {{hl|SCR_ScenarioFrameworkLayerTask}} component and in the category '''OnTaskFinished''', we will add an Action by clicking on the plus '''+''' icon
#* Search for "SpawnObjects" to find the {{hl|SCR_ScenarioFrameworkActionSpawnObjects}} action and select it
#* Now we expand the action by clicking on that arrow and click on the plus '''+''' icon in the '''Name Of Objects To Spawn On Activation''' attribute
#* And then input the LayerTaskDestroy1 name as the first item in the list
# Now you can try it in-game. This setup will result in a behavior that will not spawn Task Destroy right away, but only after you complete the Task Move.<!--
--> Since we added the {{hl|RANDOM_ONE}} and two layers under the LayerTaskDestroy1, it will randomly pick one of the two SlotDestroy, helping to make less repetitive scenarios.


== Layer Types ==
=== Add a Game Over ===


=== LayerTask ===
# To conclude this scenario, we can end it by adding an EndMission action in the '''OnTaskFinished''' on the LayerTaskDestroy1
#* Tick the '''Override Game Over Type''' attribute checkbox
#* Set Game Over Type to {{hl|FACTION_VICTORY_SCORE}} which will end the mission upon completing Task Destroy.


==== OnTaskX ====
'''Trigger Actions On Finish''' is an array of actions to take when the task finishes.


=== LayerTaskClearArea ===


=== LayerTaskDeliver ===
That's it!


{{Feature|informative|See also {{Link|#LayerTask}}.}}
Now go ahead and try other Layer/Slot types.


==== Task ====
If needed, see the {{Link|Arma Reforger:Scenario Framework|Scenario Framework}} documentation for more details!
'''Task Title Updated''' is the new task's title when the item is collected.
 
'''Task Description Updated''' is the new task's description when the item is collected.
 
=== LayerTaskDestroy ===
 
{{Feature|informative|See also {{Link|#LayerTask}}.}}
 
=== LayerTaskMove ===
 
{{Feature|informative|See also {{Link|#LayerTask}}.}}
 
This layer is a LayerTask with a {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Tasks/TaskMove.et|TaskMove}} task prefab created.
 
 
== Slot Types ==
 
=== SlotAI ===
 
==== Waypoints ====
There are several ways to assign a waypoint to the group:
* By specifying the waypoint to spawn with '''WP To Spawn'''
* By creating the Waypoint Set with '''Waypoint Group Names'''
If '''Waypoint Group Names''' is left empty, then '''WP To Spawn''' is used. If '''WP To Spawn''' is empty, the group will be provided a default patrol waypoint.
 
'''Waypoint Group Names''' is the list of wanted waypoints for the created group. If multiple Waypoint Sets are defined, a random one is used.
* Name: Name of the single waypoint (slot with waypoint prefab) or name of the layer including the waypoints (slots nested under the layer). 
* Use Random Order: if there are multiple waypoints in the layer this option will shuffle them. This way, the waypoint set can be used for more AIs not following the same pattern.
* Cycle Waypoints: it creates an endless loop. Once the last waypoint is reached, the AI will repeat waypoints.
 
'''Spawn AI On WP Pos''' makes the AI spawned on the first waypoint's position instead of the original spawn position.
 
'''WP To Spawn''' defines the waypoint prefab to spawn on the slot's position. This waypoint is used if '''Waypoint Group Names''' is left empty.
 
==== Misc ====
'''Balance On Players Count''' will change the amount of spawned group units depending on the number of players.<br>
The minimum possible amount is between 1 and 3 units, the maximum is the whole group.
 
=== SlotTask ===
 
==== Task ====
'''Task Title''' is the original task's title.
 
'''Task Description''' is the task's description in the task list (it overrides the one defined in the LayerTask); %1 in the text will be replaced by the display name of the object or by the text specified in the Override Object Display Name attribute.
 
==== OnTaskX ====
'''Actions On Finished''' is an array of actions to take when the task finishes.
 
'''Actions On Created''' is an array of actions to take when the task is created.
 
'''Actions On Failed''' is an array of actions to take when the task fails.
 
'''Actions On Progress''' is an array of actions to take when the task progresses - e.g an object is picked up
 
'''Actions On Updated''' is an array of actions to take when the task gets updated - e.g a picked-up object is dropped
 
=== SlotClearArea ===
 
{{Feature|informative|See also {{Link|#SlotTask}}.}}
 
==== Plugins ====
Only the '''Area Radius''' attribute is usaed as all the other attributes are already defined in the trigger prefab (defined in Asset > Object To Spawn).
 
=== SlotDelivery ===
 
{{Feature|informative|See also {{Link|#SlotTask}}.}}
 
=== SlotDestroy ===
 
{{Feature|informative|See also {{Link|#SlotTask}}.}}
 
=== SlotExtraction ===
 
{{Feature|informative|See also {{Link|#SlotTask}}.}}
 
=== SlotMoveTo ===
 
{{Feature|informative|See also {{Link|#SlotTask}}.}}
 
This slot is a SlotTask with a {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/ScenarioFramework/Tasks/TaskMove.et|TaskMove}} task prefab created.
 
=== SlotPick ===
 
{{Feature|informative|See also {{Link|#SlotTask}}.}}
 
It is a slot that spawns or registers the entity to be delivered; said entity should have the inventory item component in order to be delivered using the character's or vehicle's inventory. It inherits from {{Link|#SlotTask}}.<br>
It is part of the [[#Deliver Task Example|Deliver Task]] set.
 
==== Task ====
'''Task Title Updated 1''' is the task's title when the item is picked up.
 
'''Task Description Updated 1''' is the task's description when the item is picked up.
 
'''Task Title Updated 2''' is the task's title when the item gets dropped.
 
'''Task Description Updated 2''' is the task's description when the item gets dropped.
 
=== SlotTrigger ===
 
Create a trigger to be used by other slots.
{{Wiki|TODO|Check}}
 
 
== Action Types ==
 
=== ActionEndMission ===
 
This action simply ends the mission - no settings are available.
 
=== ActionExecuteFunction ===
 
This action allows a method to be executed on the object designated by the action's fields.
 
Example: {{hl|CP_GetEntityByName}} &rarr; Entity Name (e.g "MyCar") &rarr; method to call + one parameter.
 
=== ActionIncrementCounter ===
 
This action increments the named counter by 1.
 
=== ActionPlaySound ===
 
This action plays a sound (with a 2 seconds delay).
 
=== ActionPlaySoundOnEntity ===
 
This action plays a sound on the provided entity (with a 2 seconds delay).
 
=== ActionResetCounter ===
 
This action resets the counter under which it is placed.
{{Wiki|TODO|Check}}
 
=== ActionShowHint ===
 
This action shows a hint to every connected players.
 
=== ActionSpawnClosestObjectFromList ===
 
This action spawns the layer/slot that is the closest from the name list.
{{Wiki|TODO|Check}}
 
=== ActionSpawnObjects ===
 
This action spawns the layers and slots that are defined in the Spawn Object by name.
{{Feature|important|Activation Type must be set to {{hl|ON_TRIGGER_ACTIVATION}}.}}
 
 
== Examples ==
 
An example scenario is available as two worlds:
* {{Link|enfusion://WorldEditor/worlds/ScenarioFramework/SF-Tutorial-Empty.ent|SF-Tutorial-Empty.ent}} - the base world
* {{Link|enfusion://WorldEditor/worlds/ScenarioFramework/SF-Tutorial-Full.ent|SF-Tutorial-Full.ent}} - the base world populated with tasks
 
=== Tasks ===
 
==== Move ====
A '''Move''' task requires an Area holding a Move task holding a MoveTo slot.
 
==== Destroy ====
A '''Destroy''' task requires an Area holding a Destroy task holding a Destroy slot.
 
{{Feature|informative|
* The target entity can be spawned during the scenario or it can be already existing in the world.
* The target entity '''must''' have the {{hl|Destruction}} Component.
}}
 
==== Clear Area ====
A '''Clear Area''' task requires an Area holding a ClearArea task holding both a ClearArea and an AI slots.
 
==== Deliver ====
A '''Deliver''' task requires an Area holding a Deliver task holding both a Pickup and a Delivery slots.
{{Feature|important|There can be multiple possible destinations but only '''one''' must exist at the same time - use spawn conditions to do so.}}
 
 
== Tutorial ==
 
This tutorial explains how to be tasked to walk near a vehicle, get in it, bring it to a certain location, destroy it, then run to an extraction point.
 
=== World Setup ===
 
* Start '''Arma Reforger Tools'''
* Create a new Project - name it "Scenario Framework Tutorial"
* Open {{Link|enfusion://WorldEditor/worlds/ScenarioFramework/SF-Tutorial-Empty.ent|SF-Tutorial-Empty.ent}} and use {{Controls|Ctrl|N}} to create a new sub-scene of the current world
* Eventually, change the {{hl|WeatherAndTime}} entity to modify the date and time of the scenario
* Save with {{Controls|Ctrl|S}} in {{hl|ScenarioFrameworkTutorial/world/ScenarioFramework}} (you will have to create these two directories) as {{hl|SF-Tutorial-Example.ent}}
 
{{Feature|informative|
The US Spawn Point is where the player will (re)spawn.
* {{Link|enfusion://WorldEditor/worlds/ScenarioFramework/SF-Tutorial-Full.ent;83.2831,10.6734,1.06723;-34.1989,-28.9578,0;323|SF-Tutorial-Full link}}
* {{Link|enfusion://WorldEditor/worlds/ScenarioFramework/SF-Tutorial-Empty.ent;83.2831,10.6734,1.06723;-34.1989,-28.9578,0;323|SF-Tutorial-Empty link}}
* {{Link|enfusion://WorldEditor/worlds/ScenarioFramework/SF-Tutorial-Example.ent;83.2831,10.6734,1.06723;-34.1989,-28.9578,0;323|SF-Tutorial-Example link}} - requires the mod to be loaded
}}
 
=== Entity Setup ===
 
* Create a new layer ({{hl|Hierarchy}} tab > right-click on {{hl|SF-Tutorial-Example}} > {{hl|Create layer}} and name the layer {{hl|Entities}} - a layer in which scenario-related entities will be placed
* Place a {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Vehicles/Wheeled/UAZ469/UAZ469.et|UAZ469.et}} entity in the wanted location
** press {{Controls|Ctrl|PageDown}} to place it according to the ground below it
** in its '''Components''', search "dam" to find the {{hl|SCR_VehicleDamageManagerComponent}}
** name the UAZ {{hl|TargetUAZ}}
*** under {{hl|Additional hit zones}} > {{hl|Hull}}, set {{hl|Incendiary multiplier}} to '''5''' - this in order for the fire to destroy and blow up the vehicle faster
No need for more; once all the systems are working, the mission will see decorations/AI/etc added to it - not before!
 
=== Framework Setup ===
 
<!--
* Find the {{hl|GameModeSF1}} entity in the {{hl|SF-Tutorial-Empty}} layer. In its components, find {{hl|SCR_GameModeSFManager}}
** Add three entries in {{hl|Task Types Available}}:
*** DELIVER
*** DESTROY
*** EXTRACTION
* Create a new layer ({{hl|Hierarchy}} tab > right-click on {{hl|SF-Tutorial-Example}} > {{hl|Create layer}} and name the layer {{hl|ScenarioFramework}} - a layer in which only Scenario Framework entities will be placed
** Double-click on it to make it the active one
* Place an Area (found in {{hl|ArmaReforger/Prefabs/ScenarioFramework/'''Components'''}})
 
==== Move to UAZ ====
* Drag and drop a LayerTaskMove under the Area, name it "A_TaskMoveToUAZ" and place it near the UAZ
** {{hl|B_MoveUAZToDestination}}
** Add an OnTaskFinished action "Spawn Objects" entry and set the {{hl|Name Of Objects To Spawn}} to {{hl|B_MoveUAZToDestination}} - this will create the next task on this task's completion
* Drag and drop a SlotMoveTo under it
 
==== Deliver the UAZ ====
* Drag and drop a LayerTaskDeliver under the Area, name it "B_MoveUAZToDestination"
** Set its Activation Type to {{hl|ON_TRIGGER_ACTIVATION}} - the task will be activated by the "Move to UAZ" task's completion
** Add an OnTaskFinished action "Spawn Objects" entry and set the {{hl|Name Of Objects To Spawn}} to {{hl|C_DestroyUAZ}} - this will create the next task on this task's completion
* Drag and drop a SlotPick under it, placed near the UAZ
** Tick "Use Existing World Asset" and fill "ID" with {{hl|TargetUAZ}} in order to target the previously placed UAZ
 
==== Destroy the UAZ ====
* Drag and drop a LayerTaskDestroy under the Area, name it "C_DestroyUAZ"
** Set its Activation Type to {{hl|ON_TRIGGER_ACTIVATION}} - the task will be activated by the "Deliver the UAZ" task's completion
** Add an OnTaskFinished action "Spawn Objects" entry and set the {{hl|Name Of Objects To Spawn}} to {{hl|D_Extract}} - this will create the next task on this task's completion
* Drag and drop a SlotDestroy under it
** {{Wiki|TODO}}
 
==== Extract ====
* Drag and drop a LayerTaskMove under the Area, name it "D_Extract"
** Set its Activation Type to {{hl|ON_TRIGGER_ACTIVATION}} - the task will be activated by the "Destroy the UAZ" task's completion
** Add an OnTaskFinished action "End Mission" entry - there are no parameters, the mission will end a default ending
* Drag and drop a SlotExtraction under it
{{Feature[informative|Alternatively, a {{hl|SetTaskExtraction}} Task Set is available: {{hl|Prefabs/ScenarioFramework/Sets/SetTaskExtraction.et}}.}}
 
And that's it! Playing the mission in World Editor should make the tasks flow naturally.
-->
 
{{Wiki|TODO|To Be Continued&hellip;!}}




{{GameCategory|armaR|Modding|Tutorials|Scenario}}
{{GameCategory|armaR|Modding|Tutorials|Scenario}}

Latest revision as of 01:25, 17 April 2024

This Tutorial will quickly show you how to setup ScenarioFramework for a new world and create simple scenario.

It is also highly recommended to read through the Scenario Framework documentation or have it open and ready.

World Setup

Open World Editor and load the world of your choice with File > Load World (or Ctrl + O).

For the purposes of this tutorial, we will use Arland.

Create a new world using File > New World (or Ctrl + N); in the popup window, select "Sub-scene (of current world)" and click OK.

Once the process is done, save the file using File > Save World (or Ctrl + S), save in the directory of your choice.

Try and use the same directory structure as Arma Reforger has, so e.g MyModDirectory\worlds\WorldName\WorldName.ent.

Scenario Framework Setup

Once we have that, we need to setup necessary things for the Scenario Framework to work.

Open the Game Mode Setup plugin through Plugins > Game Mode Setup.

  1. Use the two dots (..) in the Template field to target ScenarioFramework.conf. Once done, click Next.
  2. The World Scan screen appears asking if you want to scan the world for proper game mode setup. As this is a clean copy of a world, this is not required - click Skip.
  3. The World Configuration screen appears to ask if you want to create required entities - click Create entities this time to generate all the required entities.
  4. The World Configuration Completed screen appears now, with a potential list of issues to fix; click Next.
  5. The Mission Header screen asks about creating a mission header in order for the scenario to appear in the main menu's scenario list - click Create header to do so, then Next on its confirmation and Close on the ending screen.

Once you are finished, you can find the created entities in the current layer.

Scenario Framework Usage

Spawn Area Creation

Before we start creating all the fancy tasks and scenario workflows, we need to add a spawn for the player.

  1. To keep things organised, we create a layer: right-click on the world's subscene (named as the created world, at the bottom of the Hierarchy panel) and we name it "Start".
  2. Then we make it the active layer by right-clicking on it and choosing "Set as active" (a double-click on it does the same thing).
  3. Then we add a Scenario Framework Area by going to the ArmaReforger/Prefabs/ScenarioFramework/Components directory and drag and dropping it into the scene (Area.et)
  4. Then drag a Layer, but this time drop it on the Area in the Hierarchy panel in order to have it as a child entity of the Area
  5. Then drag a Slot on the previously created Layer so it looks like this:
    armaR-scenario framework tutorial hierarchy.png
  6. Now, select the Slot ("Slot1") in the Hierarchy tab and find the SCR_ScenarioFrameworkSlotBase component to click on it in the Object Properties panel.
  7. Under the Asset category, we click on two dots (..) for the Object To Spawn attribute to assign it the SpawnPoint_US.et Prefab. That way, we have added spawning Spawnpoint for the US Faction using the Scenario Framework.

Press Ctrl + S to save the world.

You can already try if it is working for you and if you will get spawned on the position where you put that Slot which holds the Spawnpoint by pressing the World Editor's Play button (or F5).


Let's add another Slot under the same Layer to give players the Arsenal in order for them to customise their loadout.

We will do it the same way as with the SpawnPoint but using ArsenalBox_US.et (the one in Prefabs/Props/Military/Arsenal/ArsenalBoxes/US/) for the Object To Spawn attribute.

In order to give a player some vehicle to move around, we will add a third slot and use the M1025.et Prefab (or the M1025_MERDC.et for the camo version).

In a similar fashion, you can build up your starting area any way you like.

The end result should look like this:

armaR-scenario framework tutorial hierarchy complete.png

Add a Move Task

Now is the time for some Tasks to be created.

For starters, we will create one of the most simple task that is Task Move.

  1. Before we start, it is good to organise these things via layers in a similar fashion as the Start layer, so we will create the FirstTask layer and set it as active (see Spawn Area Creation above for a reminder of how to create a layer and set it as current).
  2. Then we find a suitable location and we create an Area there by drag and dropping it from the Components folder the same way we did with the spawn area.
  3. But then, instead of the Layer, we will find the LayerTaskMove.et, drag and drop it in the freshly created Area (Area2 if you did not rename any).
  4. Then, we drag and drop a SlotMoveTo.et into this LayerTaskMove.
  5. Notice that the slot's sphere is larger. This visualises the trigger radius for the Task Move you just created.
  6. All you have to do now is launch the game (Play button or F5), open the map and then open the Task List (default J) to see the Task.

And when you move your character in the trigger, you will complete the objective.

Add a Random Destroy Task

Since this was pretty easy, let's expand this scenario a little bit by adding a Task Destroy vehicle once you complete the Task Move.

  1. To keep things organised, we create another layer and name it SecondTask, then set it as active.
  2. Again, we create an Area, but to make it more interesting, we will randomise the kind of vehicle we will want to destroy.
    It can be achieved in various ways but the safest approach is to put a LayerTaskDestroy.et under Area3 hierarchy
  3. After selecting the SCR_ScenarioFrameworkLayerTaskDestroy component, set its Spawn Children attribute value to RANDOM_ONE and change the Activation Type to ON_TRIGGER_ACTIVATION
  4. Now, add two Layers under this hierarchy
  5. Under each of these Layers, add a SlotDestroy.et Prefab
  6. Now let's define what we want to destroy. In SlotDestroy1 we will put UAZ469.et and in the SlotDestroy2 Ural4320_transport_covered.et as Object To Spawn.
  7. Then we will head back to the FirstTask layer where we added the Task Move, select the LayerTaskMove1, click on its SCR_ScenarioFrameworkLayerTask component and in the category OnTaskFinished, we will add an Action by clicking on the plus + icon
    • Search for "SpawnObjects" to find the SCR_ScenarioFrameworkActionSpawnObjects action and select it
    • Now we expand the action by clicking on that arrow and click on the plus + icon in the Name Of Objects To Spawn On Activation attribute
    • And then input the LayerTaskDestroy1 name as the first item in the list
  8. Now you can try it in-game. This setup will result in a behavior that will not spawn Task Destroy right away, but only after you complete the Task Move. Since we added the RANDOM_ONE and two layers under the LayerTaskDestroy1, it will randomly pick one of the two SlotDestroy, helping to make less repetitive scenarios.

Add a Game Over

  1. To conclude this scenario, we can end it by adding an EndMission action in the OnTaskFinished on the LayerTaskDestroy1
    • Tick the Override Game Over Type attribute checkbox
    • Set Game Over Type to FACTION_VICTORY_SCORE which will end the mission upon completing Task Destroy.


That's it!

Now go ahead and try other Layer/Slot types.

If needed, see the Scenario Framework documentation for more details!