Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Rolling multiple d2-1

Hello,

I like to roll multiple d2-1, e.g. 5d2-1 = 5(d2-1), but with this macro he calculates (5d2)-1.
So what is wrong?

&{template:default} [[ [[1d20]] + [[?{Dice}d2-1]] + [[6]] ]] {{name=My Attack}} {{$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

April 12 (4 years ago)

Edited April 12 (4 years ago)
David M.
Pro
API Scripter

Does this roll element work for you? Also added a default input box value which you can change or remove

[[?{Dice|3}d2 - ?{Dice}]]
April 12 (4 years ago)

Daniel N. said:

Hello,

I like to roll multiple d2-1, e.g. 5d2-1 = 5(d2-1), but with this macro he calculates (5d2)-1.
So what is wrong?

&{template:default} [[ [[1d20]] + [[?{Dice}d2-1]] + [[6]] ]] {{name=My Attack}} {{$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

I'm confused about what you want the -1 to subtract from.

Is it subtracting from the number of dice rolled? 

If ?{Dice} = 5
  [?{Dice}-1]d2 
        [5-1]d2
          [4]d2
    [1,2,2,1]
            =6

Or the number of sides of the dice?

If ?{Dice} = 5
      ?{Dice}[d2-1] 
          [5]d1
    [1,1,1,1]
            =4

Or the final result? 

If ?{Dice} = 5
  ?{Dice}d2-1 
      [5]d2-1
[1,2,2,1,2]-1
          8-1
           =7

It is a rolling of a die with Symbols. 6 sided, with 3 Symbols "Head" and 3 Symbols "blank. (HeXXen 1733 roleplaying game)
3 of 6 sides + 3 of 6 sides = 6 of 6 sides.
So I shortened it into a d2: If I roll d2-1, I will get the result 1 (=Head) or 0 (=blank) in the same probability.

Now I want to count the "Heads" of x dice-rollings. So e.g. for x=5: 5*(d2-1)


April 12 (4 years ago)
David M.
Pro
API Scripter

The inline roll I posted should give you Xd2 - X, which should be the same as X*(d2-1), right?

April 12 (4 years ago)

Daniel N. said:

It is a rolling of a die with Symbols. 6 sided, with 3 Symbols "Head" and 3 Symbols "blank. (HeXXen 1733 roleplaying game)
3 of 6 sides + 3 of 6 sides = 6 of 6 sides.
So I shortened it into a d2: If I roll d2-1, I will get the result 1 (=Head) or 0 (=blank) in the same probability.

Now I want to count the "Heads" of x dice-rollings. So e.g. for x=5: 5*(d2-1)

Ah, that's not going to work the way you think.  What you are looking for is a 'success' roll: [[?{Dice?}d2>2]]

The full template:

&{template:default} [[ [[1d20]] + [[?{Dice?}d2>2]] + [[6]] ]] {{name=My Attack}} {{$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

David M.'s approach will also work:

&{template:default} [[ [[1d20]] + [[?{Dice|3}d2 - ?{Dice}]] + [[6]] ]] {{name=My Attack}} {{$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

April 12 (4 years ago)
David M.
Pro
API Scripter

Ah good call, Jarren. While the same result, the success roll would be a cleaner solution.

April 12 (4 years ago)

Edited April 12 (4 years ago)
Kraynic
Pro
Sheet Author

For this particular usage, it might be worth creating a rollable table. 

There are only 2 entries, one of which would be 0 with the other being 1, and both would have the same weight.  Since it is a 50/50 thing, it doesn't matter if you leave them both with the default weight of 1 or set them both to 3.  You could name the table as something like "hexxen-coin" and incorporate that into your macro with a query for how many times to roll it. If you went about it that way, then [[?{Dice}d2-1]] would become something like:

[[?{Dice?|0}t[hexxen-coin]]]

The dice query is then determining how many times to roll on the hexxen-coin table which will output 0 or 1 for each roll.

Edit: And Jarren came up with an alternative while I was typing that. 

I have rollable tables for all dice of this game. It works well and displays the symbols and also counts the successes.

But I have tried my case with it and it does'nt work. I thougt it can't calculate with the tables so I want to try it with a dice like in my question.

My first attemp was:

&{template:default} {{name=Testkraft}} {{Wurf=[[ ?{Wie viele Hexxenwürfel?|1}t[HeXXenwürfel] ]]}} {{Janus=[[ ?{Wie viele Janswürfel?|0}t[Januswürfel] ]]}} {{Be schrei bung=Der Schaden wird verdoppelt, wenn blöde Sprüche am Tisch gedropped werden. Wer lacht, bekommt Extraschaden}} {{Grund scha den=[[10]]}} {{Summe=$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

But it reaults in an error while calculating:

April 13 (4 years ago)
Falk
Plus

If you only are interested in the number of successes for X coin tosses, then 

David M. said:

The inline roll I posted should give you Xd2 - X, which should be the same as X*(d2-1), right?


is absolutely sufficient. You can make it more complicated of course, or "nicer", but the solution of David will always be the most simple (and the one with 100% probability of working as expected - a thing I really came to appreciate here).

Okay, I've got it. :)

But there is one problem left. My macro is:

&{template:default} {{name=Power}} {{HexxDice=[[ ?{HexxDice|1}d2>2]]}} + {{JanusDice=[[ ?{JanusDice|0}d2>2]]}} + [[10]] {{Text=lorem ipsum dolor sit amet}} {{Damage=[[10]]}} {{Summe=$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

But the sum of the calculation is wrong. It should be 15, not 10.


April 13 (4 years ago)


Daniel N. said:

Okay, I've got it. :)

But there is one problem left. My macro is:

&{template:default} {{name=Power}} {{HexxDice=[[ ?{HexxDice|1}d2>2]]}} + {{JanusDice=[[ ?{JanusDice|0}d2>2]]}} + [[10]] {{Text=lorem ipsum dolor sit amet}} {{Damage=[[10]]}} {{Summe=$[[0]] + $[[1]] + $[[2]]==$[[3]]}}

But the sum of the calculation is wrong. It should be 15, not 10.

Your last roll for damage isn't actually a roll, it's just a static number: {{Damage=[[10]]}} and that's what's being called with $[[3]].


You need to create a roll that has everything in it, then work backwards to get all of the individual rolls:

Full Roll = [[ [[ ?{HexxDice|1}d2>2]]}} + {{JanusDice=[[ ?{JanusDice|0}d2>2]]}} + [[10]] ]]
HexxDice = $[[0]]
JanusDice = $[[1]]
Damage = $[[2]]
Summe = $[[3]]