Jump to content
iceman77

Light Vehicle Respawn Script

Recommended Posts

You guys should discuss the Victor's respawn script in it's own thread? lol

I'm trying this script, and every other script I have.

Share this post


Link to post
Share on other sites

Hello Iceman, thanks for your script! It was working really awesome on Altis but Im having problems using in on Takisan and Clafghan (Takistan from A3MP and just used the regular Clafghan map). Do you know how I can fix this? It seems to spawn two vehicles in the same place during startup and they all blow up. Im using the init

_nul = [this, 99, 1, {}] execVM "vehrespawn.sqf";

Thanks for your help!

for mods Im using African Conflict, ALIVE, MAssis SF pack, FHQ M4 + accessroeis, etc for Takistan

Im using African Conflict (and all the required addons), Middle Eastern Irregulars, ALIVE, etc for Clafghan

Share this post


Link to post
Share on other sites
Hello Iceman, thanks for your script! It was working really awesome on Altis but Im having problems using in on Takisan and Clafghan (Takistan from A3MP and just used the regular Clafghan map). Do you know how I can fix this? It seems to spawn two vehicles in the same place during startup and they all blow up. Im using the init

_nul = [this, 99, 1, {}] execVM "vehrespawn.sqf";

Thanks for your help!

for mods Im using African Conflict, ALIVE, MAssis SF pack, FHQ M4 + accessroeis, etc for Takistan

Im using African Conflict (and all the required addons), Middle Eastern Irregulars, ALIVE, etc for Clafghan

if by ''the init'' you mean an init.sqf, don't do that. put the script in the init line of the vehicle. the other problem is that the script counts a vehicle as abandoned if it hasn't been entered at all, so your vehicles are abandoned as soon as you load the mission, and since you set the abandoned timer to 99 seconds they're spawning replacements right away. set the timer to a more reasonable value such as 600 (10 minutes) or 1380 (23 minutes)

Share this post


Link to post
Share on other sites

oh sorry I should have clarified, yes Im putting it in the vehicle init line :P. Ohhhhh the delay thing makes sense, is there a way to disable to abandoned timer but keep the re spawn when the vehicles destroyed?

Thanks again!

Share this post


Link to post
Share on other sites
oh sorry I should have clarified, yes Im putting it in the vehicle init line :P. Ohhhhh the delay thing makes sense, is there a way to disable to abandoned timer but keep the re spawn when the vehicles destroyed?

Thanks again!

I just tested it and setting the abandon timer to zero appears to disable respawning of abandoned vehicles.

edit: nevermind, it just takes a while. and it looks like there's a hard limit to how long you can set the abandoned timer to.

ok so I figured it out and thoroughly tested this time. use this:

_nul = [this, {}, 1, {}] execVM "vehrespawn.sqf";

Edited by Bruhmis

Share this post


Link to post
Share on other sites
Hello Iceman, thanks for your script! It was working really awesome on Altis but Im having problems using in on Takisan and Clafghan (Takistan from A3MP and just used the regular Clafghan map). Do you know how I can fix this? It seems to spawn two vehicles in the same place during startup and they all blow up. Im using the init

_nul = [this, 99, 1, {}] execVM "vehrespawn.sqf";

Thanks for your help!

for mods Im using African Conflict, ALIVE, MAssis SF pack, FHQ M4 + accessroeis, etc for Takistan

Im using African Conflict (and all the required addons), Middle Eastern Irregulars, ALIVE, etc for Clafghan

Works perfectly fine for me , just been in arma with just A3MP enabled, placed a hunter in TAKI with the script and nothing else, respawning on destruction and abandonment works as it should.

I would suggest just testing a single vehicle on one of the maps with no mods and slowly adding each mod to find out what is causing you the problem.

My guess is ALIVE and one of their management scripts. but needs testing.

the other problem is that the script counts a vehicle as abandoned if it hasn't been entered at all, so your vehicles are abandoned as soon as you load the mission,
Yes the vehicle is put on a counter as being abandoned from the start but it is not deleted unless it has moved more than 10m from its spawn position.
and since you set the abandoned timer to 99 seconds they're spawning replacements right away.
The numbers for LVR are minutes not seconds.

Share this post


Link to post
Share on other sites

yea I just tried it too and the same thing happens (explosions everywhere)

yea its really weird. I used it successfully with ALIVE on Altis but any other map seems to have problems

Share this post


Link to post
Share on other sites
yea I just tried it too and the same thing happens (explosions everywhere)

yea its really weird. I used it successfully with ALIVE on Altis but any other map seems to have problems

did you see the edit on my other post? replace the abandon counter number with {} and it disables the abandoned vehicle respawning.

Share this post


Link to post
Share on other sites

oh no sorry I didnt see the edit and thanks for the help! so

_nul = [this, {}, 1, {}] execVM "vehrespawn.sqf";

