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

Query to roll die dependent on Prof bonus

I'm trying to write a query for a Soft Crit that will roll a different die depending on what the proficiency bonus is, ie if @pb is 1 roll 1D4, if @pb is 2 roll 1D6 ect ?{Soft Crit?|No, |Yes, + @{pb}} My coding is really limited, ive got it to add the Proficiency bonus on a yes, but is it possible to have it roll a die if the @{pb} is 1?
1719320424
timmaugh
Pro
API Scripter
You should be able to make use of the Prefix Trick to make this work. You'd want an attribute for each of your outcomes. Since you're working with just numbers (and you might need to work with numbers elsewhere, at some later point), you might want to prefix the name of the attribute (unrelated to the previx trick) to include the "pb" attribute name. So a series of attributes like this: pb1        | 1d4 pb2        | 1d6 pb3        | 1d8 ...etc. Then you'd create a prefix attribute: prefix     | @{ And you could get the correct die like this (from the character sheet): @{prefix}pb@{pb}} ...or, from anywhere else where you have to include the character name as a part of it: @{Bob|prefix}Bob|pb@{Bob|pb}} It seems your query was already a part of an inline roll (since the YES return starts with a + sign), so if you use the above setup, you should be able to do what you want.
1719327436
Gauss
Forum Champion
Hi DM,  While Timmaughs solution should work there is a simpler method that can be engineered in macro form. Alternate method: ?{Soft Crit?|No,0|Yes,d[[2+@{pb}*2]]} But for that method the entire progression is needed as there is a problem at PB = 6. See progression below 1 = d4 2 = d6 3 = d8 4 = d10 5 = d12 6 = d? Also, is this for D&D 5e? If so, doesn't PB start at 2? If that is the case I would recommend something like:  2 = d4 3 = d6 4 = d8 5 = d10 6 = d12
Hi Guass, yes its for 5e, that was just a late night oversight from me. the  d[[2+@{pb}*2]], is this saying roll a dice that equals (2+proficiency bonus(2) = 4) * 2 = D8 Have just run a test sheet and +  ?{Soft Crit?|No,0|Yes,d[[@{pb}*2]]} in the damage field works perfectly as you only need to multiply the @pb by 2 to make the below list of D rolls 2 = d4 3 = d6 4 = d8 5 = d10 6 = d12