Author: JShock
Author Website:

Requirements: No addons required

Version: 1.2

Short description: This function allows a mission developer to garrison buildings in a town/city/village with a user defined percentage based on the overall building count.

Date: 2015-12-19 10:49


Comments: (0)
Rating:



 



Shock's Building Garrison Function (SBGF)

by
JShock


Description:
1. Garrison Function (Spawned Units):
This function allows a mission developer to garrison buildings in a town/city/village with a user defined percentage based on the overall building count.

2. Garrison Function (Editor Placed Units):
This function allows a mission developer to garrison groups of editor-placed units with a simple function call in the group leaders' init field.


Installation / Usage:
Garrison Function (Spawned Units):
The function returns an array of all units spawned in >> [unit,unit,unit]
For the center position you can use a marker, object, or a position array.
When using the percentage parameter, the value must be between 0-1 (i.e. (0.2)).
The function must be spawned, not called.

Place the SBGF folder in your mission directory.
In your description.ext:
class CfgFunctions 
{ 
    #include "SBGF\cfgfunctions.hpp" 
}; 
Example call line (trigger, script, etc.):
_units = ["mrkName",EAST,300,0.3,["O_Soldier_F","O_Soldier_AR_F"],-1] spawn SBGF_fnc_garrison; 

Parameters:
1- Center position: (string/object/position array) (default: objNull)
2- Side of units: (side) (default: EAST)
3- Radius for building search: (scalar) (default: 200)
4- Percentage of used building positions: (scalar (0-1)) (default: 0.2)
5- Types of units to spawn: (array of classnames) (default: ["O_Soldier_F","O_Soldier_AR_F"])
6- (Optional)Define the limit of spawned units: (scalar) (default: -1)
	**This overrides parameter 4  (percent of used building positions) unless (-1) is used**

Garrison Function (Editor Placed Units):
For the center position you can use a marker, object, or a position array.
The function must be spawned, not called.
Parameters:
1- Unit/Group Leader: (object) (note: for use with unit's name or init field using "this" as the parameter)
2- Center position: (string/object/position array) (default: objNull)
3- Radius for building search: (scalar) (default: 200)

Usage:
Place the SBGF folder in your mission directory.
In your description.ext:
class CfgFunctions
{
    #include "SBGF\cfgfunctions.hpp"
}; 
Example call line (trigger, script, etc.):
//For function spawned units
_units = ["mrkName",EAST,300,0.3,["O_Soldier_F","O_Soldier_AR_F"],-1] spawn SBGF_fnc_garrison;

//For editor placed units (in group leader's init field)
[this,"mrkName",200] spawn SBGF_fnc_groupGarrison; 


Changelog:
v1.2
- Optimizations and error fixes

v1.1 hotfix
- fixed some errors

v1.1
- Added second function to garrison editor-placed units (SBGF_fnc_groupGarrison).

v1.0
- Initial Release


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Building,   City,   Garrison,   Town,   Village