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

Roll template for character sheet - bonus based on # of dice

I'm working on a Hackmaster character sheet - when rolling dice, your honor bonus (or penalty) applies to every die.  Within the sheet I've got an entry box for entering the weapon damage (for example entering 2d4+1).  I've added a roll button to the sheet that will roll that (and add strength bonus), but adding the honor bonus needs to "parse" and get the number of dice (2) and multiply by the honor bonus per die (either -1, 0, or +1) that is available in another field: /roll @{msdamt}+@{msplusdam} @{honor_bonus}[Honor] So how can I multiply that {honor_bonus} by the number of dice that were rolled from {msdamt}?
1601849129
GiGs
Pro
Sheet Author
API Scripter
I dont believe its possible to do it that way (at least, not without a custom API script). You would be better off restructurring your sheet, so you store the number of dice in an attribute, the die sides in another attribute, and any bonus in a third attribute. Then you have the data you want, and can do something like /roll @{damage_numdice}d@{damage_diesize}+(@{damage_bonus}) + (@{honor_bonus} * @{damage_numdice})
1601941098

Edited 1601941217
I thought of that, but it will make for a horrible user-experience entering their character.  I was hoping for a miracle.  Maybe someday we can actually use javascript - then it becomes easy. Oh...and I read that API scripts are forbidden on character sheets, since not everyone would have them available.  Since this is to be the "official" Hackmaster and "Heros and Henchmen" sheet, it has to follow all the rules :)
1601944021
GiGs
Pro
Sheet Author
API Scripter
I wasnt suggesting API, and also the method I suggest is both a better user experience than entering the full damage string, if set up properly, and also a better design, since it protects against user error. A good practice is to avoid any method where users are able to enter raw strings.