Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //========================Add Action to crate and vehicle for load
- //========================First go to crate and select it to be loaded
- //========================Then go to the vehicle which it shall be loaded into
- //========================Load the fucker in
- // Defining specific types of cargo containers, assume Land_CargoBox_V1_F has a grid of 6x6 and go from there.
- // For any non square-ish container follow pattern: when placed in the editor without being rotated, the side that is towards north = x, sides east or west = y.
- // Then estimate how many subunits of Land_CargoBox_V1_F the object has.
- // This is necessary for determining if object has to be rotated when loaded to avoid clipping.
- VZ_LOG_Container_2x2 = [
- "FlexibleTank_01_forest_F",
- "FlexibleTank_01_sand_F",
- "Land_MetalBarrel_F",
- "Land_MetalBarrel_empty_F",
- "Land_BarrelEmpty_F",
- "Land_BarrelEmpty_grey_F",
- "Land_BarrelSand_F",
- "Land_BarrelSand_grey_F",
- "Land_BarrelTrash_F",
- "Land_BarrelTrash_grey_F",
- "Land_BarrelWater_F",
- "Land_BarrelWater_grey_F"
- ];
- VZ_LOG_Container_2x3 = [
- "Land_MetalCase_01_medium_F",
- "Land_PlasticCase_01_medium_F",
- "Box_NATO_Support_F",
- "Box_NATO_Ammo_F",
- "Box_NATO_AmmoOrd_F",
- "Box_NATO_Grenades_F",
- "Box_East_Support_F",
- "Box_East_Ammo_F",
- "Box_T_East_Ammo_F",
- "Box_East_AmmoOrd_F",
- "Box_East_Grenades_F",
- "Box_IND_Support_F",
- "Box_IND_Ammo_F",
- "Box_IND_AmmoOrd_F",
- "Box_IND_Grenades_F",
- "Land_PlasticCase_01_small_F",
- "ACE_Box_82mm_Mo_Combo",
- "ACE_Box_82mm_Mo_HE",
- "ACE_Box_82mm_Mo_Illum",
- "ACE_Box_82mm_Mo_Smoke",
- "ACE_Box_Ammo",
- "ACE_Box_Misc",
- "rhsusf_ammo_crate"
- ];
- VZ_LOG_Container_2x4 = [
- "Land_MetalCase_01_large_F",
- "Land_PlasticCase_01_large_F",
- "Box_NATO_Uniforms_F",
- "Box_CSAT_Uniforms_F",
- "Box_AAF_Uniforms_F",
- "Box_NATO_Equip_F",
- "Box_CSAT_Equip_F",
- "Box_AAF_Equip_F",
- "Box_GEN_Equip_F"
- ];
- VZ_LOG_Container_3x2 = [
- "Box_IED_Exp_F",
- "Box_Syndicate_Ammo_F"
- ];
- VZ_LOG_Container_3x4 = [
- "Land_WoodenCrate_01_F"
- ];
- VZ_LOG_Container_4x2 = [
- "Box_Syndicate_Wps_F",
- "ACE_medicalSupplyCrate",
- "ACE_medicalSupplyCrate_advanced",
- "rhs_weapons_crate_ak_ammo_545x39_standard",
- "rhs_weapons_crate_ak_ammo_545x39",
- "rhs_mags_crate",
- "rhs_gear_crate",
- "rhsgref_weapons_crate"
- ];
- VZ_LOG_Container_4x3 = [
- "Box_IND_Wps_F",
- "Box_T_East_Wps_F",
- "Box_East_Wps_F",
- "Box_T_NATO_Wps_F",
- "Box_NATO_Wps_F",
- "rhs_7ya37_1_single"
- ];
- VZ_LOG_Container_6x2 = [
- "Box_NATO_WpsLaunch_F",
- "Box_East_WpsLaunch_F",
- "Box_IND_WpsLaunch_F",
- "Box_Syndicate_WpsLaunch_F"
- ];
- VZ_LOG_Container_6x3 = [
- "B_supplyCrate_F",
- "C_supplyCrate_F",
- "C_T_supplyCrate_F",
- "O_supplyCrate_F",
- "I_supplyCrate_F",
- "IG_supplyCrate_F",
- "Box_NATO_WpsSpecial_F",
- "Box_T_NATO_WpsSpecial_F",
- "Box_East_WpsSpecial_F",
- "Box_T_East_WpsSpecial_F",
- "Box_IND_WpsSpecial_F",
- "ACE_Box_Chemlights",
- "rhssaf_virtual_crate"
- ];
- VZ_LOG_Container_6x6 = [
- "B_CargoNet_01_ammo_F",
- "O_CargoNet_01_ammo_F",
- "I_CargoNet_01_ammo_F",
- "Box_NATO_AmmoVeh_F",
- "Box_IND_AmmoVeh_F",
- "Box_East_AmmoVeh_F",
- "CargoNet_01_barrels_F",
- "CargoNet_01_box_F",
- "Land_PaperBox_closed_F",
- "Land_PaperBox_open_empty_F",
- "Land_PaperBox_open_full_F",
- "Land_Pallet_MilBoxes_F",
- "Land_CargoBox_V1_F",
- "Land_WaterBarrel_F",
- "Land_WoodenCrate_01_stack_x3_F",
- "rhsusf_mags_crate",
- "rhsusf_gear_crate",
- "rhsusf_launcher_crate",
- "rhsusf_spec_weapons_crate",
- "rhsusf_weapon_crate",
- "rhsusf_weapons_crate"
- ];
- VZ_LOG_Container_9x3 = [
- "rhs_weapons_crate_ak",
- "rhs_launcher_crate",
- "rhs_spec_weapons_crate",
- "rhs_weapon_crate"
- ];
- VZ_LOG_Container_6x18 = [
- "B_Slingload_01_Ammo_F",
- "B_Slingload_01_Cargo_F",
- "B_Slingload_01_Fuel_F",
- "B_Slingload_01_Medevac_F",
- "B_Slingload_01_Repair_F"
- ];
- VZ_LOG_Check = { // For Diagnosing Purposes
- cutText [format ["%1 is loaded %2, is selected %3, is attached %4, has cargo loaded %5", (typeOf _target), (_target getVariable ["isLoaded", false]), (_target getVariable ["isSelected", false]), (_target getVariable ["isAttached", false]), (_target getVariable ["hasCargoLoaded", false])], "PLAIN"];
- };
- VZ_LOG_SelectCargo = { // Only Select the Cargo that is able to be loaded
- _isSelected = _target getVariable ["isSelected", false];
- _isAttached = _target getVariable ["isAttached", false];
- _isLoaded = _target getVariable ["isLoaded", false];
- if (_isAttached) exitwith {
- cutText [format ["%1 is already attached", (typeOf _Target)], "PLAIN"];
- };
- if (_isLoaded) exitwith {
- cutText [format ["%1 is already loaded", (typeOf _Target)], "PLAIN"];
- };
- if (_isSelected) exitwith {
- cutText [format ["%1 is already selected", (typeOf _Target)], "PLAIN"];
- };
- if (!_isSelected) then {
- cutText [format ["select a vehicle to load %1 into...", (typeOf _Target)], "PLAIN"];
- _target setVariable ["isSelected", true, true];
- };
- };
- VZ_LOG_LoadCargo = { // Actually load the damn thing in, but check if it is the one that you want to be loaded
- _hasCargoLoaded = _target getVariable ["hasCargoLoaded", false];
- if (_hasCargoLoaded) exitwith {
- cutText [format ["%1 is full!", (typeOf _target)],"PLAIN"];
- };
- _NearestCargoList = (nearestObjects [_target, ["ReammoBox_F"], 10]);
- _NearestCargoItem = (_NearestCargoList) Select 0; // Add the nearest object to define variable before forEach
- if ((count _NearestCargoList) == 0) exitwith {
- cutText [format ["There is nothing near to load"], "PLAIN"];
- };
- {
- _isNearestSelected = _x getVariable ["isSelected", false];
- _isNearestAttached = _x getVariable ["isAttached", false];
- _isNearestLoaded = _x getVariable ["isLoaded", false];
- _NearestCargoItem = _x;
- if (_isNearestLoaded) exitwith {
- systemchat format ["%1 is already loaded", (typeOf _NearestCargoItem)];
- };
- if (_isNearestAttached) exitwith {
- systemchat format ["%1 is already attached", (typeOf _NearestCargoItem)];
- };
- if (_isNearestSelected) exitwith {
- systemchat format ["%1 will be loaded", (typeOf _NearestCargoItem)];
- _NearestCargoItem setVariable ["isAttached", true, true];
- _NearestCargoItem setVariable ["isSelected", false, true];
- _NearestCargoItem setVariable ["isLoaded", true, true];
- _NearestCargoItem attachTo [_target, [0,-1,0]];
- _target setVariable ["hasCargoLoaded", true, true];
- };
- } forEach _NearestCargoList;
- _hasCargoLoaded = _target getVariable ["hasCargoLoaded", false];
- _isNearestSelected = _NearestCargoItem getVariable ["isSelected", false]; // Just to throw an error if nothing was selected
- if ((!_isNearestSelected) && !_hasCargoLoaded) exitwith {
- cutText [format ["There was nothing selected"], "PLAIN"];
- };
- systemchat format ["Endresult: %1, %2, %3, %4, %5, %6", (typeOf _NearestCargoItem), _isSelected, _isAttached, _isLoaded, _hasCargoLoaded, (count _NearestCargoList)];
- };
- VZ_LOG_UnloadCargo = { // Unload the Cargo and reset its state
- _hasCargoLoaded = _target getVariable ["hasCargoLoaded", false];
- if (!_hasCargoLoaded) exitwith {
- cutText [format ["%1 has no cargo loaded!", (typeOf _target)], "PLAIN"];
- };
- if (_hasCargoLoaded) then {
- _unloadCargoDir = getDir _target;
- _unloadCargoPos = _target getPos [-6, _unloadCargoDir];
- {
- detach _x;
- _x setVelocity [0, 0, 0.2];
- _x setPos _unloadCargoPos;
- _x setVariable ["isSelected", false, true];
- _x setVariable ["isAttached", false, true];
- _x setVariable ["isLoaded", false, true];
- } forEach attachedObjects _target; // Might be handy if more than one Item is attached
- _target setVariable ["hasCargoLoaded", false, true];
- _hasCargoLoaded = _target getVariable "hasCargoLoaded";
- cutText [format ["%1 unloading cargo...", (typeOf _target)], "PLAIN"];
- };
- };
- _actionCargoCategory = ["VZ_Logistics", "Logistics", "", {}, {true}] call ACE_interact_menu_fnc_createAction; // Create Category
- _actionSelectCargo = ["VZ_SelectCargo", "Load into", "", {[_target] call VZ_LOG_SelectCargo;}, {true}] call ACE_interact_menu_fnc_createAction; // Create Select Cargo to Load Action
- _actionLoadCargo = ["VZ_LoadCargo", "Load Selected Cargo", "", {[_target] call VZ_LOG_LoadCargo;}, {true}] call ACE_interact_menu_fnc_createAction; // Create Load Cargo Action
- _actionUnloadCargo = ["VZ_UnloadCargo", "UnLoad Cargo", "", {[_target] call VZ_LOG_UnloadCargo;}, {true}] call ACE_interact_menu_fnc_createAction; // Create UnLoad Cargo Action
- _actionCargoCheck = ["VZ_CheckCargo", "Check Variables", "", {[_target] call VZ_LOG_Check;}, {true}] call ACE_interact_menu_fnc_createAction; // Create Check Variables
- ["All", 0, ["ACE_MainActions"], _actionCargoCategory, true] call ACE_interact_menu_fnc_addActionToClass; // Add Category
- ["ReammoBox_F", 0, ["ACE_MainActions", "VZ_Logistics"], _actionSelectCargo, true] call ACE_interact_menu_fnc_addActionToClass; // Add Load Cargo Action to Supply Boxes
- ["Car", 0, ["ACE_MainActions", "VZ_Logistics"], _actionLoadCargo, true] call ACE_interact_menu_fnc_addActionToClass; // Add UnLoad Cargo Action to Vehicles
- ["Car", 0, ["ACE_MainActions", "VZ_Logistics"], _actionUnloadCargo, true] call ACE_interact_menu_fnc_addActionToClass; // Add UnLoad Cargo Action to Vehicles
- ["All", 0, ["ACE_MainActions", "VZ_Logistics"], _actionCargoCheck, true] call ACE_interact_menu_fnc_addActionToClass; // Add Check Variables
Advertisement
RAW Paste Data
Copied
Advertisement