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

Custom (or Overriding) Damage Function?

Greetings, I'm currently looking for a means to effect the way roll20 calculates weapon damage. I'm interested in running a solo adventure with a friend of mine and wanted to make some alterations to the basic D&D5e character sheet / roll templates (create my own home-brew variant). Not sure if what I want to do is possible. What I want is to find some way of overriding or replacing the default behavior of, say, the roll_MeleeAttack1  button--changing the roll template to include some logic: If the damage dice results in 1: 0 points of damage. If the damage dice results in 2, 3, 4, or 5: 1 point of damage. If the damage dice results in 6, 7, 8, or 9: 2 points of damage. If the damage dice results in 10+: 4 points of damage. I created some functions within the API which work well when processing through chat. What I want is the processing to occur when the button is pressed. Is this possible? I've already discovered that API functions cannot be called within roll templates. My work-around was to create the roll template through javascript. I've also considered using rollable tables, but it seems like I'm wanting them to do something beyond their scope. I'm starting to see my efforts are heading down a dead end street. I'm not new to programming and I can handle a fair degree of complexity, but I'm far from an expert and could use some guidance. Thought I'd ask around and see if anyone had some ideas on what to try or tips that might help. I appreciate your consideration.
1447144356

Edited 1447169342
It's not by any means elegant, but this function does work: [[ {4+0d0, round((ceil(( Dice - 1)/4))/0.85)}kl1 ]]
Thanks Silvyre! I used that formula and it achieves the desired result. Greatly appreciated.
You're welcome. Happy gaming!