Random Number Subtraction Syntax (Solved)

Anonynn
25 Jul 2018, 04:14

Hey all :)

So I know how to generate a random number.

player.health = GetRandomInt (3,15)
msg ("<br/><font color="dedede">You've recovered "+ player.health +"!</font color>")

but is there a way to use a similar code to subtract health? Like for example...

player.health = GetRandomInt (-3,-15) 

OR maybe

player.health = player.health - GetRandomInt (3,15)
msg ("<br/><font color="dedede">You've lost "+ player.health +"!</font color>")

I appreciate any help ^_^

Anonynn.


hegemonkhan
25 Jul 2018, 06:13

you got it yourself with this code line of yours:

player.health = player.health - GetRandomInt (3,15)


Anonynn
25 Jul 2018, 17:28

Thanks HK! :D

Anonynn.