Jump to content

REQUEST Variable prices at traders


caboose1

Recommended Posts

Hi

 

 

I was wondering if there is anyway to make a script maybe that changes the prices in traders over the course of server uptime.

 

I dont know if you played drug wars but you buy something then after a while the price goes up or down. 

 

I was thinking this would  make people be "out and about" a little more. Also i think it would add another dimension to a already awesome mod.

Link to comment
Share on other sites

I think that would be possible in a SQL event actually. 
Say you take the update stock daily and remake it abit:

(Updates stock)

UPDATE `Traders_DATA` SET qty=100 WHERE qty<50 AND afile<>'trade_any_vehicle' AND afile<>'trade_any_boat'

and make it 
 

UPDATE `Traders_DATA` SET buy='[10,"ItemGoldBar",1]' where qty <10 AND afile<>'trade_any_vehicle' AND afile<>'trade_any_boat'

This would of course set ALL items to cost 10 gold bars when quantity is below 10.


THE ONLY PROBLEM IS THAT THIS IS NOT APPLIED UNTIL AFTER RESTART.
I'm not sure if you can make price update instant but if you have a server that restarts often it might be ok.

This means that you cant update trader quantity every restart but instead have to have it on like a daily schedule.

Link to comment
Share on other sites

I think that would be possible in a SQL event actually. 

Say you take the update stock daily and remake it abit:

(Updates stock)

UPDATE `Traders_DATA` SET qty=100 WHERE qty<50 AND afile<>'trade_any_vehicle' AND afile<>'trade_any_boat'

and make it 

 

UPDATE `Traders_DATA` SET buy='[10,"ItemGoldBar",1]' where qty <10 AND afile<>'trade_any_vehicle' AND afile<>'trade_any_boat'

This would of course set ALL items to cost 10 gold bars when quantity is below 10.

THE ONLY PROBLEM IS THAT THIS IS NOT APPLIED UNTIL AFTER RESTART.

I'm not sure if you can make price update instant but if you have a server that restarts often it might be ok.

This means that you cant update trader quantity every restart but instead have to have it on like a daily schedule.

You would need something that tells it where to put the price back too, or to increase so a default amount!

Link to comment
Share on other sites

You would need something that tells it where to put the price back too, or to increase so a default amount!

That could be solved aswell.

 

If the qty drops to 1 then update back to qty=100 and price to default

so basically:

 

UPDATE `Traders_DATA` SET buy='[1,"ItemGoldBar",1]'and qty=100 where qty <1 AND afile<>'trade_any_vehicle' AND afile<>'trade_any_boat'

I'm not 100% sure you can do it like that, but you get the general idea.

Link to comment
Share on other sites

I would not use a SQL query for this, as it will only be applied after a server restart as already said and that is to slow in my opinion, also you need many queries for all different items or price ranges at least.

since all trading stuff is handled with ingame scripts it should be possible to change the values there (in real time whenever you talk to a trader).

there is only one small problem: the different metal currencies, its not easy to add 10% to a gold bar or stuff like that so you have to be clever when dynamically changing the prices, any ideas? :D

Link to comment
Share on other sites

I would not use a SQL query for this, as it will only be applied after a server restart as already said and that is to slow in my opinion, also you need many queries for all different items or price ranges at least.

since all trading stuff is handled with ingame scripts it should be possible to change the values there (in real time whenever you talk to a trader).

there is only one small problem: the different metal currencies, its not easy to add 10% to a gold bar or stuff like that so you have to be clever when dynamically changing the prices, any ideas? :D

 

 

HI

 

 

A price rise could be triggered by the purchase of an item, either at that trader or them all.

 

If its that trader then the buyer might be more inclined to take a trip to the next trader.

If all the traders increase there price by the same amount, mr shopper might aswell stay there.

But if you buying something triggered a Christmas sale, then he may go on his travels to find a better deal. 

If its a higher populated server he runs the risk of geting to the next place to find the goods already sold and the price increased as they haven't much stock left.

 

Or it could be worked in that if people are going crazy buying/selling the same goods then the price is inflated/deflated.to mak

 

I just think it would add a nice little bit on the side of epoch, your meant to be scraping a living so treking across the map for a extra bit of shiny seems worth it.

 

Money wise you would just have to up the price by bars 10 %= one bar be it a 10oz  or standard.

 

 

Im trying to set it so you can only buy certain goods by selling other goods like a swapsys  system, like in origins in the fact that bandit hand hero lvl two house produce different goods which is ( i think ) meant to promote interaction.

Link to comment
Share on other sites

Yeah well you could do what you want, you just have to figure out a system that will work.

Imagine you just have the buy, sell and qty values from the database, e.g. sell price 2 gold bar, buy price sell price 2 gold bar and qty 23, what would you do with that? YOu can manipulate that values before they are displayed at the trader so double the buy price if the qty drops belop 10 or whatever you know.. the complicated part is to fire out a working system in my opinion..

but this way you only have to tweak some scripts and not the change the database or anything, btw every trader has its own items (qty) so you could get better prices at a trader with more items at stock.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

I think a custom HIVE call allowing updating of prices on the fly would be the best way to handle this, then simply make a script that calculates the supply and demand. If I could find the Hive source I could easily do this (I haven't looked as of yet).

 

I've already got something like this functioning on my server, but with a custom Hive.dll with CHILD:999 enabled (A very bad idea if you dont know what you are doing!)

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