First, make a script called "killdelete.sqs". In it put:
_guy = _this select 0
~40
deletevehicle _guy
Now your primary script should be changed to this:
_aUnit = _this select 0
_agroups = _this select 1
_apg = _this select 2
_utype = _this select 3
_askill = _this select 4
_aradius = _this select 5
_c = 0
#loop
#gloop
_rg = count units (_agroups select _c)
? _rg >= _apg : goto "misscreate"
_rg = _apg - _rg
#iloop
_rnum = random ((_aradius * 2))
_num = _rnum - (_rnum mod 1)
_num = _num - _aradius
_d1 = getpos _aunit select 0
_d2 = getpos _aunit select 1
_d3 = 0
_qs = (_aradius * _aradius) - (_num * _num)
_qs = sqrt _qs
_num2 = random (2)
_num2 = _num2 - (_num2 mod 1)
? _num2 == 0 : _qs = _qs - (2 * _qs)
_num2 = random (2)
_num2 = _num2 - (_num2 mod 1)
? _num2 == 0 : _d1 = _d1 + _num; _d2 = _d2 + _qs
? _num2 == 1 : _d1 = _d1 + _qs; _d2 = _d2 + _num
_utype createunit [_d1,_d2,_d3],_agroups select _c,"",_askill,"PRIVATE"]
_agroups select _c move getpos _aunit
"_x addeventhandler [{killed},{this exec {killdelete.sqs}}]" foreach units _agroup select _c
leader (_agroups select _c) move getpos _aunit
_rg = _rg - 1
? _rg == 0 : goto "misscreate"
goto "iloop"
#misscreate
_c = _c + 1
? _c == count _agroups : _c = 0; goto "eloop"
goto "gloop"
#eloop
~5
goto "loop"