Jump to content
  • 0

[RESOLVED] Can't pick up "Special" Backpacks (Tripod_Bag)


Guest

Question

Hey,

 

this is not really a scripting Issue i think, but i didn't find a matching Forum for this Topic, so yeah... I've added those Special backpacks like the TripodBag to the Loot and that works fine, but i can't pick them up. It won't show the Option to do so. I have added them to:

DZE_safeVehicle

dayz_allowedObjects

Do i have to add them to dayz_reveal ?

 

//EDIT:
Meanwhile i solve the issues with a variable in the variables.sqf:

special_backpacks = ["Tripod_Bag","M2StaticMG_US_Bag_EP1","M2HD_mini_TriPod_US_Bag_EP1","DSHKM_TK_GUE_BAG_EP1","DSHKM_mini_TriPod_TK_GUE_US_Bag_EP1","KORD_high_UN_Bag_EP1","KORD_UN_Bag_EP1","AGS_UN_Bag_EP1"];

Then i added this IF in my fn_selfActions.sqf:

	//Custom Backpack Pickup
	if(_typeOfCursorTarget in special_backpacks) then {
	_name = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
		if (s_player_special_backpack < 0) then {		 
			s_player_special_backpack = player addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "EPOCHMODS\backpackHandlers\backpack_pickup.sqf",["CfgVehicles",_typeOfCursorTarget,_cursorTarget], 20, true, true];
		};
	} else {
			player removeAction s_player_special_backpack;
			s_player_special_backpack = -1;
	};

And created the file (which is pretty much a copy of the original):

private ["_array","_type","_classname","_holder","_config","_isOk","_muzzles","_playerID","_claimedBy","_text","_playerNear","_obj","_qty"];

// Exit if player zombie
if(player isKindOf "PZombie_VB") exitWith {};

if (!DZE_CanPickup) exitWith { cutText [(localize "str_epoch_player_38") , "PLAIN DOWN"]; };
DZE_CanPickup = false;

_array = _this select 3;
_type = _array select 0;
_classname = _array select 1;
_holder = _array select 2;

// if holder is null disallow pickup for 5 seconds 
if(isNull _holder) exitWith { 
	DZE_CanPickup = true;
};

// Check if closest player
_PlayerNear = _holder call dze_isnearest_player;
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_4", "PLAIN DOWN"]};

_text = getText (configFile >> _type >> _classname >> "displayName");

player playActionNow "PutDown";

if(_classname isKindOf "TrapBear") exitwith {DZE_CanPickup = true; deleteVehicle _holder;};

if(_classname isKindOf "Bag_Base_EP1") exitwith {
	// diag_log("Picked up a bag: " + _classname);
	if(_classname == typeOf _holder) then {
		player action ["TakeBag", _holder];
	};
	DZE_CanPickup = true;
};

_obj = nearestObjects [(getPosATL player), [(typeOf _holder)], 5];
_qty = count _obj;

if(_qty >= 1) then {
	_config = (configFile >> _type >> _classname);
	_isOk = [player,_config] call BIS_fnc_invAdd;
	if (_isOk) then {
		deleteVehicle _holder;
		if (_classname in ["MeleeHatchet_DZE","MeleeCrowbar","MeleeMachete","MeleeFishingPole","MeleeSledge"]) then {
			if (_type == "cfgWeapons") then {
				_muzzles = getArray(configFile >> "cfgWeapons" >> _classname >> "muzzles");
				//_wtype = ((weapons player) select 0);
				if (count _muzzles > 1) then {
					player selectWeapon (_muzzles select 0);
				} else {
					player selectWeapon _classname;
				};
			};
		};
	};
};

DZE_CanPickup = true;
Link to comment
Share on other sites

  • Answers 55
  • Created
  • Last Reply

Top Posters For This Question

Recommended Posts

  • 0
	class DZ_Patrol_Pack_EP1: Bag_Base_EP1 {
		scope = 2;
		displayName = "$STR_EPOCH_PACK_PATROL";
		picture = "\ca\weapons_e\data\icons\backpack_US_ASSAULT_COYOTE_CA.paa";
		icon = "\ca\weapons_e\data\icons\mapIcon_backpack_CA.paa";
		mapsize = 2;
		model = "\ca\weapons_e\AmmoBoxes\backpack_us_assault_Coyote.p3d";
		transportMaxWeapons = 1;
		transportMaxMagazines = 10;

		class eventHandlers {
			init = "[(_this select 0),'CfgVehicles','DZ_Patrol_Pack_EP1'] execVM '\z\addons\dayz_code\init\object_BackpackAction.sqf';";
		};
	};

