Thats one of my scripts, although its been modified somewhat. Here's an alternative way to create a tank with crew and check the moving and firing capability of the tank, and then delete it when it's disabled and create a new one. It uses 2 scripts, but all you have to do is call the first one. This is for a single tank with crew. Check this out-
;-----------------------------------------------------------
;start of script 1
~random(10)
[T80, getpos gamelogic1, groupCharlie, groupDelta, "mount", 1, "Sergeant"] exec "createsquad.sqs"
CreateSquadRunning = true
@!CreateSquadRunning
_leader = NewSquad select 0
group _leader move getpos destination
[NewVcl select 0] exec "checkt80.sqs"
exit
;end of script 1
;-----------------------------------------------------------
;-----------------------------------------------------------
;start of script 2
_vcl = _this select 0
_group = _this select 1
_crew = units _vcl
"_x allowfleeing 0" foreach _crew
goto "loop"
#loop
? NOT(alive player): exit
?(("Alive _x" count units _group) == 0): goto "here"
? NOT(canfire _vcl): goto "here"
? NOT(canmove _vcl): goto "here"
~random(5)
goto "loop"
#here
_vcl setdammage 1
~random(3)
"deletevehicle _x" foreach _crew
~10
deletevehicle _vcl
[] exec "t80.sqs"
exit
;end of script 2
;-----------------------------------------------------------
Name the first script "t80.sqs" and the second script is called "checkt80.sqs". When the tank is deleted, it calls the first script again to create a new one and repeats.....
In the init.sqs you'll need this line for the first script to work- T80 = [["T80",1,"vcl"]]
The t80 tank should already be defined in the vclclass.sqs