Jump to content
Sign in to follow this  
pazuzu

Vehicle respawn script

Recommended Posts

Hi, I'm using a script I got from the editors depot (AI vehicle respawn by Doolittle).

I wanted to use it for planes so that the planes would respawn in the air if possible. How would I do this?

Here is the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">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 = 150; goto "notalive"

? fuel _obj == 1 : goto "clear"

? count crew _obj != 0 : goto "clear"

? _t == 0 : _t = _time + 110

? _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.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×