Hi, currently I'm using this script to respawn AI driven vehicles in a MP-map.
All works fine except for the Air-units, when they get killed they respawn
on the ground.
It would be great if someone could crack this problem since it would
be sooo cool to have a everlasting airbattle.
Here's the script:
=====================================================
requiredVersion "1.91"
? not local Server : exit
_obj = _this select 0
_pos = getPos _obj
_dir = getDir _obj
_type = typeOf _obj
_group = group _obj
_crew = []
"_crew = _crew + [typeOf _x]" forEach crew _obj
"_x addEventHandler [""Killed"", {(_this select 0) removeAllEventHandlers ""Killed""; deleteVehicle (_this select 0)}]" forEach crew _obj
#clear
_t = 0
#alive
~3
? not alive _obj : _delay = 60; goto "notalive"
? fuel _obj == 1 : goto "clear"
? count crew _obj != 0 : goto "clear"
? _t == 0 : _t = _time + 60
? _t > _time : goto "alive"
"_obj removeMagazine _x" forEach magazines _obj
_obj setFuel 0
_obj setDamage 1
_delay = 10
#notalive
~_delay
deleteVehicle _obj
~1
_obj = _type createVehicle _pos
_obj setDir _dir
? count _crew < 1 : goto "clear"
Soldier = []
_crew select 0 createUnit [_pos, _group, "Soldier = this"]
Soldier moveInDriver _obj
Soldier doMove getWPPos [_group, 1]
Soldier addEventHandler ["Killed", {(_this select 0) removeAllEventHandlers "Killed"; deleteVehicle (_this select 0)}]
? count _crew < 2 : goto "clear"
Soldier = []
_crew select 1 createUnit [_pos, _group, "Soldier = this"]
Soldier moveInGunner _obj
Soldier doMove getWPPos [_group, 1]
Soldier addEventHandler ["Killed", {(_this select 0) removeAllEventHandlers "Killed"; deleteVehicle (_this select 0)}]
? count _crew < 3 : goto "clear"
Soldier = []
_crew select 2 createUnit [_pos, _group, "Soldier = this"]
Soldier moveInCommander _obj
Soldier doMove getWPPos [_group, 1]
Soldier addEventHandler ["Killed", {(_this select 0) removeAllEventHandlers "Killed"; deleteVehicle (_this select 0)}]
goto "clear"
======================================================
Thanks in advance!