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

Macro for adding hit dice

Hey everyone, I'm trying to make a script that: -Checks if you're above level 9, and returns 1 for the number of hit dice. -For every 4th level after 9, it returns one more hit dice, so 2 for 13, etc. Right now, using the conditional statements section from the wiki, I have this: [[(ceil((level+1)/4)-1) + round((3)/(10*((level+1)-21+.1)))]] But I don't have any way to test it atm. Would something like this work, or am I on the wrong track? Thanks
1463341926

Edited 1463342420
I don't know about that exact function, but here's the one I would use: Number of hit dice: [[ (ceil((@{level} - 4 ) / 4) - 1) * {@{level} + d0}>9 ]] As you currently have, [[ (ceil((@{level} + 1) / 4) - 1) ]] counts the number of times @{level} has increased by 4, starting at 0th level. This is close to what we want, but not quite. Subtracting 5 from (@{level} + 1) starts this count at 5th level (such that it equals 1 at 9th level, etc.) [[ {@{level} + d0}>9 ]] equals 1 if @{level} ≥ 9. Otherwise, it equals 0. Multiplying by this is probably the easiest/most convenient way of setting the output to 0 if the minimum level (9) is not met. I realized just now that ceil((@{level} - 4) / 4) - 1 already equals 0 when 5 ≤ @{level} ≤ 8, and equals -1 when @{level} < 5. So, we could alternatively use a Keep / Drop function to restrict the output: [[ {(ceil((@{level} - 4) / 4), 0}kh1 ]]
[[floor((@{level}-1)/4)-1]]
Okieone Shinobi said: [[floor((@{level}-1)/4)-1]] Yup, that will work too (if you ignore the values of -1 and 0 for @{level} < 9).
Thanks for the help! I feel a little bad asking for more, but it turns out the criteria I gave were wrong. My friend actually needs it to start at 6 if they're below level 9, and increase by 2 instead of 1 for every 4 levels.
1463383640

Edited 1463383922
Is it 8 at level 9? If so, how about this? [[ 6 + (ceil((@{level} - 4) / 4) - 1) * 2 * {@{level} + d0}>9 ]]
I think he's saying it's 6 at level 9, 8 at 13. So I guess I'd just change that 6 to a 4? Really appreciate the help
Ethan M. said: So I guess I'd just change that 6 to a 4? Exactly!