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

Hit/No Hit Macro using BattleTech Rules

Hey, everyone. I'm prepping to run a BattleTech campaign, and to help my players I am making macros for them to streamline combat as much as possible. BattleTech's hit/no hit rules are fairly simple: To hit, you must meet or exceed the enemy's to-hit number, which is always 4 plus modifiers for movement and range. Think of the positive modifiers below as adding to the target's "AC". The flowchart for a certain player's Gauss Rifle looks like this: 1. Ask Player's Movement this Turn         Remained Stationary, +0         Walked, +1         Ran, +2         Jumped, +3 2. Ask Player's Weapon Range to Target (In Hexes)         Short, +0         Medium, +2         Long, +4 3. Ask Attacker's Movement this Turn (In Hexes)         0-2, +0         3-4, +1         5-6, +2         7-9, +3         10-17, +4 I would then like to combine all the relevant modifiers together, then roll 2d6 - 4. If the result is greater than or equal to the sum of the modifiers, I would like it to return something like "Hit!" into the chat, or "Miss!" if it is less than the target number. If that doesn't work I'd just like it to print 4 + the Modifier Sum into the chat, and let the player roll 2d6 themselves. I've got the query itself done (I think), but I'm at a bit of a loss as to where to go from here: [[ ?{Your movement this Turn?|         Remained Stationary, 0|         Walked, 1|         Ran, 2|         Jumped, 3 } ]] + [[ ?{Distance to Target?|         Short, 0|         Medium, 2|         Long, 4 } ]] + [[ ?{Attacker's movement this Turn?|         0-2, 0|         3-4, 1|         5-6, 2|         7-9, 3|         10-17, 4 } ]] Where do I go from here?
1532628905
The Aaron
Pro
API Scripter
something like: [[ 2d6>[[ 4 + ?{Your movement this Turn?|Remained Stationary,0|Walked,1|Ran,2|Jumped,3 } ]] + [[ ?{Distance to Target?|Short,0|Medium,2|Long,4 } ]] + [[ ?{Attacker's movement this Turn?|0-2,0|3-4,1|5-6,2|7-9,3|10-17,4 } ]] ]] should give you a 1 success(es) or 0 successes. To get an actual text output is a little harder without the API (pro perk).
1532629186
GiGs
Pro
Sheet Author
API Scripter
You can use > to represent equal or greater than, but if you have a calculation on either side of the > you need to enclose it in [[ ]] inline roll brackets. Also make sure you dont have a space on either side of the >. (You can spaces within inline roll brackets.) I'll use [[query]] to represent the query you have above, to save retyping it. This should work: /roll  2d6>[[4 + [[query]] ]] or if you just want a 0 or 1 outpit, [[2d6>[[4 + [[query]] ]] ]]
1532629489

Edited 1532629540
Thanks a bunch! Only issue I'm having is that, rather than use the sum of the 2d6 to determine success, it's using each individual die. There a fix for that? G G said: You can use > to represent equal or greater than, but if you have a calculation on either side of the > you need to enclose it in [[ ]] inline roll brackets. Also make sure you dont have a space on either side of the >. (You can spaces within inline roll brackets.) I'll use [[query]] to represent the query you have above, to save retyping it. This should work: /roll  2d6>[[4 + [[query]] ]] or if you just want a 0 or 1 outpit, [[2d6>[[4 + [[query]] ]] ]]
1532629753
The Aaron
Pro
API Scripter
Oh that, I aways forget about that. [[{0,2d6}>[[4 + [[query]] ]] ]]
1532629978

Edited 1532630043
GiGs
Pro
Sheet Author
API Scripter
Just putting the 2d6 in inline brackets works too and is simpler syntax. /roll  [[2d6]]>[[4 + [[query]] ]] Edit: never mind, apparently it doesnt!
[[{0,2d6}>[[4 + [[ ?{Your movement this Turn?|Remained Stationary, 0|Walked, 1|Ran, 2|Jumped, 3} ]] + [[ ?{Distance to Target?|Short (3-7), 0|Medium (8-15), 2|Long (16-22), 4} ]] + [[ ?{Attacker's movement this Turn?|0-2, 0|3-4, 1|5-6, 2|7-9, 3|10-17, 4} ]] ]] ]] returns nothing in chat, what's the /r method for grouping the 2d6 together? The Aaron said: Oh that, I aways forget about that. [[{0,2d6}>[[4 + [[query]] ]] ]]
1532630317
The Aaron
Pro
API Scripter
/r {0,2d6}>[[4 + [[query]] ]]
1532630366

Edited 1532630385
The Aaron
Pro
API Scripter
Ah.  Need to do: [[{0d0,2d6}>[[4 + [[query]] ]] ] "Cannot mix M and sum rolls in a  roll group"
Awesome, thank you! It's successfully returning 1s and 0s that are true to the rolls. Final question, is there any way to implement a second > statement that returns success or no success? Also, is there a method to roll several sets of 2d6, for say a bay of 4 identical weapons with separate attack rolls? The Aaron said: Ah.  Need to do: [[{0d0,2d6}>[[4 + [[query]] ]] ] "Cannot mix M and sum rolls in a  roll group"
1532631751

Edited 1532632049
GiGs
Pro
Sheet Author
API Scripter
You can add extra 2d6's in the group roll aaron added at the start. Like so: /roll {0d0,2d6,2d6,2d6}>[[4 + [[query]] ]] or [[ {0d0,2d6,2d6,2d6}>[[4 + [[query]] ]] ]] As long as they are against the same target number, it should work fine. Note: if you have more than one roll in that initial group ({0d0,2d6,2d6}) you dont need to the 0d0 part. That's just there in the first roll to trick roll20 into treating the { } section as a group of dice rolls. But there's no harm in leaving it there, too, as it might make copying & pasting between different macros easier to keep the format the same.