Jump to content
  • 0

Fluctuating prices


juandayz

Question

hey.. i was thinking start to work in a fluctuating prices for trades cities.
Have think to ways. 1- using sql  2-using sqfs.
I cannot write anything in sql cuz i dont know nothing about it... so i decided the second way.

At first.. i need remove all content on mission.sqf (dayz_server.pbo/missions/instance/).
Second make a unique market..and put the AI traders again. 1 group of marchants for a standar prices and a Second Group for Fluctuating prices.
3- i will need rebuild the server_traders_cherno_11.sqf (coins system) with the new Ai traders and add new items/categories/prices to the .hpp files
into Config/Category/

To call the Ai traders i can use the init.sqf into :

Spoiler

if (isServer) then {
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";
    _nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";
    
    /*FLUCTUATING PRICES*/
    _fluctuatingprices =     [] execVM "custom\fluctuatingprices.sqf";
    /*FLUCTUATING PRICES*/

    


then into fluctuatingprices.sqf:
 

Spoiler

fn_spawtraders = {
all codes for spawn traders here.
};

_timeprice = 600;
waituntil {(round(time)) > 300};

 
    if (time > 300) then {
    [nil,nil,rTitleText,"Lower Prices at Market", "PLAIN",10] call RE;
    call fn_spawntraders;
    sleep _timeprice;
    deletevehicle all spawned in fn_spawncrate;
    
    };   


    
    
    
So my question is: to get all working i need delete all the original traders spawned with this line in init.sqf (_nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";)
and respawn again once server delete the AI spawned with the function fn_spawntraders.
This is possible? (despawn and respawn the original traders).

 

or maybe just make the buildings for trades cities into this line: _nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";

and into fluctuatingprices.sqf...  make 2 functions.. one for Ai traders with lowers prices and other with AI traders with normal prices..

something like this:

Spoiler

fn_spawtraders = {
all codes for spawn traders with normal prices here.

};

fn_spawtraderslowerprices = {
all codes for spawn traders with lower prices here.
};

_timeprice = 600;
waituntil {(round(time)) > 300};

 
    if (time > 300) then {
    [nil,nil,rTitleText,"Normal Prices at Market", "PLAIN",10] call RE;
    call fn_spawntraders;
    sleep _timeprice;
    deletevehicle all spawned in fn_spawncrate;
    
    };   

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

 
    if (time > 900) then {
    [nil,nil,rTitleText,"Lower Prices at Market", "PLAIN",10] call RE;
    call fn_spawntraderslowerprices;
    sleep _timeprice;
    deletevehicle all spawned in fn_spawncratelowerprices;
    
    };   

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

What would be a neat addition to epoch (not overpoch) would be -

the traders have a certain amount of items.. And the item price gets higher as trader stocks get lower :-\ 

If you could get a system similar to that going the prices would always go up and down as stock diminish :)

And you could set up a delivery service like once every few days that re-fill the traders :-\

Players dont need to see a actual truck driving around the map stocking traders that could just be a automatic script thing that just happens every few days...

But yeah that just come to me while reading your idea :)

GL with your project :)  

Link to comment
Share on other sites

  • 0

i got it for now:  if anyone have a better or clean idea about it please tell me :)

Spoiler

 

private ["_despawntraders","_rand"];


///////////////////////////////FUNCTIONS AREA////////////////////////////////////////////////////////////////////////////////////////////////////    

fn_globalFunction {
    


fn_spawnnormaltraders {

spawn all units

};

fn_spawnlowertraders {

spawn all units

};

//////////////////////////////END OF FUNCTIONS AREA////////////////////////////////////////////////////////////////////////////////////////////////


_despawntraders    = 600;
_rand = floor(random 100);    
    

    

if (_rand <= 50) then {
[nil,nil,rTitleText,"Normal Prices at Starys Central Market", "PLAIN",10] call RE;
call fn_spawnnormaltraders;

sleep _despawntraders;
[nil,nil,rTitleText,"Please Cancel all transactions traders will go in 10 seconds", "PLAIN",10] call RE;

sleep 10;
deletevehicle
};

if (_rand <= 100 && _rand > 51) then {
[nil,nil,rTitleText,"Lowers Prices at Starys Central Market", "PLAIN",10] call RE;
call fn_spawnlowertraders;

sleep _despawntraders;
[nil,nil,rTitleText,"Please Cancel all transactions traders will go in 10 seconds", "PLAIN",10] call RE;
sleep 10;
deletevehicle
};    
};

///////////////////////////////////////FIRST SPAWN///////////////
waituntil {(round(time)) > 100};

 
    if (time > 100) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////SECOND SPAWN///////////////
waituntil {(round(time)) > 712};

 
    if (time > 712) then {
    
    call fn_globalFunction;
    };   
    
///////////////////////////////////////3rd SPAWN///////////////
waituntil {(round(time)) > 1324};

 
    if (time > 1324) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////4th SPAWN///////////////
waituntil {(round(time)) > 1936};

 
    if (time > 1936) then {
    
    call fn_globalFunction;
    };   

///////////////////////////////////////5 SPAWN///////////////
waituntil {(round(time)) > 2548};

 
    if (time > 2548) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////6 SPAWN///////////////
waituntil {(round(time)) > 3160 };

 
    if (time > 3160) then {
    
    call fn_globalFunction;
    };           
    
///////////////////////////////////////7 SPAWN///////////////
waituntil {(round(time)) > 3772};

 
    if (time > 3772) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////8 SPAWN///////////////
waituntil {(round(time)) > 4384 };

 
    if (time > 4384) then {
    
    call fn_globalFunction;
    };   

    ///////////////////////////////////////9 SPAWN///////////////
waituntil {(round(time)) > 4996};

 
    if (time > 4996) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////10 SPAWN///////////////
waituntil {(round(time)) > 5608 };

 
    if (time > 5608) then {
    
    call fn_globalFunction;
    };           
    
///////////////////////////////////////11 SPAWN///////////////
waituntil {(round(time)) > 6220 };

 
    if (time > 6220) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////12 SPAWN///////////////
waituntil {(round(time)) > 6832 };

 
    if (time > 6832) then {
    
    call fn_globalFunction;
    };          

///////////////////////////////////////13 SPAWN///////////////
waituntil {(round(time)) > 7444 };

 
    if (time > 7444) then {
    
    call fn_globalFunction;
    };           
    
///////////////////////////////////////14 SPAWN///////////////
waituntil {(round(time)) > 8056 };

 
    if (time > 8056) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////15 SPAWN///////////////
waituntil {(round(time)) > 8668 };

 
    if (time > 8668) then {
    
    call fn_globalFunction;
    };          

///////////////////////////////////////16 SPAWN///////////////
waituntil {(round(time)) > 9280 };

 
    if (time > 9280) then {
    
    call fn_globalFunction;
    };

///////////////////////////////////////17 SPAWN///////////////
waituntil {(round(time)) > 9892 };

 
    if (time > 9892) then {
    
    call fn_globalFunction;
    };   

 ///////////////////////////////////////18 SPAWN///////////////
waituntil {(round(time)) > 10504 };

 
    if (time > 10504) then {
    
    call fn_globalFunction;
    };

/////////////////////////////////10800 seconds last time in server with 3hs restart   

 

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...