Jump to content
  • 0

IRenaming Items In The Trader


TheGamingChief

Question

So recently i added some custom SUV skins to my server. I am using the class names that are not normally used in the traders. So when i add them to the trader it gives them the name of the SUV witch is incorrect. I was wondering is is possible to change the name of items in the trader? If so please let me know how as this would be extremely usefully!

 

Here is a image of what the trader looks like after i add the custom skins in. I would like to rename theses SUVS at the bottom.

bb177854450921faac1aa93808e690e5.jpg

 

Thanks For Any Help In Advance!  :)

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

You could just simply create new category i.e. SUV Tier 2, SUV Tier 3 etc because they are SUVs afterall but they have upgrade parts installed (DZE2,DZE3,DZE4)

 

Ok let me make sure i understand what your saying, That i could create another category. Like the trucks category ETC? Maybe you could provide a example. And would they still be called say SUV Yellow? 

Link to comment
Share on other sites

  • 0

To add extra categories to traders you'll need these files.

 

cfgServerTrader.hpp

server_traders.sqf

 

In cfgServerTrader.hpp add as many includes as you want (make sure it matches your new category/file count)

#include "Category\MyCategoryName.hpp"

In server_traders.sqf add extra category (name it whatever you like) and category ID

["Bikes and ATV",18],["Buses and Vans",19],["Cargo Trucks",20],["Fuel Trucks",21],["Military Unarmed",22],["Trucks",23],["Used Cars",24],["Utility Vehicles",25],["SUV Tier 2",26],["SUV Tier 3",27],["SUV Tier 4",28]

So your whole trader line will look similar to this (note that i have my trader categories set from 1 to 50 where, for example, vehicle traders use the same categories across the map)

menu_RU_Profiteer4 = [[["Bikes and ATV",18],["Buses and Vans",19],["Cargo Trucks",20],["Fuel Trucks",21],["Military Unarmed",22],["Trucks",23],["Used Cars",24],["Utility Vehicles",25],["SUV Tier 2",26],["SUV Tier 3",27],["SUV Tier 4",28]],[],"neutral"];

And then you create new .hpp files and place them in Category folder (You can name them whatever you like, as long as their name is in cfgServerTrader.hpp and their TCAT matches the one we set in server_traders.sqf)

class Category_# {
	class Vehicle_Classname {
		type = "trade_any_vehicle";
		buy[] = {2,"ItemGoldBar"};
		sell[] = {1,"ItemGoldBar"};
	};
	class Vehicle2_Classname {
		type = "trade_any_vehicle";
		buy[] = {2,"ItemGoldBar"};
		sell[] = {1,"ItemGoldBar"};
	};
	class Vehicle3_Classname {
		type = "trade_any_vehicle";
		buy[] = {2,"ItemGoldBar"};
		sell[] = {1,"ItemGoldBar"};
	};
};


Edit: As for Vehicle name changing you'd have to edit epoch configs to get it done

Link to comment
Share on other sites

  • 0

Why did you put those in anyway? When you get those bottom vehicles, if you upgrade the normal suv's. You only need the first throw of cars, and a few upgrade documents ;)

Link to comment
Share on other sites

  • 0

Why did you put those in anyway? When you get those bottom vehicles, if you upgrade the normal suv's. You only need the first throw of cars, and a few upgrade documents ;)

I was just testing out the new skins i got for the SUVs, I will probably go back and look more in-depth at this after i get some sleep. 

Link to comment
Share on other sites

  • 0

What you are trying to do is actually very easy, but strangely I have never seen anyone post information about it.

I have also been on many servers that have re-textured vehicles but none of them had actually modified the vehicles names in the trader menu.

 

Anyway here is what you need to do:

 

Get the player_traderMenuConfig.sqf from the dayz_code.pbo and place it somewhere in your mission file.

Then in your compiles.sqf find this:

 

call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";

 

Change the file path to point to the location where you have just copied the file.

 

Now open the player_traderMenuConfig.sqf file and find this line:

 

_index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];

 

In the above statement, _textPart is the vehicles class-name and _name is the vehicles display name.

 

So directly above that line all you need to do is check the vehicles class-name and if it is one of your re-textured vehicles you just alter the display name.

Here is my example using the SUV_Blue and SUV_White.

if (_name == "SUV_Blue") then {_textPart = "SUV Custom Texture 1"};
 
if (_name == "SUV_White") then {_textPart = "SUV Custom Texture 2"};
 
_index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];

EDIT

So here is an example to match your question:

 

if (_name == "SUV_Pink_DZE4") then {_textPart = "Hello Kitty SUV"};

 

This will only change the name that is displayed in the trader menu. 

Link to comment
Share on other sites

  • 0