Maybe this can help you :)

This is from the config.bin in the dayz_code

Link to comment
Share on other sites

  • 0

Thanks a lot. Looks like i have to add some Event Handlers :s

 

Ok, i'm stuck... Would something like this work? ->

special_backpacks = ["Tripod_Bag","M2StaticMG_US_Bag_EP1","M2HD_mini_TriPod_US_Bag_EP1","DSHKM_TK_GUE_BAG_EP1","DSHKM_mini_TriPod_TK_GUE_US_Bag_EP1","KORD_high_UN_Bag_EP1","KORD_UN_Bag_EP1","AGS_UN_Bag_EP1"];

/**
Variables to Pass:

_holder = _this select 0;
_type = _this select 1;
_classname = _this select 2;

[_holder,_type,_classname] execVM
**/


{
	_x addEventHandler ["init","[(_this select 0),'CfgVehicles',_x] execVM '\z\addons\dayz_code\init\object_BackpackAction.sqf';"];
} forEach special_backpacks;

Can't test it at the moment, but i don't think that the Magic Var will be passed in the execution, or will it?

Link to comment
Share on other sites

  • 0

IÄm not quite sure about the output from (_this select 0), maybe you add a systemchat in the object_BackpackAction.sqf to see what you get as the result so you can set it right on your script.

 

EDIT: I need some sleep -.- cant even read the whole post without overlooking important stuff ^^"

Maybe you need to add the eventhandler on the object as soon as it spawnes to get this right?

 

Like the eventhandler for vehicles to inform the player, that it will disappear on restart:

_vehicle addEventHandler ["GetIn",{
            _nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
        }];

building_spawnLoot.sqf could be the right file to do this

Link to comment
Share on other sites

  • 0

building_spawnLoot.sqf could be the right file to do this

 

Sorry, but.. where did you found that file? :D and the Event Handler for non Hive vehicles is server side. Pickup up Backpacks is somewhat client related, or not? :S

Well the Magic var didn't work and "_this select 0" should return the Player.

Maybe, i should just make a new pickup.sqf <.<

Seems to be more easy to just check, if cursor target is in "special_backpacks [];"

Link to comment
Share on other sites

  • 0

already had the same problem, you wont get any cursortarget at all =/

 

spawned one trough infi and could use it, but as soon as i dropped, no option and even inifstar could not detect it as an vehicle ^^

 

I still thnik we need to add the eventhandler on spawn of the backpack. But i cant test it that quick -.- but will try something right away.

 

give some time and i will test some things around and see what i can get there :)

Link to comment
Share on other sites

  • 0

ok got it :)

 

but you also need to add something so you can open them, because i was only to pick them up, but not open it ^^

 

this is how i did it:

 

redirect your spawn_loot.sqf in compiles

 

and in spawn_loot.sqf

 

add your nice eventhandlers ;)

also better put the specialbackpack array into your variables, should be better for live servers ^^ this was just for testing it :)

	case "backpack":
	{
		//Item is single backpack
		_itemTypes = [];
		if (DZE_MissionLootTable) then {
			_itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0);
		} else {
			_itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0);
		};
		_index = dayz_CLBase find _iItem;
		_weights = dayz_CLChances select _index;
		_cntWeights = count _weights;
	    _index = floor(random _cntWeights);
		_index = _weights select _index;
		_iItem = _itemTypes select _index;

		_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
		special_backpacks = ["Tripod_Bag","M2StaticMG_US_Bag_EP1","M2HD_mini_TriPod_US_Bag_EP1","DSHKM_TK_GUE_BAG_EP1","DSHKM_mini_TriPod_TK_GUE_US_Bag_EP1","KORD_high_UN_Bag_EP1","KORD_UN_Bag_EP1","AGS_UN_Bag_EP1"];

			{
				_x addEventHandler ["init","[(_this select 0),'CfgVehicles',_x] execVM '\z\addons\dayz_code\init\object_BackpackAction.sqf';"];
			} forEach special_backpacks;
	};

