Jump to content
Sign in to follow this  
moosh

Empty Vehicles Respawning?

Recommended Posts

Can anybody tell me if it's possible to get empty vehicles to respawn where they were first placed or in a certain area?

Share this post


Link to post
Share on other sites

CanisDEK

Junior Member

--------------------------------------------------------------------------------

It's really not that hard. You need to use the new deletevehicle and createvehicle in a script called by the initialization field of the vehicle you want to respawn.

*********************************

IN EDITOR:

1) make a "game logic" called respawn1

2) make a "game logic" called server

3) make a vehicle - no name needed but write this in the initialization field:

[unitName, Location, Azimut, VehicleClass] exec "VR.sqs"

Unitname = name of vehicle or just <this> (without <>

Location = Respawn1

Azimut = facing or <Random(360)> for random (no <>

Vehicleclass = "UH60MG" or "OH58" (WITH THE " "

exec "VR.sqs" = execute script called VR.sqs with variables between the [ ]

Example: [this, respawn1, random(360), "UH60MG"] exec "VR.sqs"

*****************

IN SCRIPT: make a script called VR.sqs (use notepad and save as VR.sqs - everything in { } is explanation and should not be in the script. lines starting with ; will not be executed.

;THE SCRIPT called VR.sqs

;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;

;Variables found---->

;

?!(local Server): Goto "end" {if computer isn't server end}

_vcl = _this select 0 {select the variable unitname}

_Location = _this select 1 {select respawn1 or whatever}

_azimut = _this select 2 {select facing variable}

_class = _this select 3 {select class variable}

_respawndelay = 30 {the time it takes to respawn}

;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;

;Respawn script, vehicle deleted and created if not alive

;

#start

~1

?(Alive _vcl):Goto "start" {if vehicle alive then loop back}

~_respawndelay {the delay in secs set earlier}

_vcl setdammage 0.2 {otherwise smoke will stay too long}

deleteVehicle _vcl

_vcl = _class createVehicle getpos _Location

_vcl setdir _azimut

Goto "start"

#end

Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

***********************

Well that's it.

PS: I would like to thank the OFP Editing Center and especially: Backoff, OFP Editing Moderator, OFP Editing Veteran for helping me figuring this out. Sign up at the OFP Editing Center you'll find answers for most of your questions at their forums!

http://www.ofpeditingcenter.com/Default.asp

Share this post


Link to post
Share on other sites

Thanks a lot. You did a really good job of explaining that  smile.gif .

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  

×