Dice Roll returning negative numbers.

The Mimic
06 Apr 2018, 13:51

No matter what i set the dice to it always returns a "-99"
Does anyone know how to fix this?
HP = DiceRoll("d10")
msg ("You now have " +HP+ "HP.")


The Mimic
06 Apr 2018, 13:53

wait never mind i found the problem.


hegemonkhan
06 Apr 2018, 14:32

you probably realized this already, it's:

DiceRoll ("NUMBER_OF_DICE_d_NUMBER_OF_SIDES_ON_A_DIE")

3 dice with 12 sides:

DiceRoll ("3d12")


you're missing the input of 'NUMBER_OF_DICE', as seen in your code:

HP = DiceRoll("d10") // HP = DiceRoll("{MISSING_NUMBER_OF_DICE_INPUT}d10")


also note that the 'HP' is a 'Variable' VARIABLE, meaning that it's destroyed upon its parent scripting ending/finishing, so if you want to preserve your 'HP' and its stored Value, you should use an 'Attribute' VARIABLE instead, for example (so long as your 'player' Player Object exists/still-exists):

player.HP = DiceRoll ("1d6")

.