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

Compare 1 die to 2 others - Mayhem dice

1597705953

Edited 1597706187
I'm trying to implement the Planet Mercenary rule system in a custom character sheet. I want either a button on the sheet or a macro players can call to roll. What I'm trying to do: Roll 1d6 as the Mayhem die. Roll 2 more d6, then compare each of them to the Mayhem die. If the Mayhem die is higher than BOTH dice (each, not total), then trigger another event or just post a message that Mayhem rules apply. In a perfect world, I'd also like to give the total of all 3 dice added together, too. In psudo code, this would be something like: m=1d6, die1=1d6, die2=1d6 if m>die1 AND m>die2 then msg=m+die1+die2 & "MAYHEM!" else msg=m+die1+die2 This looks like it should be easy, but I've been struggling to figure out how to implement it. Could someone please either point me in the right direction or tell me how this would be done?
1597716096
GiGs
Pro
Sheet Author
API Scripter
You cant do this with a macro, it's too complex for roll20's dice system which doesnt handle conditions, and cant use the same die roll in multiple different ways. You can do this with a rolltemplate, but getting the total as well as the other factors would be extremely laborious. Is there anything which influences the dice roll, like character abilities and skills? Can you describe the roll in its entirety, as if you were describing the system to a new player about to make their first roll in the game? I'm thinking the way to do it is as follows. Set up a button roll something like: &{template:mayhem} [[ [[1d6]] + [[1d6]] + [[1d6]] ]] {{title=roll title}} {{mayhemdie=$[[0]]}} {{die1=$[[1]]}} {{die2=$[[2]]}} {{total=$[[3]]}} Then create a rolltemplate for your sheet, and in that template you can use the logic helpers to compare dice rolls. {{#rollGreater() mayhemdie die1}}     {{#rollGreater() mayhemdie die2}}         here you can put whatever happens when mayhem die beats both other dice     {{/rollGreater() mayhemdie die2}} {{/rollGreater() mayhemdie die1}} The tricky part is figuring out when mayhem die does not win, because there's no OR option in rolltemplate logic. Likely you have to repeat some code like so: This says if mayhem die is NOT greater than die1. {{#^rollGreater() mayhemdie die1}}     you can display the total here with {{total}} {{/^rollGreater() mayhemdie die1}} But now you also have to handle when mayhem die is not greater than die2, but is greater than die1, so that you dont repeat the results. {{#^rollGreater() mayhemdie die2}}     {{#rollGreater() mayhemdie die1}}         a perfect repeat of the code from the previous section.     {{/rollGreater() mayhemdie die1}} {{/^rollGreater() mayhemdie die2}} You can also do this somewhat more elegantly with an API script. But that would only be useful for groups where the GM is a Pro subscriber.
Well, that's already useful information, even if frustrating. Thanks! I'll be the GM and I have a Pro sub, so an API script is a viable option for us. The Mayhem mechanic is used for skill checks (including attack rolls). All skill checks are 3d6+relevant skill rating and must equal or better the target difficulty number. So, for example, a Medicine check to heal someone would be 1d6(mayhem die)+2d6(regular dice)+Medicine skill rank. An attack roll with a pistol would be the same calculation, only with the Pistols skill rank. If the mayhem die comes up greater than both the other 2 dice, then you also draw a Mayhem card and resolve whatever's on the card in addition to the results of the roll. I have a roll template working that displays all 3 dice with the Mayhem die a different color and shows the skill rank that was clicked. So, worst case, players can do the math and comparison themselves. It would just be far more convenient if they didn't have to. In a perfect world, I'd love to automate dealing a Mayhem card to a player when their roll triggered Mayhem, but I'm fine with manually dealing that out as necessary, especially since there's a mechanic for avoiding the Mayhem card in certain situations.
1597721496

Edited 1597721635
GiGs
Pro
Sheet Author
API Scripter
Can you post your rolltemplate, and the CSS that styles it too? Do you always report the total? If so, that simplifies the rolltemplate quite a bit. I read your first post as saying you only report the total if you dont get a mayhem card.
1597738672

Edited 1597797367
GiGs
Pro
Sheet Author
API Scripter
If you always report the total, you dont need to do the second set of logic helpers from my earlier post. You can do this for your roll: &{template:mayhem} [[ [[1d6]] + [[1d6]] + [[1d6]] + @{ability} ]] {{title=roll title}} {{mayhemdie=$[[0]]}} {{die1=$[[1]]}} {{die2=$[[2]]}} {{total=$[[3]]}} {{difficulty=[[?{target|0}]]}} So two things have been added here - the ability score is added into roll total. and there's a difficulty you can use for determining if the roll was a success or fail. Then in your rolltemplate: {{#rollGreater() mayhemdie die1}}     {{#rollGreater() mayhemdie die2}}         here you can put whatever happens when mayhem die beats both other dice     {{/rollGreater() mayhemdie die2}} {{/rollGreater() mayhemdie die1}} {{#^rollLess() total difficulty}}     the roll is a success so put whatever you show on success here {{/^rollLess() total difficulty}} {{#rollLess() total difficulty}}     the roll is a failure so put whatever you show on failure here {{/rollLess() total difficulty}}
Oh! I didn't realize I could reference individual items in a set by index like that! Between that and the rolltemplate you've shown me here, I think you've solved my problems. The rest is just minor tweaks and formatting. Thank you SO much!
1597797378
GiGs
Pro
Sheet Author
API Scripter
I'm glad to hear it :)