EDIT: Screenshot:

 

srb6jwy3.png

 

EDIT:

 

this is should be the right place to edit:

 

compiles.sqf

if ((parseNumber(_this select 0)) != 0) then {
			ctrlActivate (_dialog displayCtrl 157);
			if (gear_done) then {
				waitUntil {ctrlShown (_dialog displayCtrl 159)};
				sleep 0.001;
			};
		};

because of this path:

class ButtonOpenBag: RscIGUIShortcutButton {
			idc = 157;
			shortcuts[] = {"0x00050000 + 2"};
			x = 0.554743;
			y = 0.897067;
			text = "$STR_EPOCH_PLAYER_281";
		};

STR_EPOCH_PLAYER_281:

<Key ID="STR_EPOCH_PLAYER_281">
			<Original>Open bag</Original>

At least for the gear menu, nothing found yet for the action menu =/

Link to comment
Share on other sites

  • 0

Thanks a lot! Those Backpacks are not meant to be opened :P They're meant to have a right click option to build a Tripod (for example).. It's 100% Copy + Paste and i didn't change anything in the original script, except i'm using ClickActions to add the right click to the Backpack. I will be changing it, so you'll need a Plotpole to place those.

Link to comment
Share on other sites

  • 0

I finally uploaded it to the server, only just to find out this did not work. I didn't call the file "spawn_loot.sqf", i called it "init.sqf", but i'm using a custom Folder therefore there is no interference with other init.sqf Files. I can still not pick up those Backpacks.

Are you using InfiSTAR Antihack and did you add those Backpacks to BattleEye?

Link to comment
Share on other sites

  • 0

yes i'm using infistar and this one is spawned through loot tables.

 

Only thing i did was just give the backpack the variable on spawn.

 

So to get this right you just have to do the same ^^

 

you probably have a reason for renaming it into init.sqf, just make sure you give the variable on loot spawn and it should be good

 

also the spawn_loot.sqf is called from compiles.sqf you also need to redirect it there!

Link to comment
Share on other sites

  • 0

Yes, i redirected it from compiles.sqf:

 

	spawn_loot =	compile preprocessFileLineNumbers "EPOCHMODS\backpackHandlers\init.sqf";
	spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";

And applied the changes:

 

private ["_iPos","_tQty","_qty","_index","_weights","_cntWeights","_canType","_item","_magQty","_mags","_item2","_itemTypes","_max","_iItem","_iClass","_radius","_uniq","_iPosZ"];
_iItem = _this select 0;
_iClass = _this select 1;
_iPos = _this select 2;
_radius = _this select 3;
_uniq = [];

_item = objNull;

_iPosZ = _iPos select 2;
if((isNil "_iPosZ") || {( _iPosZ < 0)}) then { _iPos = [_iPos select 0,_iPos select 1,0]; };
if (isNil "_iClass") exitWith {diag_log "_iClass isNil, exiting loot spawn!";};

