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

Wrapping individual Rolls within a group

Necromancers & Summoners can generate lots of NPCs which can cause their turns to be lengthy and tedious. So, I came up with 2 macros (Attack & Damage) to help speed up such a character's turn by throwing all the attack/damage rolls at one time (with results nicely summarized). This post will be about the Damage macro. When the player's damage is less than the DR of their target, the negative would get applied to the attacks that do more than the DR (inappropriately reducing the effectiveness of their entire turn.) This is what I have currently (which summarizes all the damage rolls + all the damage bonuses + all the DR). &{template:default} {{name=Damage from Multiple Attackers }} ?{Target's DR|0} ?{# of Hits|1} {{A horde of @{selected|token_name} manage [[?{# of Hits}]] hits =on @{target|Target1|token_name} }} {{Each hit deals =@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +[[@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -[[?{Target's DR}]] [DR] ]] (Includes DR [[?{Target's DR}]]) }} {{Total Damage to single target =[[ ((?{# of Hits}*@{selected|!Damage Dice})d@{selected|!Damage Dice|max}) [Damage Dice] +(?{# of Hits} *(@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -[[?{Target's DR}]] [DR])) ]] }} What I need is to find a way to wrap individual damages rather than summing the parts. Any ideas?
I’m not sure what game you’re playing, but if you’re playing D&amp;D 5th edition using the ‘D&amp;D 5E by Roll20’ character sheet, then&nbsp; I think it would be simpler if you used the Mob Rules from the DMG for large numbers of creatures attacks. There’s a macro already set up for that here:&nbsp; <a href="https://app.roll20.net/forum/post/10096810/d-and-d-5th-edition-by-roll20/?pageforid=11551675#post-11551675" rel="nofollow">https://app.roll20.net/forum/post/10096810/d-and-d-5th-edition-by-roll20/?pageforid=11551675#post-11551675</a> If you’re playing something else then it would be helpful to post that and which character sheet you’re using. It looks like the characters have attributes that start with exclamation points, so I’m not sure if those are custom attributes or are part of the character sheet you are using.&nbsp; To answer your question, you can’t separate out the individual dice rolls when it is constructed like that. You’d need each dice roll to be individually called. &nbsp;
Pathfinder 1e, not D&amp;D 5e. And yes, made a couple custom attributes on the sheet that the DM uses.
Is there a way to do iteration? Do this roll x times?
Lucky said: Is there a way to do iteration? Do this roll x times? With a Pro subscription and access to Mod script, yes. Otherwise not easily using the standard Roll20 dice roller.&nbsp; You could create a macro query that has all of the possible dice combinations, and outputs the correct damage calculation, but it’ll require a lot of html entity substitutions and can be tricky to write.&nbsp;
Are you referring to calling "reused" rolls? Such as $[[1]]
I would agree with Jarren that if the game is created under a Pro subscription, that this could be done with Mods but otherwise is going to be difficult to impossible. I would normally have just said impossible but I'm hedging my bets incase RainbowEncoder comes along with some those magic macros they summon.
1721014046

