Jump to content
Sign in to follow this  
[evo] dan

[EVO] Dan's Basic Vehicle Respawn script

Recommended Posts

Since BIS has recently removed various scripting commands from the scripting library it has broken the old respawn script for vehicles. Therefore I updated an old one that I wrote as scripting practice some time ago. The original reason I wrote this was because I wanted better script performance because I never used all the extra functionality that Tophe's script gave you.

So far it will only do the basic respawn with a timer, no init commands will be passed to the script as of yet (I will probably add that in the next few days if I can get it to work satisfactorily). They will released as 2 different scripts so you will have a choice of how much functionality you want vs performance cost.

Basic Respawn script

To use this put the following code into the init of your vehicle:

0 = [this,5] execVM "vehicle_respawn.sqf"

You can change the value 5 to whatever you desire as your respawn time.

Inside of the code you can change the various sleep values so as to change the looping time (for performance) and the vehicle deletion delay. Both of these commands have notes next to them telling you what they do.

Download

Dropbox:

https://dl.dropboxusercontent.com/u/28062918/vehicle_respawn_test.Stratis.rar

Armaholic mirror:

Basic Vehicle Respawn script [ALPHA]

Feel free to have a go and make this into a more advanced script if you like, just don't forget to credit me for the basics!

Credits

I would like to thank:

-BIS

-The community, for giving me various scripting help for various things over the last few years, and have helped me to advance my scripting.

-[EVO] Curry, for helping teach me the proper way of coding, so that anybody could have a look at your code and know what each bit does.

-Tophe for being the original inspiration for me writing this, as I wish to be as good as him at coding one day.

Edited by [EVO] Dan

Share this post


Link to post
Share on other sites

Nice work Dan, I had used Tophe's alot in my day, but i like how you have yours setup where you have the timer in the init line for an individual

vehicle rather then in the script where one timer was for all vehicles.

Sorry I dont have Arma3 Alpha so I cannot test it but would this work for Arma2CO?

Share this post


Link to post
Share on other sites
Nice work Dan, I had used Tophe's alot in my day, but i like how you have yours setup where you have the timer in the init line for an individual

vehicle rather then in the script where one timer was for all vehicles.

Sorry I dont have Arma3 Alpha so I cannot test it but would this work for Arma2CO?

umm, I am not sure if A2CO has the BIS_FNC_MP, but feel free to try the code out in that. Should be relatively easy to setup in the editor. But if A2CO has the function, then it should work. Make sure you add the functions module if your using A2CO since functions arent automatically activated like they are in TOH/A3

Share this post


Link to post
Share on other sites

Nice script mate, working great! :D

Dirty Haz

Share this post


Link to post
Share on other sites

Can't seem to get this working, I put the .sqf in my mission folder and put the execute string in my vehicle's init line, didn't change any variables. Blew up the vehicle in preview from editor but doesn't re-spawn. The 5 in the part that goes in the init is 5 seconds correct? Does this script function with SP missions, as that's what I am doing? Do I need to add or alter any of the values in the .sqf from default? I know you can change them for preference but just as the file comes it should work w/o me adding or altering any values correct? Also in the string you have posted here that goes in the init line of vehicle, do you have an extra "? When I paste what you have posted here into the init line it gives me an error, looking at it, it looks like you have an extra " so I removed it, is that accurate on my part?

Disregard, got it to work.

Just in case any other script noobs like myself have similar issue. I was trying to get it so vehicle respawns almost instantly after being destroyed. In the .sqf you need to lower the sleep which defaults at 240 to something much shorter. Slightly threw me off b/c the 240 value says it controls the time between vehicle being destroyed and the wreck being deleted. Thing is the respawn of the new vehicle won't occur until the wreck is gone, so that's where it kind of threw me a little. :) Anyway working nicely now.

Edited by DiabloMuerto

Share this post


Link to post
Share on other sites

I can't seem to get this to work. I put the script into the main mission and then goto the vehicles init and place the above code but it says im missining a ;.??

Share this post


Link to post
Share on other sites
I can't seem to get this to work. I put the script into the main mission and then goto the vehicles init and place the above code but it says im missining a ;.??

I think I had an error with the init code, there were 2 "" instead of just one try this:

0 = [this,5] execVM "vehicle_respawn.sqf"

Share this post


Link to post
Share on other sites

is this broken again or am i doing something wrong? Edit: i was wrong, got it working

Edited by Sarlac

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  

×