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 that lets me roll multiple monster hp and output into chat?

November 14 (4 months ago)
Steve
Marketplace Creator

Hi All, 

I am playing Tales of Argosa and trying to make a macro that will let me roll multiple creatures hp. ToA always uses d8s for monster hp, so for example an orc might have 2d8 hp, a giant 10d8 hp, and so on. I found a macro that lets me roll multiple d8s (and asks me how many d8s to roll), as follows: 

[[?{Number of times}d8]]

But what would be ace is if the macro also asked me how many creatures, and then would generate each creatures hp. At the moment I have to press the macro multiple times for multiple creatures. 

I've had a poke around the forums but couldn't quite figure it out. Any help appreciated! 

November 14 (4 months ago)
GiGs
Pro
Sheet Author
API Scripter

That can't be done with standard roll20 macros, which cant iteration of the kind you are asking for. Macros must have the number of dice defined at creation.

You can do this with a script, but your GM needs tobe a Pro subscriber (and code the script).

November 14 (4 months ago)
vÍnce
Pro
Sheet Author

an option: roll for a dozen(or whatever...) using the single HD query but only use the number that's appropriate.

&{template:default} {{name=?{Number of times|1}d8 Monster's}} {{#1:[[?{Number of times|1}d8]] #2:[[?{Number of times|1}d8]] #3:[[?{Number of times|1}d8]] #4:[[?{Number of times|1}d8]] #5:[[?{Number of times|1}d8]] #6:[[?{Number of times|1}d8]] #7:[[?{Number of times|1}d8]] #8:[[?{Number of times|1}d8]] #9:[[?{Number of times|1}d8]] #10:[[?{Number of times|1}d8]] #11:[[?{Number of times|1}d8]] #12:[[?{Number of times|1}d8]]}}


November 14 (3 months ago)
Steve
Marketplace Creator

Thanks very much Gigs and Vince. I cant be sure if others will have a pro subscription, so I'll go with Vince's idea - cheers mates!

November 14 (3 months ago)

Steve said:

Thanks very much Gigs and Vince. I cant be sure if others will have a pro subscription, so I'll go with Vince's idea - cheers mates!

Just to be clear: the Game Creator needs to have a current Roll20 Pro subscription to use Mod scripts in that game. It does not matter if any other players in the game have a Pro subscription. 

November 14 (3 months ago)
Steve
Marketplace Creator

Thanks for the clarification Jarren. I am hoping to include this with a module that others can use, which I understand from poking around the Roll20 site requires other GMs to also have the pro subscription (but not their players, as you indicate).

November 14 (3 months ago)

This was a little bit complicated, but I wrote something that does more or less what you're asking - it effectively rolls ceil(X*0.2)*10 sets of Yd8, and shows you X results, numbered from 1 to X. The reason is that this keeps the dice roller from having to roll hundreds of dice at once when you need a few large pools of dice, while allowing you to input any combination of number of pools and pool sizes. Involves reusing rolls, template overwriting, and recursivity.

group-hp

&{template:default} {{name= batch 1
[ ](#" hidden null=)}} {{[0](#)}} {{[[[{0,?{how many creatures|1}}>1*1]]](#)=[[?{how many dice|1}d8]]
}} {{[[[{0,?{how many creatures|1}}>2*2]]](#)=[[?{how many dice|1}d8]]
}} {{[[[{0,?{how many creatures|1}}>3*3]]](#)=[[?{how many dice|1}d8]]
}} {{[[[{0,?{how many creatures|1}}>4*4]]](#)=[[?{how many dice|1}d8]]
}} {{[[[{0,?{how many creatures|1}}>5*5]]](#)=[[?{how many dice|1}d8]]
}} {{[[[{0,?{how many creatures|1}}>6*6]]](#)=[more](!/
 %{@{character_name}|group-hp-continue})
}} [[[[1+1]]]] [[5]] [[?{how many creatures}]] [[[[?{how many dice}]]{{[0](#)=[ ](#" null=)}}

group-hp-continue

&{template:default} {{name= batch $[[11]][ ](#" hidden null=)}} {{[$[[12]]](#)}} {{[[[{0,$[[13]]-$[[12]]}>1*1+$[[12]]]]](#)=[[$[[14]]d8]]}} {{[[[{0,$[[13]]-$[[12]]}>2*2+$[[12]]]]](#)=[[$[[14]]d8]]}} {{[[[{0,$[[13]]-$[[12]]}>3*3+$[[12]]]]](#)=[[$[[14]]d8]]}} {{[[[{0,$[[13]]-$[[12]]}>4*4+$[[12]]]]](#)=[[$[[14]]d8]]}} {{[[[{0,$[[13]]-$[[12]]}>5*5+$[[12]]]]](#)=[[$[[14]]d8]]}} {{[[[{0,$[[13]]-$[[12]]}>6*6+$[[12]]]]](#)=[more](!/
 %{@{character_name}|group-hp-continue} [[ [[$[[11]]+1]] ]] [[$[[12]]+5]] [[$[[13]]]] [[$[[14]]]] )}} {{[$[[12]]](#)=[ ](#" null=)}}

November 14 (3 months ago)
Steve
Marketplace Creator

Wow thanks Tuo that looks complex!! I tried copying the code across but unfortunately couldn't get it to work. It came up with "TypeError: Cannot read properties of undefined (reading 'substring') Thank you however for all your efforts!

November 14 (3 months ago)

Edited November 14 (3 months ago)

Ah, you'll need to save them as abilities on a sheet, I wrote it with attribute shortcuts (that error occurs when you have an attribute or ability call without a defined reference, but attribute calls within a character sheet default to referencing the character sheet they are on if they are unspecified) so it wouldn't need editing or selecting a token or anything like that. Save them under the names above, and start with group-hp, and it should work.


November 15 (3 months ago)
Steve
Marketplace Creator

Thanks again Tuo, I have had a play around with it, just figuring out attributes and abilities on the sheet. I'm sure I'll get it soon! Thanks again for all your efforts, greatly appreciated! :D