Some math help needed

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.
Post Reply
User avatar
DazaKiwi
Posts: 830
Joined: Thu Oct 21, 2010 10:05 am
Points: 71
Location: New Zealand

Some math help needed

Post by DazaKiwi »

I am working on my parsercomp game and need a little math help. I want to have in my trading system a dynamic pricing based on durability of the item. I am thinking starting with a base price at 100% durability as one of the properties to work with. Eg. crowbar 100 Durability = $50.

My question how would i do the calculation? i know Adrift cannot do decimals. Lets say the crowbar in question has a durability of 65. What would the equation look like for reducing its price?
User avatar
Denk
Posts: 858
Joined: Mon Feb 22, 2016 6:21 pm
Points: 346
Location: Hjørring, Denmark

Re: Some math help needed

Post by Denk »

Since ADRIFT cannot handle decimals the order becomes important, i.e. if you divide by 100 first or if you multiply by duration first.

Thus, the new price can be calculated as:

New price = %price100%*%durability%/100 (do NOT this: %price100%/100*%durability% as the result will be wrong)

However, I prefer to add some parentheses to make it absolutely clear what happens first, i.e.:

New price = (%price100%*%durability%)/100 (the multiplication must happen before the division)

If the new price is a part of a bigger calculation, the parentheses could become important.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
DazaKiwi
Posts: 830
Joined: Thu Oct 21, 2010 10:05 am
Points: 71
Location: New Zealand

Re: Some math help needed

Post by DazaKiwi »

Thanks for that Denk. Just what i wanted.
Post Reply