switch (_iClass) do {
	default {
		_itemTypes = [];
		if (DZE_MissionLootTable) then {
			{
				_itemTypes set [count _itemTypes, _x select 0]
			} count getArray (missionConfigFile >> "cfgLoot" >> _iClass);
		} else {
			{
				_itemTypes set [count _itemTypes, _x select 0]
			} count getArray (configFile >> "cfgLoot" >> _iClass);
		};
		_qty = 0;
		_max = ceil(random 2) + 1;
		if (_iClass in ["trash","civilian","office","office2","food","generic","medical","hospital","military","militarypilot","policeman","hunter","worker"]) then {
			_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
			while {_qty < _max} do {
				_index = dayz_CLBase find _iClass;
				_weights = dayz_CLChances select _index;
				_cntWeights = count _weights;

				// diag_log ("dayz_CLChances: "+str(dayz_CLChances));

				_index = floor(random _cntWeights);
				_index = _weights select _index;

				//diag_log ("dayz_CLChances: "+str(_itemTypes));
				
				_canType = _itemTypes select _index;
				_tQty = round(random 1) + 1;
				if (_canType in _uniq) then {
					if (({_x in _uniq} count magazines _item) == 0) then { _tQty = 1; } else { _tQty = 0;};
					if (_tQty == 0) then {diag_log(format["%1 Prevent any duplicate member %2 from family %3",__FILE__, _canType, _uniq]);};
				};
				if (_tQty > 0) then {
					if (!(_canType in _uniq)) then {
						_item addMagazineCargoGlobal [_canType,1];
						_uniq set [count _uniq, _canType];
						_qty = _qty + 1;
					};
				};
			};
			if ((_iItem != "") && (isClass(configFile >> "CfgWeapons" >> _iItem))) then {
				_item addWeaponCargoGlobal [_iItem,1];
			};
		}
		else {
			// diag_log format["DEBUG dayz_CLBase: %1", dayz_CLBase];
			_index = dayz_CLBase find _iClass;
			if (_index > 0) then {
				_weights = dayz_CLChances select _index;
				//diag_log format["DEBUG dayz_CLChances: %1", dayz_CLChances];
				_cntWeights = count _weights;
				_index = floor(random _cntWeights);
				_index = _weights select _index;
				_item2 = _itemTypes select _index;
				if ((_item2 != "") && (isClass(configFile >> "CfgWeapons" >> _item2))) then{
					_item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
					_item addWeaponCargoGlobal[_item2, 1];
					if ((count _mags) > 0) then{
						if (_mags select 0 == "20Rnd_556x45_Stanag") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
						if (_mags select 0 == "30Rnd_556x45_G36") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
						if (_mags select 0 == "30Rnd_556x45_G36SD") then{ _mags set[0, "30Rnd_556x45_StanagSD"] };
						if (!(_item2 in MeleeWeapons)) then{
							_magQty = round(random 10);
							if (_magQty > 3) then{
								_item addMagazineCargoGlobal[(_mags select 0), (round(random 1) + 1)];
							};
						};
					};
				};
				if ((_item2 != "") && (isClass(configFile >> "CfgMagazines" >> _item2))) then{
					_item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
					_item addMagazineCargoGlobal[_item2, 1];
				};
				if ((_item2 != "") && (isClass(configFile >> "CfgVehicles" >> _item2))) then{
					_item = createVehicle[_item2, _iPos, [], _radius, "CAN_COLLIDE"];
				};
			};
		};
		
	};
	case "single":
	{
		//Item is sigle, add 1 item from cfgloot
		_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
		_itemTypes = [];
		if (DZE_MissionLootTable) then{
			{
				_itemTypes set[count _itemTypes, _x select 0]
			} count getArray(missionConfigFile >> "cfgLoot" >> _iItem);
		}
		else {
			{
				_itemTypes set[count _itemTypes, _x select 0]
			} count getArray(configFile >> "cfgLoot" >> _iItem);
		};
		_index = dayz_CLBase find _iItem;
		_weights = dayz_CLChances select _index;
		_cntWeights = count _weights;
			
	    _index = floor(random _cntWeights);
		_index = _weights select _index;
		_canType = _itemTypes select _index;
		_item addMagazineCargoGlobal [_canType,1];
	};
	case "backpack":
	{
		//Item is single backpack
		_itemTypes = [];
		if (DZE_MissionLootTable) then {
			_itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0);
		} else {
			_itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0);
		};
		_index = dayz_CLBase find _iItem;
		_weights = dayz_CLChances select _index;
		_cntWeights = count _weights;
	    _index = floor(random _cntWeights);
		_index = _weights select _index;
		_iItem = _itemTypes select _index;

		_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
		special_backpacks = ["Tripod_Bag","M2StaticMG_US_Bag_EP1","M2HD_mini_TriPod_US_Bag_EP1","DSHKM_TK_GUE_BAG_EP1","DSHKM_mini_TriPod_TK_GUE_US_Bag_EP1","KORD_high_UN_Bag_EP1","KORD_UN_Bag_EP1","AGS_UN_Bag_EP1"];

			{
				_x addEventHandler ["init","[(_this select 0),'CfgVehicles',_x] execVM '\z\addons\dayz_code\init\object_BackpackAction.sqf';"];
			} forEach special_backpacks;
	};
	case "cfglootweapon":
	{
		_itemTypes = [];
		if (DZE_MissionLootTable) then{
			{
				_itemTypes set[count _itemTypes, _x select 0]
			} count getArray(missionConfigFile >> "cfgLoot" >> _iItem);
		}
		else {
			{
				_itemTypes set[count _itemTypes, _x select 0]
			} count getArray(configFile >> "cfgLoot" >> _iItem);
		};
		_index = dayz_CLBase find _iItem;
		_weights = dayz_CLChances select _index;
		_cntWeights = count _weights;
			
	    _index = floor(random _cntWeights);
		_index = _weights select _index;
		_iItem = _itemTypes select _index;

		if (_iItem == "Chainsaw") then {
			_iItem = ["ChainSaw","ChainSawB","ChainSawG","ChainSawP","ChainSawR"] call BIS_fnc_selectRandom;
		};

		//Item is a weapon, add it && a random quantity of magazines
		_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
		_item addWeaponCargoGlobal [_iItem,1];
		_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
		if ((count _mags) > 0) then
		{
			if (_mags select 0 == "Quiver") then { _mags set [0, "WoodenArrow"] }; // Prevent spawning a Quiver
			if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
			if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
			if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
			_item addMagazineCargoGlobal [(_mags select 0), (round(random 2))];
		};
		
	};
	case "weapon":
	{
		//Item is a weapon, add it && a random quantity of magazines
		_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
		_item addWeaponCargoGlobal [_iItem,1];
		_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
		if ((count _mags) > 0) then
		{
			if (_mags select 0 == "Quiver") then { _mags set [0, "WoodenArrow"] }; // Prevent spawning a Quiver
			if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
			if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
			if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
			if (!(_iItem in MeleeWeapons)) then {
				_magQty = round(random 10);
				if (_magQty > 3) then {
					_item addMagazineCargoGlobal [(_mags select 0), (round(random 1) + 1)];
				};
			};
		};
	};
	case "weaponnomags":
	{
		//Item is a weapon, && spawns no mags
		_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
		_item addWeaponCargoGlobal [_iItem,1];
	};
	case "magazine":
	{
		//Item is one magazine
		_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
		_item addMagazineCargoGlobal [_iItem,1];
	};
	case "object": {
		_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
		if ((count _iPos) > 2) then {
			_item setPosATL _iPos;
		};
	};
};
if (!isNull(_item)) then{
	if ((count _iPos) > 2) then{
		_item setPosATL _iPos;
	};
};

