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

Calculating the rest

1648154260

Edited 1648154328
Greetings In a homebrew system of a friend of mine the number of dice is calculated. You take attribute A and attribute B divide that by 3. Every full point is a dice. The rest is calculated as a bonus on the check. Example: Attribute A = 3 Attribute B = 3 (3+3)/3 = 2,00 So two dice and a bonus of zero. Attribute A = 3 Attribute B = 4 (3+4)/3 = 2,33 So two dice, the rest is 1 point and so the check is then 2d+1 I've tried a few things and can't get this to work as an attribute in my character sheet. Can someone please help me with this? Best regards
1648173616
GiGs
Pro
Sheet Author
API Scripter
What do you mean by needing it as an attribute? Wont you need it as two attributes, the number of dice and the bonus? You can calculate each as follows: Number of dice: floor((A+b)/3) Leftover: (A+b) % 3 Those assume you are doing macros, or autocalc fields. If doing it in a sheet worker, the codeis a bit different.
Thank you very much! That worked great. Can you please explain me what the % does exactly? I've never seen this operator in Roll20 before.
Okay I have now come across a problem after all. Individually, your described method worked well, but when I want to use it as an ability in my character sheet, it doesn't really work. Here is what I did: &{template:default} {{name=@{selected|character_name}s Ini}} {{result=[[floor((@{selected|A}+@{selected|B})/3)d6+((@{selected|A}+@{selected|B})%3)+?{modifier|0}]]}} Any idea what I did wrong?
1648195453
GiGs
Pro
Sheet Author
API Scripter
The % is the modulo operator, or remainder function. You divide by a certain number, and it tells you what the remainder is after the division. Sometimes when you have something before a roll (d6), normal brackets ( ) aren't enough, and you have to enclose it in inline roll brackets [[ ]] to force the result to be treated as a number. This should work: &{template:default} {{name=@{selected|character_name}s Ini}} {{result=[[ [[floor((@{selected|A}+@{selected|B})/3)]]d6+((@{selected|A}+@{selected|B})%3)+?{modifier|0}]]}} You can use inline roll brackets to neaten up the output, so this will look better on mouseovers: &{template:default} {{name=@{selected|character_name}s Ini}} {{result=[[ [[floor((@{selected|A} + @{selected|B}) / 3)]]d6+[[(@{selected|A} + @{selected|B}) %3 ]] + ?{modifier|0} ]] }} Note also you can use spaces to break up a long line and make it more readable in the macto or ability. Finally, if you are using that as an Ability and it's only meant to be used by the character whose sheet it is on, you can dispense with the selected| part, like so &{template:default} {{name=@{character_name}s Ini}} {{result=[[ [[floor((@{A} + @{B}) / 3)]]d6+[[(@{A} + @{B}) %3 ]] + ?{modifier|0} ]] }} For Abilities (and only abilities) you can skip providing a name or selected, and it will use the stats found on that character.
Thanks a lot, that worked like a charm and the tip with the spaces and the extra brackets was genius. Have a wonderful day!