Edited 1721014083
Gauss
Forum Champion
There is another direction you can go that does not require a Pro subscription but it requires a lot more work, and can only handle batches (say around 5-10 attacks).&nbsp; The following is a quick mock up, not necessarily what I would use (I'd refine it a lot more depending on what folks want).&nbsp; &amp;{template:default} {{name=Group attacks}} {{Total damage=[[ [[[[{1d20+5}&gt;?{AC|10}]]*[[{(1d8+3-?{DR|0}),0d0}kh1]]*[[{?{Number of Attacks|1},0}&gt;1]]]]&nbsp;+[[[[{1d20+5}&gt;?{AC|10}]]*[[{(1d8+3-?{DR|0}),0d0}kh1]]*[[{?{Number of Attacks|1},0}&gt;2]]]] +[[[[{1d20+5}&gt;?{AC|10}]]*[[{(1d8+3-?{DR|0}),0d0}kh1]]*[[{?{Number of Attacks|1},0}&gt;3]]]] ]]}}&nbsp; Breakdown, each segment comprises of this:&nbsp; [[[[{1d20+5}&gt;?{AC|10}]]*[[{(1d8+3-?{DR|0}),0d0}kh1]]*[[{?{Number of Attacks|1},0}&gt;1]]]]&nbsp; This is then summed with the next segment until you have your total damage.&nbsp; Note there are only three segments above. To extend this copy the first segment and add it on to the end of the last segment before ]]}}.&nbsp; Then increment up the &gt;1 to &gt;4, &gt;5...etc.&nbsp; Attack:&nbsp; [[{1d20+5}&gt;?{AC|10}]] Note: I plugged in a value (+5) for testing, you can replace this with an attribute.&nbsp; AC check to determine if hit or miss.&nbsp; Damage:&nbsp; [[{(1d8+3-?{DR|0}),0d0}kh1]] Note: I plugged in a value (+3) for testing, you can replace this with an attribute.&nbsp; kh1 check to remove rolls which are lower than 0 hp.&nbsp; Number of Attacks check:&nbsp; [[{?{Number of Attacks|1},0}&gt;1]] Simple check to determine if the number of attacks equals or exceeds the value ("&gt;1" in the above section, but it grows by 1 for each successive section). If it does, it multiplies by 1. If it doesn't, it multiplies by 0 which results in the entire attack*damage*number of attacks check equalling zero.&nbsp; Possible upgrades:&nbsp; A bunch more work but you can use reusing rolls (such as: $[[0]] ) to pull values out in the middle of the calculations.&nbsp; Example, if you want to check to see if any attacks were criticals I would have all the Attack rolls pulled out and put in a line, then if any were green I'd roll the critical damage for that.&nbsp;
1721017547

Edited 1721046614
timmaugh
Pro
API Scripter
If you do have access to scripts, here is a solution I worked up for an open-ended number of attacks for a necromancer's minions. EDIT: All of the scripts listed as required, there, have been packaged into the Metascript Toolbox, so if you get that, you'll get them all.
@&nbsp; Gauss : Nice ... I'll try that when I'm next able to work on it. Maybe later today, who knows ... @&nbsp; timmaugh : I'm currently a Plus subscriber .. but I'm most active as a player, so I'm not sure if API scripts are available to a player if the Game's Master is not a Pro (I'm guessing not, as Joshua N. described above).
@ Gauss Tried your code, but I may have gotten something wrong. It populated results and everything seemed to work, except: It capped out at 3 rolls .. no matter how many I said to roll. The actual rolls are not visible .. which means I couldn't validate the results and the GM is highly unlikely to accept 'blind' results from a Macro they didn't create. @ Jarren &amp; @ Gauss I was able to complete the project using the reroll method to just place different options (1 hit - 10 hit) each in their own set of square brackets. But it's obvious quite tedious and an ugly set of code. (I'd post the code but not sure if anyone would care to see it, lol) I'm still open to other ideas. Especially intrigued in Gauss's solution, if I can figure out what I did wrong. (Automated Iteration has endless potential!)
1721107142
Gauss
Forum Champion
Lucky said: @ Gauss Tried your code, but I may have gotten something wrong. It populated results and everything seemed to work, except: It capped out at 3 rolls .. no matter how many I said to roll. The actual rolls are not visible .. which means I couldn't validate the results and the GM is highly unlikely to accept 'blind' results from a Macro they didn't create. @ Jarren &amp; @ Gauss I was able to complete the project using the reroll method to just place different options (1 hit - 10 hit) each in their own set of square brackets. But it's obvious quite tedious and an ugly set of code. (I'd post the code but not sure if anyone would care to see it, lol) I'm still open to other ideas. Especially intrigued in Gauss's solution, if I can figure out what I did wrong. (Automated Iteration has endless potential!) If you didn't modify it then that is what went wrong, as I stated...I only did 3 of the sections. To do more you need to add more sections.&nbsp; As for seeing the rolls, as I stated in my post, you can do that by using repeating rolls in another line.&nbsp; If you need help with all of that let me know.&nbsp;
So I finally found some time that wasn't sleep deprived ... and figured it out. Thanks to Gauss for the code basis! This uses a few custom attributes (which start with a !) and rolls 10 attacks &amp; damages. However, the dice rolled are no longer encapsulated by square brackets and that allows the GM to see what was rolled. Here is the code for anyone interested. /w Lucky &amp;{template:default} {{name=Group attacks }} ?{Target's DR|0} {{Total damage =[[ ( ( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;1 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;2 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;3 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;4 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;5 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;6 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;7 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;8 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;9 ) ) +( (( {1d20+5}&gt;@{target|Target1|AC} )*[[ {(@{selected|!Damage Dice}d@{selected|!Damage Dice|max} +@{selected|!Misc Bonus|max} [Misc Damage] +@{selected|!PartyBuffs|max} [Party Damage Buffs] -?{Target's DR} [DR]),0d0}kh1 ]]*( {?{Number of Attacks|1},0}&gt;10 ) ) ]] }}