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

Can I make macros loop?

February 15 (11 years ago)
I'm using macros as a 4E wizard--so nearly all my attacks are area attacks. A typical macro might look like this:

[name Corrosive-Mist-E]
/em sends a mist of suspended acid droplets to consume his foes
#Attack vs Fortitude
/roll 2d8+?{type 1 if attacking 1 enemy|0}d8+@{damageBonus} acid damage

This uses an #attack macro to roll one attack then rolls the damage (kind of complicated in this case because if you are targeting multiple enemies it's 2d8 but if it's just 1 enemy the damage dice go up to 3d8 so I prompt for the user (that's me) to tell me if only one is being attacked so it can add the extra d8 damage.

Anyway, my problem line is the attack line, what I'd really like is to replace my #Attack macro with something like:
repeat ?{how many targets|1} times #Attack

I know that's not realistic syntax, I'm just saying it would be nice for the system to prompt me for a number of targets then just blam out d20+19 that many times.

As is I use the one attack roll that comes with the macro on the first target and then punch it again for each additional target. This is totally usable, but I just thought I might be missing a better way.
February 15 (11 years ago)
Nothing I know of will currently let you prompt for multiple attack rolls like that, maybe with API but coding is beyond me. My groups have two work arounds to the issue.

First, just make the attack line repeat five times using inline rolls, something like this.

[[1d20+?{Attack Modifier|19}]] | [[1d20+?{Attack Modifier|19}]] | [[1d20+?{Attack Modifier|19}]] | [[1d20+?{Attack Modifier|19}]] | [[1d20+?{Attack Modifier|19}]]
Vs Fortitude

This takes up very little space in the chat window and you just read the targets in the area like a book left to right and top to bottom. Usually 5 targets for most AoE spells is enough.

The second solution is to use the same idea and build an output that looks like the AoE, so for example a blast 1 would be something like this.

[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]
[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]
[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]

That will output nine attack rolls all using the same modifier, since they are all named the same and will look like a 3x3 grid section or a burst 1.

You can even use this trick for close burst 1's by replacing the middle value with |ME|. So something like this.

[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]
[[1d20+?{Attack Modifier|19}]]|ME|[[1d20+?{Attack Modifier|19}]]
[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]|[[1d20+?{Attack Modifier|19}]]

All you do is make sure the caster used the drawing tool or a template to show where the burst or blast is placed before the roll so there is no confusion or altering of the area so that a miss turns into a hit or anything like that.

Hope that helps some.

Just remember to not hit the enter key if the line of macro goes to long, the output will end up on one single line as long as you just keep typing.
February 15 (11 years ago)
Moving to the specific use forum. :)
February 16 (11 years ago)
Lithl
Pro
Sheet Author
API Scripter

As John says, this is only doable with the API (the Campaign owner must be a Mentor). I have a Roll Repeater script for exactly this purpose. With my script, your macro would look something like this:

!rr /em sends a mist of suspended acid droplets to consume his foes
!rr #AttackMulti vs Fortitude
!rr /roll 2d8+?{type 1 if attacking 1 enemy|0}d8+@{damageBonus} acid damage

Your AttackMulti macro would be identical to your Attack macro, but with a query at the end. Something like:

[[d20+floor(@{Bill|Level}/2)+@{Bill|Int}+2]]{?{Targets}}