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

Roll Mechanic Difficulty

Hello, I'm trying to build a sheet to play test a game and I'm running into an issue with the Roll Mechanics in Roll20.  I'm wondering if I'm just failing to find the solution but I've been scouring the documentation for hours.  It's pretty simple, I want to roll an amount of D6 dice, so just XD6.  Then, I want to only sum the dice that are 3 or less.  So if I roll 1, 2, 2, 3, 5, 6, 6, 7... I would only sum the 1, 2, 2, 3 giving 8.  The rolls of 4 or higher would just be dropped.  Is this possible?  It seems so straightforward. 
1577039694
Mike deBoston
Compendium Curator
Why not just roll xD3? Is there some other constraint?
1577040884
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The curve would be slightly different. Every die allowed would have a 50% chance of not being counted. My assumption is that the number of dice in this system must skew towards giving you the possibility of more countable dice. I can't see a way to do this given the built-in functions. There are features that allow you to re-roll dice, or to take the lesser or greater of two rolls, but nothing to drop an undesirable roll altogether. By the way, just so there's no confusion, the sample given shows a result of "7" in the d6 rolls. Is there another feature that has not been detailed?
1577047225
The Aaron
Roll20 Production Team
API Scripter
The easiest thing to do is to add a Rollable Table with the values 1, 2, 3, and 0 with 0 weighted at 3 and the others weighted at 1.  Then you can roll and get the right summing: [[ 8t[d6max3] ]]
1577047605
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Nice solution.
1577049312
The Aaron
Roll20 Production Team
API Scripter
Yeah, it's too bad you can't deploy Rollable Tables with a Character Sheet.
1577050704
The Aaron
Roll20 Production Team
API Scripter
You might be able to do something with: [[{(1d6-3),0d0}kh1]] You'd need to know how many dice you're going to roll up front, but here's an example where a dropbox lets you roll between 1 and 10 of them: [[ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-1),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-2),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-3),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-4),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-5),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-6),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-7),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-8),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1+ [[ { [[{(?{Number of Dice|1|2|3|4|5|6|7|8|9|10}-9),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] You can see the basic idea is in this example: [[ [[ { [[{(?{v}-3),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] If you put in a number greater than 3, the first term (before the *) will be 1, otherwise it will be 0, causing the term to drop out of the sum regardless of what was rolled. See in this example: The first 5 terms were used resulting in that 6 that was rolled 3rd turning into a 3.  The 5 and two 6s rolled in the later 5 dice are ignored because of the 0 multipliers.
Mike, that would give me completely different results, perhaps you didn't really understand what I was saying. Keithcurtis, yeah, no idea why the 7 was there, lol.  I wrote the question after hours of trying and was trying to fire the question of into the forums as I was getting ready to go to bed. The Aaron, thank you for your well thought out response.  It seems quite complicated and it's disappointing that it can't just work more elegantly.  Rolling from the character sheet will be a major priority in the future so the tables are unfortunately not a sufficient workaround.  Unfortunately with the formula you lose the popup of each individual die rolled and that seems like a very complicated workaround for such a simple idea.  Maybe I just need to build the roll into the character sheet using a custom roll template, was hoping to avoid this but looks like it's time to dust off my js skills.
1577057768
GiGs
Pro
Sheet Author
API Scripter
Jacob W. said: Maybe I just need to build the roll into the character sheet using a custom roll template, was hoping to avoid this but looks like it's time to dust off my js skills. A rolltemplate doesnt use JS - just html and css. Doing this with a rolltemplate might not be possible.
1577057817
The Aaron
Roll20 Production Team
API Scripter
You can get the output a bit cleaner with something like: [[ 0 + [rolling ?{Number of Dice|1|2|3|4|5|6|7|8|9|10} Dice] [[ [[ { [[{(?{Number of Dice}),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-1),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-2),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-3),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-4),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-5),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-6),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-7),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-8),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] + [[ [[ { [[{(?{Number of Dice}-9),0}kh1]],1}kl1 ]]*{(1d6-3),0d0}kh1]] ]] But it's never going to be as good as with native support.  Still, it might be good enough for a Character Sheet on Roll20.  YMMV =D
The Aaron, thank you for your time and providing an example.  I've been research the capabilities of Roll20 and I'm running up against some hard limits here.  Maybe my programming skills just aren't good enough but it seems to me that there are a few problems.  I can't just have a ::roll:: button on the sheet create random numbers and display those random numbers, and then do math with those numbers.  If I pick a roll command I have to deal with the built in functionality which would only allow me to do what you gave me above.  My issue is that you can't see what is happening behind the scenes very easily so I can't display the dice rolls as they came up, and then provide the total.  This would be optimal so players understand what is happening.  So I found a workaround using "action" buttons but then I'm locked out of using the chat log to display results in a way I see fit.  I'd love to create a roll template and then seed the roll template with the results from an action button function.  Am I missing something or is this literally not possible for some reason?  I don't understand why something so simple just doesn't have a clear route to follow, in Tabletop Simulator I can program this in literally minutes.  Any suggestions or should I just give up on trying to bring this game to the Roll20 platform?
1577137971
The Aaron
Roll20 Production Team
API Scripter
Yeah, it's definitely not idea.
1577138121
GiGs
Pro
Sheet Author
API Scripter
The way so many elements of roll20 are silo'd off and inaccessible to the others without the API is a serious failing of the system. What you want can be done with a custom script, but that limits the sheet to being only fully-functional for those groups where the GM has a Pro subscription, which isnt ideal for character sheets.