[RPG] Roll20 macro for Sneak Attack showing only crits

dnd-5erogueroll20sneak-attack

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.

Best Answer

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:

Attack:[[1d20cs>19 + @{Shadow|dexterity_mod} + @{Shadow|pb} ]] for [[1d8 + @{Shadow|dexterity_mod} + [[ ?{Sneak Attack|Yes, 1 |No, 0} * @{Shadow|SA} ]] ]] Dmg
.......If Crit: addt'l [[1d8 + @{Shadow|dexterity_mod} + [[?{Sneak Attack} * @{Shadow|SA}]] ]] Dmg

This will give you output such as:

Attack: 19 for 11 Dmg
.......If Crit: addt'l 13 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.