Jump to content
focheur

Script respawn vehicles

Recommended Posts

Hello !!

I need your help because I try to respawn vehicles with init (arsenal, vehicle configuration (color, seats ...))

Currently I use the modul of respawn, after destroying the vehicles respawn but without the init, so he respawn the wrong color, without being an arsenal ...)

Thank you for your help

Share this post


Link to post
Share on other sites

The respawn module can handle this, parameters passed to the modules expression field are new vehicle and old vehicle, so in the expression field put:

params ["_newVehicle","_oldVehicle"];
//do stuff

Simply replace "this" from the object init field as you're most likely using with "_newVehicle" without the quotation marks.

You can get all kinds of info by hovering the mouse above field descriptors.

 

Cheers

Share this post


Link to post
Share on other sites

I use a translator and I do not understand too much ^^ '

Do you have an example? a mission? screenshot?

Share this post


Link to post
Share on other sites

nngMKdD.png?2

 

That's the expression field, if you use something like this in the objects init field:

[ "AmmoboxInit", [ this, true, {(_this distance _target) < 10} ] ] call BIS_fnc_arsenal;

then you need to change it into this to make it work in the vehicle respawn modules expression field:

params ["_newVehicle","_oldVehicle"];
[ "AmmoboxInit", [ _newVehicle, true, {(_this distance _target) < 10} ] ] call BIS_fnc_arsenal;

Cheers

Share this post


Link to post
Share on other sites

Okey, and to keep the same settings of vehicles? color of the car, number of seats ...

Share this post


Link to post
Share on other sites

It's complicated, I use the mobile BTC MHQ

Basic there is a respawn when the MHQ is destroyed, but it respawn basic just with the possibility of MHQ
Without arsenal and without the configuration of the vehicles
I find dasn the scritp or is the respawn script of mobiles mhq, but I do not know how to modify it so that my vehicles respawn with what I wish.
I have 2 mhq mobile, 1 truck and 1 helicopter

 

Here is the current respawn script of the 2 MHQ

BTC_vehicle_mobile_respawn =
{
    _veh  = _this select 0;
    _var  = _this select 1;
    _set  = _this select 2;
    _type = typeOf _veh;
    _pos  = getPos _veh;
    _dir  = getDir _veh;
    waitUntil {sleep 1; !Alive _veh};
    _veh setVariable [_set,0,true];
    sleep BTC_mobile_respawn_time;
    deleteVehicle _veh;
    _veh = createVehicle [_type, (_pos findEmptyPosition [2,200,_type]),[],0,"NONE"];
    if(getNumber(configFile >> "CfgVehicles" >> typeof _veh >> "isUav")==1) then {createVehicleCrew _veh;};
    _veh setDir _dir;
    _veh setVelocity [0, 0, -1];
    _veh setVariable [_set,_var,true];
    _resp = [_veh,_var,_set] spawn BTC_vehicle_mobile_respawn;
    _veh setpos _pos;
};

 

 

For the truck ( Lima_MHQ ) I wish a respawn with arsenal and the following modifications:

_veh = createVehicle ["QIN_Titus_arx20_DES",position player,[],0,"NONE"];
[
    _veh,
    ["Camo_Woodland",1],
    ["comp_camonet",0,"comp_wind_grilles",0,"comp_klec",1,"comp_police",0,"comp_police_stripes",0]
] call BIS_fnc_initVehicle;

 

For the helicopter (Hotel_MHQ) :

_veh = createVehicle ["ffaa_nh90_tth_armed",position player,[],0,"NONE"];
[
    _veh,
    ["EJERCITODETIERRA",1],
    ["HideExtras",0]
] call BIS_fnc_initVehicle;

Share this post


Link to post
Share on other sites

You can use my module, especially if you add backpacks (full) and items, arsenal and addAction in theses vehicles.

Share this post


Link to post
Share on other sites
17 hours ago, pierremgi said:

You can use my module, especially if you add backpacks (full) and items, arsenal and addAction in theses vehicles.

 

Thank you but your script will not be useful, I am trying to modify the current script: s

Share this post


Link to post
Share on other sites
5 hours ago, focheur said:

 

Thank you but your script will not be useful, I am trying to modify the current script: s

No problem. I thought this could help replacing your BI module by mine, without any script to write.

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

×