Jump to content
Sign in to follow this  
mattxr

Script Help Vehicle Respawn

Recommended Posts

Ok i need this so it works in ArmA

Quote[/b] ];By Doolittle

_vlogic = []

_vtime = []

_count = count vehicles

_delay = 3

_i = 0

#load

_v = vehicles select _i

_vl = "Logic" createVehicle getPos _v

_vl setDir getDir _v

_vlogic = _vlogic + [_vl]

_vtime = _vtime + [0]

_i = _i + 1

?_i < _count : goto "load"

#init

_i = 0

~3

#alive

_v = vehicles select _i

_vl = _vlogic select _i

?alive _v and _vl distance _v < 100 : goto "continue"

?alive _v and count crew _v != 0 : _vtime set [_i, 0]; goto "continue"

_vt = _vtime select _i

?_vt != 0 and _vt < _time : goto "notalive"

?_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 getPos _vl

_v setDir getDir _vl

vehicles set [_i, _v]

_vtime set [_i, 0]

publicObject = _v

publicVariable "publicObject"

goto "continue"

What its suppost to do, you place a empty vehicle on the map with this code in in the init "vehicles = vehicles + [this]" when the vehicle is moved and destroyed the vehicle will respawn back at its original place after a few moments.

why i want the script im making a HOLD map a big one for many players and im sick atm when all the players get their vehicles destroyed and they don't spawn back and everyone else has to run miles to get to there objective.

Im making a HOLD mission like BIS's HOLD The Castle But Mines Hold Camp Dead biggrin_o.gif

Share this post


Link to post
Share on other sites

I know theres some bright guys hanging around this forum yay.gif common.

I know Charlie will help me. inlove.gif

Share this post


Link to post
Share on other sites

I don't see anything off hand why this wouldn't work. Are you having a problem of some kind?

Share this post


Link to post
Share on other sites

Nevermind was no problem got it working.

Share this post


Link to post
Share on other sites
Yeah the vehicles are staying destroyed and not spawning back.

I edited vrs.sqs script, now it's a lot more simple but it works.

Original script credits:

;;BEGIN vrs.sqs

;;By KaRRiLLioN

;;VehicleType Loop by Sefe

;;Original script by Backoff

;;Updated for 1.75 by Jaeger Neo

;;IMPORTANT: ADD A GAMELOGIC NAMED Server

;;to the mission to prevent multispawn

Simple version:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?!(local Server): Goto "end"

_vcl = _this select 0

_position=Getpos _vcl

_dir=Getdir _vcl

_respawndelay = 5

#mainloop

@ (damage _vcl >0.7)

~_respawndelay

deleteVehicle _vcl

_vcl = "UAZMG" createVehicle _position

_vcl setdir _dir

goto "mainloop"

#end

Exit

Just add [this] exec "vr.sqs" to the init field of every vehicle.

Also change UAZMG with the vehicle type.

Try bigger values of damage for this line: @ (damage _vcl >0.7)

Also you can check if there is no driver or gunner inside before deleting the vehicle.

Hope it helps

Share this post


Link to post
Share on other sites

Um... not sure if any of you noticed this before... but I'd hate to see you waste a lot of time on this script, or maybe I'm too late.  whistle.gif

Still, if it works, it's surely going to give you better performance. Worth a shot. wink_o.gif

Share this post


Link to post
Share on other sites

Just tried the BIS way it doesn't work.

Share this post


Link to post
Share on other sites
Just tried the BIS way it doesn't work.

Hmm... you sure you used it correctly? I figured BIS must have used it if they put it in there, have you looked at any of the MP missions?

Edit:

Quote[/b] ]Edit:

Just saw your other topic on this, and to say BIS way doesn't work, is complete BS. Here is a working example that it works.

From your other thread, apparently it does work. You must have used it incorrectly or something. I really hope it does work though.

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  

×