Thanks LoTekk, I got the script working.
I added a few extra parameters to see if I could kick start some reactions out of the AI (see below)
; init command line is: [0,1,2,3,4] exec "patrolteamday.sqs"
; where:
; value 0 is name of group, e.g. teamy
; value 1 is the marker position where troops are spawned (x,y,z), e.g getMarker Pos "markery"
; value 2 is the number of units to be spawned, from 2-12, e.g. 4
; values 3 the patrol radius from spawn point in m, e.g. 200
; value 4 is the pause at each waypoint in sec, e.g. 40
; so e.g. would be [teamy, getMarkerPos "markery", 4, 200, 40] exec "patrolteamday.sqs"
;=================GET PARAMETERS========================
;get parameters
_team = grpNull
_team = _this select 0
_base = _this select 1
_scale = _this select 2
_range = _this select 3
_pause = _this select 4
;============INIT VALUES================================
_cycle = 0
_types=["BAS_RebelOfficerHD","BAS_RebelSoldierHD","BAS_RebelSoldier2HD","BAS_RebelSoldier3HD","BAS_RebelSoldier4HD","BAS_RebelSoldier5HD","BAS_RebelMGunnerHD","BAS_RebelRPGSoldierHD","BAS_RebelRTOHD","BAS_RebelMedicHD","BAS_MilitiaAKMHD", "BAS_MilitiaSKSHD","BAS_MilitiaFALHD","BAS_MilitiaG3HD","BAS_MilitiaRPDHD","BAS_MilitiaPKMHD","BAS_MilitiaRPGHD", "BAS_MilitiaRPGAAHD","BAS_MilitiaRPGAPHD","BAS_MilitiaWAKMHD","BAS_MilitiaWSKSHD","BAS_MilitiaWFALHD","BAS_MilitiaWG3HD","BAS_MilitiaWRPDHD","BAS_MilitiaWPKMHD","BAS_MilitiaWRPGHD","BAS_MilitiaWRPGAAHD","BAS_MilitiaWRPGAPHD"]
;========================SPAWN LEADER==================
#spawnleader
_z = (random (count _types))
_z = (_z -(_z mod 1))
_guy = _types select _z
_guy createUnit [_base, _team, "", 0.1, "CAPTAIN"]
_leader = (units _team select 0)
formLeader _leader
_cycle = _cycle + 1
;=============================SPAWN TEAM=====================
#spawnteam
_z = (random (count _types))
_z = (_z -(_z mod 1))
_guy = _types select _z
_guy createUnit [_base, _team, "", 0.1]
_cycle = _cycle + 1
?(_cycle < _scale):goto "spawnteam"
;===========PATROLLING=========================
#moveout
_team setBehaviour "SAFE"
_team setSpeedMode "LIMITED"
_team setCombatMode "RED"
_team setFormation "WEDGE"
#patrolagain
({_x setBehaviour "SAFE"} forEach units _team)
_team move [(_base select 0) - _range + (random (2 * _range)), (_base select 1) - _range + (random (2 * _range))]
;go on if group has reached WP
@(unitready _leader)
({_x setBehaviour "AWARE"} forEach units _team)
~_pause
goto "patrolagain"
#exit
exit;
This worked, but only after some massaging: I had put the spawning marker too close to some buildings and the group got stuck within the built-up area.
By moving the marker to an open area, it got things moving.
I noticed in the preview, if I shot a leader, they lost coherence.
I might add a check if _leader is alive subroutine and if != then appoint a new one.