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 .
×
Advertisement Create a free account

To Hit - Roll Table

1496740108

Edited 1496743448
I'm looking for a variation of the solution given in: <a href="https://app.roll20.net/forum/post/4535214/to-hit-roll-table/" rel="nofollow">https://app.roll20.net/forum/post/4535214/to-hit-roll-table/</a> For context: It's for Warhammer Fantasy Battle. One character will swing at another (rolling a D6), and it will compare their attributes (in this case Weapon Skill, and in another macro, Strength VS Toughess), consult the chart, and output the result. The function I'm after is the same, I just need different variables, given below: To Hit: Target's Weapon Skill 1 2 3 4 5 6 7 8 9 10 Attacker's Weapon Skill 1 4 4 5 5 5 5 5 5 5 5 2 3 4 4 4 5 5 5 5 5 5 3 3 3 4 4 4 4 5 5 5 5 4 3 3 3 4 4 4 4 4 5 5 5 3 3 3 3 4 4 4 4 4 4 6 3 3 3 3 3 4 4 4 4 4 7 3 3 3 3 3 3 4 4 4 4 8 3 3 3 3 3 3 3 4 4 4 9 3 3 3 3 3 3 3 3 4 4 10 3 3 3 3 3 3 3 3 3 4 To Wound: Target's Toughness 1 2 3 4 5 6 7 8 9 10 Attacker's Strength 1 4 5 6 6 6 6 6 6 6 6 2 3 4 5 6 6 6 6 6 6 6 3 2 3 4 5 6 6 6 6 6 6 4 2 2 3 4 5 6 6 6 6 6 5 2 2 2 3 4 5 6 6 6 6 6 2 2 2 2 3 4 5 6 6 6 7 2 2 2 2 2 3 4 5 6 6 8 2 2 2 2 2 2 3 4 5 6 9 2 2 2 2 2 2 2 3 4 5 10 2 2 2 2 2 2 2 2 3 4 I just plain can't wrap my little brain around Silvyre's macro, any help is greatly appreciated. For the curious, I will implement it into this macro (which currently contains the macro previously provided by Silvyre, with the other variables): &{template:default} {{name=**@{selected|name}** attacks **@{target|name}** in melee}} {{Attacker's Weapon Skill:=[[@{selected|ws}]]}} {{Defender's Weapon Skill:=[[@{target|ws}]]}} {{Hits on a:=[[ [[2 + {3 - @{selected|ws}, 0}kh1]] + {[[2 + [[{-1, 1}=@{selected|ws}]] + {@{selected|ws} - 7, 0}kh1]], [[3 + [[{1, 2, 2}=@{selected|ws}]] + {@{selected|ws} - 3, 0}kh1]], [[11 - 2 * {2, 2, 3, 3, 4}=@{selected|ws}]], [[11 - {-1, 3}=@{selected|ws}]]}&lt;@{target|ws} ]] or higher}}{{Successful Hits:=⚔[[?{Number of attacks|0}d6&gt;[[ [[2 + {3 - @{selected|ws}, 0}kh1]] + {[[2 + [[{-1, 1}=@{selected|ws}]] + {@{selected|ws} - 7, 0}kh1]], [[3 + [[{1, 2, 2}=@{selected|ws}]] + {@{selected|ws} - 3, 0}kh1]], [[11 - 2 * {2, 2, 3, 3, 4}=@{selected|ws}]], [[11 - {-1, 3}=@{selected|ws}]]}&lt;@{target|ws} ]]]]⚔}} How it works: two tokens in play need the "name" and "ws" attributes, the macro asks only for the number of attacks, then rolls that many D6's, and by comparing their Weapon Skills, tells you how many were successful. Thanks again!
1496753270

Edited 1496753370
Silvyre
Forum Champion
The to-wound table is a lot simpler to express because it's perfectly regular/linear: [[ {{@{target|tns} - @{str} + 4, 2}kh1, {6}}kl1 ]] The {}kh1 and {}kl1 functions bound the output between 2 and 6; the +4 offsets the difference between the target's toughness and attacker's strength to align with the values in the table. Another way to express this macro that might be more intuitive (factoring out a common +2 from the first macro): [[ 2 + {{@{target|tns} - @{str} + 2, 0}kh1, {4}}kl1 ]]
To Wound works perfectly, and I understand those functions now. But the less-than-linear To Hit chart is still out of my grasp. Could I bother you to do one more revision? It's subtle, but the numbers on my To Hit chart differ slightly from his.
1496766088
Silvyre
Forum Champion
Give this a shot for the to-hit table: [[ 3 + {@{ws}, @{ws} * 2 + 1}&lt;@{target|ws} ]] Your to-hit table is also much simpler to express than the other.
Works like a charm, thanks for all your help.
1496803999
Silvyre
Forum Champion
Happy rolling!