Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started 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?
-
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
-
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.