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
This post has been closed. You can still view previous posts, but you can't post any new replies.

How to add half of the result of a roll, to the roll its self or create another result

1465677360

Edited 1465677397
I would like to know how to add half of the result of a roll onto the roll in a macro (i already know how to make a drop down so that i can choose between the spell and the empowered version, i just would like to know this little bit to finish my macros and make them a bit more simple so nothing has to be done other than press the button when using feats like empower spell that add half or double the result of your damage. Thanks
1465679001

Edited 1465679097
You can multiply the roll by 1.5 to accomplish this. e.g. [[ 1d10 * 1.5 ]] If you'd like to round down after multiplication, you can add a floor() function . e.g. [[ floor(1d10 * 1.5) ]]
Silvyre said: You can multiply the roll by 1.5 to accomplish this. e.g. [[ 1d10 * 1.5 ]] If you'd like to round down after multiplication, you can add a floor() function . e.g. [[ floor(1d10 * 1.5) ]] It doesnt seem to work quite correctly,                &{template:default} {{name=Magic Missile}} {{damage=[[ floor(1d4 * 1.5+1) ]]}}  Is that right because when i rolled a nat 4 it just gave me a 5 and did nothing to the roll??? Also tried the +1 before and after the * 1.5 and i tried thout the spaces between the brackets and the square brackets
Try [[ floor(1d4 * 1.5) + 1]]. That works for me.
Rabulias said: Try [[ floor(1d4 * 1.5) + 1]]. That works for me. Wll ideally i would like the +1 before the  * 1.5 because im wanting to add half of the full result rather than adding half to the 1d4 and then adding 1  Tried this but it didnt work [[ floor(1d4+1 * 1.5) ]], what am i doing wrong??
1465750154

Edited 1465750305
This seems to work. &{template:default} {{name=Magic Missile}} {{damage=[[ floor(1d4+1) * 1.5) ]]}}
Garrett V. said: This seems to work. &{template:default} {{name=Magic Missile}} {{damage=[[ floor(1d4+1) * 1.5) ]]}} It totally works, thanks buddeh, now to figure out how to round
1465750594

Edited 1465750630
FYI, floor(1d4 * 1.5+1) = floor(1d4 * 1.5) + 1, and floor(1d4+1 * 1.5) = floor(1d4+1.5) due to the mathematical order of operations . You'll want floor((1d4 + 1) * 1.5) = floor(1d4 * 1.5 + 1.5), as Garrett V. pointed out. Happy rolling!
BennyBoy S. said: It totally works, thanks buddeh, now to figure out how to round Check out: Rounding Rolls and Math Functions
Silvyre said: BennyBoy S. said: It totally works, thanks buddeh, now to figure out how to round Check out: Rounding Rolls and Math Functions Am i understanding this wrong, because it doesn't seem to work for some reason " floor() which will always round the number down (e.g. 5.7 becomes 5), ceil() which will always round the number up (e.g. 5.1 becomes 6), and round() which will always round to the nearest whole number (e.g. 4.4 becomes 4 and 4.5 becomes 5)." As you can see from the picture, it just does the same as floor for some reason???????? Anyone know how to use the round function??
1465751506

Edited 1465751815
You're missing an opening parenthesis right after "round" (you currently have two closing parentheses, but only one opening one): round((1d4 + 1) * 1.5) FYI, this will always round up, while D&D usually calls for rounding down (i.e. using the floor() function).
oh kk, il just use floor then
OK everything is working now, you just have to add more brackets over everything, thanks guys, *******************THREAD CLOSED******************