Jump to content
ZN Anhor

Trader Issue [solved]

Recommended Posts

Hello all.

 

I hope someone here can help me.
The following problem:

 

I would like to configure our traders so that they only buy specific items.
As an an example:

Heroin, cocain, dope and magic mushrooms can only and exclusively be sold at drug dealers! Not with an armory trader, hardware trader or whatever trader.

 

At the moment every trader, no matter what he sells, buys almost everything (the armory trader allready buy hardware). And that's exactly what we want to prevent.
Does anyone know how to prevent this and would you explain this to me?
Many thanks in advance.

Share this post


Link to post
Share on other sites

I repeat my question again:

 

Is it possible to configure one (or all traders) so that they only BUY the items that they sell?

 

Even a simple no would be welcome because then I don't have to think about it any further. Nevertheless, thank you in advance for every answer.

Share this post


Link to post
Share on other sites

"Everything" is possible. Lookup the trader code related files and change it to your needs and create override via CfgExileCustomCode in the mission config.cpp

Share this post


Link to post
Share on other sites

Can can use the community trader guys and just call the name like so (example)

 

    class Exile_Trader_CommunityCustoms9
    {
        name = "AIRCRAFT";
        showWeaponFilter = 0;
        categories[] =
        {         
            "Arma3ChoppersArmed",           
            "Arma3Choppers",
            "DLCContactHellcatWY55",            
            "LawsOfWarHelis",            
            "RHSArmedHelis",            
            "RHSUnarmedHelis",            
            "Vtols",            
            "VTOLBlackfish"
        };
    };

 

 

["Exile_Trader_CommunityCustoms9", [], "Exile_Trader_CommunityCustoms9", "WhiteHead_01", [[],[],[],["Exile_Uniform_ExileCustoms",[]],[],[],"","G_Tactical_Clear",[],["","","","","",""]], [11985.7, 12673.3, 159.074], [0.649186, -0.76063, 0], [0, 0, 1]],

 

 

all this is very possible mate

Share this post


Link to post
Share on other sites

@rgscriven

Thanks for the help, but I've already had something like that. In the config.cpp (mission files) I had this:

class Community
	{
		name = "DRUGS";
		icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\uniform_ca.paa";
		items[] =
		{
			"DDR_Item_Heroin",
			"DDR_Item_Mushrooms",
			"DDR_Item_Drugs_Cocaine",
			"DDR_Item_Drugs_Weed"
		};
	};

and this:

class Exile_Trader_CommunityCustoms
	{
		name = "DRUGS";
		showWeaponFilter = 0;
		categories[] = 
		{
			"Community"
		};
	};

Of course with a own trader in initPlayerLocal.sqf:

["Exile_Trader_CommunityCustoms", ["InBaseMoves_HandsBehindBack1"], "Exile_Trader_CommunityCustoms", "AsianHead_A3_04", [[],[],["uns_bhp","","","",["uns_13Rnd_hp",13],[],""],["UNS_VC_K",[["uns_13Rnd_hp",3,13]]],["UNS_M1956_A1",[]],[],"UNS_Conehat_VC","UNS_Scarf_PL",[],["","","","","",""]], [5113.08, 1140.4, 5.30497], [0.143609, 0.989635, 0], [0, 0, 1]],

 

However, that is not the solution. As soon as the corresponding items have been added to the arsenal, they are also bought by every other trader. Not adding the items to the arsenal is of course not a solution either ...... because then NO trader would know the price.

As they say in Germany: The cat catch her own tail.

 

Rabito's approach is arguably the way to go. However, I have to admit that I have too little experience with the Exile Code. Thanks anyway.

 

 

Share this post


Link to post
Share on other sites

there are 9 diffrent Exile_Trader_CommunityCustoms guys you only need to use one that the other traders don't use, if configured correctly you can have loot reading from 1 trader but not from the others. So make new classes that the custom trader only will read

Share this post


Link to post
Share on other sites

    class Exile_Trader_CommunityCustoms9
    {
        name = "AIRCRAFT";
        showWeaponFilter = 0;
        categories[] =
        {         
            "Arma3ChoppersArmed",           
            "Arma3Choppers",
            "LawsOfWarHelis",            
            "RHSArmedHelis",            
            "RHSUnarmedHelis",
            "Vtols",            
            "VTOLBlackfish"
        };
    };

