Jump to content
Sign in to follow this  
tophe

Simple Vehicle Respawn Script

Recommended Posts

OK need some help please !

The helicopter re-spawns great but I need it to be manned , how can i get Crew back inside ?

veh = [this,10, 0, 0, true, false, 'xx=[this, "true"] execvm "revive\MedEvac\Helicoptero.sqf";'] execVM "vehicle.sqf";  xx=[this, "true"] execvm "revive\MedEvac\Helicoptero.sqf";

Share this post


Link to post
Share on other sites

INIT field:

If you you want to set the INIT field of the respawned vehicle, first set all other

values, then set init commands. Those must be inside quotations.

veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

if you need to use quotations in your init, use double. like this:

veh = [this, 15, 10, 5, TRUE, FALSE, "hey = [this] execVM ""loadout.sqf"""] execVM "vehicle.sqf"

Also, remember that you need to put your init outside the vehicles script as well if you want

it to run initially:

hey = [this] execVM "loadout.sqf"; veh = [this, 15, 10, 5, TRUE, FALSE, "hey = [this] execVM ""loadout.sqf"""] execVM "vehicle.sqf"

Share this post


Link to post
Share on other sites

Thanks , but that part does not have anything to do with the crew, that is the action which works fine.

If i try the below on a AI chopper, it spawn the Chopper back but no crew, when it should have crew inside any Idea how to get Crew to spawn as well

veh = [this, 15, 10, 5, TRUE, FALSE"] execVM "vehicle.sqf"

Share this post


Link to post
Share on other sites

This script is for respawn of empty vehicles. The script is not writting for adding man into the vehicles. You would have to rewrite the script to get it to work like that ): Sorry.

Share this post


Link to post
Share on other sites

I've used UPSMON in conjunction with this script to get around that problem. Basically use UPSMON on the unit (or group) with a respawn parameter, then set the empty vehicle beside the UPSMON group making sure it respawns quickly when destroyed (ie: 5-10 seconds). UPSMON groups will automagically search for empty vehicles to use if their assigned waypoint is > 500m (you can adjust this distance in UPSMON init file). Of course this only works when the group and vehicle start a good distance away from their assigned patrol area.

Share this post


Link to post
Share on other sites
Ahh ok , so my next question is how :)

