The Will to Macros

The excellent MapTool full of useful features. One of which is the ability to associate macros with tokens - particularly useful it 4E D&D, since the maximum number of different attacks a character can have is less than 10.

Sadly, the documentation is somewhat sparse. Let's remedy that, with a worked example: writing Graham Tom's basic attack macro.

So, at its simplest, a basic attack is d20 + Str modifier + 1/2 level + proficiency vs AC, with [W] + Str mod damage. Graham Tom wields a longsword (weapon die: d8) and has Str 16 (modifier +3). This gives us:

Attack [d20 + 3 + 1 + 3]
Damage [d8 + 3]

We can parametrise this; MapTool allows you to define the attributes of a token, so the parametrised attack looks like:

Attack [d20 + floor((Strength - 10)/2) + floor(Level/2) + 3]
[d8 + floor((Strength - 10)/2)]

Again, this is sub-optimal: a natural 20 on the to-hit is a critical, which does maximum damage. We can get this behaviour using MapTool's ability to assign variables, and the fact that eq(var, 20) = 1 iff var = 20 and 0 otherwise.

I'm not sure how to suppress output from these macros, and MapTool seems to evaluate only the first full expression in [ ]. Feel free to remedy these flaws in the macro, which ends up as:

Attack: Roll [v=d20] + modifiers = [v + floor((Strength-10)/2) + floor(Level/2) + 3]
Damage: [(eq(v,20)*8 + ne(v,20)*d8) + floor((Strength-10)/2)]

So, we can see the unmodified roll, the final result, and this correctly calculates the damage in the event of a critical.
comments powered by Disqus