Quick Help: Percentages

kadan123
15 Nov 2019, 16:58

I've looked through the forums but im still struggling to figure this out. I just want my character to loose 100% of his money after being robbed. So if he has $5 and gets robbed he should have no money left. Im not able to use decrease money by 100% or 1.100 or whatever.

Please help guys.


Io
15 Nov 2019, 17:10

You multiply by a number. In the case of losing 100%, you multiply by 0. If he gains 150%, then multiply by 2.5 (150% plus the existing 100% you have) etc.


kadan123
15 Nov 2019, 17:57

Thank You but i cant get it to work. What am i doing wrong?

DecreaseMoney (100 * 0) nor DecreaseMoney ( * 0)


kadan123
15 Nov 2019, 17:58

Thank You but i cant get it to work. What am i doing wrong?

DecreaseMoney (100 * 0) nor DecreaseMoney ( * 0)


mrangel
15 Nov 2019, 18:58

The IncreaseMoney and DecreaseMoney functions are just for adding or subtracting.

If you want someone to lose all of their money, it's easier just to set their money to zero. The command you want in this case is:

game.pov.money = 0

or

set (game.pov, "money", 0)

or you can use an expression to decrease their money by its current value (this is very silly):

DecreaseMoney (game.pov.money)

If you wanted someone to lose 23% of their money, for example, you'd multiply their money by that percentage:

DecreaseMoney (game.pov.money * 23/100)

(Note that where I've used game.pov, you can probably use player if you prefer. game.pov is just a special expression which finds the current player object even if you've changed its name to something other than "player")


kadan123
15 Nov 2019, 19:23

Yes thank you. How did i not think of that?