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

Math question

1453433963

Edited 1453434002
Alright guys, I have a monk with Martial Arts. I thought I would be able to just alter the spellcasting cantrips leveling code to be able to code it by itself. [[((@{level} + 1) / 6 + 0.5)d1]] <--- works for the levels: 1 from 1-4, 2 from 5-10, 3 from 11-16, 4 from 17-20 (Made this a d1 for testing purposes). I feel like this code below should work, but it is going up to a d5 instead of d4 at level 4. and its still a d5 at level 5 instead of d6. [[1d((((@{level} + 1) / 6 + 0.5) * 2) + 2)]] <--- NEED d4 from 1-4, d6 from 5-10, d8 from 11-16, d10 from 17-20 If someone can please help me here, it would be much appreciated. EDIT: I'm currently using the 5e shaped character page if that makes a difference for you.
1453435743

Edited 1453436492
1d((((@{level} + 1) / 6 + 0.5) * 2) + 2) is equal to 1d(((@{level} + 1) / 6) * 2 + 3) which is effectively 1d(round((@{level} + 1) / 6) * 2 + 3) As you've experienced, the round() function is difficult to work with, so you'll probably want to use either the ceil() or floor() functions . 1d(ceil((@{level} + 2) / 6) * 2 + 2) or 1d(4 + floor((@{level} + 1) / 6) * 2) should work out for you.
1453436852

Edited 1453437090
Silvyre said: 1d((((@{level} + 1) / 6 + 0.5) * 2) + 2) is equal to 1d(((@{level} + 1) / 6) * 2 + 3) which is effectively 1d(round((@{level} + 1) / 6) * 2 + 3) As you've experienced, the round() function is difficult to work with, so you'll probably want to use either the ceil() or floor() functions. 1d(ceil((@{level} + 2) / 6) * 2 + 2) or 1d(4 + floor((@{level} + 1) / 6) * 2) should work out for you. When I do either (or both) of these, I just get an output of 1. Even when I change my level. and with the ceil, why does it have a + 2 on the end that the floor doesnt have EDIT: Seems like it is pulling the whole function down to a 1.
Oops, I forgot that ceil() and floor() functions that are within a computed roll must be nested within an additional set of inline roll brackets... [[ 1d[[ceil((@{level} + 2) / 6) * 2 + 2]] ]] [[ 1d[[floor((@{level} + 1) / 6) * 2 + 4]] ]] i.e. [[ 1d[[4 + floor((@{level} + 1) / 6) * 2]] ]]
1453437602

Edited 1453437709
Silvyre said: Oops, I forgot that ceil() and floor() functions that are within a computed roll must be nested within an additional set of inline roll brackets... [[ 1d[[ceil((@{level} + 2) / 6) * 2 + 2]] ]] [[ 1d[[floor((@{level} + 1) / 6) * 2 + 4]] ]] i.e. [[ 1d[[4 + floor((@{level} + 1) / 6) * 2]] ]] You are a lifesaver. Thank you for the continued help and this community is amazing! EDIT: Future reference, they both work.
You're welcome; I'm glad that I could help!