which this is diffrent to the normal aircraft trader

 

 

    class Exile_Trader_Aircraft
    {
        name = "AIRCRAFT";
        showWeaponFilter = 0;
        categories[] =
        {         
            "Arma3ChoppersArmed",           
            "Arma3Choppers",
            "Drones",
            "FighterJets",
            "LawsOfWarHelis",            
            "Planes",
            "RHSArmedHelis",            
            "RHSUnarmedHelis",
            "RHSFighterJets",
            "RHSPlanes",
            "Vtols",            
            "VTOLBlackfish"
        };
    };

 

["Exile_Trader_Aircraft", ["HubFixingVehicleProne_idle1"], "Exile_Trader_CommunityCustoms9", "GreekHead_A3_06", [[],[],[],["U_I_pilotCoveralls",[]],[],[],"H_CrewHelmetHeli_O","G_Tactical_Black",[],["","","","","",""]], [9692.42, 3939.64, 38.8914], [-0.0130357, -0.999915, 0], [0, 0, 1]],

 

so you can do pretty much anything with it mate, turn it into a blackmarket trader, add only what you want and remove from other traders, its upto you.

 

 

 

Share this post


Link to post
Share on other sites

@rgscriven

I am sure that we will talk past each other.

First, it's not about vehicle traders who don't buy, they just sell.

So we're talking about traders who buy and sell items.

And with your option, which by the way absolutely corresponds to what I also posted, does not work.

So although you can specify which traders which items SOLD, but not which ones he BUYS.

You can sell each item in Exile each item traders as long as it is registered in the Arsenal.

And that's my problem!

 

I want that e.g. the hardware trader only BUYS hardware, the armory trader only BUYS armory, the food trader only BUYS food ......... it's not about SELLING!

 

As I said, I had already run and tested the code I posted. The result was that you could ONLY buy the drugs from this dealer ...... but you could sell them to any other dealer for pop tabs.

And that's exactly what I want to prevent. Poptabs for drugs are ONLY available from drug dealers, that's the goal.

Share this post


Link to post
Share on other sites

That's exactly what I'm looking for.
Example:
Gold bars are only bought from the Banker.
But unfortunately I got no further with the existing codes.

Share this post


Link to post
Share on other sites

Nice that I'm not the only one with this idea. And above all that someone has understood what it is about. How to assign a trader what to sell, I can do it alone, but tell him what to buy .....

 

I looked at some files in the exile_server, including the Exile_system_trading_network files, but didn't really get any further 🤒

 

I assume that the solution is hidden somewhere in the ExileServer_system_trading_network_sellItemRequest.sqf

