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

Macro for adding together numbers rolled over a threshhold

Currently playing a system with my friends where we are using the same roll for damage and accuracy with a number of 1d4's. all numbers 1-4 are added at 1 tile, numbers 2-4 are added together from 2-3 tiles, numbers 3-4 at 3-5 tiles, and only 4's past that. damage calculations are (Value of Total Rolls)-(Value of Failed rolls)=(Percentage of total enemy health). so in practice 12d4 at a range of 3-5 tiles where we have 3 3's and 4 4's that would be 25% of total enemy health. i have tried using [[{12d4}>4]]*4 but the issue is that if we go down to [[{12d4>3}]]*4 I no longer have a way to differentiate 3's and 4's that succeed. I tried using [[12d4dl2]] but found that it drops numbers that are the lowest 2 numbers, so if 2 ones were rolled then only 1 would be excluded. help?
to be specific what i need is a way to only drop numbers below a threshhold, that being numbers below 2, 3, and 4
1629630702
GiGs
Pro
Sheet Author
API Scripter
This sounds like it might be too complex for roll20's macros, but I cant be sure. Can you explain the dice mechanic in more detail - step by step process. Explain it how you would explain it to a new player at the table, with no reference to roll20.
1629633650

Edited 1629676953
Oosh
Sheet Author
API Scripter
Edit - Never mind all this, I misread your formula. It's much simpler than the one in my head. Well you can do the first part using a variation of one of RainbowEncoder's tricks. A 4d4 total, dropping numbers below 3: /r [[{1d4*101, 1d1*250}k1%10]] + [[{1d4*101, 1d1*250}k1%10]] + [[{1d4*101, 1d1*250}k1%10]] + [[{1d4*101, 1d1*250}k1%10]] You'd change the 250 to 50, 150 or 350 for the other cutoff points, and for more dice you just need to paste more code (you could do a long Query with a "number of dice" input). It's a handful of a macro if you're going up to 12 dice (or more) but I don't know of any non-hacky way of doing it. The second part is a huge problem. Retaining the values of the "failed" dice, adding them together separately, then subtracting them from the initial total is far beyond my ken with the vanilla roller. Either a custom sheet or an API script is almost certainly needed, unless someone has some serious Dark Arts up their sleeve. Edit - Excuse me while I eat my own delicious words. OK. There's probably a way to simplify this, but this macro will roll 4d4, add up the 3's and 4's, then subtract the 1's and 2's: /r {[[(1d4*101 - 250)%10]], 0}k1 + {[[(1d4*101 - 250)%10]], 0}k1 + {[[(1d4*101 - 250)%10]], 0}k1 + {[[(1d4*101 - 250)%10]], 0}k1 - (50+($[[0]]-abs($[[0]])))%10/2 - (50+($[[1]]-abs($[[1]])))%10/2 - (50+($[[2]]-abs($[[2]])))%10/2 - (50+($[[3]]-abs($[[3]])))%10/2 It sure ain't pretty, but as it reuses rolls by index $[[0], it can only be run with /r - there's not much you can do to pretty it up. You can wrap the initial rolls (first half, with the plus signs) in [[ braces ]] but that would mean needing to rewrite the $[[1]] index references.
I think focussing on which rolls to drop isn't the best way to think about it. Since (Value of total rolls) -(Value of failed rolls) is equivalent to (Value of successful rolls)+(Value of failed rolls) -(Value of failed rolls) it simplifies to (Value of successful rolls) So I'd start with working out how many successes you have and then rolling that many successes. To roll a success you can roll a d4 but reroll anything that would fail which would get you these macros [[ [[12d4>4]]d4r<3]] [[ [[12d4>3]]d4r<2]] [[ [[12d4>2]]d4r<1]] [[ [[12d4>1]]d4r<0]] Since they have a consistent pattern it can be generalised as [[ [[?{Dice|12}d4>?{Distance|1 tile,1|2-3 tiles,2|4-5 tiles,3|6+ tiles,4}]]d4r<[[?{Distance}-1]] ]] or /r [[?{Dice|12}d4>?{Distance|1 tile,1|2-3 tiles,2|4-5 tiles,3|6+ tiles,4}]]d4r<[[?{Distance}-1]]
1629676916
Oosh
Sheet Author
API Scripter
RainbowEncoder said: I think focussing on which rolls to drop isn't the best way to think about it. Since (Value of total rolls) -(Value of failed rolls) is equivalent to (Value of successful rolls)+(Value of failed rolls) -(Value of failed rolls) it simplifies to (Value of successful rolls) Good grief, I completely misread the formula as: (Value of successful rolls) - (Value of failed rolls) I'll pack up my things and go home.
GiGs said: This sounds like it might be too complex for roll20's macros, but I cant be sure. Can you explain the dice mechanic in more detail - step by step process. Explain it how you would explain it to a new player at the table, with no reference to roll20. Accuracy for artillery works like this, for each cannon you have you roll a 1d4, at 1 tile from the cannons everything hits, from 2 and 3 tiles away only those that rolled greater than 2 hit, at 3-5 tiles away those greater than 3 will hit, and beyond that only those that rolled 4. damage is just the value of the successful dice added together. the issue that we're having is that there's no way to differentiate numbers above or below a certain point, for example i can't figure out a way to drop everything below a value of 3 at a range of 3-5 tiles because the drop command drops the lowest several rolls.