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

Variable Amount of Dice Rolled

Hello World! I am trying to make Sneak Attack with rogue scale up automatically within a macro. The actual math behind it is ceil([rogue_level/2])d6 but I can't seem to translate that into a macro properly. Any help or suggestions? Thanks! ~Michael
1492772999
The Aaron
Pro
API Scripter
So, assuming rogue_level is an attribute, you'd do something like: [[ (ceil(@{selected|rogue_level}/2))d6 ]] If this is going in an attribute (or character sheet) where the character whose rogue_level you are referring to is explicit, you could leave off the selected| part: [[ (ceil(@{rogue_level}/2))d6 ]] You could also wrap it in an inline roll if you don't care about seeing the math: [[ [[ceil(@{rogue_level}/2)]]d6 ]]
This is essentially what I had before, however I get the error "TypeError: Cannot read property 'substring' of undefined".
Fixed the problem! For some reason it was not seeing which character sheet it was referring to. Thanks so much for the help :D
1492780389
The Aaron
Pro
API Scripter
Great!  No problem!
1492792728
Lithl
Pro
Sheet Author
API Scripter
The dice engine doesn't like having functions (such as ceil) being used to calculate the number of dice. The inline roll option Aaron posted solves the problem.