Custom traders Help.

mskitten87

New Member
allright i'm runing into issues most guides i'v found are outdated...so im wondering if anyone can assist with adding 3 traders.

i'm basicly trying to add

#1: Gem trader Basic/Gems only who buys gems for 1briefcase but sells them for 5


#2: 50k Humanity trader , Sales Some Tanks/Choppers etc with guns

#3: Donator Trader. Uses Bronze bars as its admin only given item now but as said were looking to get just 3 traders added

so no idea if anyone out there has bit to help implent 3 traders if so feel free add sxyvixen87 to skype and we'll talk to you in ts.

anyhow ty.
 
allright i'm runing into issues most guides i'v found are outdated...so im wondering if anyone can assist with adding 3 traders.

i'm basicly trying to add

#1: Gem trader Basic/Gems only who buys gems for 1briefcase but sells them for 5


#2: 50k Humanity trader , Sales Some Tanks/Choppers etc with guns

#3: Donator Trader. Uses Bronze bars as its admin only given item now but as said were looking to get just 3 traders added

so no idea if anyone out there has bit to help implent 3 traders if so feel free add sxyvixen87 to skype and we'll talk to you in ts.

anyhow ty.
humanity traders, you'll have to have a custom fn_selfActions and add in
Code:
            if((_traderMenu select 2) == "superhero") then {
                _humanity_logic = (_humanity < 50000);
            };
