; ; This is a part of the Group Link II script. ; ; /KeyCat ; ; Get current group _group = _this select 0 ; ---------------------------------------------------------------------------- #start ; If whole enemy group is dead then exit script ? (count (units _group) <= 0) : exit ; Wait until a gun is fired (i.e variable KEY_FireAlert = True) @ KEY_FireAlert ; ########### DEBUG ########### ;~ Random 1 ; ############################# ; Check if the leader is in a vehicle, if he is he can't hear the gunfire if (vehicle (leader _group) != (leader _group)) then {goto "In_Vehicle"} ; Get range from firing position to leader in enemy group _Range = KEY_WhoFired distance (leader _group) ; If suppressed and range is less than 300 m then goto start if (KEY_Suppressed && (_Range < 300)) then {goto "start"} ; ########### DEBUG ########### ;hint format["DEBUG: Range %1 m to %2 Weapon class %3", _Range, _group, KEY_WeaponFired] ; ############################# ; Check range against weapon fired if (_Range > 600) then {goto "not_revealed"} if ((_Range > 300) && (KEY_WeaponFired == 2)) then {goto "not_revealed"} if ((_Range > 50) && (KEY_WeaponFired == 1)) then {goto "not_revealed"} if ((_Range > 15) && (KEY_WeaponFired == 0)) then {goto "not_revealed"} ; If the group is a staticgroup never advance towards sound if (_group in KEY_staticgroups) then {goto "watch_only"} ; ---------------------------------------------------------------------------- #watch ; Randomly decide if group shall advance in that direction (50%) if ((random 100 > 50) && (_Range > 50)) then {goto "advance"} ; Force all units to lay down if (!(_group in KEY_occupied) && !(_group in KEY_advancing)) then {"_x setunitpos ""DOWN""" foreach units _group} ; Make officer watch in players direction (leader _group) doWatch (getPos KEY_WhoFired) ; Make leader use his binocular if any (eventually add a distance check) if ((leader _group) hasWeapon "Binocular") then {(leader _group) selectWeapon "Binocular"} ; ########### DEBUG ########### ;hint format["DEBUG: %1 is watching in %2 direction", _group, KEY_WhoFired] ; ############################# ; Pause ~ random 10 + 10 ; ########### DEBUG ########### ;hint "DEBUG: Stopped watching routine" ; ############################# ; Set it back to AUTO if !(KEY_Suppressed) then {"_x setunitpos ""AUTO""" foreach units _group} ; Do it all over goto "Start" ; ---------------------------------------------------------------------------- #advance ; Make officer watch in players direction (leader _group) doWatch (getPos KEY_WhoFired) ; If the group is already occupied then they shall not get any new move or behaviour order if (_group in KEY_occupied) then {goto "not_revealed"} ; Randomly decide if groups behavior should be stealth (50%) if (random 100 < 50) then {_group setBehaviour "STEALTH"} else {_group setBehaviour "COMBAT"} ; ########### DEBUG ########### ;hint format["DEBUG: %1 is moving towards %2 position", _group, KEY_WhoFired] ; ############################# ; Randomly decide if group should move with limited speed (25%) if (random 100 > 75) then {_group setSpeedMode "LIMITED"} else {_group setSpeedMode "NORMAL"} ; If group isn't already in the array lock their WP if (!(_group in KEY_advancing)) then {_group lockwp true} ; Add the group to the _advancing array KEY_advancing = KEY_advancing + [_group] ; Order group to move towards the one who fired _group move (getPos KEY_WhoFired) ; Pause ~ random 40 + 20 ; Stop enemy group at current position if !(_group in KEY_occupied) then {_group move (getPos (leader _group))} ; ########### DEBUG ########### ;hint "DEBUG: Stopped advancing routine" ; ############################# ; Do it all over goto "Start" ; ---------------------------------------------------------------------------- #watch_only ; Pause ;~ random 1 ; Force all units to lay down if (!(_group in KEY_occupied) && !(_group in KEY_advancing)) then {"_x setunitpos ""DOWN""" foreach units _group} ; Make officer watch in players direction (leader _group) doWatch (getPos KEY_WhoFired) ; Make leader use his binocular if any (eventually add a distance check) if ((leader _group) hasWeapon "Binocular") then {(leader _group) selectWeapon "Binocular"} ; ########### DEBUG ########### ;hint format["DEBUG: %1 is watching in %2 direction", _group, KEY_WhoFired] ; ############################# ; Pause ~ random 10 + 10 ; ########### DEBUG ########### ;hint "DEBUG: Stopped watching routine" ; ############################# ; Set it back to AUTO if !(KEY_Suppressed) then {"_x setunitpos ""AUTO""" foreach units _group} ; Do it all over goto "Start" ; ---------------------------------------------------------------------------- #not_revealed ; Wait until KEY_FireAlert is FALSE again before continue @ !KEY_FireAlert ; Do it all over goto "Start" ; ---------------------------------------------------------------------------- #In_Vehicle ; ########### DEBUG ########### ;hint format["DEBUG: %1 is in a vehicle", _group] ; ############################# ; Wait until KEY_FireAlert is FALSE again before continue @ !KEY_FireAlert ; Do it all over goto "Start" exit ; ----------------------------------------------------------------------------