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 .
×

Roll Query & Division

I've been trying to make an ability. For an Ancestral Weapon upgrade called Hardy - "You can use an action to spend up to half your hit dice, recovering that much health. You must complete a long rest before you can use this ability again." I've been trying to use a roll query in the ability since you must first choose how many hit dice to spend.  I don't want to hard code the numbers in as I'd have to change it after every level. My biggest issue so far is that any time I try to divide or minus from a called attribute it fails to perform the mathematical operation. It currently does provide a query and rolls a dice but only the name gets sent to the chat. @{hit_dice} has a value of 9 and @{hitdietype} has a value of 10. &{template:simple} {{rname=Hardy}} ?{Spend up to half your hit dice. Max @{hit_dice}/2|@{hit_dice}/2,}} {{r1=[[@{hit_dice}/2-1d@{hitdietype}]]|@{hit_dice}/2-1,}} {{r1=[[@{hit_dice}/2-1d@{hitdietype}]] }}  
1702197045
Gauss
Forum Champion
Hi spyhero100,  Could you provide a screenshot of what you are seeing? I'd like to confirm it is the same problem I am seeing. 
With this code, your player can input any number that they want, but the actual number of hit dice that are rolled will never exceed half of their max hit dice (rounded down). &{template:simple} {{charname=@{selected|character_name}}} {{rname=Hardy}} {{normal=1}} {{mod=Max [[floor(@{selected|hit_dice}/2)]]d@{selected|hitdietype}}} {{r1=[[[[{?{How many hit dice? Max half @{selected|hit_dice}},[[floor(@{selected|hit_dice}/2)]]}kl1]]d@{selected|hitdietype}]]}} Some errors I noticed in your code: You can't have any math operations inside of a query, as they get processed after the query . You had extra double right braces that were replaced with html entities, but they didn't match any opening double left braces. You didn't include the {{normal=1}} to make the {{r1}} field display. You need to have a completed mathematical operation using double braces in front of the 'd' for each dice roll.
Thank you that code worked great. Jarren said: You can't have any math operations inside of a query, as they get processed after the query . I'm a little disappointed that math operations can't work.