/**
 * ExileServer_system_trading_network_sellItemRequest
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_sessionID", "_parameters", "_itemClassName", "_quantity", "_containerType", "_containerNetID", "_playerObject", "_vehicleObject", "_sellPrice", "_playerRespect", "_playerMoney", "_noRespectItems", "_respectGain", "_logging", "_playerMoneyString", "_traderLog", "_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_itemClassName = _parameters select 0;
_quantity = _parameters select 1;
_containerType = _parameters select 2;
_containerNetID = _parameters select 3;
try 
{
	_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
	if (isNull _playerObject) then
	{
		throw 1;
	};
	if !(alive _playerObject) then
	{
		throw 2;
	};
	if(_playerObject getVariable ["ExileMutex",false]) then
	{
		throw 12;
	};
	_playerObject setVariable ["ExileMutex",true];
	_vehicleObject = objNull;
	if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _itemClassName) ) then
	{
		throw 3;
	};
	_sellPrice = _itemClassName call ExileClient_util_gear_calculateSellPrice;
	if (_containerType isEqualTo 1) then
	{
		if (_itemClassName isEqualTo (primaryWeapon _playerObject)) then
		{
			{
				{
					if !(_x isEqualTo "") then
					{
						_sellPrice = _sellPrice + (_x call ExileClient_util_gear_calculateSellPrice);
					};
				}
				forEach _x;
			}
			forEach 
			[
				primaryWeaponItems _playerObject,
				primaryWeaponMagazine _playerObject
			];
		};
		if (_itemClassName isEqualTo (handgunWeapon _playerObject)) then
		{
			{
				{
					if !(_x isEqualTo "") then
					{
						_sellPrice = _sellPrice + (_x call ExileClient_util_gear_calculateSellPrice);
					};
				}
				forEach _x;
			}
			forEach 
			[
				handgunItems _playerObject,
				handgunMagazine _playerObject
			];
		};
	};
	_playerRespect = _playerObject getVariable ["ExileScore", 0];
	if !(getNumber(configFile >> "CfgSettings" >> "Escape" >> "enableEscape") isEqualTo 1) then 
	{
		if (_sellPrice <= 0) then
		{
			throw 4;
		};
		_playerMoney = _playerObject getVariable ["ExileMoney", 0];
		_playerMoney = _playerMoney + _sellPrice;
		_playerObject setVariable ["ExileMoney", _playerMoney, true];
		format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
		_noRespectItems = 
		[
			"Exile_Item_FlagStolen1",
			"Exile_Item_FlagStolen2",
			"Exile_Item_FlagStolen3",
			"Exile_Item_FlagStolen4",
			"Exile_Item_FlagStolen5",
			"Exile_Item_FlagStolen6",
			"Exile_Item_FlagStolen7",
			"Exile_Item_FlagStolen8",
			"Exile_Item_FlagStolen9",
			"Exile_Item_FlagStolen10"
		];
		if !(_itemClassName in _noRespectItems) then 
		{
			_respectGain = _sellPrice * getNumber (configFile >> "CfgSettings" >> "Respect" >> "tradingRespectFactor");
			_playerRespect = floor (_playerRespect + _respectGain);
			_playerObject setVariable ["ExileScore", _playerRespect];
			format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget;
		};
	};
	[_sessionID, "sellItemResponse", [0, _sellPrice, _itemClassName, 1, _containerType, _containerNetID, str _playerRespect]] call ExileServer_system_network_send_to;
	_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
	if (_logging isEqualTo 1) then
	{
		_playerMoneyString = _playerMoney call ExileClient_util_string_exponentToString;
		_traderLog = format ["PLAYER: ( %1 ) %2 SOLD ITEM %3 FOR %4 POPTABS AND %5 RESPECT | PLAYER TOTAL MONEY: %6",getPlayerUID _playerObject,_playerObject,_itemClassName,_sellPrice,_respectGain,_playerMoneyString];
		"extDB2" callExtension format["1:TRADING:%1",_traderLog];
	};
	if !(_vehicleObject isEqualTo objNull) then
	{
		_vehicleObject call ExileServer_object_vehicle_database_update;
	}
	else 
	{
		_playerObject call ExileServer_object_player_database_update;
	};
}
catch 
{
	_responseCode = _exception;
	[_sessionID, "sellItemResponse", [_responseCode, 0, "", 0, 0, "", ""]] call ExileServer_system_network_send_to;
};
if !(isNull _playerObject) then 
{
	_playerObject setVariable ["ExileMutex", false];
};
true

The question is where 🙄

Share this post


Link to post
Share on other sites

That's exactly how I got there!
But then unfortunately it's over.

Share this post


Link to post
Share on other sites
On 10/22/2020 at 12:59 AM, ZN Anhor said:

@rgscriven

I am sure that we will talk past each other.

First, it's not about vehicle traders who don't buy, they just sell.

So we're talking about traders who buy and sell items.

And with your option, which by the way absolutely corresponds to what I also posted, does not work.

So although you can specify which traders which items SOLD, but not which ones he BUYS.

You can sell each item in Exile each item traders as long as it is registered in the Arsenal.

And that's my problem!

 

I want that e.g. the hardware trader only BUYS hardware, the armory trader only BUYS armory, the food trader only BUYS food ......... it's not about SELLING!

 

As I said, I had already run and tested the code I posted. The result was that you could ONLY buy the drugs from this dealer ...... but you could sell them to any other dealer for pop tabs.

And that's exactly what I want to prevent. Poptabs for drugs are ONLY available from drug dealers, that's the goal.

now i understand in what you are after, after re-reading your orignal post.

this seems a great idea, as we no that the waste dude buys things maybe look there first inside the script

Share this post


Link to post
Share on other sites

@rgscriven

It was clear to me that it could only be a misunderstanding 😉

 

In general, I think it would be a huge step forward if this problem could be solved.

Not just for me or @Whitey01, but for the exile community in general.

Just consider the possibilities that would open up .... in relation to the game or a story.

 

It would be nice if one or the other crack would support us 🤗

Share this post


Link to post
Share on other sites
22 minutes ago, ZN Anhor said:

@rgscriven

It was clear to me that it could only be a misunderstanding 😉

 

In general, I think it would be a huge step forward if this problem could be solved.

Not just for me or @Whitey01, but for the exile community in general.

Just consider the possibilities that would open up .... in relation to the game or a story.

 

It would be nice if one or the other crack would support us 🤗

FOR SURE MATE

Share this post


Link to post
Share on other sites

Iam gonna try if i can find a easy solution. But no promises if it's too complicated i don't wanna waste my time 😎

  • Thanks 1

Share this post


Link to post
Share on other sites

Make a override for ExileClient_gui_traderDialog_event_onSellButtonClick with the code below.
Wastedump still buys everything, so you need to "copy"/script that into the wasedump scripts.
 

/**
 * ExileClient_gui_traderDialog_event_onSellButtonClick
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_dialog", "_sellButton", "_purchaseButton", "_inventoryListBox", "_selectedInventoryListBoxIndex", "_itemClassName", "_quantity", "_inventoryDropdown", "_selectedInventoryDropdownIndex", "_currentContainerType", "_containerNetID", "_container", "_retardCheck", "_SellToTrader", "_flags"];
disableSerialization;
if !(uiNameSpace getVariable ["RscExileTraderDialogIsInitialized", false]) exitWith {};
_dialog = uiNameSpace getVariable ["RscExileTraderDialog", displayNull];
_sellButton = _dialog displayCtrl 4007;
_sellButton ctrlEnable false;
_sellButton ctrlCommit 0;
_purchaseButton = _dialog displayCtrl 4010;
_purchaseButton ctrlEnable false;
_purchaseButton ctrlCommit 0;
_inventoryListBox = _dialog displayCtrl 4005;
_selectedInventoryListBoxIndex = lbCurSel _inventoryListBox;
if !(_selectedInventoryListBoxIndex isEqualTo -1) then
{
	_itemClassName = _inventoryListBox lbData _selectedInventoryListBoxIndex;
	_quantity = 1; 
	if !(_itemClassName isEqualTo "") then
	{
		if !(ExileClientIsWaitingForServerTradeResponse) then
		{
			_inventoryDropdown = _dialog displayCtrl 4004;
			_selectedInventoryDropdownIndex = lbCurSel _inventoryDropdown;
			_currentContainerType = _inventoryDropdown lbValue _selectedInventoryDropdownIndex;
			_containerNetID = "";
			if (_currentContainerType isEqualTo 5) then
			{
				_containerNetID = _inventoryDropdown lbData _selectedInventoryDropdownIndex;
				_container = objectFromNetId _containerNetID;
				_retardCheck = _container call ExileClient_util_containerCargo_list;
			}
			else
			{
				_retardCheck = player call ExileClient_util_playerCargo_list;
			};
			
			_SellToTrader = getText(missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "sellToTradersTypes");
			if !(ExileClientCurrentTrader in _SellToTrader) exitWith
			{
				["ErrorTitleAndText", ["Wrong Trader", "This trader does not buy this. Try at a different trader!"]] call ExileClient_gui_toaster_addTemplateToast;
			};
			
			if (_itemClassName in _retardCheck) then
			{
				ExileClientIsWaitingForServerTradeResponse = true;
				["sellItemRequest", [_itemClassName, _quantity, _currentContainerType, _containerNetID]] call ExileClient_system_network_send;
				_flags = ["Exile_Item_FlagStolen1","Exile_Item_FlagStolen2","Exile_Item_FlagStolen3","Exile_Item_FlagStolen4","Exile_Item_FlagStolen5","Exile_Item_FlagStolen6","Exile_Item_FlagStolen7","Exile_Item_FlagStolen8","Exile_Item_FlagStolen9","Exile_Item_FlagStolen10"];
				if (_itemClassName in _flags) then
				{
					player setflagOwner ObjNull;
				};
			};
		};
	};
};
true


Adjust your arsenal config for every item

> example

class Exile_Item_Cement { quality = 1; price = 400000; sellPrice = 5000; sellToTradersTypes = ["Exile_Trader_Food","Exile_Trader_Hardware"] };

71C6CE8B5B340665FB78A74DE64FE3CF69B9E8D9

  • Thanks 2

Share this post


Link to post
Share on other sites

@El' Rabito

You are the best!

Tomorrow I will try to test the whole thing on the server.

Whatever the outcome, thx for that!

Share this post


Link to post
Share on other sites

@El' Rabito

 

Thank you very much for the script!
Works perfectly.

Unfortunately, I don't know how to enter that into the wastedumper.
I think it belongs in the ExileClient_gui_wasteDumpDialog_event_onSellButtonClick.
But I don't know how the codes have to be brought together.

Share this post


Link to post
Share on other sites

@El´ Rabito

 

I agree, perfect work!!! Thx for that buddy!

 

I solved the problem with the Waste Dumb Trader very pragmatically ..... there is no longer any. Nothing has to work quickly or easily! We all play to pass the time ..... well, does it dawn on the contradiction to do things in games quickly and easily?

 

Thx again Rabito ......

 

Share this post


Link to post
Share on other sites

@Whitey01

Would it help if the waste dump trader only buys vehicles but no longer "cargo"? If so, then we should ask El´ Rabito again nicely if he will watch it again 😉

  • Thanks 1

Share this post


Link to post
Share on other sites

×