Jump to content
  • 0

chi

Question

I was wondering if i could get some help clearing the loot from the usvehiclebox that i have spawning here. It spawns with like 100 mags of 240/249 bullets.

I would like to clear the cargo and create an array for the loot to choose from. I might could do the array if i knew where to put it, but i cant get the clearmagazinecargo function to work.

Thanks in advance to anyone who can help. 

P.S. It spawns whits smoke when falling from the air. Any way to make it spawn smoke in the day and flares at night?

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

heres one of my crates

Spoiler

if (isServer) then {

private ["_wep","_wep2","_wep3","_item1","_item2","_item3","_item4","_item5","_item6"];

//###############CRATE################################################################################################################################################################################################################################################################################################################################################################################################
_wep = ["M16A2","M16A2GL","M249_DZ","AK_74","M4A1_Aim","AKS_74_kobra","AKS_74_U","AK_47_M","M24","SVD_CAMO","M1014","DMR_DZ","M4A1","M14_EP1","Remington870_lamp","M240_DZ","M4A1_AIM_SD_camo","M16A4_ACG","M4A1_HWS_GL_camo","Mk_48_DZ","M4A3_CCO_EP1","Sa58V_RCO_EP1","Sa58V_CCO_EP1","M40A3","Sa58P_EP1","Sa58V_EP1"] call BIS_fnc_selectRandom;
_wep2 = ["M16A2","M16A2GL","M249_DZ","AK_74","M4A1_Aim","AKS_74_kobra","AKS_74_U","AK_47_M","M24","SVD_CAMO","M1014","DMR_DZ","M4A1","M14_EP1","Remington870_lamp","M240_DZ","M4A1_AIM_SD_camo","M16A4_ACG","M4A1_HWS_GL_camo","Mk_48_DZ","M4A3_CCO_EP1","Sa58V_RCO_EP1","Sa58V_CCO_EP1","M40A3","Sa58P_EP1","Sa58V_EP1"] call BIS_fnc_selectRandom;
_wep3 = ["M16A2","M16A2GL","M249_DZ","AK_74","M4A1_Aim","AKS_74_kobra","AKS_74_U","AK_47_M","M24","SVD_CAMO","M1014","DMR_DZ","M4A1","M14_EP1","Remington870_lamp","M240_DZ","M4A1_AIM_SD_camo","M16A4_ACG","M4A1_HWS_GL_camo","Mk_48_DZ","M4A3_CCO_EP1","Sa58V_RCO_EP1","Sa58V_CCO_EP1","M40A3","Sa58P_EP1","Sa58V_EP1"] call BIS_fnc_selectRandom;
_item1 = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;
_item2 = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;
_item3 = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;
_item4 = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;
_item5 = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;
_item6 = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;

//################################################################

 

_cratereward = objNull;
if (true) then
{
  _this = createVehicle ["TKBasicWeapons_EP1", [10469.471, 8885.4902, 0.00039672852], [], 0, "CAN_COLLIDE"];
  _cratereward = _this;
clearWeaponCargoGlobal _cratereward;
                 clearMagazineCargoGlobal _cratereward;      
                _cratereward addWeaponCargoGlobal [_wep,2];
                _cratereward addWeaponCargoGlobal [_wep2,2];
                _cratereward addWeaponCargoGlobal [_wep3,2];
                _cratereward addmagazinecargoglobal [_item1,4];
                _cratereward addmagazinecargoglobal [_item2,2];
                _cratereward addmagazinecargoglobal [_item3,2];
                _cratereward addmagazinecargoglobal [_item4,4];
                _cratereward addmagazinecargoglobal [_item5,2];
                _cratereward addmagazinecargoglobal [_item6,2];
                _cratereward setVariable ["permaLoot",true];
};

};

*if u wants random spawns per restart, define for example:

_cratepos = [[your coords],[0000,00223,023023],[" other coords"]] BIS_fnc_selectRandom;

and change in here:

_this = createVehicle ["TKBasicWeapons_EP1", [10469.471, 8885.4902, 0.00039672852], [], 0, "CAN_COLLIDE"];

by

_this = createVehicle ["TKBasicWeapons_EP1", _cratepos, [], 0, "CAN_COLLIDE"];

*If u wants diferents models of crates:

