Jump to content
Sign in to follow this  
mattxr

Vehicle Respawn Template

Recommended Posts

Ok Here is my Vehicle Respawn Template

Vehicle Respawn [intro]

Place into your ArmA/Usermissions

All you need to do is place this into the Vehicles INIT

Quote[/b] ]vehicles = vehicles + [this]

any vehicle u want and it doesn't matter where u go the vehicle will spawn back to its original position.

THE SPAWN ONLY WORKS IN MP! SO IF IT DOESNT WORK IN THE EDITOR DONT WORRY IT WILL IN MP!

Share this post


Link to post
Share on other sites

Yeah this is the shit man. i got stressed walking all that way.

BTW: This Script was Originally made By Doolittle

Share this post


Link to post
Share on other sites

Errrrr, why doing it the long way when we now have a dedicated command to do that, respawnVehicle.

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.

Share this post


Link to post
Share on other sites

Well there SPAWN IS CRAP! when the vehicle blows up it spawns on the spot that it blew up. Which is no good, At leaste with the one i posted the Vehicles spawn back at base.! smile_o.gif

Share this post


Link to post
Share on other sites

Right, and I'm Bill Gates. Change the respawn type to base and Bob's your uncle. Need another example?

Share this post


Link to post
Share on other sites
Right, and I'm Bill Gates. Change the respawn type to base and Bob's your uncle.

What? lol

Gee Sniperwolf572, you seem a little irritated. whistle.gif

So then, it does work right?

Share this post


Link to post
Share on other sites
Right, and I'm Bill Gates. Change the respawn type to base and Bob's your uncle. Need another example?

Take a chill pill, what if you dont want them to spawn at the base marker. what if you want them to spawn at the place where the editor placed them .. U CANT. so guess what. My version is still better.

Go To Bed.

Share this post


Link to post
Share on other sites
It's exactly the same as Doolittle's whistle.gif

yeah check my 3rd post down or the readme

Share this post


Link to post
Share on other sites
Right, and I'm Bill Gates. Change the respawn type to base and Bob's your uncle.

What? lol

Gee Sniperwolf572, you seem a little irritated. whistle.gif

So then, it does work right?

Yes, it does work, but as Matt noticed, it depends on the respawn type. INSTANT respawns the vehicle where it was destroyed, and BASE respawns it at the base marker. Maybe we can add a separate respawn entry for description.ext for vehicles, so we can have i.e GROUP respawn for infantry and BASE respawn for vehicles.

Also, I think you can always place a marker for that specific vehicle on where you want to respawn it, and setpos it back after a base respawn.

And, no, I wasn't irritated, I guess all that post was missing is a banana or something...

Share this post


Link to post
Share on other sites

Well i must be doing something wrong because I cannot for the life of me figure this out. What exactly do I type in the INIT field? I am trying to respawn helicopters. Any Ideas?

Share this post


Link to post
Share on other sites
Well i must be doing something wrong because I cannot for the life of me figure this out. What exactly do I type in the INIT field? I am trying to respawn helicopters. Any Ideas?

Add the three scripts into your mission folder.

then add this into the helicopters init

Quote[/b] ]vehicles = vehicles + [this]

then it only works in MP so if you test it in the editor it wont work. so save the mission in MP and test it there smile_o.gif

Share this post


Link to post
Share on other sites

You are saying to add 3 scripts to my missions folder. I assume you mean to extract the file from the .rar folder and then pull out these 3 files from "VehicleRespawnTemplate.intro"

What I did was just place the "VehicleRespawnTemplate.intro" folder into the every mission folder I had just to be safe.

I added the INIT: "vehicles = vehicles VehicleRespawnTemplate;"

I assume that is wrong...

_

So to understand what you are saying there are 4 files in the "VehicleRespawnTemplate.intro" folder: mission.sqm, player.sqs, vehicles.sqs, and smoke.sqs.

Which of these 3 out of 4 do I place in my missions folder?

I feel really dumb for asking this question but I am not understanding something or am missing a step. Thanks!

Share this post


Link to post
Share on other sites
You are saying to add 3 scripts to my missions folder. I assume you mean to extract the file from the .rar folder and then pull out these 3 files from "VehicleRespawnTemplate.intro"

What I did was just place the "VehicleRespawnTemplate.intro" folder into the every mission folder I had just to be safe.

I added the INIT: "vehicles = vehicles VehicleRespawnTemplate;"

I assume that is wrong...

_

So to understand what you are saying there are 4 files in the "VehicleRespawnTemplate.intro" folder: mission.sqm, player.sqs, vehicles.sqs, and smoke.sqs.

Which of these 3 out of 4 do I place in my missions folder?

I feel really dumb for asking this question but I am not understanding something or am missing a step. Thanks!

Just add the Script Files

Quote[/b] ]player.sqs, vehicles.sqs, and smoke.sqs

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

If you overwite your mission.sqm it will overwite your mission bad idea.. so just copy the 3 script files. smile_o.gif