should disable abandoned respawn and respawn the vehicle 1 minute after its destroyed right?

EDIT:

Hmmm well the duplicating seems to have stopped but the vehicles dont respawn when destroyed, am I doing something wrong?

Edited by Opendome

Share this post


Link to post
Share on other sites

I'm trying to use the vehicle init option and it works fine with stuff like "setVehicleAmmo" etc, but I'm trying to have it call this into the vehicles init:

null = [this] execVM "scripts\MH9_AdvancedActions\init.sqf";

When the vehicle respawns, the script isn't run, does anyone know how this could be done?

Any help is appreciated!

Share this post


Link to post
Share on other sites
yea I just tried it too and the same thing happens (explosions everywhere)

yea its really weird. I used it successfully with ALIVE on Altis but any other map seems to have problems

I didn't test the script with addons / mods running. So I'm not sure where your problem lies unfortunately.

I'm trying to use the vehicle init option and it works fine with stuff like "setVehicleAmmo" etc, but I'm trying to have it call this into the vehicles init:

null = [this] execVM "scripts\MH9_AdvancedActions\init.sqf";

When the vehicle respawns, the script isn't run, does anyone know how this could be done?

Any help is appreciated!

Replace this with _veh. That said, why not just run the code directly within the function, instead of calling the function that executes a script? Some ideas anyhow.

Regards,

Iceman77

Edited by Iceman77

Share this post


Link to post
Share on other sites

Hey Iceman! Oh no worries bud, I just thought maybe it was from me doing something wrong :P

If I figure out what it is I'll let ya know

Share this post


Link to post
Share on other sites

vehInitFunctions.sqf

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

TAG_FNC_TankInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

_veh setFuel 0.1;

nuke = _veh addaction [("<t color=#e53700'>" + "DropNuclearBomb" + "</t>"),"scripts\NukeInit.sqs];

};

TAG_FNC_HunterInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

createVehicleCrew _veh; _veh setFuel 0.1;_veh addweapon "HMG_127"; _veh addmagazine "500Rnd_127x99_mag_Tracer_Red";_veh addweapon "gatling_25mm"; _veh addmagazine "300Rnd_25mm_shells";

};

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

hi

im trying to respawn a plane with an addaction to it, but it wont work on a dedicated server.

all other code than the addaction works fine.

the addaction works in editor and when i host a server from my own pc, but it wont work on a dedicated server.

any ideas how i can make it work?

Share this post


Link to post
Share on other sites

im sorry, but im a complete noob with scripts...

i tried this....

vehInitFunctions.sqf

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

TAG_FNC_TankInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

_veh setFuel 0.1;

["{nuke = _veh addaction [("<t color='#e53700'>" + "DropNuclearBomb" + "</t>"),"scripts\NukeInit.sqs";}","BIS_fnc_spawn",true,true] spawn BIS_fnc_MP;

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

and this

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

TAG_FNC_TankInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

_veh setFuel 0.1;

[[[],"myscript.sqf"],"BIS_fnc_execVM",false,true] spawn BIS_fnc_MP;

};

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

and this

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

TAG_FNC_TankInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

_veh setFuel 0.1;

["myscript.sqf","BIS_fnc_execVM",true,true] spawn BIS_fnc_MP;

};

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

myscript.sqf

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

_veh = _this select 0;

nuke = _veh addaction [("<t color=#e53700'>" + "DropNuclearBomb" + "</t>"),"scripts\NukeInit.sqs];

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

i really have no idea what im doing here... this is giving me a headache, used to be so simple for arma 2.

could you give me an example how to use BIS_fnc_MP ?

Share this post


Link to post
Share on other sites

Okay, to keep it simple and short..

I'm using Iceman77 Light Vehicle Respawn Script, and I'm having a problem adding a function to the script after it respawns. Code is as follows thank you in advance if you could help!

Code I'm trying to add into the TAG_FNC_HunterHMGInit: {this addMagazineTurret ["200Rnd_127x99_mag_Tracer_Red",[0]]} foreach [1,2,3,4,5,6];

I have also tried replacing the {this with _veh,, Any solution ?

I should Mention that the code works when I impute it into the init line of the vehicle.

For me 2 mags in the truck to start, is a whole slap in the face of realism, Unless I'm clearly not gettin' it :D

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

TAG_FNC_TankInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

_veh disableTIEquipment true;

};

TAG_FNC_HunterInit = {

// -- Example code. You can work with the vehicle anyway you like here!! -- //

_veh = _this select 0;

_veh setFuel 0.1;

};

TAG_FNC_HunterHMGInit = {

_veh = _this select 0;

_veh disableTIEquipment true;

{this addMagazineTurret ["200Rnd_127x99_mag_Tracer_Red",[0]]} foreach [1,2,3,4,5,6]; and the way the code is originally

_veh addMagazineTurret ["200Rnd_127x99_mag_Tracer_Red",[0]]} foreach [1,2,3,4,5,6]; ?? what could I be missing ?

};

