I've been wondering on how to do a shop protocol where the items get more expensive the less of them there are. EG when the shop has 10 longswords they are 400 each, but for every one sold the price goes up by 20.
How would you go about this? I'm not asking code sheets here, just guidelines to get me started, some procs I might want to use, or how I need to go about it the most effecient way..
Does anyone has an idea? Every reply is welcome!
Yours truly, Raimo.
ID:151348
Jun 8 2011, 4:19 am
|
|
Jun 8 2011, 4:59 am
|
|
If for every sword sold it goes up by 20 then it's linear change. You could define sword price to 600, and discount per stock to 20. Then when player attempts to buy simply do "price = itemPrice - stock * discountPerStock".
|
edit learned some new stuff. Associated list holds initial stock, initial price, and price variation per unit in stock.
mob/FruitSalesman |
In response to Zaoshi
|
|
I like to simplify things. I would do this:
*setting up* |