Share this post


Link to post
Share on other sites
Errrrr, why doing it the long way when we now have a dedicated command to do that, respawnVehicle.

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.

link not working

Share this post


Link to post
Share on other sites

Ok I also can not seem to get it to work. I was able to get the other script to work by kyrillion but that requires a script per vehichle which I do not see myself liking.

The init field that they say ArmA supports that doesn't work for me either.

this on seems to be the only one I get to work

?!(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

Now I am running some other scripts do you need to exec this in the description.ext?

Share this post


Link to post
Share on other sites

I got it to work you need to add a game logic and a trigger to it like your mission contained

Share this post


Link to post
Share on other sites
Errrrr, why doing it the long way when we now have a dedicated command to do that, respawnVehicle.

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.

link not working

yep, his url is dead, but here is the right one....

http://www.surfacezero.com/uploads/Sniperwolf572/RespawnTest.rar

Share this post


Link to post
Share on other sites

Hey... I'm surprised that still works. I'm sure there's better ways of doing it now?

Doolittle

Share this post


Link to post
Share on other sites

Why not just use the respawnVehicle command and then move the vehicle to get it at the location where you want it? For example you can create an empty marker where the vehicle goes, then every time the vehicle is destroyed, move it as soon as it respawns.

Jeff

Share this post


Link to post
Share on other sites

That script snippet from my vrs.sqs is ancient stuff.  Just from looking at the credits, I can tell it came from before OFP 1.8 when they added the typeOf command, lol.

Anyway, for ArmA, I redid it as an SQF script.  In the mission editor, simply put this in the init field of each vehicle:

s = [] execVM "vrs.sqf"

You MUST have a dummy variable, in this case 's', for the script, or the mission editor parser will error.

And copy the following code into a file named vrs.sqf and put the file in your mission folder.

What this does is monitor the vehicle until someone gets in it, or it's destroyed.  Let's say Joe Player hops in a jeep, drives it across the map and abandons it at the enemy base.  If no one hops into the jeep for 150 seconds, then it'll respawn it.  You can adjust that with the _crewWait variable.  Put it high if you don't want it automatically respawning even if it's not destroyed.

Then of course it'll respawn it once it's destroyed anyway.  You can adjust the _respawndelay to change the timer on that.

I also will be adding a couple more things to this script later, such as the ability to change the respawn time depending on the type of vehicle, i.e. plane, helo, tank, etc.  It'll only require a few extra lines of code, but I haven't put it in yet because I wanted to test some new script commands besides the age-old countType command that I used.   Anyway, then if you want planes to take longer to spawn, you'll be able to do that.

I tried the BIS version of respawn, but it's sort of half-assed, TBH.  The ONLY thing I want to have to put in the editor is the vehicle itself and the execVM command in the init field.  Having to put markers and such simply to respawn a vehicle is a PITA.  And I've used this script with hundreds of vehicles at once so I know it doesn't bog the server down at all.

I'll also be changing the while...do command to a for...do.   Just haven't done it yet.  That way it'll prevent the script from exiting after 10,000 loops.  Seeing as how there's a lot of sleep commands, it'd only be an issue with very long missions.

Anyway, here it is.

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

//BEGIN vrs.sqf

//By KaRRiLLioN

//IMPORTANT: ADD A GAMELOGIC NAMED Server

//to the mission to prevent multispawn

private ["_vcl","_respawndelay","_dir","_pos","_type","_run","_crewWait","_wait","_delay"];

if (!local Server) exitWith {};

_vcl = _this;

_respawndelay = 20;

_dir = Getdir _vcl;

_pos = Getpos _vcl;

_crewWait = 150;

_wait = 0;

_type = typeOf _vcl;

_run = TRUE;

sleep 1;

for [{}, {_run}, {_run}] do

{

    while {canMove _vcl && count crew _vcl < 1} do

    {

         _wait = Time + _crewWait;

         sleep 1;

    };

    while {Count crew _vcl > 0 && Alive _vcl} do

    {

         _wait = Time + _crewWait;

         sleep 1;

    };

    while {canMove _vcl && count Crew _vcl < 1 && Time < _wait} do

    {

         sleep 1;

    };

    _delay = Time + _respawnDelay;

    while {!canMove _vcl && count Crew _vcl < 1 && Time < _delay} do

    {

         sleep 1;

    };

    if (count Crew _vcl < 1) then

    {

         deleteVehicle _vcl;

         _vcl = _type createVehicle _pos;

         _vcl setdir _dir;

         sleep 1;

         _vcl setvelocity [0,0,0];

         _vcl setpos _pos;

         sleep 1;

         _vcl setvelocity [0,0,0];

    };

};

Share this post


Link to post
Share on other sites
You MUST have a dummy variable, in this case 's', for the script, or the mission editor parser will error.

Could you explain this a lil further? I'm getting the parse error.

On my 1st run, the vehicle spawned where it was destroyed?

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  

×