Edit Weapons Crate Mission

Tartarus116

New Member
Hi,

This is the code I want to change:
Code:
private ["_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_position", "_event_marker", "_loot_pos", "_debug_marker","_loot_box", "_hint"];
 
_spawnChance =  0.75; // Percentage chance of event happening
_markerRadius = 800; // Radius the loot can spawn and used for the marker
_debug = false; // Puts a marker exactly were the loot spawns
 
_loot_box = "RUBasicWeaponsBox";
_loot_lists = [
[
["DMR","NVGoggles","NVGoggles","G36_C_SD_camo","FN_FAL_ANPVS4","SCAR_H_LNG_Sniper_SD","G36K_camo","M249_DZ","baf_l110a1_aim_dz","M4A1_HWS_GL_SD_CAMO"],
["ItemPainkiller","ItemMorphine","ItemBandage","ItemBloodbag","ItemAntibiotic","ItemEpinephrine","ItemBriefcase10oz","1Rnd_HE_M203","1Rnd_HE_M203","1Rnd_HE_M203","1Rnd_HE_M203","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","200Rnd_556x45_M249","200Rnd_556x45_M249"],
["DZ_LargeGunBag_EP1"]
],
[
["BAF_LRR_scoped","NVGoggles","NVGoggles","Mk_48_DZ ","SCAR_L_CQC","SCAR_L_CQC","SCAR_H_LNG_Sniper_SD","M40A3","MG36","SCAR_H_STD_EGLM_Spect","m8_Sharpshooter","SCAR_L_STD_EGLM_RCO"],
["ItemPainkiller","ItemMorphine","ItemBandage","ItemBloodbag","ItemAntibiotic","ItemEpinephrine","ItemBriefcase10oz","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","100Rnd_762x51_M240","100Rnd_762x51_M240","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24"],
["DZ_LargeGunBag_EP1"]
],
[
["BAF_LRR_scoped","NVGoggles","NVGoggles","VSS_vintorez","FN_FAL","DMR","DMR","SCAR_L_CQC_EGLM_Holo","SCAR_L_STD_EGLM_RCO","SCAR_L_STD_Mk4CQT"],
["ItemPainkiller","ItemMorphine","ItemBandage","ItemBloodbag","ItemAntibiotic","ItemEpinephrine","ItemBriefcase100oz","100Rnd_556x45_BetaCMag","100Rnd_556x45_BetaCMag","5Rnd_86x70_L115A1","5Rnd_86x70_L115A1","5Rnd_86x70_L115A1","20Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL"],
["DZ_LargeGunBag_EP1"]
]
];
_loot = _loot_lists call BIS_fnc_selectRandom;
 
_loot_amount = 75;
_wait_time = 1800;
 
// Dont mess with theses unless u know what yours doing
_start_time = time;
_spawnRadius = 5000;
_spawnMarker = 'center';
 
if (isNil "EPOCH_EVENT_RUNNING") then {
    EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
    diag_log("Event already running");
};
 
// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance and !_debug) exitWith {};
 
// Random location
_position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
 
diag_log(format["Spawning loot event at %1", _position]);
 
_event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
_event_marker setMarkerShape "ELLIPSE";
_event_marker setMarkerColor "ColorRed";
_event_marker setMarkerAlpha 0.5;
_event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
 
_loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
 
if (_debug) then {
    _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
    _debug_marker setMarkerShape "ICON";
    _debug_marker setMarkerType "mil_dot";
    _debug_marker setMarkerColor "ColorBlue";
    _debug_marker setMarkerAlpha 1;
};
 
diag_log(format["Creating ammo box at %1", _loot_pos]);
 
// Create ammo box
_loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
clearMagazineCargoGlobal _loot_box;
clearWeaponCargoGlobal _loot_box;
 
// Cut the grass around the loot position
_clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
_clutter setPos _loot_pos;
// cut the grass    end
 
// Add loot
{
_loot_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_loot_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
 
// Send message to users (http://dayzepoch.com/forum/index.php?/topic/1026-server-side-hintglobalchat-fix-deathmsg-fix/)
_hint = parseText format["<t align='center' color='#52bf90' shadow='2' size='1.75'>Weapon Cache Mission</t><br/><t align='center' color='#ffffff'>A weapons cache has been located within the shaded area on the map, you have 15 minutes to grab the loot</t>"];
customRemoteMessage = ['hint', _hint];
publicVariable "customRemoteMessage";
 
diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);
 
// Wait
sleep _wait_time;
 
// Clean up
EPOCH_EVENT_RUNNING = false;
deleteVehicle _loot_box;
deleteMarker _event_marker;
if (_debug) then {
    deleteMarker _debug_marker;
};


The part I want to change is at the top where it says loot box. I wanted it to be supply loot instead of Weapons but didn't want to put every item 300x in manually, so I tried this:
Code:
_loot_box = "RUBasicWeaponsBox";
_loot_lists = [
[
[["PartWoodLumber",100],["ItemToolbox",5],["ItemCrowbar",5],["ItemPole",40],["PartGeneric",50],["PartWoodPlywood",200],["ItemTankTrap",50],["rusty_gate_kit",10],["metal_panel_kit",50]],
[["CinderBlocks",300],["Generator_DZ",5],["MortarBucket",20],"Skin_Sniper1_DZ","Skin_Rocket_DZ","Skin_RU_Policeman_DZ","Skin_Pilot_EP1_DZ","Skin_Haris_Press_EP1_DZ","Skin_Ins_Soldier_GL_DZ","Skin_GUE_Commander_DZ","Skin_Functionary1_EP1_DZ","Skin_Priest_DZ","Skin_Soldier_Sniper_PMC_DZ",["ItemTent",20],["ItemSandbag",50],["ItemWire",15],["ItemSledge",5],["TrashTinCan",20]]
]
];

It spawned the crate but apart from the clothing items it was empty.

Can Anyone tell me how to spawn the items 300x without having to copy/paste it 300x?
 
i'm not totally sure. but i'd guess the list your making is separating everything by commas (,) so you got { ["partwoodlumber" } and { 100] }being saved as separate entities, along with everything else you got on the list.
if your trying to add your own cargo you have to stop this:
// Add loot
{
_loot_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_loot_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);

That code is going through the list generated by _loot_lists. the one you modified trying to include your own items and quantities.
[_x,1]; this part of the loot code above means it takes the name between the commas, in your case ["partwoodlumber" and adds, 1 to the cargo.

you need to go through your whole list and start making code like this
addWeaponCargoGlobal ["PartWoodLumber", 100];
addWeaponCargoGlobal ["ItemToolbox", 5];
 
Back
Top