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

Can't get macro to drop critical failures in a dice pool roll or auto-calc damage from success count

1782062925

Edited 1782063000
What I'm trying to do: Automate the attacking process of my game by resolving the amount of hits within a dice pool. The mechanic works like this: Make a Target Number based on range and target range mulitiplier, e.g. 26. Roll Xd20 where X is the amount of attacks the weapon makes, e.g.  5. Any natural 1s are misses regardless of modifiers, any natural 20s are hits regardless of if they're lower than the target number. The macro should report the Target Number in one field, use that in the roll, then display the amount of hits and then automatically calculate damage based on that weapon's damage stat plus multipliers. The Target Number and damage multiplier are queries. The problem: I can't figure out how to make the macro drop critical failures and always count crit successes. I also don't know what to do to make the macro automatically count the hits and multiply the given damage by that number. Current Test Macro: ["(hits)" is a placeholder] &{template:default} {{Name=Test Rifle}} {{Target Number=[[?{Target Number}]]}} {{Hits=[[5d20cs20cf1>?{Target Number}]]}} {{Damage=[[(7+@{Damage Bonus}*?{Damage Multiplier})*(hits)]]}}
1782070551

Edited 1782070593
Gauss
Forum Champion
Hi Lucifina,  Do you need it to do double damage on a 20? If so, what does double damage look like? two hits? Something else? 
1782075106

Edited 1782075152
Gauss said: Hi Lucifina,  Do you need it to do double damage on a 20? If so, what does double damage look like? two hits? Something else?  I don't, I just need crits to guarantee a hit even if the result is below the target number. Damage isn't affected by them. Increased damage hits will be handled by manual aiming at critical locations instead of RNG.
1782076774

Edited 1782077377
Gauss
Forum Champion
To make sure I understand:  Lets say the threshold to hit is 11+ On a 1 to 10 it is a miss On a 11 to 20 it is a hit.  In the circumstance that a 1 might otherwise be a hit a 1 is still a miss.  In the circumstance that a 20 might otherwise be a miss a 20 is still a hit.  Do I understand correctly? Also, can you confirm your damage calculation? It appears to be:  (7+damage bonus*damage multiplier)*hits Just want to make sure that it shouldn't be:  (7+damage bonus)*damage multiplier *hits  ie: does the damage muliplier apply to the 7? Or only to the damage bonus?
1782079541

Edited 1782081736
Gauss
Forum Champion
Here you go: (7+Damage bonus)*damage multiplier:  &{template:default} {{Name=Test Rifle}} {{Target Number=[[?{Target Number}]]}} [[[[?{Number of Dice?}d20>[[{[[{?{Target Number},20}kl1]],2}kh1]]]]*[[(7+@{Damage Bonus})*?{Damage Multiplier}]]]] {{Hits=$[[4]]}} {{Damage=$[[5]]}} 7+(Damage bonus*damage multiplier):  &{template:default} {{Name=Test Rifle}} {{Target Number=[[?{Target Number}]]}} [[[[?{Number of Dice?}d20>[[{[[{?{Target Number},20}kl1]],2}kh1]]]]*[[7+@{Damage Bonus}*?{Damage Multiplier}]]]] {{Hits=$[[4]]}} {{Damage=$[[5]]}} How it works:  Assuming my understanding above is correct, the limit should be placed on the target number.  A target number of less than 2 is really 2 since a 1 is always a failure.  A target number of higher than 20 is really a 20 since a 20 is always a success.  So the calculation  [[{[[{?{Target Number},20}kl1]],2}kh1]]]] limits whatever you set for your target number to 2 or 20. A target number lower than 2 becomes a 2. A target number higher than 20 becomes a 20.  Note: if you want to include modifiers (1d20+5 for example) then put them on the target number side.  [[{[[{(?{Target Number}-(modifiers)),20}kl1]],2}kh1]]]] The rest of it is success/fail checks and pulling the values out into the template at the proper spots. 
1782096638