Lol its not that simple): I am just now able to read scripts and change somethings within The script after a few years (: good luck.

Share this post


Link to post
Share on other sites

You would have to find out which type of vehicle is being respawned and then create the appropriate number of crew and move them into the vehicle with every respawn.

Edited by Iceman77

Share this post


Link to post
Share on other sites

Then the problem becomes... do you respawn the vehicle as soon as it's destroyed?.... or wait for the crew to all die before you do the respawn. If it's the latter then more code needs to be also added to track if the crew is alive or not.

Otherwise you can end up with a lot of surviving crew running around as vehicles are spawned with new crew.

Good old Arma... solve one problem and it creates another!

Share this post


Link to post
Share on other sites

Is there anyway of getting this to work with vehicles that spawn in the map randomly? I am using a script that spawns in the vehicles in random towns/cities so I am unable to add anything into their init line as they don't exist in the editor.

Share this post


Link to post
Share on other sites
Is there anyway of getting this to work with vehicles that spawn in the map randomly? I am using a script that spawns in the vehicles in random towns/cities so I am unable to add anything into their init line as they don't exist in the editor.

Yes, you just have to pass the information to the script, it doesn't care about where the info comes from.

So in your veh spawn script, after you create a veh just pass the reference of that veh and the desired perams and execVM the script.

---------- Post added at 09:50 AM ---------- Previous post was at 09:46 AM ----------

_veh = createVehicle ["ah1w", position player, [], 0, "NONE"];[color=#000000][font=Lucida Console]
[/font][/color]
_null = [[color=#000000][font=Lucida Console]_veh[/font][/color], 15, 10, 5, TRUE, FALSE] execVM "vehicle.sqf";

Share this post


Link to post
Share on other sites

I am using tophes vehicle respawn script and Mikes IED script which enable vehicles to detect IEDs

I am trying to get vehicles that respawn to be capable of detecting IEDs

If I put both lines in the vehicle it works first time but as soon as vehicle respawns it loses its IED detecting capabilities

iedid = [this] execVM "FOCK_ied\Fock_iedveh.sqf";

0 = [this, 999, 900] execVM "scripts\vehicle.sqf";

I guess my question is how can I get the IED script to run within the vehicle respawn script?

Thanks in advance

Share this post


Link to post
Share on other sites
veh = [this, 999, 990, 5, TRUE, FALSE, "iedid = [this] execVM 'FOCK_ied\Fock_iedveh.sqf';"] execVM "vehicle.sqf";

Share this post


Link to post
Share on other sites

Hello, I'm have an issue that I can't wrap my head around. I am fairly new to scripting and have set up a AN-2 dogfight for my friends, but on respawn the AN-2's aren't armed anymore.

I've tried the various fixes to others problems here and still nada. Any help?

Share this post


Link to post
Share on other sites
Hello, I'm have an issue that I can't wrap my head around. I am fairly new to scripting and have set up a AN-2 dogfight for my friends, but on respawn the AN-2's aren't armed anymore.

I've tried the various fixes to others problems here and still nada. Any help?

You need to make another script for the plane(s) loadouts that you gave them, than put that script into the init line of the respawn script, so it respawns with the custom loadouts.

Like it says here

hey = [this] execVM "loadout.sqf"; veh = [this, 15, 10, 5, TRUE, FALSE, "hey = [this] execVM ""loadout.sqf"""] execVM "vehicle.sqf"

Share this post


Link to post
Share on other sites

So I need to figure out how to make a loadout script then. Thanks!

Share this post


Link to post
Share on other sites
So I need to figure out how to make a loadout script then. Thanks!

Same way you probably did in your A-2 Init filed with "addWeapon" and whatever you added to it. Just this time, make it into a .sqf file, and name your plane, and put in whatever weapons you want to it.

Example of what I have for a custom L-159 plane with GBU's and Mavericks

ALCAGBU removeMagazinesTurret ["4Rnd_Maverick_L159",[-1]]; 
ALCAGBU removeMagazinesTurret ["2Rnd_Sidewinder_AH1Z",[-1]];
ALCAGBU addWeapon "BombLauncherA10";
ALCAGBU addMagazineTurret ["4Rnd_GBU12",[-1]];
ALCAGBU removeWeapon "MaverickLauncher_ACR";
ALCAGBU removeWeapon "SidewinderLaucher_AH1Z";
ALCAGBU addWeapon "MaverickLauncher";
ALCAGBU addMagazineTurret ["2Rnd_Maverick_A10",[-1]];

More info here for weapon adding; http://community.bistudio.com/wiki/addWeapon and http://community.bistudio.com/wiki/addMagazine and http://community.bistudio.com/wiki/addMagazineTurret

GL

Share this post


Link to post
Share on other sites

Thanks! I kind of got it working. For some reason the plane respawns without ammo, and I can only get it to work on one of them. Could you point me in the direction of a guide on how to do a script for multiple loadouts on vehicles?

Wait I got it! Thanks for all the help!

Edited by EightEx

Share this post


Link to post
Share on other sites
veh = [this, 999, 990, 5, TRUE, FALSE, "iedid = [this] execVM 'FOCK_ied\Fock_iedveh.sqf';"] execVM "vehicle.sqf";

Many thanks - works flawlessly

Share this post


Link to post
Share on other sites

Looking for some help guys

Trying to add this

heli2 setVehicleInit format ["this addAction ['<t color=""#FF0000"">Halo Jump</t>','scripts\halo\Action_HALO.sqf'];"];

to the vehicle.sqf command,

veh = [this, 30, 120, 0, FALSE, FALSE] execVM "vehicle.sqf"

For this

	_veh2 = ["UH1H_TK_GUE_EP1","MH6J_EP1","AH6J_EP1","UH1H_TK_EP1"] call BIS_fnc_selectRandom;
heli2 = createVehicle [_veh2,[(getMarkerpos _marker2 select 0) + 30, getMarkerpos _marker2 select 1,0],[], 0, "NONE"];
heli2 setFuel random 1;
heli2 setVehicleAmmo random 1;

Any help would be appreciated

Thanks

Edited by marker

Share this post


Link to post
Share on other sites

Don't use the setVehicleInit command in the init field... You're already setting the vehicle init by adding code to it.

Something like this should do it:

this addAction ["Halo Jump","scripts\halo\Action_HALO.sqf"]; veh = [this, 30, 120, 0, FALSE, FALSE, "this addAction ['Halo Jump','scripts\halo\Action_HALO.sqf']" ] execVM "vehicle.sqf"

Share this post


Link to post
Share on other sites

hey there Tophe,

I am working on a huge Mission where the Helipad and all the stuff around (Servicetrucks, Heli H´s, etc.) will be moved from the first point where it was placed

to another place. This is supposed to happen after accomplishing a certain target.

The Problem I have now is that the script has knowledge only from the first place, but not from the new place. So is there a possibiliy to make it happen that

the script will accept the new place as current one and spawn the Heli right there?

Thanks in advance

regards

Memphis

Share this post


Link to post
Share on other sites

Many thanks for this script. Works great for my little mission.

Share this post


Link to post
Share on other sites

The Problem I have now is that the script has knowledge only from the first place, but not from the new place. So is there a possibiliy to make it happen that

the script will accept the new place as current one and spawn the Heli right there?

v1.2:

* Script now fully support any vehicle, including bícycles.

* Fixed positioning for vehicles close to other objects.

* Improved stability. The script runs much better with large amounts of vehicles.

Can someone please tell me how to make a vehicle spawn at a place it has NOT been placed first but has been moved by setpos getpos command?

Share this post


Link to post
Share on other sites

Was wondering if someone could help me here. This script works fantastic. I only have one issue. I am using it to respawn Little Birds when they get destroyed in my attempts to create a Little Bird Deathmatch mission. My issue is when they get destroyed without being moved they are catapulted into the air when they respawn causing an endless chain of destruction and respawning. Not sure if it makes a difference but I am placing them on the grass areas at the North West Airfield of Chernarus, and at the grass airfield at Balota. Not sure if it is the crater the initial spawn left when it blew up causing this catapulting action or what it is. Thanks in advance for any help.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×