Jump to content
Sign in to follow this  
Cyrus

Adding Custom loot crates when using DZAI mission system.

Recommended Posts

I know of some questions in the forums regarding custom loot crates with available missions systems. I have managed to create a custom loot crate thanks to @DAmNRelentless help, that randomizes items and weapons from user customizable arrays and integrate this with the mission system. This for the time being works for DZAI on Epoch 1.0.6.2. 

Following is my custom lootcrate.sqf , all the classnames used is from the official epoch 1.0.6.2 github repo with thanks to @salival found >here<

Spoiler
if (isServer) then {

// Delete if crate exists
deleteVehicle _vehicle_999999; 

//Then recreate it at the same position.
_vehicle_999999 = objNull;

	while {true} do {
		_refreshTime = 180;
		_this = createVehicle ["TKVehicleBox_EP1", [726.63354, 9610.8154, 0], [], 0, "CAN_COLLIDE"];
		_vehicle_999999 = _this;
		_this setDir 20;
		_vehicle_999999 setVariable ["ObjectID","1",true];
		_vehicle_999999 setVariable ["permaLoot",true];
		_vehicle_999999 allowDamage false;

		//Clears the possible random content from the crate
		clearWeaponCargoGlobal _this;
		clearMagazineCargoGlobal _this;

//All items and Weapons arrays. User customizable.

		_weaponAmmoArray = [[["DMR_DZ",2],["20Rnd_762x51_DMR",5]],
							[["L115A3_DZ",2],["5Rnd_86x70_L115A1",5]],
							[["m107_DZ"],["10Rnd_127x99_m107",5]],
							[["PMC_AS50_scoped"],["5Rnd_127x99_as50",5]],
							[["M249_m145_EP1_DZE",2],["200Rnd_556x45_M249",5]]
		];
	
		_toolArray = [["ItemEtool",5],
					  ["ItemCrowbar",5]
		];

		_magazineArray = [["150Rnd_127x107_DSHKM",7],
						  ["150Rnd_127x108_KORD",7],
						  ["2000Rnd_762x51_M134",7],
						  ["CinderBlocks",20],["FoodCanRusPork",10],
						  ["FoodMRE",10],["ItemBriefcase100oz",2],
						  ["ItemComboLock",5],
						  ["ItemLightBulb",5],
						  ["ItemLockbox",2],
						  ["ItemMorphine",10],
						  ["ItemPainkiller",10],
						  ["ItemPole",2],
						  ["ItemSodaMzly",10],
						  ["ItemSodaR4z0r",10],
						  ["ItemVault",2],
						  ["cinder_door_kit",5],
						  ["cinder_garage_kit",5],
						  ["full_cinder_wall_kit",10],
						  ["metal_floor_kit",10],
						  ["ItemBloodbag",10]
		];

		_gemArray = [["ItemEmerald",2],
				  	 ["ItemSapphire",2],
					 ["ItemTopaz",2],
					 ["ItemCitrine",2],
					 ["ItemAmethyst",2]
		];


		_counterWeaponsAmmo = 0;

//Random Crate filling

		while {_counterWeaponsAmmo < 5} do {
			_randomWeapAmmo = _weaponAmmoArray call BIS_fnc_selectRandom;
			_weaponAmmoArray = _weaponAmmoArray - _randomWeapAmmo;
			_weapon = _randomWeapAmmo select 0;
			_ammo = _randomWeapAmmo select 1;
			_randomAmmo = round(random(_ammo select 1));
			_ammo set[1,_randomAmmo];
			_this addWeaponCargoGlobal _weapon;
			_this addMagazineCargoGlobal _ammo;
			_counterWeaponsAmmo = _counterWeaponsAmmo + 1;
		};
	
		_counterTool = 0;
	
		while {_counterTool < 2} do {
			_randomTool = _toolArray call BIS_fnc_selectRandom;
			_tooldArray = _toolArray - _randomTool;
			_this addMagazineCargoGlobal _randomTool;
			_counterTool = _counterTool + 1;
		};
	
		_counterMagazine = 0;
	
		while {_counterMagazine < 25} do {
			_randomMagazine = _magazineArray call BIS_fnc_selectRandom;
			_magazineArray = _magazineArray - _randomMagazine;
			_this addMagazineCargoGlobal _randomMagazine;
			_counterMagazine = _counterMagazine + 1;
		};
	
		_counterGem = 0;
	
		while {_counterGem < 3} do {
			_randomGem = _gemArray call BIS_fnc_selectRandom;
			_gemArray = _gemArray - _randomGem;
			_this addMagazineCargoGlobal _randomGem;
			_counterGem = _counterGem + 1;
		};
	sleep _refreshTime;
	};
};

 

From here I have added the following script to my custom DZAI spawns found in \z\addons\dayz_server\DZAI\init\world_spawn_configs\custom_spawns\cust_spawns_panthera2.sqf. Obviously you will use the sqf appropriate to your map etc.

["staticspawn",10,2,true] call DZAI_spawn_units;

if {DZAI_spawn_units && DZAI_despawnWait == true} then {
	execVM "\z\addons\dayz_server\custom\lootcrate.sqf";
};

