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 Help To add (dis)advantage to a macro

Howdy, Can anyone help me edit this macro so we can choose if it rolls with (dis)advantage or normal please. [[{?{Number of Attackers|10}d20 + ?{To hit modifiers +|8}}>[[?{Target AC|15}]] ]] hits vs **AC**[[?{Target AC}d1]] [Damage](!
#Mob-Damage) Thanks for your time
1630066090
timmaugh
Pro
API Scripter
What does your advantage mechanic look like? The advantage/disadvantage mechanic I know would go: Normal: 1d20 Advantage: 2d20, keep high 1 Disadvantage: 2d20, keep low 1 For your roll, it seems you have a number of d20 equal to some number of attackers in a mob, but currently you are totalling them. I can see a keep high 1 still being advantage, and I can see keep low 1 being disadvantage, but then I can't parse what a "normal" roll would be. Keep the most middle one? =D Help us help you with a little more info.
1630066413

Edited 1630070423
Matt
Pro
timmaugh said: What does your advantage mechanic look like? The advantage/disadvantage mechanic I know would go: Normal: 1d20 Advantage: 2d20, keep high 1 Disadvantage: 2d20, keep low 1 For your roll, it seems you have a number of d20 equal to some number of attackers in a mob, but currently you are totalling them. I can see a keep high 1 still being advantage, and I can see keep low 1 being disadvantage, but then I can't parse what a "normal" roll would be. Keep the most middle one? =D Help us help you with a little more info. Sorry yes, that is how we use it. Sorry should of said that. So this is for a Conjure Animals macro. I was sometimes the attacks will be at advantage and can't figure out how to add an option. Is there a way for each roll to roll 2d20 and only us the highest roll in the hit calc?
1630073663
timmaugh
Pro
API Scripter
OK, how about this one: ?{Advantage?| Normal,[[floor(?{Number of Attackers|10}d20/?{Number of Attackers})]]| Advantage,[[{{?{Number of Attackers|10}d20}kh1,{?{Number of Attackers|10}d20}kh1}kh1]]| Disadvantage,[[{{?{Number of Attackers|10}d20}kl1,{?{Number of Attackers|10}d20}kl1}kl1]]} That prompts you for the advantage state, then for the number of attackers. The math for each formula works out like this: Normal Roll 1d20 for each attacker, take the average and round down Advantage Roll 1d20 for each attacker, keeping the highest one; roll 1d20 for each attacker, keeping the highest one. Between those two figures, keep the highest one. Since you're always going to end up with the highest value shown on any die, it doesn't matter the order you compare them in. You don't have to compare 2d20 for each attacker, taking the highest, then the next, etc. The high die will always win. Disadvantage Same as Advantage, but you keep the lowest at each step. Same comparison logic applies regarding timing.
timmaugh said: For your roll, it seems you have a number of d20 equal to some number of attackers in a mob, but currently you are totalling them. You've missed that Single Sub-Roll Success behaves differently to other group rolls. What is happening is that the modifier is being added to each roll which is then compared to the target number to count successes rather than totalling the rolls together. Implementing advantage for this type of roll cannot make use of this behaviour since 4d20k2 is substantially different to 2d20k1 twice, nor is there any real shortcuts. Two attackers would be {2d20k1+8,2d20k1+8}>15 and three {2d20k1+8,2d20k1+8,2d20k1+8}>15. Edit: A better version than what I wrote here follows Using a roll query dropdown is annoying due to the nested queries and syntax that needs escaping but we can workaround that. This will work for up to 15 attackers [[ {([[floor(1.001**(?{Number of Attackers|10}-1))]]*?{Advantage?|Normal,1)d20|Advantage,2)d20kh1|Disadvantage,2)d20kl1} [+HIT ?{To hit modifiers +|8}] ,([[floor(1.001**(?{Number of Attackers}-2))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-3))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-4))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-5))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-6))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-7))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-8))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-9))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-10))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-11))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-12))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-13))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-14))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-15))]]*?{Advantage?} }>[[{?{Target AC|15}-(?{To hit modifiers +}),1}kh1]] ]] Or the easier to read/edit version before it all goes on one line [[ {([[floor(1.001**(?{Number of Attackers|10}-1))]]*?{Advantage?|Normal,1)d20|Advantage,2)d20kh1|Disadvantage,2)d20kl1} [+HIT ?{To hit modifiers +|8}] ,([[floor(1.001**(?{Number of Attackers}-2))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-3))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-4))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-5))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-6))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-7))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-8))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-9))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-10))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-11))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-12))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-13))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-14))]]*?{Advantage?} ,([[floor(1.001**(?{Number of Attackers}-15))]]*?{Advantage?} }>[[{?{Target AC|15}-(?{To hit modifiers +}),1}kh1]] ]] It uses some mathematical trickery to determine if the given attacker actual rolls any dice, so it only rolls the specified number of attacks. I've also put the to hit modifier on the target number side to prevent ghost hits against easy targets but also as a roll label at the top for reference
1630090965
timmaugh
Pro
API Scripter
RainbowEncoder said: timmaugh said: For your roll, it seems you have a number of d20 equal to some number of attackers in a mob, but currently you are totalling them. You've missed that Single Sub-Roll Success behaves differently to other group rolls. What is happening is that the modifier is being added to each roll which is then compared to the target number to count successes rather than totalling the rolls together. Actually, I missed the modifier altogether. When I came back to the thread, I was only focused on the advantage portion. Oops. RainbowEncoder said: Implementing advantage for this type of roll cannot make use of this behaviour since 4d20k2 is substantially different to 2d20k1 twice, nor is there any real shortcuts. Two attackers would be {2d20k1+8,2d20k1+8}>15 and three {2d20k1+8,2d20k1+8,2d20k1+8}>15. 4d20k2 is substantially different from 2d20k1 twice, yes. But 4d20k1 is exactly the same as 2d20k1 twice. (I have a different problem, see below.) Maybe I'm misunderstanding the mechanic. I interpreted it to be "if anyone in the mob hits, the mob hits." It didn't matter if 3 people out of 10 hit, the effect was the same... which meant whether anyone hit individually was unimportant. I just needed the best roll, including adv dice. Including the comparison against target AC, mine should have looked more like: ?{Advantage?|Normal,[[ {?{Number of Attackers|10}d20}kh1>[[?{Target AC|15}-?{To hit modifiers|8}]] ]]|Advantage,[[{{?{Number of Attackers|10}d20}kh1,{?{Number of Attackers|10}d20}kh1}kh1>[[{(?{Target AC|15}-?{To hit modifiers|8})}]] ]]|Disadvantage,[[{{?{Number of Attackers|10}d20}kl1,{?{Number of Attackers|10}d20}kl1}kl1 > ?{Target AC|15}-?{To hit modifiers|8}]]} Or, with line breaks. ?{Advantage?| Normal,[[ {?{Number of Attackers|10}d20}kh1>[[?{Target AC|15}-?{To hit modifiers|8}]] ]]| Advantage,[[{{?{Number of Attackers|10}d20}kh1,{?{Number of Attackers|10}d20}kh1}kh1>[[{(?{Target AC|15}-?{To hit modifiers|8})}]] ]]| Disadvantage,[[{{?{Number of Attackers|10}d20}kl1,{?{Number of Attackers|10}d20}kl1}kl1 > ?{Target AC|15}-?{To hit modifiers|8}]]} The above does work with any number of attackers to determine if anyone hit (it will produce a 1 or a 0). Like I said, maybe I'm misunderstanding the mechanic the OP was looking for. Or maybe this is a different way to approach the situation you hadn't thought of. I know I've had moments like that looking at some of the roll mechanics you've posted, Rainbow! Frankly, that's what I'm hoping for, because if it is a different way to approach the problem, then the Disadvantage portion of the roll could use some attention... The problem I am realizing my solution still has is that this approach to the logic not only credits the mob as hitting if any of them hit... it also penalizes them if any of them misses (2d20kl1, twice, where you keep the lowest of all, will run with the worst shot of any of them). I don't think that's what the mechanic should be. =/
Ah! You appear to be answering "Does anyone hit?" whilst I'm answering "How many hit?" So looking at your solution Normal is check if the best roll hits, which will always tell you if anyone hits Advantage is check the best roll hits, with two rolls per attacker, which will always tell you if anyone hits These could be simplified as #d20kh1>AdjustedTarget and (#*2)d20kh1>AdjustedTarget Disadvantage is check if the lowest roll hits, with two rolls per attacker. I'd say you were right to be suspicious of it. Since you could have 9 attackers hitting with both rolls for the 10th to miss one roll marking the entire group as missing. Probably not the intention. An alternate way to present it would be to roll #d20 and for each hit roll another d20 then check if any of those hit since an attacker has to hit twice for it to count with disadvantage. This would be [[#d20>AdjustedTarget]]d20kh1>AdjustedTarget Oh and something I wasn't clear about before; negative numbers cannot be used as target numbers, they break the roll. That's why I had the kh1 with 1 as a minimum. So all that said and done your solution, with the new disadvantage calculation becomes... Does anyone hit?, with (Dis)advantage [[ ?{Advantage?| Normal,?{Number of Attackers|10}| Advantage,(?{Number of Attackers|10}*2)| Disadvantage,[[?{Number of Attackers|10}d20>[[{?{Target AC|15}-(?{To hit modifiers +|8}),1}kh1]] ]]}d20kh1>[[{?{Target AC|15}-(?{To hit modifiers +|8}),1}kh1]] ]] Also having now done this disadvantage calculation and I got an idea how to vastly improve my solution to "How many hit?" in a way without attacker limits How many hit?, with (Dis)advantage [[ ?{Advantage?| Normal,?{Number of Attackers|10}d20>[[{?{Target AC|15}-(?{To hit modifiers +|8}),1}kh1]]| Advantage,?{Number of Attackers|10}-[[?{Number of Attackers}d20<[[{?{Target AC|15}-(?{To hit modifiers +|8})-1,0}kh1]] ]]d20<[[{?{Target AC}-(?{To hit modifiers +})-1,0}kh1]]| Disadvantage,[[?{Number of Attackers|10}d20>[[{?{Target AC|15}-(?{To hit modifiers +|8}),1}kh1]] ]]d20>[[{?{Target AC}-(?{To hit modifiers +}),1}kh1]]} ]]
1630190904
timmaugh
Pro
API Scripter
So, this:  [[#d20>AdjustedTarget]]d20kh1>AdjustedTarget Is ingenious. I hadn't thought of it that way. Question: is that why both versions are rolling less dice than they should for Disadvantage? Because once the first one misses, it becomes "0d20" for the second roll?
It's quite similar to how I approach awkward exploding dice and summing successful values. As for why less dice get rolled; In essence yes the second roll becomes a 0d20 on an initial miss. From a practical sense it rolls precisely the amount of dice needed to determine the outcome. An initial miss roll with disadvantage doesn't need the second roll to know it's a miss overall but an initial hit requires the second roll to know if it's a hit or miss overall. Thus our second round of dice is one per hit from the first round since they are the only dice that give us new information (and conveniently the only source of disadvantage hits).