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

BECMI Magic missile issue

1637136371

Edited 1637143684
Hello, I am actually playing BECMI D&D and I was wondering if there is a way to auto-calculate the number of magic missiles available to cast. The rule says: For each 5 levels the caster has above 1st, two more missiles are created (i.e. 1 missile at 1st level, 3 missiles at 6th level, 5 missiles at 11th...) The macro I am actually using for this spell prompts the level of the caster (1-5, 6-10, 11-15 and so on) in order to know how many missiles are available, but I would like to automate this step with the @{level} attribute, if possible. While recalling some easy math formula, I came out with something like [[0.4*@{level}+0.6]] but I soon realized it only works if you are at 6th, 11th, 16th level and on, not in the levels between since I'm dealing with a step function. How should I fix it in order to make it always work, no matter the level you are on?
1637144386

Edited 1637144432
Oosh
Sheet Author
API Scripter
Something like this is what you want: [[1 + floor((@{level}-1)/5)*2]] If you start with the level step - in this case it's 5. So at the core of it you'll need floor( @{level} / 5 ). But we want the first tick to be at level 6, not at 5, so it becomes floor( (@{level}-1) / 5 ) This gives the correct level bumps, but it's an increase of 2 each time, so multiply that whole thing by 2: floor( (@{level}-1) / 5 )*2 And then just add the default 1 missile from levels 1-5: [[ 1 + floor( (@{level}-1) / 5 )*2 ]] Or... you can use ceiling instead of floor: [[ ceil( @{level}/5 )*2 - 1 ]] Similar theory - start in the middle with your rounding, and work it out from there. In this case ceil( @{level / 5 ) already works by giving us the first increase at level 6, making it a bit simpler.
I was completely out of track on this! Now I got it, thank you Oosh very much for the step-by-step explanation :-)