Jump to content

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


ViktorReznov

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 

 

Link to comment
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;
    }; 

 

Link to comment
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!

Link to comment
Share on other sites

  • 1 year later...

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?

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

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

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
  • Discord

×
×
  • Create New...