Jump to content
  • 0

Need a way to have static loot caches.


SgtSparraGump

Question

Hi Everyone,

 

As the title says, I need a way to have loot caches in set locations (yes this is another salvation city thing) 

 

Need them to refresh at every server start and only at server restart to eliminate them being farmed.

 

How would I go about doing this?

 

Cheers

 

SG.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I use the following code to spawn loot boxes on our AI Island, they spawn every restart.

if(!isServer) exitwith {};
diag_log["AI Crates Started"];

_Base = [["M9","15Rnd_9x19_M9"], ["AKS_74_UN_kobra","30Rnd_545x39_AKSD"], ["M4A3_CCO_EP1","30Rnd_556x45_Stanag"], ["M4A1_AIM_SD_camo","30Rnd_556x45_StanagSD"], ["M16A4","30Rnd_556x45_Stanag"], ["m8_carbine","30Rnd_556x45_Stanag"], ["BAF_L85A2_RIS_Holo","30Rnd_556x45_Stanag"], ["Sa58V_CCO_EP1","30Rnd_762x39_AK47"]];
_Scoped = [["AK_107_pso","30Rnd_545x39_AK"], ["M16A4_ACG","30Rnd_556x45_Stanag"], ["Sa58V_RCO_EP1","30Rnd_762x39_AK47"], ["SCAR_L_STD_Mk4CQT","30Rnd_556x45_Stanag"], ["BAF_L86A2_ACOG","30Rnd_556x45_Stanag"], ["M4A1_AIM_SD_camo","30Rnd_556x45_StanagSD"], ["M14_EP1","20Rnd_762x51_DMR"], ["M8_sharpshooter","30Rnd_556x45_Stanag"]];
_Underbarrel = [["AK_107_GL_pso","30Rnd_545x39_AK"], ["AK_107_GL_kobra","30Rnd_545x39_AK"], ["M4A1_HWS_GL","30Rnd_556x45_Stanag"], ["M16A4_ACG_GL","30Rnd_556x45_Stanag"], ["RPG7V","PG7V"], ["M8_carbineGL","30Rnd_556x45_Stanag"], ["SCAR_L_STD_EGLM_RCO","30Rnd_556x45_Stanag"], ["BAF_L85A2_UGL_Holo","30Rnd_556x45_Stanag"], ["M4A3_RCO_GL_EP1","30Rnd_556x45_Stanag"]];
_Sniper = [["KSVK","5Rnd_127x108_KSVK"], ["SCAR_H_STD_EGLM_Spect","20rnd_762x51_B_SCAR"], ["M110_NVG_EP1","20rnd_762x51_B_SCAR"], ["SCAR_H_LNG_Sniper_SD","20rnd_762x51_SB_SCAR"], ["SVD_CAMO","10Rnd_762x54_SVD"], ["VSS_Vintorez","20Rnd_9x39_SP5_VSS"], ["BAF_LRR_scoped","5Rnd_86x70_L115A1"], ["DMR","20Rnd_762x51_DMR"], ["M40A3","5Rnd_762x51_M24"]];
_LMG = [["RPK_74","75Rnd_545x39_RPK"], ["MK_48_DZ","100Rnd_762x51_M240"], ["M249_DZ","200Rnd_556x45_M249"], ["Pecheneg_DZ","100Rnd_762x54_PK"], ["RPG7V","PG7V"], ["M240_DZ","100Rnd_762x51_M240"]];
_Trade= [["ItemWoodStairs"],["ItemWoodStairs"],["MortarBucket"],["CinderBlocks"],["ItemWoodFloor"],["metal_floor_kit"],["ItemWoodWallGarageDoor"],["ItemWoodWallWindowLg"],["ItemWoodWallLg"],["outhouse_kit"],["cinder_wall_kit"],["PartPlankPack"],["PartPlywoodPack"]];
_Gold =[["ItemBriefcase100oz"]];