above line 758 like so
Code:
            _humanity = player getVariable ["humanity",0];
            _traderMenu = call compile format["menu_%1;",_traderType];

            // diag_log ("TRADER = " + str(_traderMenu));
          
            _low_high = "low";
            _humanity_logic = false;
            if((_traderMenu select 2) == "friendly") then {
                _humanity_logic = (_humanity < -5000);
            };
            if((_traderMenu select 2) == "hostile") then {
                _low_high = "high";
                _humanity_logic = (_humanity > -5000);
            };
            if((_traderMenu select 2) == "hero") then {
                _humanity_logic = (_humanity < 5000);
            };
            if((_traderMenu select 2) == "superhero") then {
                _humanity_logic = (_humanity < 50000);
            };
            if(_humanity_logic) then {
                _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
                s_player_parts set [count s_player_parts,_cancel];
            } else {
and then follow a usual tutorial on creating a trader, and everywhere it asks you to put a neutral, hostile, friendly, or hero (usually in the DB and server_traders.sqf in the mission pbo) replace it with superhero.

EDIT: this is untested, but it should work. If it doesn't you'll just have to play around with some values
 
allright i'm runing into issues most guides i'v found are outdated...so im wondering if anyone can assist with adding 3 traders.

i'm basicly trying to add

#1: Gem trader Basic/Gems only who buys gems for 1briefcase but sells them for 5


#2: 50k Humanity trader , Sales Some Tanks/Choppers etc with guns

#3: Donator Trader. Uses Bronze bars as its admin only given item now but as said were looking to get just 3 traders added

so no idea if anyone out there has bit to help implent 3 traders if so feel free add sxyvixen87 to skype and we'll talk to you in ts.

anyhow ty.
and for every other trader you would do the same thing, but skip the fn_selfActions crap. Just follow the usual trader install tutorials and make sure you use the right TIDS and such. It's really simple to do. http://opendayz.net/threads/tutorial-epoch-creating-a-new-trader.19593/ I added in two gem / medical traders last night in about 10 minutes.
 
done this so idk what were doing wrong so ill just give up every time server just locks up. so we'v stoped trying as all it does is lock our server/not allow us log in. i can add other stuff here/there fine but traders seem a no go.
 
done this so idk what were doing wrong so ill just give up every time server just locks up. so we'v stoped trying as all it does is lock our server/not allow us log in. i can add other stuff here/there fine but traders seem a no go.
You obviously messed something up. Don't just stop because you can't figure it out. Push on. There should be some errors in your arma2oaserver.rpt. Post them. We will fix whats wrong.
 
ok this is straight from here ( http://epochmod.com/forum/index.php?/topic/970-custom-trader-cities/ ) just cleaned it up for you :p

This is how i do it so its not the best way :) but it works!

1. create anew file and call it customtrader.sqf and paste this into it
Code:
_unit_13001 = objNull;if(true)then{
  _this = createAgent ["RU_Damsel5",[2550.658,8326.5928,2.3534577],[],0,"CAN_COLLIDE"];
  _unit_13001 = _this;
  _this setDir 114.59087;
  _this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;  ";
  _this setUnitAbility 0.60000002;
_this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;};

now change RU_Damsel5 to the skin you want your trader to have (dont use one already in use!)
change
2550.658,8326.5928,2.3534577 to the loaction you want the trader to spawn.

save the file in your root MPMission folder (where your init.sqf is)
2. open server_trader.sqf and addthis to the bottom of it


// Gem Trader
menu_RU_Damsel5 =[[["Gems",900]],[],"neutral"];
(code tags ruined the color so i just put it as normal text)

make sure you include menu_ also change RU_Damsel5 to the skin you used in step 1
900 is the unique trader id

now at the top of server_traders add into the array add this to the start of the traders array
Code:
"RU_Damsel5",
so it looks like this
Code:
serverTraders =["RU_Damsel5","SOMESKIN",more code];
save


3. now you need to import somethings into your DB so use the below SQL code to import your new trader

Code:
REPLACE INTO `server_traders`(`id`,`classname`,`instance`,`status`,`static`,`desc`) VALUES (900,'RU_Damsel5',11,'friendly', NULL,'Gem Trader');
900 must match the trader id from step 2

Gem Trader is the traders description, you can put what ever you want here
11 is your instance id ( 11 is epoch chernarus id )

now we need to give the trader something to sell!

4. again you need to import this into your DB

Code:
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (9999,'["ItemRuby",1]',1000,'[9,"ItemGoldBar",1]','[5,"ItemGoldBar",1]',0,900,'trade_items');
9999 is a uniquie id make sure its not already used
ItemRuby is the name of the item you want the trader to buy/sell
9,"ItemGoldBar" is the buy price is this case it is 9 goldbars
5,"ItemGoldBar" is the sell price in this case it is 5 gold bars
900 must match the trader id from step 2

here is theSQL to import all the GEMS for the example above
Code:
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (9999,'["ItemRuby",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (10000,'["ItemTopaz",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (10001,'["ItemObsidian",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (10002,'["ItemSapphire",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (10003,'["ItemAmethyst",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (10004,'["ItemEmerald",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
REPLACE INTO `traders_data`(`id`,`item`,`qty`,`buy`,`sell`,`order`,`tid`,`afile`) VALUES (10005,'["ItemCitrine",1]',250,'[9,"ItemGoldBar10oz",1]','[5,"ItemGoldBar10oz",1]',0,900,'trade_items');
4. last but not least we need to call our customtrader.sqf to spawn the trader
open your init.sqf and at the bottom add this line
Code:
[] execVM "customtrader.sqf";
thats it your trader should be good to go!
 
Last edited:
Ok .. database traders all well and good but what about cfgTraders based traders ?? do u even need to add items into db for them ??
And How would u specify humanity of 20k for super hero ??
 
Last edited:
cfgtraders do not use the database, hence the name cfg based traders .

I am assuming the "superhero" question doesnt mean the code below:
if (player getvariable["humanity",0] > 20,000) then {
is_superhero = true;
};

But what you mean is make the trader only trade with super hero's. THAT is in your fn_selfactions and it looks like you would add in a super_hero option
Code:
if (_isMan && !_isPZombie && _traderType in serverTraders) then {
       
        if (s_player_parts_crtl < 0) then {

            // get humanity
            _humanity = player getVariable ["humanity",0];
            _traderMenu = call compile format["menu_%1;",_traderType];

            // diag_log ("TRADER = " + str(_traderMenu));
           
            _low_high = "low";
            _humanity_logic = false;
            if((_traderMenu select 2) == "friendly") then {
                _humanity_logic = (_humanity < -5000);
            };
            if((_traderMenu select 2) == "hostile") then {
                _low_high = "high";
                _humanity_logic = (_humanity > -5000);
            };
            if((_traderMenu select 2) == "hero") then {
                _humanity_logic = (_humanity < 5000);
            };
            if(_humanity_logic) then {
 
Back
Top