Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_allHouses","_house1","_house2"];
- _debug = _this select 0;
- if !(isServer) then {[[[_debug],"scripts\spawnCaches.sqf"],"BIS_fnc_execVM",false,false] call BIS_fnc_MP;};
- if !(isServer) exitWith {true};
- if !(isNil "TF_CachesLeft") exitWith {true};
- //Initialize Caches TF_CachesLeft = 3;
- publicVariable "TF_CachesLeft";
- _array = ["Land_Slum_01_F","Land_Shed_03_F","Land_Slum_02_F","Land_House_Native_02_F","Land_House_Small_03_F","Land_LampShabby_F","Land_House_Native_01_F","Land_Shed_05_F","Land_Shed_04_F","Land_Addon_05_F","Land_Shed_06_F","Land_i_Shed_Ind_F","Land_PowerLine_01_pole_transformer_F","Land_PierConcrete_01_4m_ladders_F","Land_House_Small_04_F","Land_House_Small_01_F","Land_LampHalogen_F","Land_Shop_Town_04_F","Land_PowerLine_01_wire_50m_F","Land_PowerLine_01_wire_50m_main_F","Land_Shop_Town_01_F","Land_LampStreet_small_F","Land_LampHarbour_F","Land_QuayConcrete_01_5m_ladder_F","Land_PowerLine_01_pole_small_F","Land_House_Small_05_F","Land_Slum_05_F","Land_WaterTower_01_F","Land_Shed_02_F","Land_House_Small_06_F","Land_Shop_Town_02_F","Land_House_Small_02_F","Land_Shed_01_F","Land_Shop_Town_03_F","Land_Addon_03_F","Land_MetalShelter_01_F","Land_MetalShelter_02_F","Land_Slum_03_F","Land_Supermarket_01_F","Land_Shop_City_04_F","Land_Addon_02_F","Land_Addon_04_F","Land_House_Big_05_F","Land_Shop_City_07_F","Land_Addon_01_F","Land_House_Big_03_F","Land_House_Big_01_F","Land_Hotel_02_F","Land_PowerLine_01_pole_junction_F","Land_LampDecor_F","Land_Slum_04_F","Land_GarageShelter_01_F","Land_WoodenShelter_01_F","Land_PowerLine_01_pole_tall_F","Land_PierWooden_02_16m_F","Land_PierWooden_02_30deg_F","Land_PortableLight_double_F","Land_i_Stone_HouseSmall_V2_F","Land_Garbage_square5_F","Land_Tank_rust_F","Land_PierWooden_02_hut_F","Land_PierWooden_02_ladder_F","Land_Church_03_F","Land_Shed_07_F","Land_LampStreet_F","Land_School_01_F","Land_Temple_Native_01_F","Land_Shop_City_06_F","Land_Shop_Town_05_F","Land_PowerLine_01_pole_end_v2_F","Land_NavigLight_3_F","Land_Shop_City_03_F","Land_Church_01_F","Land_Warehouse_03_F","Land_FireEscape_01_short_F","Land_House_Big_04_F","Land_runway_edgelight","Land_LandMark_F","Land_Shed_Big_F","Land_Shop_City_02_F","Land_PowerLine_01_pole_end_v1_F","Land_Shop_City_01_F","Land_Hotel_01_F","Land_WindmillPump_01_F","Land_FuelStation_01_shop_F","Land_FuelStation_01_workshop_F","Land_FuelStation_01_pump_F","Land_runway_edgelight_blue_F","Land_Flush_Light_green_F","Land_FuelStation_02_workshop_F","Land_Flush_Light_yellow_F","Land_Mausoleum_01_F","Land_Barracks_01_grey_F","Land_Church_02_F","Land_SCF_01_warehouse_F","Land_Shed_Small_F","Land_GuardHouse_01_F","Land_Airport_01_controlTower_F","Land_Airport_01_terminal_F","Land_FuelStation_02_pump_F","Land_ReservoirTower_F","Land_Hangar_F","Land_dp_smallTank_F","Land_MilOffices_V1_F","Land_Barracks_01_camo_F","Land_TTowerSmall_2_F","Land_spp_Transformer_F","Land_Obstacle_Climb_F","Land_TBox_F","Land_TTowerBig_1_F","Land_FuelStation_02_roof_F","Land_House_Big_02_F","Land_TTowerSmall_1_F","Land_TTowerBig_2_F","Land_Communication_F","Land_Communication_anchor_F","Land_PierWooden_02_barrel_F","Land_PierWooden_01_10m_noRails_F","Land_PierWooden_01_16m_F","Land_PierWooden_01_dock_F","Land_PierWooden_01_hut_F","Land_PierWooden_01_ladder_F","Land_u_Shed_Ind_F","Land_Track_01_bridge_F","Land_SCF_01_storageBin_big_F","Land_SCF_01_storageBin_medium_F","Land_PowerLine_01_pole_lamp_F","Land_Offices_01_V1_F","Land_ContainerLine_01_F","Land_DPP_01_waterCooler_F","Land_DPP_01_waterCooler_ladder_F","Land_DPP_01_smallFactory_F","Land_GantryCrane_01_F","Land_Walkover_01_F","Land_SCF_01_storageBin_small_F","Land_ContainerLine_03_F","Land_StorageTank_01_small_F","Land_MobileCrane_01_F","Land_i_Stone_Shed_V1_F","Land_LampSolar_F","Land_ContainerLine_02_F","Land_FireEscape_01_tall_F","Land_MobileCrane_01_hook_F","Land_dp_bigTank_F","Land_Shop_City_05_F","Land_MultistoryBuilding_01_F","Land_MultistoryBuilding_03_F","Land_MultistoryBuilding_04_F","Land_Cathedral_01_F","Land_GarbageBags_F","Land_GarbagePallet_F","MetalBarrel_burning_F","Land_GarbageWashingMachine_F","Land_PierWooden_01_platform_F","Land_Airport_01_hangar_F","Land_Airport_02_controlTower_F","Land_Airport_02_terminal_F","Land_LampAirport_F","Land_Airport_02_hangar_right_F","Land_Airport_02_hangar_left_F","Land_BasaltWall_01_gate_F","Land_d_House_Small_01_V1_F","Land_DPP_01_mainFactory_F","Land_SCF_01_heap_bagasse_F","Land_SCF_01_diffuser_F","Land_SCF_01_generalBuilding_F","Land_SCF_01_condenser_F","Land_SCF_01_washer_F","Land_SCF_01_clarifier_F","Land_SCF_01_feeder_F","Land_SCF_01_chimney_F","Land_Tyres_F","Land_SCF_01_boilerBuilding_F","Land_SCF_01_crystallizer_F","Land_SCF_01_crystallizerTowers_F","Land_Radar_F","Land_Medevac_house_V1_F","Land_Radar_Small_F","Land_Flush_Light_red_F","Land_NavigLight_3_short_F","Land_SM_01_reservoirTower_F","Land_Warehouse_01_F","Land_Warehouse_02_F","Land_SM_01_shelter_narrow_F","Land_SM_01_shelter_wide_F","Land_SM_01_shed_unfinished_F","Land_SY_01_conveyor_end_F","Land_Warehouse_02_ladder_F","Land_SY_01_shiploader_F","Land_SY_01_shiploader_arm_F","Land_Warehouse_01_ladder_F","Land_WarehouseShelter_01_F","Land_SY_01_reclaimer_F","Land_SY_01_crusher_F","Land_ContainerCrane_01_F","Land_DryDock_01_end_F","Land_DryDock_01_middle_F","Land_SM_01_shed_F","Land_StorageTank_01_large_F","Land_Crane_F"];
- _allHouses = nearestobjects [[4000,4300,0],_array, 5000];
- //Get house for 1st Cache
- _house1 = _allHouses call BIS_fnc_selectRandom;
- while {_house1 distance (getMarkerPos "flagge") < 500} do {
- _house1 = _allHouses call BIS_fnc_selectRandom;
- };
- //Get house for 2nd Cache
- _house2 = _allHouses call BIS_fnc_selectRandom;
- while {(_house2 distance (getMarkerPos "flagge") < 500) or (_house2 distance _house1 < 500)} do {
- _house2 = _allHouses call BIS_fnc_selectRandom;
- };
- //Get house for 3rd Cache
- _house3 = _allHouses call BIS_fnc_selectRandom;
- while {(_house3 distance (getMarkerPos "flagge") < 500) or (_house3 distance _house1 < 500) or (_house3 distance _house2 < 500)} do {
- _house3 = _allHouses call BIS_fnc_selectRandom;
- };
- //Get house for 4rd Cache
- _house4 = _allHouses call BIS_fnc_selectRandom;
- while {(_house4 distance (getMarkerPos "flagge") < 500) or (_house4 distance _house1 < 500) or (_house4 distance _house2 < 500) or (_house4 distance _house3 < 500)} do {
- _house4 = _allHouses call BIS_fnc_selectRandom;
- };
- //Create Caches
- Cache1 = createVehicle ["Box_FIA_Wps_F", (_house1 buildingPos 0), [], 1, "NONE"];
- Cache2 = createVehicle ["Box_FIA_Wps_F", (_house2 buildingPos 0), [], 1, "NONE"];
- Cache3 = createVehicle ["Box_FIA_Wps_F", (_house3 buildingPos 0), [], 1, "NONE"];
- Cache4 = createVehicle ["Box_FIA_Wps_F", (_house4 buildingPos 0), [], 1, "NONE"];
- publicVariable "Cache1";
- publicVariable "Cache2";
- publicVariable "Cache3";
- publicVariable "Cache4";
- {
- //Empty Caches
- clearWeaponCargoGlobal _x;
- clearMagazineCargoGlobal _x;
- _x addMPEventHandler ["MPHit", {if (isServer and (_this select 2) < 1) then {(_this select 0) setDamage 0;};}];
- _x addMPEventHandler ["MPkilled", {if (isServer) then {[(_this select 0)] call TF_caches_fnc_Destroyed;};}];
- _x enableSimulationGlobal false;
- } forEach [Cache1,Cache2,Cache3,Cache4];
- //DEBUG
- if (_debug) then {
- for "_i" from 1 to 4 do {
- _marker = createMarker [format ["M_Cache_%1",_i],[0,0]];
- _marker setMarkerShape "ICON";
- _marker setMarkerType "mil_flag";
- _marker setMarkerColor "ColorRed";
- switch (_i) do {
- case 1: {_marker setMarkerPos [getPos Cache1 select 0, getpos Cache1 select 1]};
- case 2: {_marker setMarkerPos [getPos Cache2 select 0, getpos Cache2 select 1]};
- case 3: {_marker setMarkerPos [getPos Cache3 select 0, getpos Cache3 select 1]};
- case 4: {_marker setMarkerPos [getPos Cache4 select 0, getpos Cache4 select 1]};
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement