soldier9945 12 Posted February 23, 2016 Hi! I was trying to implement the Virtual Arsenal in my MP mission, but ran into the problem that I didn't want to blacklist most of the available stuff per faction. Then I stumbled across the new Eden Virtual Inventory (or real inventory) where I can choose either a fixed amount of weapons, or infinite weapons and items on this vehicle, ammobox. Problem is, if I wanted to copy the same selection I made on a truck for example, but I wanted to copy it over to an ammo box... how would someone do that? Edit the mission.sqm directly? The other way may be to copy the virtual arsenal loadout to the other object, but I can't find a way to edit the inventory content of a vehicle/ammobox. How would you proceed? Share this post Link to post Share on other sites
davidoss 552 Posted February 23, 2016 copy paste created vehicle with custom inventory and than change the vehicle type and other stuff 1 Share this post Link to post Share on other sites
soldier9945 12 Posted February 24, 2016 Dayum... Gonna try this, didn't event think about it. Thanks! What if I wanted to add some equipment everywhere, I'd have to edit every vehicle, right? Share this post Link to post Share on other sites
davidoss 552 Posted February 24, 2016 nope if you want the same inventory for every vehicle. Or script it in init field of any vehicle/ammobox or multiple. if (isServer) then { this spawn { params ['_vehicle']; clearWeaponCargoGlobal _vehicle; clearMagazineCargoGlobal _vehicle; clearItemCargoGlobal _vehicle; clearBackpackCargoGlobal _vehicle; _vehicle addItemCargoGlobal ['B_UavTerminal', 10]; _vehicle addItemCargoGlobal ['G_Combat', 10]; _vehicle addItemCargoGlobal ['Laserbatteries', 20]; _vehicle addItemCargoGlobal ['Laserdesignator', 10]; _vehicle addItemCargoGlobal ['ToolKit', 10]; }; }; Share this post Link to post Share on other sites
soldier9945 12 Posted February 25, 2016 Okay, that I know. But is there an easy way to get the names of the already configured items from one vehicle to copy it into the init? Thanks! Share this post Link to post Share on other sites
Tajin 349 Posted February 25, 2016 copyToClipboard [this, "init", false] call BIS_fnc_saveInventory; Put that in the init of the configured vehicle. Run the mission once. Check your clipboard contents and paste them to the init of any other vehicle. Just remember to remove the code above once you have what you want. 1 Share this post Link to post Share on other sites
TedHo 53 Posted February 25, 2016 Another option is to edit mission.sqm with a text editor (make sure not to binarize it when you save scenario), and copy/paste the stuff related to your virtual arsenal to other vehicles. Everything will be done inside mission.sqm. Share this post Link to post Share on other sites
soldier9945 12 Posted February 27, 2016 (edited) I may have found a solution reading the Arsenal Wiki and came up with the following idea: I could set up a Truck for Blufor called west_truck_1 and edit the virtual items I wanted. and in the init of every object I wanted to replicate these item selections: [this,(west_truck_1 call BIS_fnc_getVirtualBackpackCargo)] call BIS_fnc_addVirtualBackpackCargo; [this,(west_truck_1 call BIS_fnc_getVirtualItemCargo)] call BIS_fnc_addVirtualItemCargo; [this,(west_truck_1 call BIS_fnc_getVirtualMagazineCargo)] call BIS_fnc_addVirtualMagazineCargo; [this,(west_truck_1 call BIS_fnc_getVirtualWeaponCargo)] call BIS_fnc_addVirtualWeaponCargo; I'll try this now and will report back if it works! EDIT: Confirmed! This works! I had to change a few things from my first idea, sorry for the notifications that may have sent to subscribers of this thread Edited March 1, 2016 by soldier9945 Share this post Link to post Share on other sites
Larrow 2826 Posted March 1, 2016 Server side function to copy arsenal from one vehicle to an array of vehicles. fnc_copyVehicleArsenal = { params[ "_vehToCopy", "_vehs" ]; _condition = _vehToCopy getVariable "BIS_fnc_arsenal_condition"; _cargo = _vehToCopy getVariable "bis_addvirtualweaponcargo_cargo"; { _x setVariable [ "BIS_fnc_arsenal_condition", _condition, true ]; _x setVariable [ "bis_addvirtualweaponcargo_cargo", _cargo, true ]; [ "AmmoboxServer", [ _x, true ] ] call BIS_fnc_arsenal; }forEach _vehs; }; if ( isServer ) then { [ west_truck_1, [ west_truck_2, west_truck_3, west_truck_4 ] ] call fnc_copyVehicleArsenal; }; 1 Share this post Link to post Share on other sites
soldier9945 12 Posted March 1, 2016 @larrow, you're the best. I was gonna try to implement it like that... Do you read minds? Thanks a thousand times! Were did you find the BIS_fnc_arsenal_condition variable? EDIT: doesn't your script only copy the weapons from the truck ? _x setVariable [ "bis_addvirtualweaponcargo_cargo", _cargo, true ]; If this is for the weapons, shouldn't we add these variables too ? BIS_fnc_getVirtualBackpackCargo_cargo BIS_fnc_getVirtualItemsCargo_cargo BIS_fnc_getVirtualMagazineCargo_caro fnc_copyVehicleArsenal = { params[ "_vehToCopy", "_vehs" ]; _condition = _vehToCopy getVariable "BIS_fnc_arsenal_condition"; _cargo = _vehToCopy getVariable "bis_addVirtualBackpackCargo_cargo"; _cargo = _vehToCopy getVariable "bis_addVirtualItemsCargo_cargo"; _cargo = _vehToCopy getVariable "bis_addVirtualMagazinesCargo_cargo"; _cargo = _vehToCopy getVariable "bis_addVirtualWeaponcargo_cargo"; { _x setVariable [ "BIS_fnc_arsenal_condition", _condition, true ]; _x setVariable [ "bis_addVirtualBackpackCargo_cargo", _cargo, true ]; _x setVariable [ "bis_addVirtualItemsCargo_cargo", _cargo, true ]; _x setVariable [ "bis_addVirtualMagazinesCargo_cargo", _cargo, true ]; _x setVariable [ "bis_addVirtualWeaponcargo_cargo", _cargo, true ]; [ "AmmoboxServer", [ _x, true ] ] call BIS_fnc_arsenal; }forEach _vehs; }; if ( isServer ) then { [ west_truck_1, [ west_truck_2, west_truck_3, west_truck_4 ] ] call fnc_copyVehicleArsenal; }; Also, is using these variables faster than calling the functions BIS_addVirtual*****Cargo ? Share this post Link to post Share on other sites
soldier9945 12 Posted March 1, 2016 I've got an error on this line: _x setVariable ["BIS_fnc_arsenal_condition", _condition, true ]; In the original BIS_fnc_arsenal it's used the same way, so I don't know why it wouldn't work here : case "AmmoboxInit": { private ["_box","_allowAll"]; _box = [_this,0,objnull,[objnull]] call bis_fnc_param; _allowAll = [_this,1,false,[false]] call bis_fnc_param; _condition = [_this,2,{true},[{}]] call bis_fnc_param; if ({} isequalto {}) then { _box setvariable ["bis_fnc_arsenal_condition",_condition,true]; }; Share this post Link to post Share on other sites
soldier9945 12 Posted March 2, 2016 I finally got it working by using the functions instead of the variables. initServer.sqf: fnc_copyVehicleArsenal = { Params["_vehToCopy", "_destVehs"]; Private["_BackPackCargo", "_ItemCargo", "_MagazineCargo", "_WeaponCargo"]; _BackPackCargo = _vehToCopy call BIS_fnc_getVirtualBackpackCargo; _ItemCargo = _vehToCopy call BIS_fnc_getVirtualItemCargo; _MagazineCargo = _vehToCopy call BIS_fnc_getVirtualMagazineCargo; _WeaponCargo = _vehToCopy call BIS_fnc_getVirtualWeaponcargo; { [_x, _BackPackCargo] call BIS_fnc_addVirtualBackpackCargo; [_x, _ItemCargo] call BIS_fnc_addVirtualItemCargo; [_x, _MagazineCargo] call BIS_fnc_addVirtualMagazineCargo; [_x, _WeaponCargo] call BIS_fnc_addVirtualWeaponCargo; ["AmmoboxServer", [_x, true]] call BIS_fnc_arsenal; } forEach _destVehs; }; [west_truck_1, [west_truck_2, west_truck_3, west_truck_4]] call fnc_copyVehicleArsenal; [east_truck_1, [east_truck_2, east_ammobox_1, east_ammobox_2]] call fnc_copyVehicleArsenal; I'm not sure that code is clean or optimized... still re-learning ArmA scripting... :/ Share this post Link to post Share on other sites
Larrow 2826 Posted March 2, 2016 Script works fine for me, no errors either on screen or in RPT. doesn't your script only copy the weapons from the truck ? No. All the BIS_fnc_addVirtual#Cargo functions all end up calling BIS_fnc_addVirtualItemCargo, this function then adds to an array on the object. This array is called bis_addvirtualweaponcargo_cargo and despite its name holds an array of [ [iTEMS],[WEAPONS],[MAGAZINES],[bACKPACKS] ] 1 Share this post Link to post Share on other sites
soldier9945 12 Posted March 4, 2016 And just like that it works... Don't know what I did back then... Thanks for the explanation regarding BIS_addVirtualWeaponCargo_cargo Share this post Link to post Share on other sites