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

Degrees of Success & Failure, Mutants & Masterminds 3E script help?

1609867074

Edited 1609867119
KO
Pro
My group is about to head into Mutants and Masterminds 3E. It's a lot crunchier than many of my players are used to, particularly the degrees of success & failure mechanic. Damage Resistance compares 1d20+Toughness vs. Difficulty Class of Incoming Damage + 15. 0+ succeeds, but failures are measured in four degrees. For now, I've created a macro that calculates the above and provides the following text: -1/-5, 1 Degree of Failure -6/-10, 2 Degrees of Failure  -11/-15, 3 Degrees of Failure -16/-, 4 Degrees of Failure However, would it be possible for the API script to output something along the lines of this instead: Toughness Save: [Result] vs. DC [Damage + 15], [X Degrees of Failure]
1609868830

Edited 1609868841
Jordan C.
Pro
API Scripter
You can actually get pretty close to what you want without API: &{template:default} {{name=Results}} [[ ceil(abs(([[1d20+5[Toughness]]] - [[5[DC] + 15]])/5)) ]] {{Toughness=$[[0]]}} {{DC=$[[1]]}} {{Degrees of success/failure=$[[2]]}} Where the result looks like this: Obviously I used placeholder data for the rolls, but those can be swapped out easily.
1609874064

Edited 1609874259
KO
Pro
Thank you! For ease of use for my newer players, I removed the "abs" so that negative numbers would appear for the Degrees of Failure. However, when I did that, it shifted the degrees of failure by 1. For example, a 14 Toughness Roll vs. DC25 fails by 11, which is 3 degrees. Original Macro: 3  Macro with abs removed: -2, rather than -3 What do I need to tweak?
1609875947

Edited 1609876241
Jordan C.
Pro
API Scripter
KO  said: Thank you! For ease of use for my newer players, I removed the "abs" so that negative numbers would appear for the Degrees of Failure. However, when I did that, it shifted the degrees of failure by 1. For example, a 14 Toughness Roll vs. DC25 fails by 11, which is 3 degrees. Original Macro: 3  Macro with abs removed: -2, rather than -3 What do I need to tweak? That's where it gets tricky. So with something like   -7 / 5 = -1.4   the use of "ceil()" rounds up to the next  largest  number,  -1 . When it becomes  1.4  through "abs()" the next  largest  number is  2 . I don't believe macros are capable of conditional statements like 'if ( x > y) then z' and I am not savvy enough to find/make an equation that can output results based on whether the result was positive or negative. I'll tinker some more to find out but in the meantime someone may come along with a proper solution or script! Edit: If you only want degrees of failure you can replace ceil() with floor() and remove abs() . This will mean the success has the previous problem though.
Ah, thank you so much for the clear explanation! I'll leave the macro as is for now. 
1609877765
Jordan C.
Pro
API Scripter
No problem! While this isn't a particularly elegant solution, maybe this version would at least make it easier to determine if it is a success or failure based on whether or not the result row is positive or negative: &{template:default} {{name=Results}} [[ ceil(abs( [[ ([[1d20+5[Toughness]]] - [[5[DC] + 15]]) ]]/5 )) ]] {{Toughness=$[[0]]}} {{DC=$[[1]]}} {{Result=$[[2]]}} {{Degrees of success/failure=$[[3]]}}
Ah, that could work! Thanks a bunch for helping me with this!