;spawntank.sqs by Mandoble
;Spawns a tank each time your missile destroy one

westgrp = createGroup west
#spawn
~2
cutText["Spawnning new tank", "PLAIN DOWN"]
_tank = "M1Abrams" createVehicle getPos spawntank
_tank setDir 0
tank1 = _tank
"SoldierWCrew" createUnit [getPos spawncrew, westgrp,"tnkcmdr = this;this MoveInCommander tank1", 0.6, "corporal"]
tnkcmdr moveInCommander _tank
"SoldierWCrew" createUnit [getPos spawncrew, westgrp,"tnkgnr = this;this MoveInGunner tank1", 0.6, "private"]
tnkgnr MoveInGunner _tank
"SoldierWCrew" createUnit [getPos spawncrew, westgrp,"tnkdrv = this;this MoveInDriver tank1", 0.6, "private"]
tnkdrv MoveInDriver _tank

#move
tnkdrv doMove getPos move1
~2
@((damage _tank > 0.9) || ((_tank distance move1)<20))
~2
?(damage _tank > 0.9):{deleteVehicle _x} forEach crew _tank;deleteVehicle _tank;goto "spawn"
tnkdrv doMove getPos move2
~2
@((damage _tank > 0.9) || ((_tank distance move2)<20))
~2
?(damage _tank > 0.9):{deleteVehicle _x} forEach crew _tank;deleteVehicle _tank;goto "spawn"
goto "move"