# How to make a Roll20 macro that rolls Advantage and adds a modifier?

I have an Abjuration Wizard with the Improved Abjuration feature which lets me add my proficiency bonus to ability checks made when casting a spell such as counterspell. Additionally, my wizard also has an item that allows him to roll all INT ability checks with Advantage.

I'd like to make a Roll20 macro for use with counterspell and similar spells, but I don't see how to do that in the Macros Wiki. I need the macro to roll with Advantage and add the proficiency and ability modifiers (or just +10 and I can change the hardcoding when the modifiers change). I very much do not want to fill out the Roll20 character sheet, nor do I want the 'always roll Advantage' option turned on.

How to make a Roll20 macro that rolls Advantage and adds a modifier?

• To be clear, you're just asking for syntax on how to roll dice; 2d20 + some_value? And do you want that value keyed off of a specific character and their attribute, any character and their attribute, or a pop-up that asks for the modifier every time? Oct 4, 2022 at 17:21
• @MivaScott It would be nice for the values to be pulled from a DDB character sheet, but not necessary. The biggest part is the Advantage roll - I've gotten the rest of it figured out but can't find how to roll 2d20 and take the highest. Oct 4, 2022 at 18:23

### Roll20 implements min/max functions on dice pools.

One option is to write the following macro:

INT with advantage: [[{1d20,1d20}kh1]]


where roll20 keeps the highest 1 among the dice pool.

If you want to implement the dependency on the Proficency Bonus and on the INT mod, you can use the following code:

Int with advantage:
[[{1d20,1d20}kh1+@{charName|PB}+@{charName|intelligence_mod}]] rolled


You have to substitute charName with the name of your character. In case you desire to have this particular roll available also for other creatures/tokens, you can use selected instead of charName: in this way, the roll is made using the char sheet of the selected token.

The example above refers to the case in which you are using the DnD5ed char sheet by Roll20.

Check Dice Reference: Grouping Rolls, for documentation. In case you need a complete list of the possible roll modifiers check Dice Reference: Roll Modifiers; for grouped roll modifiers, see Dice Reference: Grouped Roll Modifiers.

• Thanks for that documentation link! I scrolled right past that as I was looking for how to roll with Advantage. Oct 4, 2022 at 18:56
• @aaron9eee I added another piece of code, in case you do not want to hard code some the prof bonus and/or the modifiers. Oct 4, 2022 at 19:21
• And you can use "selected" if you want this to work with the selected token. (You may want to add that point; nice answer. :) Oct 5, 2022 at 11:50
• @KorvinStarmast Thanks! I used the selected variable in the past, but I did not included in the answer since the OP seems to be not interested in. I can add it, maybe someone will find it useful. Oct 5, 2022 at 12:32

You can use this as the text for your macro

/roll 2d20kh1 + 3 + 5


where the +3 is the proficiency bonus, the +5 your Int bonus. The kh1 turns the 2d20 into an roll that picks the higher dice ("keep high one"). The trickier part would be to tie the bonuses to values in a character sheet, but it seems you do not want to do that anyways. If you wanted to, use

/roll 2d20kh1 + @{Name|pb} + @{Name|intelligence_mod}


where Name would be your character's name (or, if you use selected for Name, it will work with the currently selected token's stats).

The announcement text as to what you are rolling for is optional, you can leave that first line off if you do not need it. In case you are wondering about the difference in syntax to Eddymages's version, he is using inline rolls, that show you just the resulting number, while these will output both the rolls and the resulting number, like you get with a normal /roll command.

The macro will show up in your macro tab. If you check the Show in Macro Bar button, and also check the "Display Macro Bar" at the bottom of the macro list, you will have it on the screen as a button and can click it anytime you want to roll it.

• I'd love to be able to tie the bonuses to the modifiers from a DDB character sheet, but as those bonuses won't change all that often, a hardcoded value works as well. Oct 4, 2022 at 18:28
• @aaron9eee You can do that like so /roll 2d20kh1 + @{Naal|pb} + @{Naal|intelligence_mod} where Naal would be your character's name. Oct 4, 2022 at 18:35
• Can you provide a better image description than "insert image description here"? Imagine you're describing the images over the phone — the image description should be a replacement for the images for people who can't see them. Oct 4, 2022 at 21:34
• can't this be done with the 'selected token' or is that limited to initiative? Oct 4, 2022 at 23:29
• @KorvinStarmast, it can, you just use "selected" for the name instead of a specific character's name. Added that. Oct 5, 2022 at 3:47