TAG_FNC_HunterGMGInit = {

_veh = _this select 0;

_veh setVehicleAmmo 0.2;

};

TAG_FNC_slammerInit = {

_veh = _this select 0;

_veh setVehicleAmmo 0.6;

};

TAG_FNC_marshallInit = {

_veh = _this select 0;

_veh setVehicleAmmo 0.8;

};

// -- ADD MORE FUNCTIONS HERE!! -- //

Edited by 3lockad3

Share this post


Link to post
Share on other sites

You're missing a

{

It should be

{_veh addMagazineTurret ["200Rnd_127x99_mag_Tracer_Red",[0]]} foreach [1,2,3,4,5,6];

All square curly and normal brackets must be opened and closed. In other words for each open bracket symbol used, there must be a close bracket as well. i.e.

[ { or ( must have a corresponding ) } or ]

Get a decent sqf editor that recognises sqf code. You would have spotted it straight away.

Edited by Beerkan
The spelling bee told me too..

Share this post


Link to post
Share on other sites

Okay will try in a few, thank you for your time Beerkan.

Will post results for future patrons.

Oh and thank you for teaching me something I never knew!

---------- Post added at 22:11 ---------- Previous post was at 21:53 ----------

You're missing a
{

It should be

{_veh addMagazineTurret ["200Rnd_127x99_mag_Tracer_Red",[0]]} foreach [1,2,3,4,5,6];

All square curly and normal brackets must be opened and closed. In other words for each open bracket symbol used, there must be a close bracket as well. i.e.

[ { or ( must have a corresponding ) } or ]

Get a decent sqf editor that recognises sqf code. You would have spotted it straight away.

Works like a charm, and I even learned a few things..

Thank you so much!

I will share your post on Armaholic to help others as well struggling with this,, If you have any problems with that, please bring it to my attention and I will remove the post I credited your handle with.

Now I may resume the insanity of editing lol

Edited by 3lockad3

Share this post


Link to post
Share on other sites

From my understanding, createVehicle should not be used, when running on a server, is this correct?

Share this post


Link to post
Share on other sites

I am having a similar problem to 3lockad3.

I am using some vehicles as Virtual Ammo boxes - but VAS is not available on respawn. So I added this code, but it does not work - any idea what I have done wrong?

             if (_dead) then { 
               deleteVehicle _veh; 
               sleep 1; 
               _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; 
               _veh setDir _dir; 
               _veh setPos [_pos select 0, _pos select 1,0]; 
			_veh addAction["<t color='#ff1111'>Virtual Ammobox</t>", "VAS\open.sqf"];
           }; 
       }; 
   }; 
};

Edited by CallMeSarge
Typos

Share this post


Link to post
Share on other sites
I am having a similar problem to 3lockad3.

I am using some vehicles as Virtual Ammo boxes - but VAS is not available on respawn. So I added this code, but it does not work - any idea what I have done wrong?

             if (_dead) then { 
               deleteVehicle _veh; 
               sleep 1; 
               _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; 
               _veh setDir _dir; 
               _veh setPos [_pos select 0, _pos select 1,0]; 
	_veh addAction["<t color='#ff1111'>Virtual Ammobox</t>", "VAS\open.sqf"];
           }; 
       }; 
   }; 
};

Put this in your init.sqf

// Add VAS to Respawned Vehicles
	if (!(isNull player)) then {
   		Fnc_MPAddVASAction = {
     	  _this addAction["<t color='#ff1111'>Virtual Ammobox</t>","VAS\open.sqf"];
 	  };
};

and in your respawn script replace

_veh addAction["<t color='#ff1111'>Virtual Ammobox</t>", "VAS\open.sqf"];

with

[_veh,"Fnc_MPAddVASAction",nil,true] spawn BIS_fnc_MP;

Share this post


Link to post
Share on other sites

Oh, God! Thank you so much! Your script was the only one that worked properly! :D

But I'm facing a problem. I've put the UAV to respawn. When it respawns, I just can't connect to it anymore (on the terminal).

Share this post


Link to post
Share on other sites

Another question - I am using a vehicle as an MHQ, and a simple teleport script - but when the vehicle respawns, teleporting is no longer an option. I am using the teleport script described by Iceman here. Any advice would be gratefully received.

Share this post


Link to post
Share on other sites
Another question - I am using a vehicle as an MHQ, and a simple teleport script - but when the vehicle respawns, teleporting is no longer an option. I am using the teleport script described by Iceman here. Any advice would be gratefully received.
Put the init string for the script in your vehicle.sqf script. Possibly something like this
if (_veh iskindof "I_Heli_Transport_02_F") then {blah blah blah};

Share this post


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

×