fathersarge 46 Posted May 11, 2017 So I've edited a vehicle in the Eden editor to have a custom inventory. It respawns with the default arma/mod inventory. Can anyone clue me in on how to respawn vehicles with the custom inventory? Google hasn't been much help, unfortunately... Using CBA and ACE3 if that provides any additional resources to be used. Share this post Link to post Share on other sites
fathersarge 46 Posted May 16, 2017 In case anyone finds their way here with a similar question, here is the answer. Special thanks to Iceman77, soulkobk, and @Larrow for the work. Spoiler /* ---------------------------------------------------------------------------------------------------- File: vehRespawn.sqf Author: Iceman77 Modified: soulkobk 4:07 PM 13/05/2017 - added load out for specific vehicles. Larrow(via FatherSarge) 15/05/2017 - added load out for specific varible named vehicle Description: Respawn destroyed and abandoned vehicles (with custom vehicle load outs based on vehicle type, by soulkobk) Parameter(s): _this select 0: vehicle _this select 1: abandoned delay in minute(s) - Required _this select 2: destroyed delay in minute(s) - Required How to use - Vehicle Init Line: _nul = [this, 120, 60] execVM "vehRespawn.sqf"; << 2 minute abandoned delay, 1 minute destroyed delay. ---------------------------------------------------------------------------------------------------- */ private "_veh"; _veh = _this select 0; _abandonDelay = _this select 1; _deadDelay = _this select 2; _dir = getDir _veh; _pos = getPos _veh; _vehType = typeOf _veh; if (isServer) then { _executeLoadout = { params ["_veh","_vehType"]; _loadOut = []; // init _loadOut. switch ( true ) do { case ( _vehType == "RHS_UH60M_d" ) : { _loadOut = [["Chemlight_blue",10],["Chemlight_red",10]]; }; //Compatable with previous formatting case ( vehicleVarName _veh == "heli2" ) : { _loadOut = [["Chemlight_blue",10],["Chemlight_red",10]]; }; //Choose vehicle via name given in eden }; clearBackpackCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearWeaponCargoGlobal _veh; clearItemCargoGlobal _veh; { _x params[ "_item" ]; [ _item ] call BIS_fnc_itemType params[ "_type", "_subType" ]; switch ( toUpper _type ) do { case "MINE"; case "MAGAZINE" : { _veh addMagazineCargoGlobal _x; }; case "ITEM" : { _veh addItemCargoGlobal _x; }; case "WEAPON" : { _veh addWeaponCargoGlobal _x; }; case "EQUIPMENT" : { if ( _subType == "backpack" ) then { _veh addBackpackCargoGlobal _x; }else{ _veh addItemCargoGlobal _x; }; }; }; } forEach _loadOut; }; [_veh,_vehType] call _executeLoadout; // init the load out for the first spawn while {true} do { sleep 1; if ((alive _veh) && {canMove _veh} && {{alive _x} count crew _veh == 0}) then { _abandoned = true; for "_i" from 0 to _abandonDelay do { if (({alive _x} count (crew _veh) > 0) || (!alive _veh) || (!canMove _veh)) exitWith {_abandoned = false;}; sleep 1; }; if ((_abandoned) && {_veh distance _pos > 10}) 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 setVehicleVarName _varName; [ _veh, _varName ] call BIS_fnc_objectVar; [_veh,_vehType] call _executeLoadout; }; }; if ((!alive _veh) || (!canMove _veh)) then { _dead = true; for "_i" from 0 to _deadDelay do { if (({alive _x} count (crew _veh) > 0) || (canMove _veh)) exitWith {_dead = false;}; sleep 1; }; if (_dead) then { _varName = vehicleVarName _veh; deleteVehicle _veh; sleep 1; _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; _veh setDir _dir; _veh setPos [_pos select 0, _pos select 1,0]; _veh setVehicleVarName _varName; [ _veh, _varName ] call BIS_fnc_objectVar; [_veh,_vehType] call _executeLoadout; }; }; }; }; Share this post Link to post Share on other sites