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

Minimum value of 0

In a regular Character Sheet macro, I'm trying to calculate damage for weapons. This in itself is simple enough, except for Armor and Armor Piercing. Armor works simply as damage reduction, but Armor Piercing reduces the value of Armor, but not below 0. So a target with 2 Armor that is hit with an AP 4 weapon has 0 Armor against that weapon.   Simple enough, right? But how to I make that function stop at 0? Or is there a way to drop anything lower than 0?
1591834358
GiGs
Pro
Sheet Author
API Scripter
You can use the keep highest function, where you wrap two or more numbers in { }kh1, like {0,@{strength}}kh1 The problem is that with kh, all values must be the same type. If one is a dice roll, all must be dice rolls. You can get around this by using 0d0 as a fake dice roll, like {0d0,[[1d6-3]]}kh1 This will not let the roll go below 0. There can be difficulties using this in more complex roll macros, so if you have issues getting it to work, post your roll and we'll help you.