I have a script that spawns vehicles for me and is very simple. I have edited it to my liking however I'm having trouble with just spawning AI. Is there a small script to allow 0ne AI unit, a soldier to respawn to it's starting waypoint leaving it's dead body behind where it died. I've got my vehicles script to do just that. I also need to set the number of times it respawns for both scripts. Here is my vehicle script which requires only a timer or switch to set the number of respawns or the amount of time it can respawn. I need help making the AI single soldier respawn 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 = 9; goto "notalive"
? fuel _obj == 1 : goto "clear"
? count crew _obj != 0 : goto "clear"
? _t == 0 : _t = _time + 9
? _t > _time : goto "alive"
"_obj removeMagazine _x" forEach magazines _obj
_obj setFuel 0
_obj setDamage 1
_delay = 1
#notalive
~_delay
~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"
----------------------------------------------------------------------------------
this script needs a timer or switch to tell it when to quit.
I then need an AI simple script, simular to the one above to respawn AI at there starting waypoint leaving their dead body behind and it too needs a switch or timing to turn it off. Any help with this would be great.
PACO454