I reworked a genuine vehicle respawn script from Doolittle (the King of Respawns). I found it on the official forum, however, i think it's in order i post it here
;By Doolittle
;USE
;put into INIT FIELD of 1st vehicle on map: vehicles = [this]
;put into INIT FIELDS of any other vehicle: vehicles = vehicles + [this]
;make trigger that runs ONCE: Condition: local Server OnActivation: [] exec "vehicles.sqs"
;make a GameLogic called Server
_vpos = []
_vdir = []
_vtime = []
_count = count vehicles
_delay = 1
_delaya = 120
_i = 0
#load
_v = vehicles select _i
_vpos = _vpos + [[getPos _v select 0, getPos _v select 1, 0]]
_vdir = _vdir + [getDir _v]
_vtime = _vtime + [0]
_i = _i + 1
?_i < _count : goto "load"
#init
_i = 0
~20
#alive
_v = vehicles select _i
?fuel _v == 1 : goto "continue"
?alive _v and count crew _v != 0 : _vtime set [_i, 0]
_vt = _vtime select _i
?_vt != 0 and _vt < _time : goto "notalive"
?count crew _v == 0 and _vt == 0 : _vtime set [_i, _time + _delaya]
?!alive _v and _vt == 0 : _vtime set [_i, _time + _delay]
#continue
_i = _i + 1
?_i < _count : goto "alive"
goto "init"
#notalive
_vtype = typeOf _v
deleteVehicle _v
~1
_v = _vtype createVehicle (_vpos select _i)
_v setDir (_vdir select _i)
vehicles set [_i, _v]
_vtime set [_i, 0]
goto "continue"
Pay attention to header how to use it. This script is the "vehicles.sqs" mentioned there of course.
What i've changed:
The original script had only 1 certain delay for respawning vehicles that are (a.) destroyed or (b.) left alone by the crew. I wanted to have seperate delay times for my MP mission.
Basically i set the above delay values to:
(delay =) 1 sek for destroyed vehicles.
(delaya =) 120 sek for abandoned vehicles that are NOT destroyed.
The script checks the vehicle status every 20 secondes (i changed that, too). I found that with a fast check rate the computer considers a vehicle abandoned too fast. That is when you, the player, see the end coming and eject from your vehicle in an emergency. Although the airvehicle goes down & explodes, it's already considered 'abandoned' and therefore take a looong time to respawn, unlike a vehicle that is destroyed instantly. Therefore the 20 seconds (every aircraft should come down during that period)
If i forgot something or you can't get it to work just blame me, not Dolittle *gg* ;D