Edited 1782097724
Gauss said: Here you go: (7+Damage bonus)*damage multiplier:  &{template:default} {{Name=Test Rifle}} {{Target Number=[[?{Target Number}]]}} [[[[?{Number of Dice?}d20>[[{[[{?{Target Number},20}kl1]],2}kh1]]]]*[[(7+@{Damage Bonus})*?{Damage Multiplier}]]]] {{Hits=$[[4]]}} {{Damage=$[[5]]}} 7+(Damage bonus*damage multiplier):  &{template:default} {{Name=Test Rifle}} {{Target Number=[[?{Target Number}]]}} [[[[?{Number of Dice?}d20>[[{[[{?{Target Number},20}kl1]],2}kh1]]]]*[[7+@{Damage Bonus}*?{Damage Multiplier}]]]] {{Hits=$[[4]]}} {{Damage=$[[5]]}} How it works:  Assuming my understanding above is correct, the limit should be placed on the target number.  A target number of less than 2 is really 2 since a 1 is always a failure.  A target number of higher than 20 is really a 20 since a 20 is always a success.  So the calculation  [[{[[{?{Target Number},20}kl1]],2}kh1]]]] limits whatever you set for your target number to 2 or 20. A target number lower than 2 becomes a 2. A target number higher than 20 becomes a 20.  Note: if you want to include modifiers (1d20+5 for example) then put them on the target number side.  [[{[[{(?{Target Number}-(modifiers)),20}kl1]],2}kh1]]]] The rest of it is success/fail checks and pulling the values out into the template at the proper spots.  Sorry for not getting back sooner, busy day. I should have previously noted in my post that there are, in fact, three separate ways to add modifiers to the d20 rolls that determine hits: One flat bonus from the weapon itself, a flat bonus from the player character, and multiplier from temporary buffs. The right damage formula would be ((7+Damage bonus)*damage multiplier)*hits which if the math obeys pemdas how I think it does, should be identical to the first one you gave. I don't think I'll need the amount of dice query since the macro will be specific to each weapon which have static shot counts, but my bigger concern is the setting to 2 or 20 part. Enemies will be able to have a much  higher target number than that. It doesn't look like it's going to break, but I don't know if you're aware of any weaknesses it might have that I'm not. I've also realized another thing about the damage formula: It will need to be reduced by various defenses as well. Enemy armor directly subtracts from anti-personnel damage, but that varies based on enemy, and then partial cover protects from half of damage per hit. The first is easy to make a query, but I don't know how to format the second one. There are also two different damage types: Personnel and Armor, which weapons have different values for. Do you think you could provide a more in depth explanation of what all the syntax is doing? Especially the $[[4]] and $[[5]] parts. For future reference.
1782103139
Gauss
Forum Champion
$[[4]] and $[[5]] are reusing rolls (which is a bit of a misnomer as it is really just calling the results of a roll).&nbsp; <a href="https://wiki.roll20.net/Reusing_Rolls" rel="nofollow">https://wiki.roll20.net/Reusing_Rolls</a> The setting 2 or 20 is foolproof, it cannot get a hit if it is a 1 or lower, and it cannot miss if it is a 21 or higher.&nbsp; As for attack modifiers, I gave you the section of code for that.&nbsp; As for damage formula, you can modify your damage formula as desired.&nbsp; This is the damage portion:&nbsp; [[(7+@{Damage Bonus})*?{Damage Multiplier}]] If you want to subtract the armor put it in the appropriate location (whatever works for your game system), as long as it is inside the outer [[ ]] of the damage calculation.&nbsp; If you want to cut the damage in half you can do that by multiplying by 0.5 right after the damage multiplier. Again, inside the outer [[ ]] of the damage calculation.&nbsp; Note: if you add any [[ ]] to the entire string the reusing rolls calls will have to be refigured as it could change their order.&nbsp;
1782141441

