?!(local server): exit
?(etankpool <= 0): exit
?(etankcnt < 4): goto "makeT72"
?(etankcnt2 < 4): goto "makeT80"
?(etankcnt3 < 4): goto "makeZSUc"
?(etankcnt4 < 4): goto "makeZSUd"

#makeT72
~30
_alphaunitcnt = count units groupAlpha
?(_alphaunitcnt >=12): exit
_etank = "T72" createVehicle getmarkerpos "tnkmrk1"
etankpool = etankpool - 1

"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupAlpha, "TMP1=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupAlpha, "TMP2=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupAlpha, "TMP3=this"]

_crew1 = TMP1
_crew2 = TMP2
_crew3 = TMP3

_crew1 assignasdriver _etank
_crew2 assignasgunner _etank
_crew3 assignascommander _etank
_crew1 moveindriver _etank
_crew2 moveingunner _etank
_crew3 moveincommander _etank

TMP1 = nil
TMP2 = nil
TMP3 = nil

etankcnt = etankcnt + 1

#loop
~0.001
?!(alive _etank): goto "quit"
goto "loop"


#quit
etankcnt = etankcnt - 1
~10
deletevehicle _etank
deletevehicle _crew1
deletevehicle _crew2
deletevehicle _crew3
exit

#makeT80
~30
_betaunitcnt = count units groupBeta
?(_betaunitcnt >=12): exit
_etank = "T80" createVehicle getmarkerpos "tnkmrk1"
etankpool = etankpool - 1

"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupBeta, "TMP1=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupBeta, "TMP2=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupBeta, "TMP3=this"]

_crew1 = TMP1
_crew2 = TMP2
_crew3 = TMP3

_crew1 assignasdriver _etank
_crew2 assignasgunner _etank
_crew3 assignascommander _etank
_crew1 moveindriver _etank
_crew2 moveingunner _etank
_crew3 moveincommander _etank

TMP1 = nil
TMP2 = nil
TMP3 = nil

etankcnt2 = etankcnt2 + 1

#loop2
~0.001
?!(alive _etank): goto "quit2"
goto "loop2"


#quit2
etankcnt2 = etankcnt2 - 1
~10
deletevehicle _etank
deletevehicle _crew1
deletevehicle _crew2
deletevehicle _crew3
exit

#makeZSUc
~30
_charunitcnt = count units groupCharlie
?(_charunitcnt >=12): exit
_etank = "fz_nkzsu" createVehicle getmarkerpos "tnkmrk1"
etankpool = etankpool - 1

"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupCharlie, "TMP1=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupCharlie, "TMP2=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupCharlie, "TMP3=this"]

_crew1 = TMP1
_crew2 = TMP2
_crew3 = TMP3

_crew1 assignasdriver _etank
_crew2 assignasgunner _etank
_crew3 assignascommander _etank
_crew1 moveindriver _etank
_crew2 moveingunner _etank
_crew3 moveincommander _etank

TMP1 = nil
TMP2 = nil
TMP3 = nil

etankcnt3 = etankcnt3 + 1

#loop3
~0.001
?!(alive _etank): goto "quit3"
goto "loop3"


#quit3
etankcnt3 = etankcnt3 - 1
~10
deletevehicle _etank
deletevehicle _crew1
deletevehicle _crew2
deletevehicle _crew3
exit

#makeZSUd
~30
_deltunitcnt = count units groupDelta
?(_deltunitcnt >=12): exit
_etank = "fz_nkzsu" createVehicle getmarkerpos "tnkmrk1"
etankpool = etankpool - 1

"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupDelta, "TMP1=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupDelta, "TMP2=this"]
"SoldierEB" createUnit [getMarkerPos "tnkmrk1", groupDelta, "TMP3=this"]

_crew1 = TMP1
_crew2 = TMP2
_crew3 = TMP3

_crew1 assignasdriver _etank
_crew2 assignasgunner _etank
_crew3 assignascommander _etank
_crew1 moveindriver _etank
_crew2 moveingunner _etank
_crew3 moveincommander _etank

TMP1 = nil
TMP2 = nil
TMP3 = nil

etankcnt4 = etankcnt4 + 1

#loop4
~0.001
?!(alive _etank): goto "quit4"
goto "loop4"


#quit4
etankcnt4 = etankcnt4 - 1
~10
deletevehicle _etank
deletevehicle _crew1
deletevehicle _crew2
deletevehicle _crew3
exit