Jump to content
  • 0

Adding a AmmoBox to the Server with Loot after every Restart


Zernichter

Question

Hey guys,

 

i need to spawn a ammobox with custom loot at my ai base. so it has to refill after every server restart and it should not dissapear.

 

I use Wicked Ai/Missions and some other custom events. (so using the ammobox as a mission would clear it after another mission gets cleared?)

 

Anybody there who can help me ? :) 

 

great wishes

Florian

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Here is an example:

 

save as myLoot.sqf

if (isServer) then {


		_vehicle_999999 = objNull;
		
		if (true) then
		{
		  _this = createVehicle ["TKVehicleBox_EP1", [8000.0,10000.0], [], 0, "CAN_COLLIDE"];
		  _vehicle_999999 = _this;
		  _this setDir 20;

		  clearWeaponCargoGlobal _this;
		  clearMagazineCargoGlobal _this;

		  
		  _this addWeaponCargoGlobal ["NVGoggles",1];
		  _this addWeaponCargoGlobal ["MakarovSD",1];
		  _this addWeaponCargoGlobal ["G36K_camo",1];

		  _this addMagazineCargoGlobal ["MortarBucket",1];
		  _this addMagazineCargoGlobal ["PartGeneric",1];
		  _this addMagazineCargoGlobal ["8Rnd_9x18_MakarovSD",10];
		  _this addMagazineCargoGlobal ["ItemGoldBar10oz",1];
		};

};

add to init.sqf

[] ExecVM "myLoot.sqf";  

dont forget to edit the spawn location -> 8000.0,10000.0

Link to comment
Share on other sites

  • 0

Nice :)

You could also add that into the server PBO (in a new folder like say '/loot', and call it via the server_functions.sqf file adding:

[] execVM "\z\addons\dayz_server\loot\myLoot.sqf";
:)

Here is an example:

 

save as myLoot.sqf

if (isServer) then {


		_vehicle_999999 = objNull;
		
		if (true) then
		{
		  _this = createVehicle ["TKVehicleBox_EP1", [8000.0,10000.0], [], 0, "CAN_COLLIDE"];
		  _vehicle_999999 = _this;
		  _this setDir 20;

		  clearWeaponCargoGlobal _this;
		  clearMagazineCargoGlobal _this;

		  
		  _this addWeaponCargoGlobal ["NVGoggles",1];
		  _this addWeaponCargoGlobal ["MakarovSD",1];
		  _this addWeaponCargoGlobal ["G36K_camo",1];

		  _this addMagazineCargoGlobal ["MortarBucket",1];
		  _this addMagazineCargoGlobal ["PartGeneric",1];
		  _this addMagazineCargoGlobal ["8Rnd_9x18_MakarovSD",10];
		  _this addMagazineCargoGlobal ["ItemGoldBar10oz",1];
		};

};
add to init.sqf

[] ExecVM "myLoot.sqf";  
dont forget to edit the spawn location -> 8000.0,10000.0

Link to comment
Share on other sites

  • 0

Oh, and also try adding this to the end, to give players 10mins to loot the crate when they get to it, before it vanishes :)

waitUntil{{isPlayer _x && _x distance _vehicle_999999 < 10  } count playableunits > 0}; 

[nil,nil,rTitleText,"You have 10mins to loot crate, then it will vanish! Hurry!!!!", "PLAIN",6] call RE;
sleep 300;

[nil,nil,rTitleText,"Survivors, 5mins remaining to loot crate!", "PLAIN",6] call RE;
sleep 300;

deletevehicle _vehicle_999999;
sleep 1;
[nil,nil,rTitleText,"Crate is GONE! If you didn't loot it all, you're too slow!", "PLAIN",6] call RE;
Basically to give this:



if (isServer) then {


		_vehicle_999999 = objNull;
		
		if (true) then
		{
		  _this = createVehicle ["TKVehicleBox_EP1", [8000.0,10000.0], [], 0, "CAN_COLLIDE"];
		  _vehicle_999999 = _this;
		  _this setDir 20;

		  clearWeaponCargoGlobal _this;
		  clearMagazineCargoGlobal _this;

		  
		  _this addWeaponCargoGlobal ["NVGoggles",1];
		  _this addWeaponCargoGlobal ["MakarovSD",1];
		  _this addWeaponCargoGlobal ["G36K_camo",1];

		  _this addMagazineCargoGlobal ["MortarBucket",1];
		  _this addMagazineCargoGlobal ["PartGeneric",1];
		  _this addMagazineCargoGlobal ["8Rnd_9x18_MakarovSD",10];
		  _this addMagazineCargoGlobal ["ItemGoldBar10oz",1];
		};
waitUntil{{isPlayer _x && _x distance _vehicle_999999 < 10  } count playableunits > 0}; 

[nil,nil,rTitleText,"You have 10mins to loot crate, then it will vanish! Hurry!!!!", "PLAIN",6] call RE;
sleep 300;

[nil,nil,rTitleText,"Survivors, 5mins remaining to loot crate!", "PLAIN",6] call RE;
sleep 300;

deletevehicle _vehicle_999999;
sleep 1;
[nil,nil,rTitleText,"Crate is GONE! If you didn't loot it all, you're too slow!", "PLAIN",6] call RE;


};

Only thing I'm not 100% of is deletevehicle _vehicle_999999; - I normally use createvehicle a lil differently, but it should work I think :)

Link to comment
Share on other sites

  • 0

Here is an example:

 

save as myLoot.sqf

if (isServer) then {


		_vehicle_999999 = objNull;
		
		if (true) then
		{
		  _this = createVehicle ["TKVehicleBox_EP1", [8000.0,10000.0], [], 0, "CAN_COLLIDE"];
		  _vehicle_999999 = _this;
		  _this setDir 20;

		  clearWeaponCargoGlobal _this;
		  clearMagazineCargoGlobal _this;

		  
		  _this addWeaponCargoGlobal ["NVGoggles",1];
		  _this addWeaponCargoGlobal ["MakarovSD",1];
		  _this addWeaponCargoGlobal ["G36K_camo",1];

		  _this addMagazineCargoGlobal ["MortarBucket",1];
		  _this addMagazineCargoGlobal ["PartGeneric",1];
		  _this addMagazineCargoGlobal ["8Rnd_9x18_MakarovSD",10];
		  _this addMagazineCargoGlobal ["ItemGoldBar10oz",1];
		};

};

add to init.sqf

[] ExecVM "myLoot.sqf";  

dont forget to edit the spawn location -> 8000.0,10000.0

How do you convert the position from a grid ref? 

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...