Math help...

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
1 post Page 1 of 1
Contributors
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

Math help...
Cheatmasterbw
I am working on a shop plugin for minecraft servers.

One problem I ran into is that the prices to buy an item are always the same, no matter how many are in shop. To fix this, I am working on making the value of an item decrease as more of the item is in the shop.

I am doing this with a half-life sort of equation.

Here are variables that the server admin will configure:
halfLife
itemPrice
itemsInStock

The way i have this work is every time the stock equals the half life, the item price is halved.

If the half life is 10 and the item price is $20, you get this:
0 in stock = $20
10 in stock = $10
20 in stock = $5
30 in stock = $2.50
etc...

This is the equation i have to find out the price of an item:
newPrice = price / 2^(itemsInStock / halfLife)

The problem I have now is trying to calculate the price if a user purchases multiple items at once. How can I make an equation that calculates the price for multiple items? I have this equation that uses summation, but i would rather not use loops.
Image
qty = items purchased
x = half life
y = raw price
z = items in stock

Thanks if you can help. If you don't understand anything, feel free to ask me to explain better :P
http://www.megaapps.tk/
1 post Page 1 of 1
Return to “Coding Help & Support”