_item

Link to comment
Share on other sites

  • 0

well this looks exactly how i did it =/

 

Have you tested it on a backpack spawned through loot table or did you soawned it in somehow?

 

Tested with both. Is this maybe related to custom Loot Tables?

Link to comment
Share on other sites

  • 0

Thanks, got your PN.

I  got a feeling this might be related to me being stupid..

 

i thought "case "backpack"" would determine all backpacks, but maybe that is just for the categorie "Backpack" in the CfgLoot.hpp. I put my backpacks in "militarybackpacks", instead of inside "backpacks". Maybe the issue is there. I'll test that tonight.

Link to comment
Share on other sites

  • 0

What exactly do these special bags do? Do they allow you to deploy things?

 

Yeah, with a other custom mod, it adds a right click to the backpack and then you can build a Kord from Kord Backpack, etc..

Link to comment
Share on other sites

  • 0

Ok, so I added the code to my fn_selfactions and put the backpack_pickup.sqf in the proper place and the option to pick up the bags were there. The problem is that the prompt to pick up the bags didn't go away when I walked away. The option still showed up in the scroll menu. I am getting this in my client RPT:

Error in expression < true];
};
} else {
player removeAction s_player_special_backpack;
s_player_spec>
  Error position: <s_player_special_backpack;
s_player_spec>
  Error Undefined variable in expression: s_player_special_backpack

*edit nevermind. I got it worked out.

Link to comment
Share on other sites

  • 0

Ok, so I added the code to my fn_selfactions and put the backpack_pickup.sqf in the proper place and the option to pick up the bags were there. The problem is that the prompt to pick up the bags didn't go away when I walked away. The option still showed up in the scroll menu. I am getting this in my client RPT:

Error in expression < true];
};
} else {
player removeAction s_player_special_backpack;
s_player_spec>
  Error position: <s_player_special_backpack;
s_player_spec>
  Error Undefined variable in expression: s_player_special_backpack

*edit nevermind. I got it worked out.

 

 

Obviously you're interested in this, so:

If not done already add this to fn_selfActions.sqf:

 

player removeAction s_player_special_backpack;
	s_player_special_backpack = -1;

Pretty far at the bottom, you'll find lots of those.

In variables.sqf search for:

dayz_resetSelfActions

And add inside:

s_player_special_backpack = -1;

If you got ClickActions installed, add this in the config.sqf:

 

	//Backpacks
	["Tripod_Bag","Build Tripod","execVM 'EPOCHMODS\overwrites\click_actions\mgs\MK19_TriPod.sqf';","true"],
	["M2StaticMG_US_Bag_EP1","Build M2 Static MG","execVM 'EPOCHMODS\overwrites\click_actions\mgs\M2StaticMG_US_EP1.sqf';","true"],
	["M2HD_mini_TriPod_US_Bag_EP1","Build mini Tripod","execVM 'EPOCHMODS\overwrites\click_actions\mgs\M2HD_mini_TriPod.sqf';","true"],
	["DSHKM_TK_GUE_BAG_EP1","Build GUE DSHKM","execVM 'EPOCHMODS\overwrites\click_actions\mgs\DSHkM_Gue.sqf';","true"],
	["DSHKM_mini_TriPod_TK_GUE_US_Bag_EP1","Build GUE mini Tripod","execVM 'EPOCHMODS\overwrites\click_actions\mgs\DSHkM_Mini_TriPod.sqf';","true"],
	["KORD_high_UN_Bag_EP1","Build Kord High","execVM 'EPOCHMODS\overwrites\click_actions\mgs\KORD_high.sqf';","true"],
	["KORD_UN_Bag_EP1","Build UN Kord","execVM 'EPOCHMODS\overwrites\click_actions\mgs\KORD.sqf';","true"],
	["AGS_UN_Bag_EP1","Build AGS UN","execVM 'EPOCHMODS\overwrites\click_actions\mgs\AGS_RU.sqf';","true"],

Note: There is a comma at the end, you might have to remove it, if that's your last entry there!

 

 

Then use this file and edit the Classname on the very top:


/*
DayZ Base Building
Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
 
 
Note: Edit the _classname variable below to be the correct classname of the item you want to build, and I suggest you name the file appropiately!
 
Recommended to use alongside Maca's excellent 'right clicks' system: http://epochmod.com/...tions-to-items/
 
Edits by Mike of http://www.petuniaserver.com/ - Original file & all kudos to the EPOCH devs! http://www.dayzepoch.com
*/
 
private ["_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_object","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_objHupDiff","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 
// Edit the classname BELOW to change what is built
 
_classname = "AGS_RU";
 
// Edit the classname ABOVE to change what is built
 
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
 
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater =  dayz_isSwimming;
_cancel = false;
_reason = "";
_canBuildOnPlot = false;
 
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

//Get Player UID (Steam ID) for the PlotPole
_playerUID = [player] call FNC_GetPlayerUID;
 
DZE_Q = false;
DZE_Z = false;
 
DZE_Q_alt = false;
DZE_Z_alt = false;
 
DZE_Q_ctrl = false;
DZE_Z_ctrl = false;
 
DZE_5 = false;
DZE_4 = false;
DZE_6 = false;
 
DZE_cancelBuilding = false;
 
call gear_ui_init;
closeDialog 1;
 
if (_isWater) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
if (_inVehicle) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_42"), "PLAIN DOWN"];};
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};
 
_item = _this;
_this setVariable["ObjectUID","0"];
 
// Need Near Requirements
_abort = false;
_distance = 3;
_reason = "";
 
 
if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
 
_classnametmp = _classname;
//_require =  getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
_text =  getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
 
_lockable = 0;
 
_requireplot = DZE_requireplot;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
_requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
};
 
