Jump to content
Sign in to follow this  
Oldi1knoby

Respawning Vehicles

Recommended Posts

I am new to mission editing and I have gotten the basics down pretty good. Now what I want to learn is how to make a Vehicle Respawn...if you know how plz post it here...thx

Share this post


Link to post
Share on other sites

Thanks for the link but I searched through that site for 3 hours without finding it.(not a very good website layout)

Can you give me a direct link?

Share this post


Link to post
Share on other sites

I don't think the layout is that bad. Maybe you're just a twit...?

Go back to that site and click on the code snippets button. There are a few respawining scripts there. There are also dozens of threads in their forums covering the same topic.

Share this post


Link to post
Share on other sites

Here's a simple respawn script:

- - -

; Takes 3 parameters:

; - a "game logic" (simply place one in the map and name it, that's all)

; - vehicle type, eg. "JeepMG"

; - vehicle object, easily referred with the "this" keyword

; Example: [glogic, "JeepMG", this] exec "respawn.sqs"

; This needs to run on the server!

_srv = _this select 0

? (!local _srv) : exit

; Get vehicle type, position and facing.

_type = _this select 1

_vehicle = _this select 2

_pos = getPos _vehicle

_dir = getDir _vehicle

#CheckAlive

? (!alive _vehicle) : goto "Respawn"

~1

goto "CheckAlive"

#Respawn

; Respawn delay, could've been made into a parameter

; but I didn't find it necessary.

~5

; Reduce damage, otherwise the smoke will stay!

_vehicle setDammage 0.5

deleteVehicle _vehicle

; Create the new vehicle.

_vehicle = _type createVehicle _pos

_vehicle setDir _dir

goto "CheckAlive"

- - -

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (EmperorVader @ Jan. 11 2002,02:36)</td></tr><tr><td id="QUOTE">can you post oa link of a example mission?<span id='postcolor'>

I'm afraid not. I don't have a completed mission nor a website. But here's quick instructions:

1) Place a Game Logic somewhere in the map. Name it, for example "is_Srv".

2) Place the unit you want to respawn, for example a Jeep with MG. In it's initialization field, type this:

[is_Srv, "JeepMG", this] "respawn.sqs"

3) Save the mission.

4) Cut 'n paste the script to file and name it "respawn.sqs". Place it under the OFP directory in users/username/missions/missionname/. (I'm not sure about the first directory, could be "userdata" or something)

Share this post


Link to post
Share on other sites

#Respawn

; Respawn delay, could've been made into a parameter

; but I didn't find it necessary.

~5

Does this mean 5 secs or 5 mins?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">#Respawn

; Respawn delay, could've been made into a parameter

; but I didn't find it necessary.

~5

Does this mean 5 secs or 5 mins?<span id='postcolor'>

Seconds, naturally. 5 minutes would be quite insane.

Also, here is how to parameterize the delay, makes the script more reusable...

(original lines to indicate the place, bold indicates new or changed lines)

; Takes 4 parameters:

; - a "game logic" (simply place one in the map and name it, that's all)

; - vehicle type, eg. "JeepMG"

; - vehicle object, easily referred with the "this" keyword

; - respawn delay in seconds

; Example: [glogic, "JeepMG", this, 5] exec "respawn.sqs"

...

; Get vehicle type, position and facing.

_type = _this select 1

_vehicle = _this select 2

_pos = getPos _vehicle

_dir = getDir _vehicle

_delay = _this select 3

...

#Respawn

; (previous comment deleted)

; ~5 (delete or comment out this)

~_delay

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  

×