//Spawn Boxes skanky
_wbox1 = createVehicle ["RUOrdnanceBox",[14000.7, 2799.59, 0.002], [], 0, "CAN_COLLIDE"]; //Lumber Mill
_wbox2 = createVehicle ["RUOrdnanceBox",[14008.6, 2720.19, 0.002], [], 0, "CAN_COLLIDE"]; //Dock
_wbox3 = createVehicle ["RUOrdnanceBox",[13692.5, 2956.68, 0.002], [], 0, "CAN_COLLIDE"]; //Church
_wbox4 = createVehicle ["RUOrdnanceBox",[13692.7, 2956.82, 0.443], [], 0, "CAN_COLLIDE"]; //Hill Left
_wbox5 = createVehicle ["RUOrdnanceBox",[13656.5, 3010.72, 0.002], [], 0, "CAN_COLLIDE"]; //Village 1
_wbox6 = createVehicle ["RUOrdnanceBox",[13441.4, 3312.91, 0.201], [], 0, "CAN_COLLIDE"]; //Hill Right
_wbox7 = createVehicle ["RUOrdnanceBox",[13629.3, 2913.38, 0.001], [], 0, "CAN_COLLIDE"]; //Village 2

//Clear ammo boxes
clearWeaponCargoGlobal _wbox1;
clearMagazineCargoGlobal _wbox1;
clearBackpackCargoGlobal _wbox1;
clearWeaponCargoGlobal _wbox2;
clearMagazineCargoGlobal _wbox2;
clearBackpackCargoGlobal _wbox2;
clearWeaponCargoGlobal _wbox3;
clearMagazineCargoGlobal _wbox3;
clearBackpackCargoGlobal _wbox3;
clearWeaponCargoGlobal _wbox4;
clearMagazineCargoGlobal _wbox4;
clearBackpackCargoGlobal _wbox4;
clearWeaponCargoGlobal _wbox5;
clearMagazineCargoGlobal _wbox5;
clearBackpackCargoGlobal _wbox5;
clearWeaponCargoGlobal _wbox6;
clearMagazineCargoGlobal _wbox6;
clearBackpackCargoGlobal _wbox6;
clearWeaponCargoGlobal _wbox7;
clearMagazineCargoGlobal _wbox7;
clearBackpackCargoGlobal _wbox7;

//Set Loot skanky
_Baseloot = _Base call BIS_fnc_selectRandom;
_Baseloot2 = _Base call BIS_fnc_selectRandom;
_Baseloot3 = _Base call BIS_fnc_selectRandom;
_ScopedLoot = _Scoped call BIS_fnc_selectRandom;
_ScopedLoot2 = _Scoped call BIS_fnc_selectRandom;
_UnderbarrelLoot = _Underbarrel call BIS_fnc_selectRandom;
_SniperLoot = _Sniper call BIS_fnc_selectRandom;
_SniperLoot2 = _Sniper call BIS_fnc_selectRandom;
_LMGLoot = _LMG call BIS_fnc_selectRandom;
_LMGLoot2 = _LMG call BIS_fnc_selectRandom;
_Construction = _Trade call BIS_fnc_selectRandom;
_Construction1 = _Trade call BIS_fnc_selectRandom;
_Construction2= _Trade call BIS_fnc_selectRandom;
_Construction3 = _Trade call BIS_fnc_selectRandom;
_Gold = _Gold call BIS_fnc_selectRandom;
_Gold1 = _Gold call BIS_fnc_selectRandom;
_Gold2 = _Gold call BIS_fnc_selectRandom;
_Gold3 = _Gold call BIS_fnc_selectRandom;
//Spawn weapons
_wbox1 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox1 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox1 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox1 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox1 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox1 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox1 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox1 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox1 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox1 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];
_wbox2 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox2 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox2 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox2 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox2 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox2 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox2 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox2 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox2 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox2 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];
_wbox3 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox3 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox3 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox3 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox3 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox3 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox3 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox3 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox3 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox3 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];
_wbox4 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox4 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox4 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox4 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox4 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox4 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox4 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox4 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox4 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox4 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];
_wbox5 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox5 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox5 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox5 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox5 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox5 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox5 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox5 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox5 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox5 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];
_wbox6 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox6 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox6 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox6 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox6 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox6 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox6 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox6 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox6 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox6 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];
_wbox7 addWeaponCargoGlobal [_Baseloot select 0, 5];
_wbox7 addWeaponCargoGlobal [_Baseloot2 select 0, 5];
_wbox7 addWeaponCargoGlobal [_Baseloot3 select 0, 5];
_wbox7 addWeaponCargoGlobal [_ScopedLoot select 0, 5];
_wbox7 addWeaponCargoGlobal [_ScopedLoot2 select 0, 5];
_wbox7 addWeaponCargoGlobal [_UnderbarrelLoot select 0, 5];
_wbox7 addWeaponCargoGlobal [_SniperLoot select 0, 5];
_wbox7 addWeaponCargoGlobal [_SniperLoot2 select 0, 5];
_wbox7 addWeaponCargoGlobal [_LMGLoot select 0, 5];
_wbox7 addWeaponCargoGlobal [_LMGLoot2 select 0, 5];

