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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Keep/Drop dice mechanic with Negative numbers

I would like to be able to provide a negative number to the Keep/Drop dice syntax, with the result that it inverts the "side" keeping/dropping dice. I am aware this is possible with the API, but would prefer not to need the API for this dice mechanic. For instance, the following three dice specifications would be equivalent if this were implemented: /roll 4d6d-1 /roll 4d6d(-1) /roll 4d6dh1 Similarly, /roll 4d6k-3 /roll 4d6k(-3) /roll 4d6kl3 would be equivalent.
I'm not sure what it is you're wanting it to do... can you provide an actual example with sample dice rolls?
Sure. I'm making a homebrew RPG with a basic dice rolling mechanic of 3dX, where X is based on skill level, and the goal is to roll low, so 3d4 is the best skill level and 3d20 is the worst. I want to avoid additive and subtractive modifiers to the die roll, so I use bonus and penalty dice.  If a person is rolling at skill level 3d12, and has two bonus dice to roll, they actually roll (3+2)d12dh(2). If it's two penalty dice, the roll is (3+2)d12dl(2). The result bonus and penalty dice rolled this way on the distribution is a very predictable skew to the bell curve while keeping the same range of results for a given skill level. If only one type is ever used, there's no issues. But if both type of extra dice can affect a roll, things get more complex. These dice cancel each other out in my rules, so 2 bonus dice and 1 penalty die = 1 bonus die. Effectively, a penalty die is a negative bonus die. A first attempt at coming up with a generic formula that handles both bonus and penalty dice without API intervention might be: (3+abs(B-P))d(X)d(P-B), given B = # of Bonus dice, P = # of Penalty dice, and X = # of sides for the dice rolled, based on skill level So let's say somebody is rolling 3d12 with 2 penalty and 1 bonus die. Plug the numbers in and you get the following roll spec: (3+abs(1-2))d(12)d(2-1) = 4d12d1 But if the bonus dice outnumber the penalty dice (X = 12, B = 2, P = 1): (3+abs(2-1))d(12)d(1-2) = 4d12d-1 And then the dice rolling system breaks, because it cannot handle dropping negative dice. if the system knew to change that to: 4d12dh1 then everything would work just fine, and I'd have a single, very elegant dice rolling formula to support my homebrew system. While I ask for this only for my own homebrew (and thus not even remotely popular enough to get votes) system, my system is inspired by D&D 5e advantage and disadvantage, which would also benefit from this feature being added.
1488043780

Edited 1488044103
I think I got this. Bear with me. ! ?{Die type|d4|d6|d8|d10|d12|d20} ! ?{Dice number|1} ! ?{Bonus|0} ! ?{Penalty|0} ! /roll { [[ (?{Bonus} - ?{Penalty}) / abs(?{Bonus} - ?{Penalty}) * [[ abs(?{Bonus} - ?{Penalty}) + ?{Dice number} ]]?{Die type}dl[[ abs(?{Bonus} - ?{Penalty}) ]] ]], [[ (?{Penalty} - ?{Bonus}) / abs(?{Penalty} - ?{Bonus}) * [[ abs(?{Penalty} - ?{Bonus}) + ?{Dice number} ]]?{Die type}dh[[ abs(?{Penalty} - ?{Bonus}) ]] ]] }kh1 I don't know how you get the various dice and modifiers into the macro, so I've assumed you ask for them in roll queries. The overall logic here is this: calculate one set of dice rolls that assumes Bonus > Penalty and make it Drop Lower. If B ≯ P then multiply it by -1 (by calculating (B - P) / abs(B - P)). Now do the same thing where you assume Penalty > Bonus and make it Drop Higher. Finally, take the two separate dice rolls, here call them X and Y, one of which will be negative and one of which will be positive, and do a Keep Higher on them as {X, Y}kh1. I've tried it a bit and it seems to work. You'll have to give it more testing before you trust it. Mathematically and without the Roll20 macro language making it confusing, this is what it looks like (B = bonus dice; P = penalty dice; S = skill dice; X = number of sides): (B - P) / abs(B - P) * (abs(B - P) + S)dXdl(abs(B - P)) and (P - B) / abs(P - B) * (abs(P - B) + S)dXdh(abs(P - B)) and then keep the higher. P.S.: Sample inputs would be X = d12, S = 2, B = 3, P = 1. Don't use negative numbers for Penalty; it's the number of penalty dice. Or if you do, negate Penalty wherever it is in the macro.
Ooh. Unless P = B, in which case you get division by zero. Have to think about that some more.
Nope! I got nothing. Unless someone can think of a more clever math trick than that, it can't be done with just macros.
Nice try David. Even if that pesky section with the quite possible divide by zero issue could be resolved, that leaves us with 2 ways to get the results, neither of which are entirely satisfactory, and here's why. Assuming that section is magic'ed away and we are left with just a 1 or a 0 to use to multiply the actual dice roll with (and thus pick the correct one), you either have to have the roll results in the tooltip show no dice rolls at all (when using a nested dice roll), or show all dice results for both the drop low AND drop high rolls. My homebrew rules use the individual results of the dice rolled to determine critical successes and fumbles, so not showing them is not an option for me. And having both sets of rolls shown will make it difficult, but not impossible, to figure out which individual dice results to pay attention to, and also will interfere with the way roll20 shows crits and fumbles, since it will show a crit even if all the crit dice are on the group that's multiplied by 0. For now I'm going to use API scripts to tackle the situation, but as evidenced by posting here, I think it would be nice to have my OP as a stock Roll20 dice mechanic.
Definitely no way to do all that in just a macro, sorry.
Well, yeah. I'm very aware of that. I'm not looking for how to do it with what's currently available, I'm hoping my suggested change to the keep/drop dice system will be implemented so it will be possible in the future.
Heh, sorry. I usually look at the "all posts" list, so I didn't realize you were making a suggestion rather than asking for help. Sorry to hijack your topic.
1550175532
Roll20 Dev Team
Pro
Marketplace Creator
Thanks for the suggestion! After 30 days, Suggestions and Ideas with fewer than 10 votes are closed and the votes are refunded to promote freshness. Your suggestion didn't build the right momentum this time, but feel free to submit it again! We find that the best suggestions describe the problem you are having, and the solution you want. You can learn more about the process of making suggestions on the Roll20 Wiki! More details can be found here .