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

Intermediate Macro tips

1521469155

Edited 1521475086
So, seeing as I work with code a bit, I thought I'd post a few ideas for how to make your macros a bit more powerful. Please note that this is not a thread intended for new players. If you're new, you are strongly advised to consult Matt's excellent  Macros: The Absolute Basics and  Matt's Guide to Great Macros threads and start there. In fact, just go read everything by Matt and watch all his vids first, then come back here. These are approaches to macros which I've discovered after several iterations of my own characters' macros - once you're comfortable with the basics and with macro writing as an overall process, hopefully you can use this thread to make your own macros more modular and easier to maintain as your character grows into a bloated, sprawling Paragon mess. There will be little here that surprises experienced players...but this thread is not for you :p Attack Rolls So, let's say you have a level 6 Heroic character with: +3 proficiency bonus (eg using a longsword) +1 feat bonus to attack rolls (from the Heavy Blade Expertise feat) +2 magical weapon You might have an attack line in your powers that looks like this: Attack: [[ 1d20 + @{Half level} + @{STR} + 3 + 1 + 2 ]] vs AC The trouble with this is that as soon as you have to change any of this (eg. you upgrade your weapon from a +2 to a +3), you have to go through and edit every single "Attack" line in every macro you have in your whole character sheet. So instead, I suggest you make a few new attributes in your character sheet (in the left-hand column, similar to your STR, DEX, Hit Points, Half level etc), one for each of these variables. Call them what you like, but I went with "enh_bonus", "feat_bonus", "prof_bonus", "item_bonus" and so on. Fill each of these attributes out with the appropriate value (so "3" for prof_bonus, "2" for enh_bonus, etc). Here's an example from my own character sheet: Once you've done that, make a macro called AttackRoll, and put this into it: AttackRoll: 1d20 + @{Half level} + @{STR} + @{enh_bonus} + @{feat_bonus} + @{prof_bonus} + ?{Temp attack modifiers?|0} This sub-macro basically rolls your 1d20 attack roll, adds the attribute variables you just created, and gives you a prompt where you can type in any temporary attack roll bonuses (like adding 2 for Combat Advantage, for example). This way, if you need to update your weapon, feat bonus or whatever, you can just change the one relevant attribute, and the rest will be calculated automatically through all your powers from that one change. In your actual power macros, you can just call that AttackRoll sub-macro: Attack: [[ %{YourCharacterName|AttackRoll} ]] vs AC If you have a need for different attack rolls keying off different stats or using different weapons (melee, ranged and implement attacks for example), you can just make a sub-macro for each one, and call them as you need them, for example: MeleeAttack: 1d20 + @{Half level} + @{STR} + @{enh_bonus} + @{feat_bonus} + @{prof_bonus} + ?{Temp attack modifiers?|0} RangedAttack: 1d20 + @{Half level} + @{DEX} + @{enh_bonus} + @{feat_bonus} + @{prof_bonus} + ?{Temp attack modifiers?|0} ImplementAttack: 1d20 + @{Half level} + @{WIS} + @{enh_bonus} + @{feat_bonus} + ?{Temp attack modifiers?|0} Damage Rolls You can use the same process to make a sub-macro for your static damage, where (for example) enh_bonus is your weapon's enhancement bonus, feat_bonus is your feat bonus to damage (eg from Weapon Focus) and item_bonus is your item bonus (say from Iron Armbands of Power): MeleeDamage: @{STR} + @{enh_bonus} + @{feat_bonus} + @{item_bonus} + ?{Temp damage modifiers?|0} You can call this from your powers in the same way (let's assume you're using a Warhammer, which has a 1d10 damage die, and you're using a 1[w] power): Hit: [[ 1d10 + %{YourCharacterName|MeleeDamage} ]] damage In this case, having the 1d10 roll separate to the static damage is good because various powers roll different amounts of damage (2[w], 3[w] etc) and you need to allow for that. Finally, let's look at crit damage. In this case you can just make a CritDamage macro, call your damage macro from it, and add your crit dice (2d6 from your +2 weapon) since your crit damage will use the same melee static: CritDamage 2d6 + %{CharacterName|MeleeDamage} So putting it all together, your actual power macro might look like this (using Holy Strike from my own character Reinhardt as an example, and adding some ** and * for bolds and italics): /me smites the enemy with Holy Strike! **Holy Strike** *At-will ✦ Divine, Radiant, Weapon* *Standard Action ✦ Melee weapon* **Target:** One creature **Attack:** [[ %{Reinhardt|AttackRoll} ]] vs AC **Hit:** [[ 1d10 + %{Reinhardt|MeleeDamage} ]] Radiant damage ([[ 10 + %{Reinhardt|CritDamage} ]] crit), plus [[ @{WIS} ]] bonus damage if the target is marked by me. But I wanted nested macros with a nice dropdown menu? Nesting macros is complex, but having less clutter definitely helps, so it's a little easier if you've taken this modular approach. You can nest these macros into a dropdown by making the following modifications. Note that for some stupid reason, even with the <code> formatting in this forum, if I type out the actual HTML code you should  use it will helpfully render into a comma or curly brace or whatever, and not actually show you the thing you need to really use, so I've put a space between the & and the # in each one - you'll need to remove that space to make this stuff work (you'll see what I mean below). According to the  Roll20 Macro guide : , Commas nested one level down have to be replaced with & #44;  (<< this is what I meant. Remove the space between & and #) | Pipes nested one level down that are not part of an attribute have to be replaced with & #124; } Closing curly braces nested one level down that are not part of an attribute have to be replaced with & #125; The idea of 'levels' is a bit hard to grasp, but essentially a dropdown menu is constructed like this: ?{Question? | Option one, Do this | Option two, Do that | Option three, Do this other thing } The commas serve a structural purpose here: each | separates the options from each other, and then each comma separates the option from the thing that will happen if that option is selected. So if you have more  of these special characters appearing inside any of these component parts (eg "do this", "do that" or "do this other thing"), you need to substitute them or Roll20 will get confused about where your options start and finish. So, if you have something like: ?{Question? | Option one, Do this, and do it well | Option two, Do that | Option three, Do this other thing } See the extra comma in "Do this, and do it well"? You'll need to substitute that out with the HTML equivalent (again, remove the space when you do this for real): ?{Question? | Option one, Do this & #44;  and do it well | Option two, Do that | Option three, Do this other thing } We do that substitution so Roll20 knows to ignore that one comma, so it doesn't mess with the overall structure of the dropdown. With that in mind, our power macro will look something like this (I've bolded the substitutions): ?{Which power to use?| Attack one, /me uses Attack one! **Attack One** *At-will ✦ Keyword & #44; Keyword & #44; Keyword* *Standard Action ✦ Melee weapon* **Target:** One creature **Attack:** [[ %{CharacterName|AttackRoll} ]] vs AC **Hit:** [[ 1d10 + %{CharacterName|MeleeDamage} ]] damage ([[10 + %{CharacterName|CritDamage} ]] crit) & #44; plus whatever other effects this power has on a hit. | Attack two, /me uses Attack two! **Attack Two** *At-will ✦ Keyword & #44; Keyword & #44; Keyword* *Standard Action ✦ Melee weapon* **Target:** One creature **Attack:** [[ %{CharacterName|AttackRoll} ]] vs AC **Hit:** [[ 1d10 + %{CharacterName|MeleeDamage} ]] damage ([[ 10 + %{CharacterName|CritDamage} ]] crit) & #44; plus whatever other effects this power has on a hit. | Attack three, /me uses Attack three! **Attack Three** *Encounter ✦ Keyword & #44; Keyword & #44; Keyword* *Standard Action ✦ Melee weapon* **Target:** One creature **Attack:** [[ %{CharacterName|AttackRoll} ]] vs Fort **Hit:** [[ 2d10 + %{CharacterName|MeleeDamage} ]] damage ([[ 20 + %{CharacterName|CritDamage} ]] crit) & #44; plus whatever other effects this power has on a hit. } However, because we're effectively pulling our sub-macros into our main macros when they actually run, we'll need to make the appropriate substitutions in those too. We don't have any commas in the sub-macros and the majority of the values we're using in them are attributes, so the only parts that need to be substituted are the prompts where the user is asked for temporary modifiers: MeleeAttack: 1d20 + @{Half level} + @{STR} + @{enh_bonus} + @{feat_bonus} + @{prof_bonus} + ?{Temp attack modifiers? & #124; 0 & #125; MeleeDamage: @{STR} + @{enh_bonus} + @{feat_bonus} + @{item_bonus} + ?{Temp damage modifiers?? & #124; 0 & #125; Obviously nested macros can get much thornier than this, but I'm hoping that at least this might help some newer players take the next step when it comes to organising their macros into something a bit less chaotic and intimidating. It's a little more work up-front, but you get less headaches in the long run. Either way, I hope this has been helpful and I hope I haven't stepped on any toes by making this thread - if you have any questions about macros you can post them in the Build Chat Discord channel, and anyone else who has tips to share can obviously feel free to add them to this thread if they wish :) Finally DMs, if this isn't helpful and you think it's just going to confuse new players, then please go ahead and delete the thread. Cheers and happy monster slaying! D
Thanks for the info-posting, Drew. I will point out, however, that this information (and more) is covered in Matt's Guide to Great Macros , as well as partially in the Guild Character Creation Video Tutorial (Part 3) (dropdowns and nested prompts are under the Skills section (part 8)). That being said, I don't think that deleting this thread outright is necessary, as your style of writing may be more helpful to some people than mine (and vice versa), but do perhaps check with the DMs before making a reference thread, as you may be duplicating efforts already done. Cheers.