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

Is there a way to set a maximum number to a Macro?

I'm trying to make a Macro for DnD 3.5 where a skillcheck results in adding additional damage dice to an attack. I have the Macro set up, but the problem is that for the rules, the extra dice only goes up to a maximum of an additional 9d6. This is the table for the rules

10—14 +1d6

15—19 +2d6

20—24 +3d6

25—29 +4d6

30—34 +5d6

35—39 +6d6

40—44 +7d6

45—49 +8d6

50—∞ +9d6 (maximum)


And this is the Macro I have so far, since the amount of d6 goes up by one for every value of 5, I just used a floor for the total and divided the whole thing by 5.

{{Iaijutsu Focus= [[[[floor( ( [[1d20+@{cha-mod}+((@{level}+3)*2))/5)-1}}]]d6]]}}

I am going to put this macro into a weapon attack as a dropdown so it just automatically does it when the bonus applies, and I can turn it off but still attack with the same button if it doesn't. Any help would be greatly appreciated.

August 19 (2 years ago)

Edited August 19 (2 years ago)

If I get this right, you want to limit the following code to 9?

[[[[floor( ( [[1d20+@{cha-mod}+((@{level}+3)*2))/5)-1}}]]

Yes, the highest value that code can output being 9

August 19 (2 years ago)

Edited August 19 (2 years ago)

Ok so, you might want to try the "keep low" function like:

[[ {CODE,9D1}kl1 ]]D6

Your CODE would generate a number up to infinity (technically speaking), then the function would keep the lower number between your MATH, and 9, whichever is the lowest.

August 19 (2 years ago)

Edited August 19 (2 years ago)

I haven't tested your code to make sure it works proper, but if you manage it to work, replace CODE with it and voila ^.^

Thankyou, this worked out perfectly

August 20 (2 years ago)

Glad it worked for you ;oP

I'm not familiar with the 3.5 sheet, so I was crossing my fingers for you ^.^