Vehicle spawner

## Introduction

The mod includes a powerful vehicle spawner function that allows you to turn any object into a vehicle spawner. The spawner then allows you to spawn any vehicle from a computer interface, accessible via ACE3 interactions. From the interface you can filter vehicles by type/faction/Mod/dlc. Mission makers can define what factions, dlc, mod, are available for a mission. You can exclude vanilla assets for example, or only allow RHS USMC vehicles so as not two see players spawn "out of theme" vehicles.

The spawner reads config files and can display a preview image of the desired vehicle.

## Function

A single function is used that can be used in different ways. Here's the function header.

```
Function name: MRH_fnc_Spawner
    Author: Mr H.
    Description:
    This function makes an object a vehicle spawner and gives it an interface, allowed factions, mods and dlcs can ge defined via cba settings by mission makers, the spawner can include all vehicles or filter them by types, (Air Land, Sea)
    Return value:None
    Public: Yes
    Parameters:
    0 - <OBJECT> - Source object that serves as a spawner interface, a laptop is appropriate.
    1 -<OBJECT>- OPTIONNAL - object that serves as a spawn point, preferably an invisible helipad, note that the vehicle will spawn with the same direction the object has (useful for planes spawning facing the landing strip etc ) if undefined vehicle will be spawned a few meters behind the source object.
    2- <STRING> - OPTIONNAL (requires parameter 1 to be defined) - type of vehicles this particular spawner will spawn, can be "Air","Land", "Sea" or "All". If you have multiple spawners in a mission they can all have different types. If undefined type will be "All"
    Example(s):
    [this] call MRH_fnc_Spawner;
    or
    [laptop1,helipad1] call MRH_fnc_Spawner;
    or
    [this,helipad1,"Air"] call MRH_fnc_Spawner;

```

In the examples below, the function is called from the spawner access point object's initbox. Refered to  as "this" in arma sqf script.

if you call the spawner with only one parameter

```
[this] call MRH_fnc_Spawner;

```

The  spawner will spawn all types of vehicles (still filtered by the mission's settings, see below). And will spawn them 30 meters behind the object you have defined as a spawn access point.

You can also call the spawner functions with two parameters:

```
 [this,helipad1] call MRH_fnc_Spawner;

```

Where the second parameter is an object whose location will serve as a position for vehicles, it is advisable to use an invisible helipad for that purpose. Note that the spawned vehicle will face the same direction as the reference spawnpoint object. (Even invisible helipads have a direction that you can turn around in the editor). This is very useful if you want to spawn planes facing the landing strip of an airport, or nose toward's the exit from a hangar.

Finally you can call the spawner with a third parameter:

```
[this,helipad1,"Air"] call MRH_fnc_Spawner;

```

The parameter can be "Air", "Land", "Sea" or "All" and is self explanatory. "Land" will only show terrestrial vehicles for the spawner for example. You can set up multiple spawners with different parameters.
Note that any previously spawned vehicle remaining within a 5 meters radius around the spawn point will be deleted upon  spawning a new one. This sometimes causes issues with bigger vehicles (such as RHS AFRF Tu-95 planes) that do not get deleted. In that case Arma creates the new vehicle wherever there's room for it in the vicinity.

## Settings

The spawner settings are generated after loading in the editor or in game, they are generated depending on what mods are activated by the user/ on the server. Mission makers can select what factions, what mods, and what dlcs are accessible from the mission. These settings can be set either on the server and in the mission and will be imposed on every client.

the settings can be found under **settings>>configure addons>>MRHSpawner Allowed DLCs** and **settings>>configure addons>>MRHSpawner Allowed Factions**  these settings will be applied to every spawner in the mission.

## Caveats

Since the spawner automatically generates its settings from config files, its settings are dependent on what mods the mission maker has activated when they edit their mission and on what mods are activated on the server. The spawner is also highly dependent on how mod makers have scripted and organized their vehicles config files. The spawner behaves as expected with: CUP vehicles, RHS USAF, RHS AFRF, Project Opfor and Vanilla/official DLCs. Last time I tried it with 3CB BAF vehicles the vehicles didn't show. I haven't tested it with other mods. While I will ensure that it is compatible with the 'big modes' out there. I cannot possibly offer support for every vehicle mod there is. If you are willing to contribute in adding compatibility for different mods you can always fork the mod on github and contribute to its enhancement.