_cratemodels=["GuerillaCacheBox","RULaunchersBox","RUBasicAmmunitionBox","RUOrdnanceBox","USBasicAmmunitionBox","USLaunchersBox","USOrdnanceBox","USOrdnanceBox_EP1","USLaunchers_EP1","USBasicWeapons_EP1","USBasicAmmunitionBox_EP1","UNBasicAmmunitionBox_EP1","TKOrdnanceBox_EP1","TKLaunchers_EP1","TKBasicAmmunitionBox_EP1","GuerillaCacheBox_EP1","GERBasicWeapons_EP1"] BIS_fnc_selectRandom;

then change it:

_this = createVehicle ["TKBasicWeapons_EP1", _cratepos, [], 0, "CAN_COLLIDE"];

by

_this = createVehicle [_cratemodels, _cratepos, [], 0, "CAN_COLLIDE"];

 

*here you have another example, i use it on traders to give players random positions of randoms crates-

Spoiler

private ["_playerPos","_neartalker","_hasitem","_random","_LastUsedTime","_Time","_getPos","_unit"];

call gear_ui_init;
_playerPos = getPosATL player;
_neartalker = count nearestObjects [_playerPos, ["ValentinaFit"], 3] > 0;
_random = round(random(4));
_hasitem = "FoodchickenCooked" in magazines player;
_LastUsedTime = 1200;
_Time = time - lastuse;

if (!_hasitem) exitWith {cutText [format["Me gusa el pollo Traeme un FoodchickenCooked y hablare contigo"], "PLAIN DOWN"];};
sleep 5;