//Spawn Mags
_wbox1 addMagazineCargoGlobal [_Baseloot select 1, 2];
_wbox1 addMagazineCargoGlobal [_Baseloot2 select 1, 2];
_wbox1 addMagazineCargoGlobal [_Baseloot3 select 1, 2];
_wbox1 addMagazineCargoGlobal [_ScopedLoot select 1, 2];
_wbox1 addMagazineCargoGlobal [_ScopedLoot2 select 1, 2];
_wbox1 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 2];
_wbox1 addMagazineCargoGlobal [_SniperLoot select 1, 2];
_wbox1 addMagazineCargoGlobal [_SniperLoot2 select 1, 2];
_wbox1 addMagazineCargoGlobal [_LMGLoot select 1, 2];
_wbox1 addMagazineCargoGlobal [_LMGLoot2 select 1, 2];
_wbox1 addMagazineCargoGlobal [_Construction2 select 0, 10];
_wbox1 addMagazineCargoGlobal [_Gold select 0, 2];
_wbox2 addMagazineCargoGlobal [_Baseloot select 1, 2];
_wbox2 addMagazineCargoGlobal [_Baseloot2 select 1, 2];
_wbox2 addMagazineCargoGlobal [_Baseloot3 select 1, 2];
_wbox2 addMagazineCargoGlobal [_ScopedLoot select 1, 2];
_wbox2 addMagazineCargoGlobal [_ScopedLoot2 select 1, 2];
_wbox2 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 2];
_wbox2 addMagazineCargoGlobal [_SniperLoot select 1, 2];
_wbox2 addMagazineCargoGlobal [_SniperLoot2 select 1, 2];
_wbox2 addMagazineCargoGlobal [_LMGLoot select 1, 2];
_wbox2 addMagazineCargoGlobal [_LMGLoot2 select 1, 2];
_wbox2 addMagazineCargoGlobal [_Construction1 select 0, 10];
_wbox2 addMagazineCargoGlobal [_Gold select 0, 2];
_wbox3 addMagazineCargoGlobal [_Baseloot select 1, 2];
_wbox3 addMagazineCargoGlobal [_Baseloot2 select 1, 2];
_wbox3 addMagazineCargoGlobal [_Baseloot3 select 1, 2];
_wbox3 addMagazineCargoGlobal [_ScopedLoot select 1, 2];
_wbox3 addMagazineCargoGlobal [_ScopedLoot2 select 1, 2];
_wbox3 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 2];
_wbox3 addMagazineCargoGlobal [_SniperLoot select 1, 2];
_wbox3 addMagazineCargoGlobal [_SniperLoot2 select 1, 2];
_wbox3 addMagazineCargoGlobal [_LMGLoot select 1, 2];
_wbox3 addMagazineCargoGlobal [_LMGLoot2 select 1, 2];
_wbox3 addMagazineCargoGlobal [_Construction3 select 0, 10];
_wbox3 addMagazineCargoGlobal [_Gold select 0, 2];
_wbox4 addMagazineCargoGlobal [_Baseloot select 1, 2];
_wbox4 addMagazineCargoGlobal [_Baseloot2 select 1, 2];
_wbox4 addMagazineCargoGlobal [_Baseloot3 select 1, 2];
_wbox4 addMagazineCargoGlobal [_ScopedLoot select 1, 2];
_wbox4 addMagazineCargoGlobal [_ScopedLoot2 select 1, 2];
_wbox4 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 2];
_wbox4 addMagazineCargoGlobal [_SniperLoot select 1, 2];
_wbox4 addMagazineCargoGlobal [_SniperLoot2 select 1, 2];
_wbox4 addMagazineCargoGlobal [_LMGLoot select 1, 2];
_wbox4 addMagazineCargoGlobal [_LMGLoot2 select 1, 2];
_wbox4 addMagazineCargoGlobal [_Construction select 0, 10];
_wbox4 addMagazineCargoGlobal [_Gold select 0, 2];
_wbox5 addMagazineCargoGlobal [_Baseloot select 1, 10];
_wbox5 addMagazineCargoGlobal [_Baseloot2 select 1, 10];
_wbox5 addMagazineCargoGlobal [_Baseloot3 select 1, 10];
_wbox5 addMagazineCargoGlobal [_ScopedLoot select 1, 10];
_wbox5 addMagazineCargoGlobal [_ScopedLoot2 select 1, 10];
_wbox5 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 10];
_wbox5 addMagazineCargoGlobal [_SniperLoot select 1, 10];
_wbox5 addMagazineCargoGlobal [_SniperLoot2 select 1, 10];
_wbox5 addMagazineCargoGlobal [_LMGLoot select 1, 10];
_wbox5 addMagazineCargoGlobal [_LMGLoot2 select 1, 10];
_wbox5 addMagazineCargoGlobal [_Construction select 0, 10];
_wbox5 addMagazineCargoGlobal [_Gold select 0, 2];
_wbox6 addMagazineCargoGlobal [_Baseloot select 1, 2];
_wbox6 addMagazineCargoGlobal [_Baseloot2 select 1, 2];
_wbox6 addMagazineCargoGlobal [_Baseloot3 select 1, 2];
_wbox6 addMagazineCargoGlobal [_ScopedLoot select 1, 2];
_wbox6 addMagazineCargoGlobal [_ScopedLoot2 select 1, 2];
_wbox6 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 2];
_wbox6 addMagazineCargoGlobal [_SniperLoot select 1, 2];
_wbox6 addMagazineCargoGlobal [_SniperLoot2 select 1, 2];
_wbox6 addMagazineCargoGlobal [_LMGLoot select 1, 2];
_wbox6 addMagazineCargoGlobal [_LMGLoot2 select 1, 2];
_wbox6 addMagazineCargoGlobal [_Construction select 0, 10];
_wbox6 addMagazineCargoGlobal [_Gold select 0, 2];
_wbox7 addMagazineCargoGlobal [_Baseloot select 1, 10];
_wbox7 addMagazineCargoGlobal [_Baseloot2 select 1, 10];
_wbox7 addMagazineCargoGlobal [_Baseloot3 select 1, 10];
_wbox7 addMagazineCargoGlobal [_ScopedLoot select 1, 10];
_wbox7 addMagazineCargoGlobal [_ScopedLoot2 select 1, 10];
_wbox7 addMagazineCargoGlobal [_UnderbarrelLoot select 1, 10];
_wbox7 addMagazineCargoGlobal [_SniperLoot select 1, 10];
_wbox7 addMagazineCargoGlobal [_SniperLoot2 select 1, 10];
_wbox7 addMagazineCargoGlobal [_LMGLoot select 1, 10];
_wbox7 addMagazineCargoGlobal [_LMGLoot2 select 1, 10];
_wbox7 addMagazineCargoGlobal [_Construction select 0, 10];
_wbox7 addMagazineCargoGlobal [_Gold select 0, 2];

//Loot Perm
_wbox1 setVariable ["permaLoot",true];
_wbox2 setVariable ["permaLoot",true];
_wbox3 setVariable ["permaLoot",true];
_wbox4 setVariable ["permaLoot",true];
_wbox5 setVariable ["permaLoot",true];
_wbox6 setVariable ["permaLoot",true];
_wbox7 setVariable ["permaLoot",true];

diag_log["AI Crates Spawning Complete"];

Obviously change co ords and loot to suit yourself.

 

Save in server.pbo Mines saved in the init folder.

 

Called Server side.    

 

//Load Crates

[] ExecVM "\z\addons\dayz_server\init\crates.sqf";
 
Bottom of server_functions.sqf
Link to comment
Share on other sites

  • 0

I found loading the crate sqf that way caused it to spawn each one twice, you couldn't see there were 2 there, but moving around and checking gear at different spots would give you 2 different loot selections.

Added it to be called along with custom map edits, worked a charm, nomore multiple loots :) 

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
  • Advertisement
  • Discord

×
×
  • Create New...