This method might need some tweaking and someone else might have a more effective way of doing this, but for me this works perfectly. Fully tested with random loot spawns after new AI group spawned.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Similar Content

    • By Reaper5150
      Simple but fun little script I put together awhile ago.
      What it does? It is bound to a object in this case "ItemObsidian" as a right click, but can be changed to whatever you want. It then will sends out a message to the players on the server and marks the player with red smoke and a marker on the map.
      The player will then get 2 mins of god mod acting like the amour. Once the amour takes damage (All it is is a countdown timer really) The god mode is then disabled so they can be killed.
      I'm still working on this and will update it when it is done. If any of you better scriptwriters then myself ( I'm still a noob lol) have any ideas on how to improve this? contact me so I can give you credit in the update :)
      Known bugs:
      marker sometimes stays on map Credits to : @Schalldampfer  For helping me understand map markers
      Install: Place this in your scripts folder name it something like Jugg.sqf
      //========================================================
      //========= Juggernaut script-Written by Reaper5150 ===========
      //=======================================================
      sleep 2;
      [nil,nil,rTitleText,"THERE IS A JUGGERNAUT,FIND HIM AND KILL HIM IF YOU CAN!!!","PLAIN",3] call RE;
      sleep 1;
      [nil, player, rSAY, "YOURSOUND.OGG", 100] call RE; //Add your custom sound here when Juggernaut spawns 
      [] spawn {
      player removeMagazine 'ItemObsidian';//Add whatever object you want and bound to your right click function
      sleep 5;
      [nil,nil,rTitleText,"THE JUGGERNAUT HAS BODY ARMOR,WE CAN'T KILL HIM...HELP!!!","PLAIN",3] call RE;
      ////////Set marker/////////////////////////////////////////////////////////////////////
      [] execVM "scripts\marker.sqf";
      //Start Smoke Marker//////////////////////////////////////////////////////////////////////////
      sleep 5;
      PJ_grenade = "SmokeShellRed" createVehicle position player;
      PJ_grenade attachto [vehicle player,[0.1,0,0]];
      sleep 2;
      [nil,nil,rTitleText,"THE JUGGERNAUT (PLAYER) HAS BEEN MARKED WITH SMOKE AND ON THE MAP!!!","PLAIN",3] call RE;
       
      //Temp Godmode for 2 mins////////////////////////////////////////////////////
      (vehicle player) removeAllEventHandlers "handleDamage";
      (vehicle player) addEventHandler ["handleDamage", { false }];    
      (vehicle player) allowDamage false;
       
      //Acts like a countdown timer//////////////////////////////////////////////////////////////////
      sleep 90;
      [nil,nil,rTitleText,"THE JUGGERNAUTS ARMOR HAS TAKEN 30% DAMAGE","PLAIN",3] call RE;
      sleep 100;
      [nil,nil,rTitleText,"THE JUGGERNAUTS ARMOR HAS TAKEN 50% DAMAGE","PLAIN",3] call RE;
      sleep 110;
      [nil,nil,rTitleText,"THE JUGGERNAUTS ARMOR HAS TAKEN 90% DAMAGE","PLAIN",3] call RE;
      uiSleep 120;
      [nil,nil,rTitleText,"THE JUGGERNAUTS ARMOR IS WEAK...TAKE HIM OUT NOW!!!","PLAIN",3] call RE;
      sleep 2;
       
      //Start ending Juggernaut///////////////////////////////////
      (vehicle player) addEventHandler ["handleDamage", { true }];    
      (vehicle player) removeAllEventHandlers "handleDamage";
      (vehicle player) allowDamage true;
      uiSleep 240;
      deleteVehicle PJ_grenade;
      END;
      Call it from your right click
      ["ItemObsidian","JUGGERNAUT","execVM 'scripts\Jugg.sqf';","true"], 
      marker.sqf:
      _unit = player;
      _nameP = name _unit;
      _markerobjp = createMarker [_namep,[0,0]];
      _markerobjp setMarkerShape "ICON";
      _markerobjp setMarkerType "mil_dot";
      _markerobjp setMarkerColor "ColorRed";
      _markerobjp setMarkerText _nameP;
      _markerobjp setMarkerSize [1,1];

      while {alive _unit} do {
      _markerobjp setmarkerdir (getdir _unit);
      _markerobjp setMarkerPos (getPos _unit);
      _markerobjp setMarkerText _nameP;
      sleep 5;
      };
      ////////////////////////////////////////////
      uiSleep 240;
      deleteMarker _markerobjp;
       
    • By Vladick
      BSBS Server IP: 216.244.93.103:7802
      Website: https://bsbsepoch.000webhostapp.com/
      Discord: https://discord.gg/PVn8PvG
      Server Features:
      PvPvE Database wiped 1/5/18 ESS V3 spawn selection Coins and Global Banking WAI missions and Roaming DZAI Bandits Customized map additions Skalisky Bridge Skalisky Island Bandit Camp with high loot (fun mission!) Garage Door Opener Virtual Garage Deploy bike Refuel, Repair, Rearm Take clothes Bury Body Butcher Body Locate vehicle with keys and GPS One plot poll per player Indestructible bases Trader Safe Zones Day/Night Schedule 4-hour restarts
    • By FG_Trap
      Made this in my free time awhile ago thought id make it public.
      Right Alt is the key to open the menu.
      Install instructions are inside the download.
      https://github.com/NWDZ-Trapxxgods/traps-menu
       
       
      here is a picture of the server menu
       
    • By stephen21k
      Dose anyone know where to find Updated/Working files for DayZ OverPochIns Taviana?
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...