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

Do you know how i can use these bags to deploy guns using Deploy Anything script ?

 

I have tried this 

["M2StaticMG_US_Bag_EP1",[0,2,0],1,-1,false,false,false,true,false,false,false,["M2StaticMG_US_EP1"],[],["M2StaticMG_US_Bag_EP1"],"true"]

But doesnt seem to work

Link to comment
Share on other sites

  • 0

Do you know how i can use these bags to deploy guns using Deploy Anything script ?

 

I have tried this 

["M2StaticMG_US_Bag_EP1",[0,2,0],1,-1,false,false,false,true,false,false,false,["M2StaticMG_US_EP1"],[],["M2StaticMG_US_Bag_EP1"],"true"]

But doesnt seem to work

 

What's the array parameters for?

If you can find an explenation for that i can help you with it.

Link to comment
Share on other sites

  • 0
["M2StaticMG_US_Bag_EP1",[0,2,0],1,-1,false,false,false,true,false,true,false,["M2StaticMG_US_EP1"],[],["M2StaticMG_US_Bag_EP1"],"true"]

Try that.

Link to comment
Share on other sites

  • 0
["M2StaticMG_US_Bag_EP1",[0,2,0],1,-1,false,false,false,true,false,true,false,["M2StaticMG_US_EP1"],[],["M2StaticMG_US_Bag_EP1"],"true"]

Try that.

 

 

Says, M2StaticMG_US_Bag_EP1 must be in your Main inventory to deploy. I think this script doesnt work with backpacks

Link to comment
Share on other sites

  • 0

I didn't even think to ask here since it doesn't have to do with the right click mod () but glad you did. Let me know if it works out.

 

*edit* Had a few minutes to test and no luck. Something in the right click script needs to be changed.

 

The right click option doesnt show up for you ? It does for me. I am working on changing the code to detect backpacks

Link to comment
Share on other sites

  • 0

Try this, not at home so i cant test

Replace:

_inventory = (weapons _player) + (magazines _player);

With:

_inventory = (weapons _player) + (magazines _player) + (backpack _player);

In wrapper.sqf

 

Already tried that a while ago. No luck

 

edit : is it unitBackpack or just backpack ?

Link to comment
Share on other sites

  • 0

Try something like this maybe:

 

_inventory = (weapons _player) + (magazines _player) + (typeOf (unitBackpack _player));

Because "unitBackpack" returns the Backpack as Object, but you'll want the classname.

Link to comment
Share on other sites

  • 0

Try something like this maybe:

 

_inventory = (weapons _player) + (magazines _player) + (typeOf (unitBackpack _player));

Because "unitBackpack" returns the Backpack as Object, but you'll want the classname.

Link to comment
Share on other sites

  • 0
Error in expression <(weapons _player) + (magazines _player) + (typeOf (unitBackpack _player));
_retu>
  Error position: <+ (typeOf (unitBackpack _player));
_retu>
  Error Generic error in expression
File mpmissions\__CUR_MP.Chernarus\GG\bike\wrapper.sqf, line 161
Link to comment
Share on other sites

  • 0

The right click option doesnt show up for you ? It does for me. I am working on changing the code to detect backpacks

 

Using the right click mod allows me to right click on the backpack and select the option to deploy, but when I try deploying it, it tells me I need "M2StaticMG_US_Bag_EP1", which needs to be in my inventory, which it obviously can not be because it's a backpack on my back.

 

I can deploy the gun bags as described in this thread but since you mentioned the right click post where I asked about using right click to deploy, I thought I'd try that method, as a player can decide where to put it and it can be set to write to the database, whereas the method in this thread doesn't allow that.

 

But anyway that discussion is better left to the right click script post and not here.

Link to comment
Share on other sites

  • 0

What solution was posted here? The only method i know is to put a tripod bad and then deploy it with that. But that cant save to db and can be built anywhere. 

 

also do you have to edit the BE filters to allow these bags ?

Link to comment
Share on other sites

  • 0

Hi,

If your only problem is that it's not saving to database then why not simply add pvdze obj publish under your files?

I will post you my files in private message after i've had some sleep.

Link to comment
Share on other sites

  • 0

It would be best to use the existing deploy method we are using for bikes and other buildables, we just need to figure out how to get it to detect the backpack

The other method martin has listed above requires multiple of the same file just with diffrent static classnames resulting in a bigger mission file.

The answer is in the wrapper.sqf we just need to figure it out

Link to comment
Share on other sites

  • 0

It would be best to use the existing deploy method we are using for bikes and other buildables, we just need to figure out how to get it to detect the backpack

The other method martin has listed above requires multiple of the same file just with diffrent static classnames resulting in a bigger mission file.

The answer is in the wrapper.sqf we just need to figure it out

 

does the RPT error above help ?

Link to comment
Share on other sites

  • 0

i think the problem here is not that hard to solve, never messed around with deploy anything that much though, BUT:

 

Array

String

 

_inventory = (weapons _player) + (magazines _player) + (typeOf (unitBackpack _player));

 

so if i read that right this lines needs to be:

_inventory = (weapons _player) + (magazines _player) + [(typeOf (unitBackpack _player))];
Link to comment
Share on other sites

  • 0

What solution was posted here? The only method i know is to put a tripod bad and then deploy it with that. But that cant save to db and can be built anywhere. 

 

also do you have to edit the BE filters to allow these bags ?

 

Yes, put the bag down and deploy with a tripod bag. That's what the OP was all about and yes, you do need to edit BE filters.

 

It would be helpful if you guys could provide any feedback about deploying weapons bags using the right click script in the thread where I initially asked about it: 

 

This would benefit people searching for this answer in the future and keep the topic relevant,especially since the OP marked this as solved.

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