# Roll20 macro for Sneak Attack showing only crits

I'm trying to automate my sneak attack with my weapons. Currently I have the following

&{template:default} {{name= Light Crossbow}} {{attack= [[1d20+@{Shadow|dexterity_mod}+@{Shadow|pb} ]]}} {{damage= [[1d8+@{Shadow|dexterity_mod} +?{Sneak Attack?:|Yes,@{Shadow|SA}|No,0}|]] + [[1d8+@{Shadow|SA} if crit]]}}


The problem is however that it always shows the crit damage regardless if I crit or not.

For what it's worth I'm using the 5th edition OGL character sheet.

The order of operations should be the following. I click the macro. It asks if I want to use sneak attack. It generates the roll and a single damage value that takes into account whether or not I got a critical hit.

• So, as it stands, it will always give me the non crit roll plus the crit roll. this is confusing at a glance. I would like it to only display the crit roll when I do in fact roll a natural 20. I realize there are colored cues for this, but having the extra number in there adds a layer of complexity. I should be able to know I crit by just seeing the damage I rolled PLUS the extra crit damage. Im simply trying to make it only display the +dmg if i crit. – gxrobb May 21 '18 at 21:05
• I think I understand the modification you want to make. I have gotten so used to the default that you mention that I just use "as is" ... it may be a few days before my friend who is very good at r20 stuff can get back to me ... your response tells me that you are not intending for this output to feed into another macro/feature/function as an input. Is that correct? – KorvinStarmast May 21 '18 at 21:09
• That is correct, I want this to be the only output that happens. The order of opperations should be the following. I click the macro. It asks if I want to use sneak attack. It generates the roll and damage, taking into account if I crit or not. thats all I need it to do. I may decide to add advantage in there in the future, but im less concerned about it as I can always just hit it twice – gxrobb May 21 '18 at 21:31

Roll20 text macros do not support conditional statements based around die results for free users. To do this, you need access to their scripting APIs, which require a Pro subscription. You can read more about the subscriber models here.

My advice is to drop the crit section, and handle your crits with a second macro.
It slightly ruins the automation, but you also probably won’t need it quite as often.

What you could do, if you do not mind slight clutter in the chatlog when you do not score a critical hit, is to separate your critical hit damage into a separate line in your macro. If you use something like the following:

This will give you output such as:

Attack: 19 for 11 Dmg


If you want to look into the options for using the default template for a prettier format, you can find out more about how to add options to your roll here.

• Depending on the system they're using, there are crit-specific conditionals available for free users. We need to know the asker's specific context before we can give them a definitive answer. – BESW May 20 '18 at 23:40
• @BESW I’d be greatly interested in knowing any manner outside of drop-down sheets for approximating conditional statements in macro. Could you explain further? – royalmurder May 20 '18 at 23:43
• Comments aren't really the place for answering questions. If the asker were using D&D 4e I could write an answer with an easy solution (hence a global "no, that's not possible" is not an accurate answer), but I'm not familiar enough with Roll20's 5e implementation to know if there's an equivalent feature built into its free character sheet template. – BESW May 21 '18 at 7:52
• This might be a good back up plan, but not exactly ideal. thanks! – gxrobb May 21 '18 at 21:06
• It's what I had to do on my Pathfinder character that crit on 1/3 of his attacks (statistically). The answer is in royal's opening; without API access and knowledge of coding it, you can't create the 'if the die rolls a 20' function. – Ifusaso Jun 1 '18 at 21:05

The other option that I've found on the Roll20 forums is to edit the weapon itself in your character sheet. This link will give you a step by step on how to get that functionality.

Here's a summary:

• Open your character sheet, and click the cog next to your weapon attack you wish to edit.
• In the resulting edit box, select the first field for the damage1 slot (IE, "1d8").
• add to the text field: + ?{Sneak Attack|No, 0|Yes, [[ ceil((@{base_level}) / 2) ]]d6}[Sneak Attack]
• Click the cog to close and accept the new damage

At this point, how the result displays will be based on your character sheet. When you click your weapon, it will either roll your attack roll (1d20) and wait, letting you click the weapon name in chat if it was a hit to roll damage, or automatically roll for you. Either way, once you roll for damage, you will be asked if this was a Sneak Attack. If yes, it will roll the total damage for you and display. If no, it will roll the dice like normal. And if the roll was a crit, it will roll the crit like normal for that weapon and display it as a separate damage roll (IE: "12 + 5").

Hope this helps!