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

Multiattack Macros

So, I will admit, I am still pretty new into using macros in general, but I have found a way to set up my monsters to have many token macros to speed up things up. I use a simple macro like this: /w gm [[1d20+1 &{tracker}]] for every monster for initiative (changing the +1 depending on each Monster's Dex mod of course) and something like: /em Bite /w gm [[1d20+8]] to deal [[1d10+5]] Piercing Damage It's simple, and it does what I need. Even Multiattacks end up looking something like: /em Multiattack /em Longsword /w gm [[1d20+7]] to deal [[1d8+3]] Slash Damage, and the target must make a DC 15 Constitution saving throw, taking [[7d6]] Poison Damage on a failed save, or half as much damage on a successful one /em Longsword /w gm [[1d20+7]] to deal [[1d8+3]] Slash Damage, and the target must make a DC 15 Constitution saving throw, taking [[7d6]] Poison Damage on a failed save, or half as much damage on a successful one /em Shortsword /w gm [[1d20+7]] to deal [[1d6+3]] Pierce Damage, and the target must make a DC 15 Constitution saving throw, taking [[7d6]] Poison Damage on a failed save, or half as much damage on a successful one But I am starting to delve into more complicated macros and there is one I currently am obsessed with figuring out, if its even possible. I would like to set up a Multiattack for a 5e Hydra, which means a macro that will ask how many heads the hydra has, and then roll that many number of attacks for me. So far my attempts at making a working macro have failed abysmally.
I think this can be done using an API script, but there may be a work around possible. Aaron the Scriptomancer could solve it in his sleep, try beaming a symbol of a guy with a beard on a cloud...
1541344860
GiGs
Pro
Sheet Author
API Scripter
For the examples you do have working, i suggest looking into how to use attributes. For instance, you could have a universal macro like /w gm [[1d20+@{selected|DEX} &amp;{tracker}]] that you only need to create once, and then can use for every character that has a DEX attribute and a token. Likewise, if you created a macro like /em Longsword /w gm [[1d20+@{AttackBonus}]] to deal [[1d8+@{DamageBonus}]] Slash Damage, and the target must make a DC 15 Constitution saving throw, taking [[@{PoisonDamage}d6]] Poison Damage on a failed save, or half as much damage on a successful one You create it once, as an Ability on that character's sheet, and it will be scaled whenever the character's stats increase. This doesn't really matter for NPCs whose stats rarely change, but if you are creating PCs it's worth knowing. On to your real question: Christopher S. said: But I am starting to delve into more complicated macros and there is one I currently am obsessed with figuring out, if its even possible. I would like to set up a Multiattack for a 5e Hydra, which means a macro that will ask how many heads the hydra has, and then roll that many number of attacks for me. So far my attempts at making a working macro have failed abysmally. There is a way to do it, but it requires a much more advanced syntax than you have used so far, namely html entities. The problem is that the macro system doesnt support true conditionals, like "if i enter the number 3, roll 3 attacks". You have to create every option in full. You must use a query asking for the number of attacks, and then in the query code, write the full code you need for each option. It would look something like this: ?{How Many Heads?| 1,all code needed for 1 attack here| 2,all code needed for 2 attacks here| 3,all code needed for 3 attacks here} and so on. The tricky part is making those attack strings work without breaking the query. It's very tricky, requiring the use of html entity replacement codes, as described here: <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> Don't be alarmed if you dont understand that. I havent attempted to write the code for you multi-attack macro here because it is so complicated. Maybe someone will be along to do it... There is a simpler solution though, using a chat button. You create two macros. In one, you create some text indicating the hydra has x heads and is initiating its attacks. And it prints a button to launch an attack macro. This second macro includes the text for one attack, and lets you declare the target. So you click it as many times as you need, and can declare who each head attacks. This is a more flexible approach.&nbsp; Create the following two ABILITIES on a Hydra character sheet. (See the Attributes an Abilities tab.) Ability 1 The ?{How Many Heads?|7}-headed&nbsp;Hydra attacks! /w gm [Head Attack]( !&amp;#13;&amp;#37;{Hydra|HeadAttack} ) If your character sheet is named something other than Hydra, change the word Hydra on the second line above to match. Now create a second Ability on the same sheet, called HeadAttack &nbsp;with the following code /em Hydra Attacks @{Target|character_name} /w gm [[1d20+8]] to deal [[1d10+5]] Chomping Damage The first ability will print a button in chat that you can click, and you click it for each attack the hydra makes.&nbsp; The @{Target} on the line above will ask you to select a character's token, and it will print out that character's name as the target.
I am definitely familiar with this, lol, though I appreciate the advice. I am really trying to create a Monster Manual for my current and future campaigns at this particular juncture. I have many macros set up for my players that draw from their attributes, though that's a whole other can of worms. Some of players still don't understand why their token picture doesn't change when they change their character portrait, so I am trying to not get too advanced for them. G G said: For the examples you do have working, i suggest looking into how to use attributes. For instance, you could have a universal macro like /w gm [[1d20+@{selected|DEX} &amp;{tracker}]] that you only need to create once, and then can use for every character that has a DEX attribute and a token. Likewise, if you created a macro like /em Longsword /w gm [[1d20+@{AttackBonus}]] to deal [[1d8+@{DamageBonus}]] Slash Damage, and the target must make a DC 15 Constitution saving throw, taking [[@{PoisonDamage}d6]] Poison Damage on a failed save, or half as much damage on a successful one You create it once, as an Ability on that character's sheet, and it will be scaled whenever the character's stats increase. This doesn't really matter for NPCs whose stats rarely change, but if you are creating PCs it's worth knowing.
1541397049
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Note that if the abilities are indeed Abilities (macros written on the character sheet, instead of the Collections tab, this line: /w gm [Head Attack]( !&amp;#13;&amp;#37;{Hydra|HeadAttack} ) Can be more simply written as this: /w gm [Head Attack]( ~HeadAttack ) Ability Command Buttons enjoy a much simpler syntax. Also, you could write the second macro with the addition of a third line to give you an automatic repeat: /em Hydra Attacks @{Target|character_name} /w gm [[1d20+8]] to deal [[1d10+5]] Chomping Damage /w gm [Repeat]( ~HeadAttack )
1541397983
GiGs
Pro
Sheet Author
API Scripter
keithcurtis said: Note that if the abilities are indeed Abilities (macros written on the character sheet, instead of the Collections tab, this line: /w gm [Head Attack]( !&amp;#13;&amp;#37;{Hydra|HeadAttack} ) Can be more simply written as this: /w gm [Head Attack]( ~HeadAttack ) Wow, so it can. I hadnt realised that. I took the syntax straight from the wiki, that should probably be fixed.
1541400129
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I originally learned the syntax from the wiki entry on Ability Command Buttons . Where did you reference from? I'll look into it. The simpler syntax and the lack of need to use HTML replacements in most cases is one of the many reasons I switched nearly all my campaign macros to using a macro sheet . G G said: Wow, so it can. I hadnt realised that. I took the syntax straight from the wiki, that should probably be fixed.
1541439476
GiGs
Pro
Sheet Author
API Scripter
keithcurtis said: I originally learned the syntax from the wiki entry on Ability Command Buttons . Where did you reference from? I'll look into it. Right at the bottom of this page:&nbsp;<a href="https://wiki.roll20.net/API:Chat" rel="nofollow">https://wiki.roll20.net/API:Chat</a>
1541447287
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks GG! I have edited that entry and included a link to the specific section on Ability Command Buttons.