====== Garrison ======
[[#headless_client_support|{{:tmf:hcicon.png?nolink&}}]] [[#trigger_support|{{:tmf:triggericon.png?nolink&}}]]
The garrison module can be used to spawn units inside buildings in a garrisoned state (will remain standing and not leave their post). The positions are chosen randomly at mission start (or trigger activation if a trigger is synced). Building positions will be selected inside the area of the module. If you would like to add further areas you can syncronize [[:tmf:area|area]] modules to provide extra areas to be searched for building positions.
Each unit [[:tmf:sync|synced]] to the garrison module will become a possible unit to be spawned inside the area. If you want to increase the chance of a certain unit to spawn, [[:tmf:sync|sync]] several versions of it. Note the module will also apply TMF loadouts or arsenal loadouts that are applied to the synced units.
===== Usage =====
Put down the module and adjust the module area to contain buildings you intend the AI to spawn in.
{{:tmf:garrison1.jpg?800}}
Configure the module options to set the number of AI to spawn inside buildings and whether the AI should hold their position.
{{:tmf:garrison2.jpg?800}}
Example of the spawned AI:
{{:tmf:garrison3.jpg?800}}
You can also sync TMF Area modules to the Garrison module to expand the area of building selection.
{{:tmf:tmf_garrison_usage.png?800}}
===== Trigger support =====
The garrison module can be activated once by a trigger.
Simply [[:tmf:sync|sync]] the trigger to the module and when activate the garrison module will activate.
===== Headless client support =====
By [[:tmf:sync|syncing]] a headless client unit to the module.
The module will spawn the units on the [[:tmf:headlessclient|HC]] instead.
===== API - retrieve spawned units =====
The units spawned by the garrison module can be retrieved with the following code:
module getVariable "spawned_units"
Example usage: Re-enabling the movement of the AI.
//This code can be placed in a trigger on activation to enable the units to move again (assumes the garrison module is called garrison_1).//
{_x enableAI "PATH"} forEach (garrison_1 getVariable "spawned_units")