if(_Time < _LastUsedTime) exitWith {
    cutText [format["ya tienes una mision en progreso espera otros %1 segundos !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

if (_neartalker && _hasitem) then {
    lastuse = time;
    player removeMagazine "FoodchickenCooked";
    
    switch (_random) do {    
        case 0 :{

            
            titleText ["Coordenadas //16 arriba 79 izq// tienes 15 minutos ", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[1677.587, 7417.2876],[1682.7095, 7416.1377],[1638.1494, 7402.5869, 0],[1614.4928, 7447.8296, -0.032172654],[1688.9667, 7443.4146, 0],[1672.4465, 7364.9146, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
            _unit = player;
            _getPos = getPos _unit;
               
                _crate1 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate1 = _this;
                _smoke = "SmokeShellBlue" createVehicle (getPos _crate1);
                _smoke attachTo [_crate1, [0,0,0]];
                 clearWeaponCargoGlobal _crate1;
                 clearMagazineCargoGlobal _crate1;  
                _crate1 addWeaponCargoGlobal ["ItemToolbox", 2];
                _crate1 addWeaponCargoGlobal ["ItemSledge", 1];
                _crate1 addWeaponCargoGlobal ["ItemShovel", 1];    
                _crate1 addWeaponCargoGlobal ["M24_des_EP1", 2];
                _crate1 addWeaponCargoGlobal ["SCAR_H_LNG_Sniper", 1];
                _crate1 addmagazinecargoglobal ["bulk_ItemWire",2];
                _crate1 addmagazinecargoglobal ["ItemAntibiotic",2];
                _crate1 addmagazinecargoglobal ["ItemBriefcase100oz",1];
                _crate1 addmagazinecargoglobal ["forest_large_net_kit",2];
                _crate1 addmagazinecargoglobal ["bulk_ItemSandbag",2];
                _crate1 addmagazinecargoglobal ["CinderBlocks",10];
                _crate1 addmagazinecargoglobal ["Skin_GUE_Commander_DZ",1];
                _crate1 addmagazinecargoglobal ["20Rnd_762x51_B_SCAR",3];
                _crate1 addmagazinecargoglobal ["20Rnd_762x51_DMR",3];
                                
            };
             sleep 900;
                deleteVehicle _crate1;  
        };
        case 1 :{
            titleText ["Coordenadas //79 arriba - 77 izq//  Tienes 15 minutos", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[7990.2954, 7658.2842, -6.1035156e-005],[7946.6958, 7657.1748, -0.00015258789],[7904.582, 7580.2603, -0.00039672852],[7995.6387, 7562.2183, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
            _unit = player;
            _getPos = getPos _unit;
               
                _crate2 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate2 = _this;
                _smoke = "SmokeShellBlue" createVehicle (getPos _crate2);
                _smoke attachTo [_crate2, [0,0,0]];
                 clearWeaponCargoGlobal _crate2;
                 clearMagazineCargoGlobal _crate2;  
                _crate2 addWeaponCargoGlobal ["Binocular_Vector", 2];
                _crate2 addWeaponCargoGlobal ["ItemEtool", 1];
                _crate2 addWeaponCargoGlobal ["SVD_des_EP1", 1];    
                _crate2 addWeaponCargoGlobal ["M14_EP1", 2];
                _crate2 addWeaponCargoGlobal ["SCAR_H_LNG_Sniper", 1];
                _crate2 addmagazinecargoglobal ["50Rnd_127x107_DSHKM",1];
                _crate2 addmagazinecargoglobal ["100Rnd_762x51_M240",1];
                _crate2 addmagazinecargoglobal ["ItemBriefcase100oz",1];
                _crate2 addmagazinecargoglobal ["forest_large_net_kit",2];
                _crate2 addmagazinecargoglobal ["bulk_ItemSandbag",2];
                _crate2 addmagazinecargoglobal ["Skin_TK_INS_Warlord_EP1_DZ",1];
                _crate2 addmagazinecargoglobal ["10Rnd_762x54_SVD",3];
                _crate2 addmagazinecargoglobal ["20Rnd_762x51_B_SCAR",3];
                _crate2 addmagazinecargoglobal ["20Rnd_762x51_DMR",3];
                                
            };
             sleep 900;
                deleteVehicle _crate2;
        };
        case 2 :{
            titleText ["Coordenadas //86 arriba - 114 izquierda//  Tienes 15 minutos", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[8693.7461, 3957.5413, 3.0517578e-005],[8603.2891, 3869.7571, -0.00012207031],[8643.4014, 3915.6455, -3.0517578e-005],[8667.9189, 3862.4624, -0.00012207031]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
            _unit = player;
            _getPos = getPos _unit;
               
                _crate3 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate3 = _this;
                _smoke = "SmokeShellBlue" createVehicle (getPos _crate3);
                _smoke attachTo [_crate3, [0,0,0]];
                 clearWeaponCargoGlobal _crate3;
                 clearMagazineCargoGlobal _crate3;  
                _crate3 addWeaponCargoGlobal ["ItemFishingPole", 2];
                _crate3 addWeaponCargoGlobal ["ItemSledge", 1];
                _crate3 addWeaponCargoGlobal ["ItemShovel", 1];    
                _crate3 addWeaponCargoGlobal ["ItemEtool", 2];
                _crate3 addWeaponCargoGlobal ["Mk_48_DZ", 1];
                _crate3 addmagazinecargoglobal ["ItemEmerald",1];
                _crate3 addmagazinecargoglobal ["ItemCanvas",4];
                _crate3 addmagazinecargoglobal ["ItemVault",1];
                _crate3 addmagazinecargoglobal ["forest_large_net_kit",2];
                _crate3 addmagazinecargoglobal ["ItemLockbox",1];
                _crate3 addmagazinecargoglobal ["ItemTankTrap",5];
                _crate3 addmagazinecargoglobal ["Skin_GUE_Commander_DZ",1];
                _crate3 addmagazinecargoglobal ["FoodbaconCooked",3];
                _crate3 addmagazinecargoglobal ["100Rnd_762x51_M240",3];
                                
            };
             sleep 900;
                deleteVehicle _crate3;
        };
        case 3 :{
            titleText ["Coordenadas //105 arriba - 06 izquierda//  Tienes 15 minutos", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[10536.205, 14738.917, -0.00012207031],[10503.95, 14728.156, 3.0517578e-005],[10597.102, 14675.437, -0.00031280518],[10594.756, 14750.181, -0.0005569458]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
            _unit = player;
            _getPos = getPos _unit;
               
                _crate4 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate4 = _this;
                _smoke = "SmokeShellBlue" createVehicle (getPos _crate4);
                _smoke attachTo [_crate4, [0,0,0]];
                 clearWeaponCargoGlobal _crate4;
                 clearMagazineCargoGlobal _crate4;  
                _crate4 addWeaponCargoGlobal ["ItemToolbox", 2];
                _crate4 addWeaponCargoGlobal ["ItemSledge", 1];
                _crate4 addWeaponCargoGlobal ["ItemShovel", 1];    
                _crate4 addWeaponCargoGlobal ["M24_des_EP1", 2];
                _crate4 addWeaponCargoGlobal ["SCAR_H_LNG_Sniper", 1];
                _crate4 addmagazinecargoglobal ["100Rnd_127x99_M2",1];
                _crate4 addmagazinecargoglobal ["ItemSodaOrangeSherbet",5];
                _crate4 addmagazinecargoglobal ["ItemComboLock",1];
                _crate4 addmagazinecargoglobal ["ItemSandbagExLarge5X",5];
                _crate4 addmagazinecargoglobal ["ItemBloodbag",5];
                _crate4 addmagazinecargoglobal ["100Rnd_762x54_PK",4];
                _crate4 addmagazinecargoglobal ["Skin_GUE_Commander_DZ",1];
                _crate4 addmagazinecargoglobal ["20Rnd_762x51_B_SCAR",3];
                _crate4 addmagazinecargoglobal ["20Rnd_762x51_DMR",3];
                                
            };
             sleep 900;
                deleteVehicle _crate4;
        };        
    };
};

 

 

Link to comment
Share on other sites

  • 0

Lines 89 and 90 are what i tried for clearing the loot, but its still in the box.

 

Lines 94 and 95 are what i tried for flares. I would like the flares to only work at night though, and the smoke in the daytime. OR both at the same time if nothing else.

 

But clearing the loot so i can put in an array is essential. Thanks juan, you are everywhere today!!!! lol ;-)

Spoiler

    private["_model","_startpos","_endpos","_rand_player","_spawnchance","_spawnroll","_position","_aircraftpos","_chutePos","_var","_posATL","_CBLBase","_weights","_cntWeights","_num","_lootPos"];
 
    _model            = ["MV22","F35B","Su25_CDF","A10","Mi24_D","AV8B","Su25_TK_EP1","L39_TK_EP1","C130J_US_EP1","MQ9PredatorB_US_EP1"] call BIS_fnc_selectRandom;
    _startpos        = [[1000.0,2.0],[3500.0,2.0],[5000.0,2.0],[7500.0,2.0],[9712.0,663.067],[12304.0,1175.07],[14736.0,2500.0],[16240.0,5000.0],[16240.0,7500.0],[16240.0,10000.0]] call BIS_fnc_selectRandom;
    _rand_player    = playableUnits call BIS_fnc_selectRandom;
    
    _spawnChance    = 100; // Percent chance of spawning a crash number between 0 - 100 
    _spawnRoll        = round(random 100);   
 
if (_spawnRoll <= _spawnChance) then
{
 
    if((isPlayer _rand_player) && (alive _rand_player)) then {
 
        _rand_num        = ceil(random 5);
        _playerpos        = [_rand_player] call FNC_GetPos;
        _number            = 0;
 
        for "_i" from 1 to _rand_num do {
        
            _number = (_number + 1);
 
            [_number,_model,_startpos,_playerpos] spawn {
 
                private["_aircraft","_aigroup","_pilot","_wp1","_wp2","_cor_y","_cor_x"];
                
                _number     = _this select 0;
                _model         = _this select 1;
                _startpos     = _this select 2;
                _playerpos     = _this select 3;            
                _endpos        = [0,16000,200];
 
                call {
                if(_number == 1) exitWith {
                    _cor_y = 0;
                    _cor_x = 0;
                };                    
                if(_number == 2) exitWith {
                    _cor_y = -60;
                    _cor_x = -60;
                };
 
                if(_number == 3) exitWith {
                    _cor_y = -60;
                    _cor_x = 60;
                };
 
                if(_number == 4) exitWith {
                    _cor_y = -120;
                    _cor_x = -120;
                };
 
                if(_number == 5) exitWith {
                    _cor_y = -120;
                    _cor_x = 120;
                };
            };
 
                _aircraft     = createVehicle [_model,[((_startpos select 0) + _cor_y),((_startpos select 1) + _cor_x),200],[],0,"FLY"];
                _aircraft     engineOn true;
                _aircraft     flyInHeight 200;
 
                _aigroup     = creategroup civilian;
 
                _pilot         = _aigroup createUnit ["SurvivorW2_DZ",[_aircraft] call FNC_GetPos,[],0,"FORM"];
                _pilot         setCombatMode "BLUE";
                _pilot         moveindriver _aircraft;
                _pilot         assignAsDriver _aircraft;
 
                _wp1         = _aigroup addWaypoint [[((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200],0];
                _wp1         setWaypointType "MOVE";
                _wp1        setWaypointBehaviour "CARELESS";
 
                _wp2         = _aigroup addWaypoint [[(_endpos select 0),(_endpos select 1),200],0];
                _wp2         setWaypointType "MOVE";
                _wp2         setWaypointBehaviour "CARELESS";
                
                //MattL's carepackage script (edited by dgx) 
                _position = [((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200];
                waitUntil { (_aircraft distance _position < 50) };
                _aircraftpos = [_aircraft] call FNC_GetPos;
                _chute = createVehicle ["ParachuteMediumEast", _aircraftpos, [], 0, "FLY"];
                _chutePos = getPos _chute;
                _FlyingSupplyBox = createVehicle ["USVehicleBox", _chutePos, [], 0, "FLY"];
                _FlyingSupplyBox attachTo [_chute, [0,0,3]];
                _FlyingSupplyBox setVariable ["permaLoot",true];
                _FlyingSupplyBox setVariable ["ObjectID", ""];
                _FlyingSupplyBox addEventHandler ["handleDamage", {false}];
                //ClearWeaponCargo _FlyingSupplyBox;
                //ClearMagazineCargo _FlyingSupplyBox;
                _chute setVariable ["ObjectID", ""];
                _smoke = "SmokeShellYellow" createVehicle (getPos _FlyingSupplyBox);
                _smoke attachTo [_FlyingSupplyBox, [0,0,0]];
                //_flare = "F_40mm_white" createVehicle  (getPos _FlyingSupplyBox);
                //_flare attachTo [_FlyingSupplyBox, [0,0,0]];
                _var = floor((random 2) + 1);
 
 
 
                while {getPos _FlyingSupplyBox select 2 > 4} do
                {
                    _chute SetVelocity [0,0,-5];
                    uiSleep 0.1;
                };
                detach _FlyingSupplyBox;
                while {getPos _FlyingSupplyBox select 2 > 0} do {
                    _FlyingSupplyBox setPos [getPos _FlyingSupplyBox select 0, getPos _FlyingSupplyBox select 1, (getPos _FlyingSupplyBox select 2) - .25]
                };
                deleteVehicle _chute;
                _posATL = getPosATL _FlyingSupplyBox;
                deleteVehicle _FlyingSupplyBox;
                _SupplyBox = "USVehicleBox" createVehicle _posATL;
                _SupplyBox setVariable ["permaLoot",true];
                _SupplyBox enableSimulation false;
                //MattL's Carepackages script end
                
                //supply_drop.sqf code
                if (DZE_MissionLootTable) then {
                    dgx_itemTypes = [] + getArray (missionConfigFile >> "CfgBuildingLoot" >> "MassGrave" >> "lootType");
                    } else {
                    dgx_itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> "MassGrave" >> "lootType");
                    };
                _CBLBase = dayz_CBLBase find (toLower("MassGrave"));
                _weights = dayz_CBLChances select _CBLBase;
                _cntWeights = count _weights;
                _num = (round(random 8)) + 4;
                for "_x" from 1 to _num do {
                //create loot
                _maxLootRadius = (random 4) + 4;
                _lootPos = [_posATL, _maxLootRadius, random 360] call BIS_fnc_relPos;
                _index1 = floor(random _cntWeights);
                _index2 = _weights select _index1;
                _itemType = dgx_itemTypes select _index2;
                [_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;
                };
 
                // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.
                _nearby = _position nearObjects ["ReammoBox", sizeOf("USVehicleBox")];
                {
                _x setVariable ["permaLoot",true];
                } count _nearBy;
                
                //supply_drop.sqf code end
                
                waitUntil { (_aircraft distance _endpos < 500) };
                deleteVehicle _aircraft;
                deleteGroup _aigroup;
                deleteVehicle _pilot;
            };
        };
    };
};

 

Link to comment
Share on other sites

  • 0
35 minutes ago, chi said:

Lines 89 and 90 are what i tried for clearing the loot, but its still in the box.

 

Lines 94 and 95 are what i tried for flares. I would like the flares to only work at night though, and the smoke in the daytime. OR both at the same time if nothing else.

 

But clearing the loot so i can put in an array is essential. Thanks juan, you are everywhere today!!!! lol ;-)

  Reveal hidden contents

    private["_model","_startpos","_endpos","_rand_player","_spawnchance","_spawnroll","_position","_aircraftpos","_chutePos","_var","_posATL","_CBLBase","_weights","_cntWeights","_num","_lootPos"];
 
    _model            = ["MV22","F35B","Su25_CDF","A10","Mi24_D","AV8B","Su25_TK_EP1","L39_TK_EP1","C130J_US_EP1","MQ9PredatorB_US_EP1"] call BIS_fnc_selectRandom;
    _startpos        = [[1000.0,2.0],[3500.0,2.0],[5000.0,2.0],[7500.0,2.0],[9712.0,663.067],[12304.0,1175.07],[14736.0,2500.0],[16240.0,5000.0],[16240.0,7500.0],[16240.0,10000.0]] call BIS_fnc_selectRandom;
    _rand_player    = playableUnits call BIS_fnc_selectRandom;
    
    _spawnChance    = 100; // Percent chance of spawning a crash number between 0 - 100 
    _spawnRoll        = round(random 100);   
 
if (_spawnRoll <= _spawnChance) then
{
 
    if((isPlayer _rand_player) && (alive _rand_player)) then {
 
        _rand_num        = ceil(random 5);
        _playerpos        = [_rand_player] call FNC_GetPos;
        _number            = 0;
 
        for "_i" from 1 to _rand_num do {
        
            _number = (_number + 1);
 
            [_number,_model,_startpos,_playerpos] spawn {
 
                private["_aircraft","_aigroup","_pilot","_wp1","_wp2","_cor_y","_cor_x"];
                
                _number     = _this select 0;
                _model         = _this select 1;
                _startpos     = _this select 2;
                _playerpos     = _this select 3;            
                _endpos        = [0,16000,200];
 
                call {
                if(_number == 1) exitWith {
                    _cor_y = 0;
                    _cor_x = 0;
                };                    
                if(_number == 2) exitWith {
                    _cor_y = -60;
                    _cor_x = -60;
                };
 
                if(_number == 3) exitWith {
                    _cor_y = -60;
                    _cor_x = 60;
                };
 
                if(_number == 4) exitWith {
                    _cor_y = -120;
                    _cor_x = -120;
                };
 
                if(_number == 5) exitWith {
                    _cor_y = -120;
                    _cor_x = 120;
                };
            };
 
                _aircraft     = createVehicle [_model,[((_startpos select 0) + _cor_y),((_startpos select 1) + _cor_x),200],[],0,"FLY"];
                _aircraft     engineOn true;
                _aircraft     flyInHeight 200;
 
                _aigroup     = creategroup civilian;
 
                _pilot         = _aigroup createUnit ["SurvivorW2_DZ",[_aircraft] call FNC_GetPos,[],0,"FORM"];
                _pilot         setCombatMode "BLUE";
                _pilot         moveindriver _aircraft;
                _pilot         assignAsDriver _aircraft;
 
                _wp1         = _aigroup addWaypoint [[((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200],0];
                _wp1         setWaypointType "MOVE";
                _wp1        setWaypointBehaviour "CARELESS";
 
                _wp2         = _aigroup addWaypoint [[(_endpos select 0),(_endpos select 1),200],0];
                _wp2         setWaypointType "MOVE";
                _wp2         setWaypointBehaviour "CARELESS";
                
                //MattL's carepackage script (edited by dgx) 
                _position = [((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200];
                waitUntil { (_aircraft distance _position < 50) };
                _aircraftpos = [_aircraft] call FNC_GetPos;
                _chute = createVehicle ["ParachuteMediumEast", _aircraftpos, [], 0, "FLY"];
                _chutePos = getPos _chute;
                _FlyingSupplyBox = createVehicle ["USVehicleBox", _chutePos, [], 0, "FLY"];
                _FlyingSupplyBox attachTo [_chute, [0,0,3]];
                _FlyingSupplyBox setVariable ["permaLoot",true];
                _FlyingSupplyBox setVariable ["ObjectID", ""];
                _FlyingSupplyBox addEventHandler ["handleDamage", {false}];
                //ClearWeaponCargo _FlyingSupplyBox;
                //ClearMagazineCargo _FlyingSupplyBox;
                _chute setVariable ["ObjectID", ""];
                _smoke = "SmokeShellYellow" createVehicle (getPos _FlyingSupplyBox);
                _smoke attachTo [_FlyingSupplyBox, [0,0,0]];
                //_flare = "F_40mm_white" createVehicle  (getPos _FlyingSupplyBox);
                //_flare attachTo [_FlyingSupplyBox, [0,0,0]];
                _var = floor((random 2) + 1);
 
 
 
                while {getPos _FlyingSupplyBox select 2 > 4} do
                {
                    _chute SetVelocity [0,0,-5];
                    uiSleep 0.1;
                };
                detach _FlyingSupplyBox;
                while {getPos _FlyingSupplyBox select 2 > 0} do {
                    _FlyingSupplyBox setPos [getPos _FlyingSupplyBox select 0, getPos _FlyingSupplyBox select 1, (getPos _FlyingSupplyBox select 2) - .25]
                };
                deleteVehicle _chute;
                _posATL = getPosATL _FlyingSupplyBox;
                deleteVehicle _FlyingSupplyBox;
                _SupplyBox = "USVehicleBox" createVehicle _posATL;
                _SupplyBox setVariable ["permaLoot",true];
                _SupplyBox enableSimulation false;
                //MattL's Carepackages script end
                
                //supply_drop.sqf code
                if (DZE_MissionLootTable) then {
                    dgx_itemTypes = [] + getArray (missionConfigFile >> "CfgBuildingLoot" >> "MassGrave" >> "lootType");
                    } else {
                    dgx_itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> "MassGrave" >> "lootType");
                    };
                _CBLBase = dayz_CBLBase find (toLower("MassGrave"));
                _weights = dayz_CBLChances select _CBLBase;
                _cntWeights = count _weights;
                _num = (round(random 8)) + 4;
                for "_x" from 1 to _num do {
                //create loot
                _maxLootRadius = (random 4) + 4;
                _lootPos = [_posATL, _maxLootRadius, random 360] call BIS_fnc_relPos;
                _index1 = floor(random _cntWeights);
                _index2 = _weights select _index1;
                _itemType = dgx_itemTypes select _index2;
                [_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;
                };
 
                // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.
                _nearby = _position nearObjects ["ReammoBox", sizeOf("USVehicleBox")];
                {
                _x setVariable ["permaLoot",true];
                } count _nearBy;
                
                //supply_drop.sqf code end
                
                waitUntil { (_aircraft distance _endpos < 500) };
                deleteVehicle _aircraft;
                deleteGroup _aigroup;
                deleteVehicle _pilot;
            };
        };
    };
};

 

:D

89 and 90  must be  clearWeaponCargoGlobal

 clearWeaponCargoGlobal _FlyingSupplyBox;
 clearMagazineCargoGlobal _FlyingSupplyBox;

 

Link to comment
Share on other sites

  • 0

dang, i was close.... lol. I know nothing about coding really, so thanks again for your help. Thats two problems solved in one day!!!!!

 

Everything you help me with does help me to learn a little more than i do know. So thanks for that.

 

Im looking up some stuff on the night time flares now.

 

Link to comment
Share on other sites

  • 0

here u have a part block of wai missions. for flares and smoke....try to identify wheres is defined  sunOrMoon

Spoiler

if (_complete) then {

        if (typeOf(_crate) in (crates_large + crates_medium + crates_small)) then {

            if(wai_crates_smoke && sunOrMoon == 1) then {
                _marker = "smokeShellPurple" createVehicle getPosATL _crate;
                _marker setPosATL (getPosATL _crate);
                _marker attachTo [_crate,[0,0,0]];
            };

            if (wai_crates_flares && sunOrMoon != 1) then {
                _marker = "RoadFlare" createVehicle getPosATL _crate;
                _marker setPosATL (getPosATL _crate);
                _marker attachTo [_crate, [0,0,0]];
                
                _in_range = _crate nearEntities ["CAManBase",1250];
                
                {
                    if(isPlayer _x && _x != player) then {
                        PVDZE_send = [_x,"RoadFlare",[_marker,0]];
                        publicVariableServer "PVDZE_send";
                    };
                } count _in_range;

            };

        };

 

Link to comment
Share on other sites

  • 0

i will check that out now.

 

I just got the boxes to empty. Had to put

                ClearWeaponCargoGlobal _SupplyBox;
                ClearMagazineCargoGlobal _SupplyBox;

on lines 113 and 114 where the boxes were created on the ground. Thanks for helping me with the global thing though. That was my whole problem.

 

Now im gonna try to get these flares working. Thanks again!!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...