Author: zorilya
Author Website:

Requirements: No addons required

Version: 1.6

Short description: This script will allow you to make a more lively urban environment

Date: 2013-09-11 10:58

Comments: (10)


Garrison script


This script will allow you to make a more lively urban environment where you have to check every window and door in every house rather than having in the back of your mind 'it's arma, AI don't go in buildings very well'. The units you put into buildings will remain there pretty well under fire but if you get bogged down they will come to you so bust in a clear 'em out. You can also use this to liven up a patrol route by setting the waypoint init with the script so the group gets there and garrisons a nearby building.

Installation/ Usage:
To install copy the sqf files into your mission folder and run with this template the brackets denote optional variables.
nul = [unit,radius,stationary?(,[occupy percentage,maximum],warping?)] execVM "Garrison_script.sqf"
Where 'unit' is the leader of the group your using it on, 'radius' is the radius of the circle within which they will look for buildings and 'stationary' is true or false. you must change these, this is a template!
So an example would be:
nul = [this,100,true,[60,4],false] execVM "Garrison_script.sqf"


Known issue:
just pathinding issues.
AI are still AI and will occasionally be retarded, but what can be done

You may Improve on this design so long as there is atleast a mention of the source and obviously that you share so we can all benifit.

- Added : new optional Variables (capacity limit and warping) for more customised use of the script.
index 3 accepts an array for capacity with two number enries [percentage,maximum].
percentage is the percentage of positions to fill of buildings encountered rounded up.
maximum is the maximum number of units to enter any building. 0 sets no limit.
default : [60,0]
index 4 accepts a boolean to control whether or not the units will walk into position.
if true they just teleport or 'warp' handy for a tidy mission start or dealing with that awkward pathing problem.
default : false
- Added : new AI check to help AI recognise a door as a possible entry point for enemies.
- Changed : silenced check for arma 3 so it now works as intended.
- Fixed : patrol script error where units would just stop if nothing was around.

- fixed repair (was a typo in the code)

- Fixed : sorted roaming problem caused by unstable variable. roaming now works as intended.
- changed : Tweaked the willwalk.sqf to improve roaming.

- Added : cqc reaction funtions. Units are now more aware of enemies when they fire round close by and look in a logical direction.
- Added : garrisoned units can now move inside buildings, improving randomness of the environment.
- Changed : 4 man limit to patrol groups then next group is made and so on.
- Changed : many other little optimisations.

- Added : indoors check to control behaviour i.e. crouching on roofs and balconys (works better than the old top third check);
- Added : check for watch towers (and other buiildings) to avoid 3 units garrisoning the one tower (who makes a one man watch tower with 3 positions? who does that?)
- Added : vision obscured check to stop units looking in useless directions.
- Changed : increased time that script waits for a patrol group before exiting to 4 minutes to handle yet more pathfinding issues.

- Added : small tweak so that units look around a little more, it's random!
- Added : height check relative to building so that units now crouch when on roofs. balconys and overhangs that are not the top of a building are a liitle hit and miss.
- Added : persitance to getting into position. pathfinding being as problematic as it can be, a unit will try a few times to get into position before givin up and joining a patrol group.

- Changed : no longer required the World_build_list.sqf or any other over arching variables. This means you can nowuse in on any map!
- Changed : optimised the script since the first change making it on average 3 seconds faster when executing (less standing around looking gormless).
- Changed : Improved the checks for occuppied buildings to ensure even less doubling up when garrisoning with multiple groups in the same area (seems to only mess up when i accellerate time hehe).
- changed : better system for patrol script to loop (doesn't constantly call the script anymore);

- Removed : all world buildings lists. no need for them any more.
- Removed : annoying debug hints that are no longer needed thanks to patrol script.

- added : redesigned building check to include an occupied variable so as to avoid different groups garrisoning the same building.
- added : patrol script. if all buildings are occupied or none are in range, the group randomly partol around staying in the general area of the nearest building.

- added : compatibility with more islands
- added : randomiser for stationary command

Forum topic:
- Armaholic forums
- BI forums

Enable javascript to be able to download from Armaholic please!

Tags: No tags