Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Can you customize the number of die rolled?

2 years ago

Hi guys, this is my latest issue.

If you are level 1 you can roll 1 dice.

If you are level 2 you can roll 2 die.

This is the script I have tried:

%RESULT := %RESULT + %LEVEL + "D6"

I then tried to change the dice value instead:

%RESULT := %RESULT + "1D" + %LEVEL

Didn't work either. Do I really have to surrender and script:

IF %LEVEL := 1

THEN %RESULT := 1D6

IF %LEVEL := 2

THEN %LEVEL := 2D6

because this method could take a while.

Any help would be greatly appreciated.

 

Can you customize the number of die rolled?

2 years ago

Try this:

%RESULT := %LEVEL * 1D6

EDIT:  Never mind, that will just multiply 1D6 by the level, sorry.

EDIT 2:  This solution is slightly shorter than what you have, but still annoyingly recursive.
IF %LEVEL > 0 THEN %RESULT := %RESULT + 1D6
IF %LEVEL > 1 THEN %RESULT := %RESULT + 1D6
IF %LEVEL > 2 THEN %RESULT := %RESULT + 1D6
IF %LEVEL > 3 THEN %RESULT := %RESULT + 1D6
IF %LEVEL > 4 THEN %RESULT := %RESULT + 1D6

Can you customize the number of die rolled?

2 years ago

That's better than what I have.

It seems like there's no way to make the script infinitely adaptable. If I want to go all the way to level 1000 it would be a slog. But this is an improvement on my current script so thanks. I am grateful :)

Can you customize the number of die rolled?

2 years ago

I appreciate the suggestion but it hasn't worked.

Instead of rolling 3 separate die it just multiplies the number which limits the result to multiples of the number. 

2*1D6 will give me 2, 4, 6, 8, 10, 12

2D6 will give every number between 2 and 12.

Thanks anyway though I appreciate it :)

This was a reply to the previous comment. 

Can you customize the number of die rolled?

2 years ago
Sorry, the scripting abilities of this site are super-old. There are no loops, so you have to make do.

Can you customize the number of die rolled?

2 years ago
Yep, if you want true 3d6 for example, you will need

:= 1D6 + 1D6 + 1D6

VS := 3D6 (which is literally just the result of 1d6 multiplied by 3)