Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: derkoi on May 21, 2013, 05:48:24 AM

Title: Deduct Percentage?
Post by: derkoi on May 21, 2013, 05:48:24 AM
Hi, I'm trying to deduct a percentage from a float value. Any idea how I can do that please?
Title: Re: Deduct Percentage?
Post by: jeanfabre on May 21, 2013, 05:56:28 AM
Hi,

first solution:

You need to get the percentage itself of that value, then you substract that to the  value itself.

value = 35
percentage to substract: 5%
5% of 35 is (35*0.05) = 1.75
the new value is (35-1.75) = 33.25

OR

you get the opposite percent ( what you want to keep)
you want to get 95% of the value ( 100%-5%), 1-0,5 = 0.95
the new value is (35*0.95) = 33.25

 if your percent comes as "95" then you simply divide by "100"

35*95/100 = 33.25

Does that help?

bye,

 Jean
Title: Re: Deduct Percentage?
Post by: Lane on May 21, 2013, 07:39:44 AM
Multiplying by "0.nn" will work fine.

As long as it is a number less than the smallest positive whole then it will work as a percentage so you can just multiply by 0.9 to get 90% of something. If you're working differently in the background I would suggest multiplying the number to display it to the player as you want and keeping the "0.nn" number in the background calcs for simplicity.