_isAllowedUnderGround = 1;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
_isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
};
 
_offset =  getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
if((count _offset) <= 0) then {
_offset = [0,1.5,0];
};
 
_isPole = (_classname == "Plastic_Pole_EP1_DZ");
_isLandFireDZ = (_classname == "Land_Fire_DZ");
 
_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";
 
if(_isPole) then {
_distance = DZE_PlotPole select 1;
};
 
// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];
 
{
    if (alive _x) then {
        _findNearestPole set [(count _findNearestPole),_x];
    };
} count _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
if(_IsNearPlot == 0) then {

    // Allow building of plot
    if(_requireplot == 0 || _isLandFireDZ) then {
        _canBuildOnPlot = true;
    };

} else {
    // Since there are plots nearby we check for ownership and then for friend status
    
    // check nearby plots ownership and then for friend status
    _nearestPole = _findNearestPole select 0;

    // Find owner
    _ownerID = _nearestPole getVariable ["ownerPUID","0"];

    diag_log format["Player_build start: [PlayerUID = %1]  [OwnerID = %2]", _playerUID, _ownerID];

    // check if friendly to owner
    if(_playerUID == _ownerID) then {  //Keep ownership
        // owner can build anything within his plot except other plots
        diag_log text "Player is owner";
        if(!_isPole) then {
            _canBuildOnPlot = true;
        };

    } else {
        _friendlies = _nearestPole getVariable ["plotfriends",[]];
        _fuid  = [];
        {
             _friendUID = _x select 0;
             _fuid  =  _fuid  + [_friendUID];
        } forEach _friendlies;
        
        _builder  = getPlayerUID player;
        // check if friendly to owner
        if(_builder in _fuid) then {
            _canBuildOnPlot = true;
        };  
    };
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format["Woah there survivor! This ain't your patch, someone's plot pole is nearby!"], "PLAIN DOWN",3]; };
 
