Jump to content
ViktorReznov

[Release] Advanced Trading Economy v1.1 (fluctuating prices!)

Recommended Posts

This here is a modification to Zupas Advanced Trading. It did not sit well with me that on a Post-Zombie Apocalyptic that there were traders that would never run out of stock and with enough cash, you would want for nothing. No bueno, this is my first attempt to remedy this crisis. With every server startup, the economy will be set with a random variable that will modify the buy sell prices simultaneously. On startup you could be selling your gear for up to 2x its normal price and buying for half of the cost!  The prices now change every 30 minutes (configurable) and with a more balanced range. This is release one, designed to put the idea out there with an example of the code. THIS IS NOT BALANCED IN ANY WAY SHAPE OR FORM AND IS HIGHLY EXPLOITABLE.  Code is currently sound and not exploitable as is.BUT STILL COULD BE IF YOU CONFIGURE WRONG!

This is only compatible with Zupa's single currency, although it could be modified i suppose to fit old currency system thanks to zupas built in function

Still ToDo:

Rebalance Trader Prices Completed, now with stock config you cant exploit the system

Prices change over time Completed, thanks to this amazing community!

Actual trader stock determines per trader/per item prices

Additional variables that modify prices further (but in smaller and more dynamic ways (ie trader boons for expert zombie hunting)

STILL THINKING

Install Instructions 

Download https://github.com/Arstan13/AdvancedTradingEconomy

Spoiler
Install

This all assumes you already have custom compiles.sqf and fn_selfActions.sqf. Especially considering you should have installed zupas single currency to even make use of this script!

copy Advanced trading folder to dayz_code\actions\ in your mission folder (or be sure to change the paths with wherever you install it!)

open your fn_selfActions.sqf and find // All Traders block of code around line 1044 for me youll see

if (DZE_ConfigTrader) then {
	_buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false];
	s_player_parts set [count s_player_parts,_buyV];

and change to

if (DZE_ConfigTrader) then {
	_buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false];
	s_player_parts set [count s_player_parts,_buyV];

Open your init.sqf and insert

[] execVM "dayz_code\actions\AdvancedTrading\functions\adv_econFlucArray.sqf";

at the bottom

open your Description.ext and insert

#include "dayz_code\actions\AdvancedTrading\functions\defines.hpp"

somewhere near the top, my file is heavily customized but I have it just underneath CfgSounds and working flawless.

Config Options

in dayz_code\actions\advancedTrading\functions\adv_econFluc.sqf youll find the code block that actually modifies the trader prices, currently working and posting this to engage the community on the idea!

For Right now this is usable and not exploatable as is and just adds a little bit of flavor to traders. Open to suggestions and teaching! This was the first script I attempted to modify that was a bit more indepth than some of the other things ive tried.

ALL SOURCE CODE IS NOT MY WORK, ADVANCED TRADING IS THE GENIUS OF ZUPA AND THE TRADER CONFIGS ARE ALSO COURTESY OF ZUPA! IVE MERELY MODIFIED THEM TO ENJOY A NEW FUNCTION!

Straight from epoch 106 updates thread. https://epochmod.com/forum/topic/42887-arma-2-dayz-epoch-106/

[NEW] Optional variable to prevent stealing from backpacks by non-friendlies at traders. Set DZE_BackpackAntiTheft = true; in init.sqf @ebayShopper
29	[NEW] A much improved version of Zupa's Advanced Trading 2.1+ is now the default config trader menu, NOT COMPATIBLE WITH DATABASE TRADERS @icomrade @Windmolders 
…	
37	[NEW] Door Management v3.0+ by Zupa is now included and enabled by default with variable DZE_doorManagement, see configVariables.sqf @DevZupa @Bruce-LXXVI @ebayShopper 

 

Share this post


Link to post
Share on other sites

@ViktorReznov awesome!! really like it.    do you think you can made fluctuating prize over the server up time?

I dont know how is defined DZE_ecoMult  but basically something like this?

 

DZE_ecoMult call BIS_fnc_selectRandom;

waituntil {(round(time)) > 300};

 
    if (time > 300) then {
    [nil,nil,rTitleText,"Prices has changes", "PLAIN",10] call RE;
   DZE_ecoMult call BIS_fnc_selectRandom;
    };   

waituntil {(round(time)) > 1700};

 
    if (time > 1700) then {
    [nil,nil,rTitleText,"Prices has changes", "PLAIN",10] call RE;
   DZE_ecoMult call BIS_fnc_selectRandom;
    }; 

 

Share this post


Link to post
Share on other sites
On 6/25/2017 at 9:31 PM, juandayz said:

@ViktorReznov awesome!! really like it.    do you think you can made fluctuating prize over the server up time?

I dont know how is defined DZE_ecoMult  but basically something like this?

 

DZE_ecoMult call BIS_fnc_selectRandom;

waituntil {(round(time)) > 300};

 
    if (time > 300) then {
    [nil,nil,rTitleText,"Prices has changes", "PLAIN",10] call RE;
   DZE_ecoMult call BIS_fnc_selectRandom;
    };   

waituntil {(round(time)) > 1700};

 
    if (time > 1700) then {
    [nil,nil,rTitleText,"Prices has changes", "PLAIN",10] call RE;
   DZE_ecoMult call BIS_fnc_selectRandom;
    }; 

 

I was considering doing a per hour change of prices but decided to first release a static per server restart version to keep things simple, thanks for the suggestion! I will look into it!

Well, that was one hell of a process with no success but ALOT learned! Much obliged for your time! @juandayz

Great new things to come, stick around ladies and gents!

Share this post


Link to post
Share on other sites

Seems to be working pretty good, but something I don't like is that the sell price on attachments seem to be way higher then the buy price. Players could literally just buy and sell to make huge profits. 

Maybe I just catch it at a bad time and always see the sell higher then the buy. I just noticed it the exact opposite just now, so maybe false alarm.

Would there be a way to set it so the sell price always matches the last buy price?

Share this post


Link to post
Share on other sites
6 hours ago, sjd6795 said:

Seems to be working pretty good, but something I don't like is that the sell price on attachments seem to be way higher then the buy price. Players could literally just buy and sell to make huge profits. 

Maybe I just catch it at a bad time and always see the sell higher then the buy. I just noticed it the exact opposite just now, so maybe false alarm.

Would there be a way to set it so the sell price always matches the last buy price?

Yes, yes it would. I designed this to be pretty fairly balanced and had hoped i had eliminated any possibility for cheating the system.

There are 2 places you could make the modifications.

1. inside the AdvancedTrading\functions\adv_econFlucArray.sqf

_multArray = [ //array to hold values and keep the scaling of the market
					[2.0,0.5], //select 0 [BuyMult,SellMult] = select 0, select 1
					[1.9,0.6], //select 1
					[1.8,0.7], //select 2
					[1.6,0.8], //select 3
					[1.5,0.9], //select 4
					[1.4,1.1], //select 5
					[1.2,1.2], //select 6
					[0.9,1.3], //select 7
					[0.8,1.4], //select 8
					[0.7,1.5], //select 9
					[2.5,1.0], //select 10
					[0.8,2.0]  //select 11

the numbers inside the smaller arrays handle the changing of prices. The first number modifies the buy multiplier and the second handles the sell multiplier

2. This method is A LOT more drawn out and it is modifing the cfgs that handle the items that are even sold by the traders. Here is where I made the price changes. I built it against the highest sell array and tried to make it so there was never a time when selling netted more gain than buying took away.

Also, I havent technically updated this yet although it still works. There were changes to Zupas advanced trading and the cfg traders that I need to update to

Share this post


Link to post
Share on other sites

Found another problem, when purchasing a vehicle it does not spawn, something with publishvehicle2 in the RPT. I removed the script and vehicles seem to be spawning again.

Share this post


Link to post
Share on other sites
On 11/4/2018 at 2:24 AM, sjd6795 said:

Found another problem, when purchasing a vehicle it does not spawn, something with publishvehicle2 in the RPT. I removed the script and vehicles seem to be spawning again.

Ah yes, i need to push a fix to my script since epoch updated.

in z_at_buyItems.sqf (mpmissions, dayz_code\AdvancedTrading\functions\z_at_buyItems.sqf)

if (_buyingType in DZE_tradeVehicleKeyless) then {
	PVDZE_veh_Publish2 = [[_dir,_location],_part_out,true,"0",_activatingPlayer,dayz_authKey];
} else {
	PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_keySelected,_activatingPlayer,dayz_authKey];
};

the change is the dayz_authKey

Share this post


Link to post
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

  • Similar Content

    • By Cyrus
      Hi,
      I have successfully set up an Arma 3 Epoch altis server (private for now) with a bunch of server side mods running. One of them is the Black Market Trader found elsewhere in the forums. My question is how do i add weapons and gear from the DLC expansions (MARK, HELI) etc. more specifically gear and weapons. I have seen on the BMS server they have gear specific to APEX and helis specific to HELI DLC. My black market trader does not have any of the DLC gear and weapons but only some of the heli's like the Huron and Taru. I own all of the DLC's and they are all present on the server folder structure. I cannot spawn them either using the builtin Anti Hack admin menu as they aren't present.
       
      I there any way that i can make them visible th AH menu and black market trader?
       
      Thanks in advance
    • By Mart123
      Hey, i have a question.
       
      How, and where do i change the prices for my traders in my Dayz Epoch server?
       
       
    • By Gabriel12237
      Hello Community i need help .

      Sorry for my bad english. Im from germany and i need help.

      I Have Advanced trading and Single currency 3.0 (without global banking) from zupa, and when i sell or buy in the normal trading menu , the trader dont use coins from me. With advanced trading menu the trader use coins for the item.

      Pls help me.

      Thx
    • By vbawol
      For some of the newly supported CUP terrain maps I have added a new feature that allows for dynamically placed trader cites and NPC traders. 
      The server will attempt to load a template from 'CfgPropTemplate' when the 4th 'telePos' array element is a string.
      For example Sahrani uses 3 trader city templates (north,east,west) 
      https://github.com/EpochModTeam/Epoch/blob/master/Sources/epoch_server_settings/configs/maps/Sara.h#L38
      The initial seed location for these are pulled from Marker locations with the same names. https://github.com/EpochModTeam/Epoch/blob/master/Sources/mpmissions/epoch.Sara/mission.sqm#L2077-L2094
      The CfgPropTemplate template data (the actual templates) are contained in the server settings pbo here: https://github.com/EpochModTeam/Epoch/blob/master/Sources/epoch_server_settings/configs/templates/CfgPropTemplate.h
      You can customize these templates. The script needed to generate the configs and was made to work with the new 3d "eden editor" can be found here. https://github.com/EpochModTeam/Epoch/blob/8bbec6258a45345080832212299f3aed223a8452/Tools/SQF/saveTraderCityTemplate.sqf
      Currently the 4 existing templates (north,east,west,south) are the same exact layouts and will likely made more unique in future patches.
    • By Joshyy
      The trading times for my server when it has around 40-60 people online after about 30 mins into a restart becomes very slow.
      It takes around 5 minutes just to purchase a vehicle and unlock it.
      Anyone know a solution to fixing this?
      Thanks,
  • Advertisement
  • Advertisement
  • Supporters
  • Advertisement
  • Discord

×