PDA

View Full Version : Script Help Vehicle Respawn



MattXR
Dec 8 2006, 15:23
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 &#33;= 0 : _vtime set [_i, 0]; goto "continue"
_vt = _vtime select _i
?_vt &#33;= 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&#39;t spawn back and everyone else has to run miles to get to there objective.

Im making a HOLD mission like BIS&#39;s HOLD The Castle But Mines Hold Camp Dead http://forums.bistudio.com/oldsmileys/biggrin_o.gif

MattXR
Dec 8 2006, 16:05
I know theres some bright guys hanging around this forum http://forums.bistudio.com/oldsmileys/yay.gif common.

I know Charlie will help me. http://forums.bistudio.com/oldsmileys/inlove.gif

hoz
Dec 8 2006, 18:10
I don&#39;t see anything off hand why this wouldn&#39;t work. Are you having a problem of some kind?

MattXR
Dec 8 2006, 18:15
Nevermind was no problem got it working.

Johnnie_Walker
Dec 8 2006, 18:47
Yeah the vehicles are staying destroyed and not spawning back.
I edited vrs.sqs script, now it&#39;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">
?&#33;&#40;local Server&#41;&#58; Goto &#34;end&#34;
_vcl = _this select 0
_position=Getpos _vcl
_dir=Getdir _vcl

_respawndelay = 5

#mainloop
@<hidden> &#40;damage _vcl &#62;0.7&#41;
~_respawndelay

deleteVehicle _vcl
_vcl = &#34;UAZMG&#34; createVehicle _position
_vcl setdir _dir

goto &#34;mainloop&#34;

#end
Exit

[/QUOTE]

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: @<hidden> (damage _vcl >0.7)
Also you can check if there is no driver or gunner inside before deleting the vehicle.


Hope it helps

Big Dawg KS
Dec 8 2006, 19:16
Um... not sure if any of you noticed this (http://community.bistudio.com/wiki/respawnVehicle) before... but I&#39;d hate to see you waste a lot of time on this script, or maybe I&#39;m too late.  http://forums.bistudio.com/oldsmileys/whistle.gif

Still, if it works, it&#39;s surely going to give you better performance. Worth a shot. http://forums.bistudio.com/oldsmileys/wink_o.gif

MattXR
Dec 8 2006, 19:43
Just tried the BIS way it doesn&#39;t work.

Big Dawg KS
Dec 8 2006, 20:39
Just tried the BIS way it doesn&#39;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&#39;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.