First of all use the code format function
when posting code, makes it easier to read.
It depends on what you mean by 'group arrays'. At first glance your script won't quite work because since you're now using an array of groupnames - if that's what the group arrays are - the script is selecting a group at random to utter the radio chatter rather than an individual loon. Once you've randomly determined the group you need to repeat the random selection to determine which loon of that group will do the chattering.
#assign
; loop again?
? (enemy_contact) : exit
; wait between 7 - 15 seconds
~(7 + random 8)
; choose a group at random
_r = random (count group_array1)
_r = _r - _r % 1
_speakers_group = (group_array1) select _r
; choose a loon at random - make sure he's alive
_r = random ({alive _x} count units _speakers_group)
_r = _r - _r % 1
_speaker = (_speakers_group) select _r
; choose a random goto marker
_saywhat = random 5
_saywhat = _saywhat - _saywhat % 1
goto format ["radio%1", _saywhat]
#radio0
_speaker say "recon1"
goto "assign"
#radio1
_speaker say "sweepsector"
goto "assign"
#radio2
_speaker say "checkzone"
goto "assign"
#radio3
_speaker say "hear"
goto "assign"
#radio4
_speaker say "radiocheck"
goto "assign"
Take a look at the
format command in the COMREF - one of the best resources you'll find for editing. It can be used for a great many handy things. And yes, you've grasped exactly what it does in the above context, i.e. appends whatever the value of
_saywhat is to the string
#radio.
If the
enemy_contact variable is just going to be true or false make it a boolean; and if all you're going to do is exit the script when
enemy_contact becomes true, just put the exit command there with the conditional rather than jumping to another script marker. Of course it could be you intend
enemy_contact to have more than 2 states, and you might want to do something before the script exits, in which case your approach is exactly right.
Looks like you're getting the hang of it.