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 .
×
May your rolls be chill this holiday season!
Create a free account

limit number of dice

Hi, I would like to limit the number of dice to 10. How can I do that in a macro? I have seen somebody suggesting the keep lowest function but that is as unfair as keeping the highest numbers. So something like 'min(actual,cap)d10 + (actual % cap) * 5' is what i am looking for.
1658835994
David M.
Pro
API Scripter
min(actual,cap)d10 can be written as [[ [[{actual,cap}kl1]]d10 ]]. If your "actual" is a die roll, it would be something like this:  [[ [[{3d6,0d0+10}kl1]]d10 ]] If your "actual" is a static number (stored in an attribute, say), then this should work: [[ [[{@{selected|StaticNumberAttr},10}kl1]]d10 ]] AFAIK, kl1 needs two values of the same type (so rolls vs rolls or static vs static), hence the 0d0+10 in the first example. Not sure what the modulo part is doing, but assuming you need that as well, I think this should do it (using the 3d6 example):  [[ [[ [[{3d6,0d0+10}kl1]]d10 ]] + [[[[3d6]]%10*5]] ]] You could prove it to yourself with this: &{template:default} {{name=Max 10 dice}} [[ [[ [[{3d6,0d0+10}kl1]]d10 ]] + [[[[3d6]]%10*5]] ]] {{Total=$[[4]]}} {{num d10's=$[[0]]}} {{min(actual,cap)d10=$[[1]]}} {{"actual" 3d6=$[[2]]}} {{modulo part=$[[3]]}} 
Hey David, This looks pretty good! I did not know that the `kl` can be used with static numbers. I think you gave me what I need. Now I need to read up on the templates and how to actually call them. Best, Jan
1658843531

Edited 1658847464
Can anyone explain what I am doing wrong here: `/roll [[{[[@{body}+@{ability}+@{unarmed}]],10}kl1]]d10+[[@{body}+@{ability}+@{unarmed}]]%10*5+5` it throws the error `TypeError: nn is undefined` Update 1: It is now working /r [[{[[@{Yoash Lasil|body}+@{Yoash Lasil|ability}+@{Yoash Lasil|unarmed}]],10}kl1]]d10+[[@{Yoash Lasil|body}+@{Yoash Lasil|ability}+@{Yoash Lasil|unarmed}]]%10*5+5 I have this as macro that can be called with # now i guess that the `[[@{Yoash Lasil|body}+@{Yoash Lasil|ability}+@{Yoash Lasil|unarmed}]]` could be put in some sort of template of the character sheet?! And I have read that the person can be linked so can remove the `name|` Update 2: I think i want to use abilities instead of templates:-) Now I wonder how to nest templates: i have body_ability which is ´@{Yoash|body}+@{Yoash|ability}´ now I would like to use this in body_ability_unarmed but i can not get that one right I think the best try is: %{Yoash|body_ablilty}+@{Yoash|unarmed} but this gives me the nn error again