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

Getting total AND successes from a roll.

Hello All,

I'm looking to do something I thought would have been simple, but reading through stuff it seems maybe not.

I have a rolling system that rolls Xd12k2+modifier for a total roll. But additionally it looks at ALL dice rolled to see if it's a critical success, with 10s 11s and 12s counting toward critical success, and 1s 2s and 3s counting toward failure. Critical success is +3 if you have two 10/11/12s, +6 if you have three, +9 with four, and so on. Analogous for critical failure (with some nuance that isn't important here).


So if I use

/r 5d12k2cs>10cf<3+12

I get the total that I want, and it highlights the dice appropriately, which is nice. But what I'd like is:

Best case: apply the critical success modifiers based on the number of 12s/11s/10s, e.g.

Acceptable case: count the number of 12s/11s/10s while STILL giving me the total of the roll. I can count the number of 10s/11s/12s with a { } type operation easy, but then it doesn't tell me the total.


If there's any solution here I'd be appreciative. I'd even consider a paid license if it solves it (but not, like, pay $100 and then ALSO learn how to write the very difficult code yourself).

March 13 (3 weeks ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

It's possible one of the macro wizards will come up with something, but the only solution I'm aware of is use an API script to make and process the roll, or use a custom character sheet to do the same thing.

March 13 (3 weeks ago)
timmaugh
Pro
API Scripter

If you're actually willing to go with a subscription, here's a way you can approach this with the Metascript Toolbox. This is just one presentation of the value in a default template. Depending on what the "nuance" is you're mentioning regarding the critical success modifiers, you might need some more meta-magic, but here is a working example just with the info you provided:

!&{template:default} {{name=Proof of Concept}} {{Original Roll=[[5d12k2cs>10cf<3+12]]}} {{Number of 10+={&eval}getDiceByVal($[[0]] >=10 included count){&/eval}}}{&simple}

And the output...


If I (as GM) have that subscription, will my players be able to use something like that without themselves subscribing? Because if so I will very seriously consider it.

Thank you for the responses in any case.

March 13 (3 weeks ago)

Edited March 13 (3 weeks ago)
Gauss
Forum Champion

Hi Rudy H., 

The Game Owner (usually the GM also is the game owner) controls what is available in their game via their subscription level. So if you have a Pro account your game has access to Mods (API Scripts) which you can install and run in your game. 

From there whether the players have access depends on you and the script(s) you install. Some are GM only, others are intended for anyone to use. Timmaugh's script command would be for anyone. 

March 13 (2 weeks ago)

Edited March 13 (2 weeks ago)

The roll parser is linear and can only process each roll once, so what you're trying to do here is quite tricky to do without scripts. One way would be to break the roll into two parts, but that gets kinda complicated.

&{template:default} {{name=Roll
}} {{Raw rolls=[[ [[1d12]] ]] [[ [[1d12]] ]] [[ [[1d12]] ]] [[ [[1d12]] ]] [[ [[1d12]] ]]
[Results](!/&NewLine; &amp;{template:default} &lbrace;{name=Results}&rbrace; &lbrace;{Total=&lbrack;&lbrack;{$[[1]],$[[4]],$[[6]],$[[8]],$[[9]]}k2 &rbrack;&rbrack;}&rbrace; &lbrace;{crit=&lbrack;&lbrack;{$[[1]],$[[4]],$[[6]],$[[8]],$[[9]]}&gt;10f&lt;3 &rbrack;&rbrack;}&rbrace;)
}}

There's more that could be done with this, but it's a pain to write - namely, querying for the initial number of dice and processing the criticals.If you could tell the minimum and maximum dice pools, that would help with the former, and knowing if I'm right to assume that crit fails and successes count against each other would help too.

EDIT: Forgot to remove a test line

Using a /roll command does give a bit more room to manoeuvre. I'm unsure if crit success numbers cancel out crit failure numbers or done seperately (ie is the value of 10,10,10,1,1 +0 or +6-3) so I wrote two versions


These will give you your roll total + modifier + critical bonus/penalty


Crit dice cancel each other out:

/r 3*ceil(0.99*floor(([[ (?{Dice Count|5}-[[?{Dice Count}d12<3cf<3cs0]])d9<3cs<3cf0]]-$[[0]])*0.99)) + ?{Mod|12} + {$[[1]]d12r<9cs>10cf0sd + (?{Dice Count}-$[[0]]-$[[1]])d9r<3cs0cf0sd + $[[0]]d3cs0cf<3sd}k2

Criticals are evaluated seperately
/r 3*(floor([[ (?{Dice Count|5}-[[?{Dice Count}d12<3cf<3cs0]])d9<3cs<3cf0]]*0.99)-floor($[[0]]*0.99)) + ?{Mod|12} + {$[[1]]d12r<9cs>10cf0sd + (?{Dice Count}-$[[0]]-$[[1]])d9r<3cs0cf0sd + $[[0]]d3cs0cf<3sd}k2

The output is a bit of mess since the rolls get split into high, middle, and low rolls. Which require a bunch of rerolls to make happen. So the d12r<9 and d9r<3 could be replaced by rollable tables (10 to 12 and 4 to 9 respectively) but you'd lose the proper critical highlighting. There is an open suggestion for a custom dice syntax which while not required would clean this up nicely, so consider voting for it.