_missing = "";
 
_location = [0,0,0];
_isOk = true;
 
// get inital players position
_location1 = getPosATL player;
_dir = getDir player;
 
// if ghost preview available use that instead
if (_ghost != "") then {
_classname = _ghost;
};
 
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
 
_object attachTo [player,_offset];
 
_position = getPosATL _object;
 
cutText [(localize "str_epoch_player_45"), "PLAIN DOWN"];
 
_objHDiff = 0;
 
while {_isOk} do {
 
_zheightchanged = false;
_zheightdirection = "";
_rotate = false;
 
if (DZE_Q) then {
DZE_Q = false;
_zheightdirection = "up";
_zheightchanged = true;
};
if (DZE_Z) then {
DZE_Z = false;
_zheightdirection = "down";
_zheightchanged = true;
};
if (DZE_Q_alt) then {
DZE_Q_alt = false;
_zheightdirection = "up_alt";
_zheightchanged = true;
};
if (DZE_Z_alt) then {
DZE_Z_alt = false;
_zheightdirection = "down_alt";
_zheightchanged = true;
};
if (DZE_Q_ctrl) then {
DZE_Q_ctrl = false;
_zheightdirection = "up_ctrl";
_zheightchanged = true;
};
if (DZE_Z_ctrl) then {
DZE_Z_ctrl = false;
_zheightdirection = "down_ctrl";
_zheightchanged = true;
};
if (DZE_4) then {
_rotate = true;
DZE_4 = false;
_dir = 180;
};
if (DZE_6) then {
_rotate = true;
DZE_6 = false;
_dir = 0;
};
 
if(_rotate) then {
_object setDir _dir;
_object setPosATL _position;
//diag_log format["DEBUG Rotate BUILDING POS: %1", _position];
};
 
if(_zheightchanged) then {
detach _object;
 
_position = getPosATL _object;
 
if(_zheightdirection == "up") then {
_position set [2,((_position select 2)+0.1)];
_objHDiff = _objHDiff + 0.1;
};
if(_zheightdirection == "down") then {
_position set [2,((_position select 2)-0.1)];
_objHDiff = _objHDiff - 0.1;
};
 
if(_zheightdirection == "up_alt") then {
_position set [2,((_position select 2)+1)];
_objHupDiff = _objHupDiff + 1;
};
if(_zheightdirection == "down_alt") then {
_position set [2,((_position select 2)-1)];
_objHDiff = _objHDiff - 1;
};
 
if(_zheightdirection == "up_ctrl") then {
_position set [2,((_position select 2)+0.01)];
_objHupDiff = _objHupDiff + 0.01;
};
if(_zheightdirection == "down_ctrl") then {
_position set [2,((_position select 2)-0.01)];
_objHDiff = _objHDiff - 0.01;
};
 
_object setDir (getDir _object);
 
if((_isAllowedUnderGround == 0) and ((_position select 2) < 0)) then {
_position set [2,0];
};
 
_object setPosATL _position;
 
//diag_log format["DEBUG Change BUILDING POS: %1", _position];
 
_object attachTo [player];
 
};
 
sleep 0.5;
 
_location2 = getPosATL player;
 
if(DZE_5) exitWith {
_isOk = false;
detach _object;
_dir = getDir _object;
_position = getPosATL _object;
//diag_log format["DEBUG BUILDING POS: %1", _position];
deleteVehicle _object;
};
 
if(_location1 distance _location2 > 5) exitWith {
_isOk = false;
_cancel = true;
_reason = "You've moved to far away from where you started building (within 5 meters)";
detach _object;
deleteVehicle _object;
};
 
if(abs(_objHDiff) > 5) exitWith {
_isOk = false;
_cancel = true;
_reason = "Cannot move up or down more than 5 meters";
detach _object;
deleteVehicle _object;
};
 
if (player getVariable["combattimeout", 0] >= time) exitWith {
_isOk = false;
_cancel = true;
_reason = (localize "str_epoch_player_43");
detach _object;
deleteVehicle _object;
};
 
if (DZE_cancelBuilding) exitWith {
_isOk = false;
_cancel = true;
_reason = "Cancelled building.";
detach _object;
deleteVehicle _object;
};
};
 