Smal addition to that:

It might be better for the resources (loading time), if you set the name within the config files:

 

class Pickup_PK_GUE_DZE {
		type = "trade_any_vehicle";
		buy[] ={75000,"Coins"};
		sell[] ={37500,"Coins"};
		name = "custom name";
	};
	class Pickup_PK_INS_DZE {
		type = "trade_any_vehicle";
		buy[] ={75000,"Coins"};
		sell[] ={37500,"Coins"};
		name = "empty";
	};
for "_i" from 0 to ((count _cfgTraderCategory) - 1) do {

		class = configName (_cfgTraderCategory select _i);
		_type  = getText ((_cfgTraderCategory select _i) >> "type");	
		_buy  = getArray ((_cfgTraderCategory select _i) >> "buy");	
		_sell = getArray ((_cfgTraderCategory select _i) >> "sell");
		_customName  = getText ((_cfgTraderCategory select _i) >> "name");	
		_buy set [2,1];
		_sell set [2,1];
		_typeNum = 1;
		
		if (_type == "trade_weapons") then {
			_typeNum = 3;
		} else { 
			if (_type in ["trade_backpacks", "trade_any_vehicle", "trade_any_vehicle_free", "trade_any_boat", "trade_any_bicycle"]) then {
				_typeNum = 2;
			};
		};

		if (!isNil "_customName") then {
			_data = [9999,[class,_typeNum,_customName],99999,_buy,_sell,0,_trader_id,_type];
		} else {
			_data = [9999,[class,_typeNum],99999,_buy,_sell,0,_trader_id,_type];
		};
		

		PVDZE_plr_TradeMenuResult set [count PVDZE_plr_TradeMenuResult, _data];
	};
	{
		private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image"];
		_header = _x select 0;
		_item = _x select 1;
		_name = _item select 0;
		_type = _item select 1;
		
		switch (true) do {
			case (_type == 1): {
				_type = "CfgMagazines";
			}; 
			case (_type == 2): {
				_type = "CfgVehicles";
			}; 
			case (_type == 3): {
				_type = "CfgWeapons";
			};
		};

		if (count _item == 3) then {
			_textPart = _item select 2;
		} else {
			_textPart = getText(configFile >> _type >> _name >> "displayName");
		};
		_qty = _x select 2;
		_buy = _x select 3;
		_bqty = _buy select 0;
		_bname = _buy select 1;
		btype = _buy select 2;

		switch(true)do{ 
			case (btype == 1): { 
				btype = "CfgMagazines";
			}; 
			case (btype == 2): { 
				btype = "CfgVehicles";
			}; 
			case (btype == 3): { 
				btype = "CfgWeapons";
			}; 
		}; 

		_btextCurrency = CurrencyName;
		_sell = _x select 4;
		_sqty = _sell select 0;
		_sname = _sell select 1;
		stype = _sell select 2;

		switch(true)do{ 
			case (stype == 1): { 
				stype = "CfgMagazines";
			}; 
			case (stype == 2): { 
				stype = "CfgVehicles";
			}; 
			case (stype == 3): { 
				stype = "CfgWeapons";
			}; 
		}; 

		_stextCurrency = CurrencyName;
		_order = _x select 5;
		_afile = _x select 7;
		_File = "EPOCHMODS\ZSC\actions\" + _afile + ".sqf";
		_count = 0;

		if(_type == "CfgVehicles") then {
			if (_afile == "trade_backpacks") then {
				_bag = unitBackpack player;
				_bagclass = typeOf _bag;
				if(_name == _bagclass) then {
					_count = 1;
				};
			} else {
				if (isClass(configFile >> "CfgVehicles" >> _name)) then {
					_distance = dayz_sellDistance_vehicle;
					if (_name isKindOf "Air") then {
						_distance = dayz_sellDistance_air;
					};
					if (_name isKindOf "Ship") then {
						_distance = dayz_sellDistance_boat;
					};
					_count = {(typeOf _x) == _name} count (nearestObjects [player, [_name], _distance]);
				};
			};
		};

		if(_type == "CfgMagazines") then {
			_count = {_x == _name} count magazines player;
		};

		if(_type == "CfgWeapons") then {
			_count = {_x == _name} count weapons player;
		};

		_index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];

		if (_count > 0) then {
			lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]];
		};

		_image = getText(configFile >> _type >> _name >> "picture");

		lbSetPicture [TraderDialogItemList, _index, _image];

		_item_list set [count _item_list, [
			_name,
			_textPart,
			_bqty,
			_bname,
			_btextCurrency,
			_sqty,
			_sname,
			_stextCurrency,
			_header,
			_File
		]];
	} forEach PVDZE_plr_TradeMenuResult;
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...