Simple maths formula - help needed!

DigiChainDigiChain Member, PRO Posts: 1,288

I wonder if anyone with a better mathematical brain than mine can come up with a simple formula for this?…

I have 2 attributes (as percentages):
1) Poisoned - Real attribute (value can be between 0-100): 0= no poison, 100= max poison
2) Tolerance - Real attribute (value can be between 0-100): 0= no tolerence, 100 = max tolerence

From these I need a formula to calculate a 3rd Real Atrribute named ‘Health’ (also a percentage: 0 - no health, 100 full health)

So as an example:
If Poisoned = 50, Tolerence = 100, then Health Should = 100.
If Poisoned = 50, Tolerence = 0, then Health Should = 50.
If Poisoned = 50, Tolerence = 50, then Health Should = 75 (I think) etc etc.

Seems simple enough, but I’m struggling!

Thanks if anyone can help!!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    Hmmmmm . . .

  • DigiChainDigiChain Member, PRO Posts: 1,288

    Thanks socks - but my problem is both P and T can vary in the game...

    So with this equation if P and T were high it would deliver a Health figure above 100.

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    @Socks said:
    Hmmmmm . . .

    I now no longer feel stupid for not being able to come up with a formula myself :) did try...

  • DigiChainDigiChain Member, PRO Posts: 1,288

    @Socks said:
    Hmmmmm . . .

    Indeed. I've spent an entire day on this... it must be simple, but I can't see it!

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited June 2015

    P-((P/100)*T)

    For the 3rd one it gives you 25 so you could do:

    H-(P-((P/100)*T)) to get 75

    The first formula returns the damage done to your health from the poison, not your final health

  • DigiChainDigiChain Member, PRO Posts: 1,288

    @KevinCross - great... I think you may have cracked it!
    I'm going to have a play with some figures and see if I can catch it out!

    Thanks

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    You're welcome! Hope it works with all the numbers you throw at it.

  • zweg25zweg25 Member Posts: 738

    H = H-(P*(100-T)/100)?

Sign In or Register to comment.