//No building on roads unless toggled
if (!DZE_BuildOnRoads) then {
if (isOnRoad _position) then { _cancel = true; _reason = "Cannot build on a road."; };
};
 
// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
 
if(!_cancel) then {
 
_classname = _classnametmp;
 
// Start Build
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
 
_object setdir _dir;
 
// Get position based on object
_location = _position;
 
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
_location set [2,0];
};
 
_object setPosATL _location;
 
 
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
 
_limit = 1;
 
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
 
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;
 
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
 
if (_isPole) then {
[] spawn player_plotPreview;
};
 
_object setVariable ["OEMPos",_location,true];
_object setVariable ["CharacterID",dayz_characterID,true];
_charID = dayz_characterID;
_activatingPlayer = player;
 
PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location],_classname];
publicVariableServer "PVDZE_obj_Publish";
removeBackpack player;
 
// Customise the message below
 
cutText [format["Nice one! You now have a shiny new Avtomaticheskiy Granatomet Stankouyy (Russian automatic grenade launcher)!"], "PLAIN DOWN",3];
 
// Customer the message above
_object setVehicleAmmo 0;
player reveal _object;
DZE_ActionInProgress = false;
 
} else {
cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
DZE_ActionInProgress = false;

 

Please keep the Copyright in, as that original was not made by me!

Link to comment
Share on other sites

  • 0

Hey, 

 

I've been trying to get deployable static guns to work on my server for awhile now. I don't have them in the loot tables, I have them at the trader. You can buy them, but even after putting in the code you have here, I can't even get the option to pic it up. and buying it gave me an error in my RPT that actually seemed to stop it from logging 

REMOTE   {HCBDSM} Wezul - added ItemBriefcase100oz to his inventory"
 8:46:28 "EPOCH SERVERTRADE: Player: {HCBDSM} Wezul (*******************) bought a Unknown Vehicle in/at trader city Stary for x "
 8:46:29 Error in expression 
_qty =		_this select 6;
_clientID = 	owner _player;
_p>
 8:46:29   Error position: 

I added the code you have here, as best as possible, there wasnt really specifics as to where to add in which files, but some of them I don't think it would matter much. 

 

Anyway you could post a step by step for being able to pick up these things. I don't have click actions, but can find it if need be

 

Also, after looking at Clickactions, it doesnt have it's own config file, so I don't know how to put that list of static gun bags in a file that does not exist. Lastly, that last long file you posted... what is that, where does it go and where do I call it?

Link to comment
Share on other sites

  • 0

Hi mate,

 

follow the instructions on the first page and if you can't seem to find the issue, leave me a private Message :)

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