Edited 1782141561
Gauss said: $[[4]] and $[[5]] are reusing rolls (which is a bit of a misnomer as it is really just calling the results of a roll).&nbsp; <a href="https://wiki.roll20.net/Reusing_Rolls" rel="nofollow">https://wiki.roll20.net/Reusing_Rolls</a> The setting 2 or 20 is foolproof, it cannot get a hit if it is a 1 or lower, and it cannot miss if it is a 21 or higher.&nbsp; As for attack modifiers, I gave you the section of code for that.&nbsp; As for damage formula, you can modify your damage formula as desired.&nbsp; This is the damage portion:&nbsp; [[(7+@{Damage Bonus})*?{Damage Multiplier}]] If you want to subtract the armor put it in the appropriate location (whatever works for your game system), as long as it is inside the outer [[ ]] of the damage calculation.&nbsp; If you want to cut the damage in half you can do that by multiplying by 0.5 right after the damage multiplier. Again, inside the outer [[ ]] of the damage calculation.&nbsp; Note: if you add any [[ ]] to the entire string the reusing rolls calls will have to be refigured as it could change their order.&nbsp; Thanks. It seems to be working. For the damage reduction bit and the multiple damage types, is it possible to make something like an If/Then conditional? Such as asking if the target is armor or not, and if yes, use AT damage instead of AP damage. Or asking if the target is covered and if so, do 0.5x the total damage. Or would I need to make a separate macro for that?
Lucifina said: Thanks. It seems to be working. For the damage reduction bit and the multiple damage types, is it possible to make something like an If/Then conditional? Such as asking if the target is armor or not, and if yes, use AT damage instead of AP damage. Or asking if the target is covered and if so, do 0.5x the total damage. Or would I need to make a separate macro for that? It's very likely possible, using either several queries, or possibly attributes from the target's character sheet if you explain the mechanics. The best way to explain is to pretend that you are in person, rolling physical dice - how would you explain the full range of options that a player could possibly take in this situation?&nbsp;
1782148708

Edited 1782149398
Jarren said: Lucifina said: Thanks. It seems to be working. For the damage reduction bit and the multiple damage types, is it possible to make something like an If/Then conditional? Such as asking if the target is armor or not, and if yes, use AT damage instead of AP damage. Or asking if the target is covered and if so, do 0.5x the total damage. Or would I need to make a separate macro for that? It's very likely possible, using either several queries, or possibly attributes from the target's character sheet if you explain the mechanics. The best way to explain is to pretend that you are in person, rolling physical dice - how would you explain the full range of options that a player could possibly take in this situation?&nbsp; I would explain it like this: When a player moves their unit and chooses to attack with them, they have to pick a target. Then, they pick a part on that target. The target has a Target Number equal to the amount of hexes away it is from the attacker, multiplied by the Range Multiplier of the part the attacker is shooting at. For a headshot, you could say it's 2x, so a target 5 hexes away would have a target number of 10 for that. The enemy would do their evasion check, dodging the attack if they succeed, or if they fail the attack goes through. Then, the player would choose which weapon they're attacking with. They typically only have one weapon, maybe an attached subweapon, and grenades. For example, we'll use their main gun. Depending on the target they chose (whether it's considered a person or armor), they would use their weapon's AP damage (for a person) or AT damage (for armor). For a person, a gun would have a high AP damage. The player would roll all of the gun's shots as d20s, and compare them to the target number, then calculate damage based on that. The main choice made here in the moment is just what weapon to use on what target and which part of that target to aim at. If you had, say, a rifle that does a 5-shot burst, you'd roll 5d20 and each die that hits 10 or over would hit their head, which is their critical spot and would deal double the rifle's total damage after all modifiers. You might go from dealing 7 damage to 14, or if you got an attack boost of 100%, it'd be 28. And if you got an accuracy boost, you might get +5 to your d20 rolls for example, giving a solid 75% hit rate. The player could also use a grenade, which even if it misses will still explode where it lands and deal splash damage. Other options taken outside of this are positioning, such as the defender hiding behind partial cover, or either player using an ability of some kind that gives their unit a buff, such as double damage or double defense. That, and whether or not they leveled up that class of unit to the point that they get a flat bonus in a stat. Everything else is pure math or RNG. It's a wargame, so choices in strategy are the focus instead of stacking options on a single character.
1782177019
Gauss
Forum Champion
What would help is a breakdown of each option.&nbsp; Example:&nbsp; Option X = 0.5 Option Y = 1.0 Option Z = 2.0 Every option, every result of that option, to both attacks and damage. Then we can more readily suggest how to implement it.