7. DYNAMIC SPAWNS
The Dynamic Spawns framework can be used to spawn in any kind of prefab. It can spawn AI groups or vehicles, and can even spawn prefab structures and then update the navmesh to enable the AI to use them. We’re going to use the Framework to spawn in a counter attack on the cottage, AI to fight on the way to the extract, and a vehicle at the extract point. Although we have used static AI already in this scenario, there is an advantage to using the dynamic spawner for all of your AI – for example being able to easily scale what AI spawn based on the number of players.
The latest version of the Dynamic Spawn Framework includes a Spawn Manager. This manager can be used to set certain prefabs to be categorised as “Fireteam” or “Squad” etc., and then when dynamically spawning in units you simply select from a dropdown list which unit type you want, rather than finding the specific unit prefab in the menu (which was laborious!)
Set your Init layer as active again and then navigate in teh resource browser to NightOpsDynamicSpawnFramework>Prefabs>NO_DSF>MP>Managers, which should only have SpawnManager.et in it. Drag this into the map anywhere:
The spawn manager comes pre-made with spawns for the three factions – USSR, FIA and the US, with the default faction being FIA.
If you open up one of the factions, you’ll see prefabs assigned to unit type such as Fire Team, Light Fire Team, Rifle Squad etc. and also 10 Custom Teams where you can set new prefabs (or create your own prefabs and set them as the custom teams)
For this tutorial I’m leaving everything as default except for the default faction, which I have changed to USSR.
SPAWNING AN AI GROUP
For this tutorial I want to spawn two groups of enemies to attack Godfrey’s Cottage as soon as the first player enters the immediate area of the house. So the first thing I’m going to do is switch my active layer to Phase_2. I’m then going to navigate in the Resource Browser to NightOpsDynamicSpawnFramework>Prefabs>NO_DSF and find the BaseSpawnTrigger.et. Drag this onto the map where you want the trigger to be – in my case over the cottage:
In this base spawn trigger you have all of the basic trigger options under unsorted, where you can set how wide the radius is etc. Be aware that the radius starts quite wide at 150m – I’ve taken mine down to 35 to just cover the cottage itself.
In the Spawn Trigger options you have six options. The first will delete the trigger and despawn any units it created when players leave the trigger area. Update Navmesh should only be used if you are spawning in structures. Randomised spawns, as the name suggest, means that you can add several spawns to the trigger and make it random which ones spawn – useful for replayability! The percentage AI is the % of the spawns that should spawn – it is defaulted to 0, which means nothing would spawn is randomised spawns is selected. Finally the Faction is which faction should trigger the spawn, and the “On Player Contact” checkbox being checked would mean that only players can activate the trigger – friendly AI won’t.
I’ve set mine not to delete, not to update the navmesh nor randomise the spawns, the faction to be US and only to trigger on players.
Now we need to tell the trigger what to spawn! We do this by adding SpawnAIGroup prefabs and adding them as children to the BaseSpawnTrigger. These are found in NightOpsDynamicSpawnFramework>Prefabs>NO_DSF>Groups, and I’m just going to be using SpawnAiGroupMove.et. Drag the entity where you want the group to spawn:
This has added a spawn point and two move waypoints as shown opposite
Now drag the SpawnAiGroup onto the BaseSpawnTrigger to make it a child. The BaseSpawnTrigger will spawn all of the spawners that are its children.
Make sure the Spawner itself is on the ground (and not stuck in a tree!) and you can move the waypoints. If you move the spawner, the waypoints with move alongside it.
The spawer has a component NO_SCR_AISpawnerComponent, which contains all of the information for what to spawn.
The only options we’ll be using in the tutorial are those under the “Spawn Manager” category. Spawn immediately means that the group will spawn on mission start rather than waiting for the trigger, and respawn means that when the group is destroyed it will respawn. To spawn a new unit, click on the “+” next to Spawns:
In the new line you have a “Count of players” selector. This is the minimum number of players required to spawn this particular layer. You can create extra spawns to make the mission more difficult with more players. Click on the “+” icon to determine which type of team should spawn, I’ve gone for a Sentry Team:
Then simply select the type of team you want from the drop down. You can have multiple prefabs for each spawn layer.
By default, the spawn layer with the highest count of players spawns and the lower spawn layers don’t. So if you have one spawn layer with a count of players as 1 and another with a count of players of 3, and you have 3 or more players connected then only the spawn layers with a count of players of 3 will spawn – the layer with a 1 player count will not. However, if you have select the “Should stack” option from the Spawn Manager category, both will spawn.
I’ve set mine to have two layers, one with just a sentry team if one player is connect, or a fireteam if three or more players are connected.
The “Ignore Spawn Manager And Use Prefabs” option can be used to spawn groups from different factions other than the default. These work the same way, but you have to find the fireteam in the prefabs (most are under ArmaReforger>Prefabs>Groups using the “..” button:
I’ve added a second trigger with two randomised spawns and set the groups to respawn, with waypoints to intercept the extract location:
To this second trigger, I’m also going to add a vehicle spawner to spawn a humvee at the extract location. To do this navigate to NightOpsDynamicSpawnFramework>Prefabs>NO_DSF>Vehicles, find SpawnVehicle.et and drag it onto the map where you would like the vehicle to spawn:
The options are similar to the group spawn, so you can have different spawn layers for different playercounts. By default the spawner will spawn a BTR70, but you can press the “..” and change the prefab:
There are a few other options you can explore, but for now this is enough for a basic mission.