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

Damage Macro - Can't get multiplication to work

1748855705

Edited 1748858604
I am trying to write a macro for D&D5E that will show roll my attack, then show the damage coming from my weapon, True Strike cantrip, and Sneak Attack individually, as well as add in the extra damage should my attack critically hit. Here is the macro I have written: &{template:default}  {{name=Shortbow - True Strike/Sneak Attack}}  [[floor([[3d20kh1cs>20]]/20)]]  [[ [[1d6+4]] + [[1d6]] + [[3d6]] + [[1d6]] + [[1d6]] + [[3d6]] ]]  {{Attack=$[[0]]}}     {{Bow Damage=[[$[[2]] + $[[1]]*$[[5]]]]}}      {{True Strike Damage=[[$[[3]]+$[[1]]*$[[6]]]]}}     {{Sneak Attack Damage=[[$[[4]]+$[[1]]*$[[7]]]]}} Here is what I get as an output, both on a normal attack and a critical hit: As you can see, the critical hit damage will not multiply and combine into a single displayed number. It stays displayed as multiple rolls. Is there any way to get this to combine the added/multiplied numbers into a single displayed number? Thanks in advance. Edit: With a little more testing, it appears that no math functions work within [ ] while using reused rolls. Even simple addition/subtraction won't combine into a single result.
As you've found you cannot use reused rolls directly as part of further calculations. However there are ways around it to do what you want. Here is a solution using Toggleable Template Fields :- $[[$[[1]]]] [[[ [[ {0,[[3d20kh1cs>20 +0[mod] ]]-0[mod]}=20*2 ]] ]]] &{template:default} {{Attack=$[[0]] }} {{Bow Damage=$[[9.computed]] }} {{True Strike Damage=$[[10.computed]] }} {{Sneak Attack Damage=$[[11.computed]] }} {{*Total Damage*=$[[15.computed]] }} [[[0 [[0]] {{Bow Damage=$[[11]] }} {{True Strike Damage=$[[12]] }} {{Sneak Attack Damage=$[[13]] }} ]]] {{name= Go Faster Stripe [[0]][[0]][[0]][[0]][[0]] Standard Damage [[ [[1d6 +4]][bow] + [[1d6]][true strike] + [[3d6]][sneak] ]] Crit Damage [[ [[2d6 +4]][bow] + [[2d6]][true strike] + [[6d6]][sneak] ]] }} {{name=Shortbow - True Strike/Sneak Attack}} It works by doing both sets of damage rolls but only showing the appropriate ones. I also took the liberty of adding a total damage line and added a space for an attack modifier (used twice).
Thank you, sir! You are a scholar and a gentleman!