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

Successes based on sum and multiples over sum, need help.

1551797754

Edited 1551798354
Hi, I'm designing an RPG and I am trying to make a macro for the main roll, but I'm having issues.  Here is the rule in my game I am referring to.  ROLLING DICE: The player rolls three ten sided dice (abbreviated to 3d10, “d” being dice) to determine the outcome of everything from cooking to combat by adding the sum of the rolled dice together. The roll can be modified by adding or removing dice based on contextual effects, by how much mastery they have over the skill they are applying, and it can be modified by core statistics which add to or subtract from the roll accordingly. Whenever a player wants to accomplish something, they will be asked to roll to determine if their desired action plays out the way they want it to. If the sum of the dice is higher or equal to a target number, the player succeeds. If it is lower, the player fails.  A success is achieved when the sum of the dice rolled is equal to the Target Number or, every sum of 5 over the target number. The core idea of this game is to increase the sum of your roll far over the Target Number, so as to accrue multiple successes.  A failure is missing the target number, and every 5 under the target number is an additional failure . For example; if the target number is 15, and you roll 20, you have gained two successes, one for hitting the Target Number, and one more for being 5 over the Target Number.  Additionally, if a 1 is rolled on any dice, it counts as a failure, and a 10 is rolled, it counts as a success. In either of these circumstances, the roll is called a natural success or failure. If you do not meet the Target Number, and your roll contains a 10, it does not matter. You still fail. The opposite is true, meeting the TN with a 1 in the roll does not mean you fail. In short, I need to be able to roll 3d10, check the sum of the dice rolled to see if the SUM hits the target number, and add 1 success whenever the sum of 3d10 is any multiple of 5 over the target number. EG: TN =15 roll 3d10 and get 8, 7,6 (Sum = 21), get a success for hitting 15, get a success for being 5 over 15
1551800700
GiGs
Pro
Sheet Author
API Scripter
This bit is concerning:  The roll can be modified by adding or removing dice based on contextual effects, by how much mastery they have over the skill they are applying, and it can be modified by core statistics which add to or subtract from the roll accordingly.  What happens if dice are reduced to zero or less? can that happen? This part also posses a problem: Additionally, if a 1 is rolled on any dice, it counts as a failure, and a 10 is rolled, it counts as a success. In either of these circumstances, the roll is called a  natural success or failure.  There's a way to represent it visually, but it cant alter the result that will be reported.
Dice can be reduxed to 0, but at that point you wouldn't need to roll, you'd just take the modifier to the skill check and treat that as the sum result. The naturals don't need to be calculated, since you can just add the number of green numbers or subtract the number of red numbers from the success total. Neither are the issue I am having.
1551801378

Edited 1551801515
GiGs
Pro
Sheet Author
API Scripter
Something like this should do the job /roll floor(([[3+?{NumDice|0}]]d10+?{Modifier|0}-?{Target|15})/5 +1)  As an inline roll [[floor(([[3+?{NumDice|0}]]d10+?{Modifier|0}-?{Target|15})/5 +1) ]] With the variables removed this is /roll floor((3d10-15)/5 +1)  The floor() function rounds down whatever is inside it. The formula 3d10-15 means that you roll and subtract the target number. So any successful roll is 0 or greater. You then divide by 5 to count successes, and add 1 to account for the 1 success at 0. Note that a failure is reported as a negative number.  Regarding natural successes and failures: by default, roll20 makes the dice green if they show a maximum value, red if they show a minimum value, and blue of they show both. So, if you rolled a 1, 7, and 9, the result would be shown as red so you can see it is a natural failure. You can incorporate this into the deice result, you just have to look at the result and declare it manually.
This works perfectly! Thank you so much, I've never been able to parse code or do math very well, hence everything being multiples of 5. I'm extremely pleased with these macros, thank you again!
1551801944
GiGs
Pro
Sheet Author
API Scripter
Yay! I'm very happy to hear it :)