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

Damage based on target attribute [macro request/help] (D&D 5e)

1556749469

Edited 1556750836
Hi everyone. I think this'll be easy for most of you, but I'm having trouble with a macro. I want an attack of a creature to deal ( 2d8 + 4 + the Constitution modifier of the target or 1 whichever is higher ) in necrotic damage. How'd you guys do this? i nearly succeeded, but I'm struggling with the conditional part (i.e. Constitution mod or 1...). For now I'm using 2d8+4 + @{target|Target1|constitution_mod} though if the Constitution modifier of the target is negative it will reduce the total damage. Thanks in advance.
1556757097
The Aaron
Roll20 Production Team
API Scripter
[[ { 2d8+4 + @{target|Target1|constitution_mod}, 1d1}kh1 ]]
The Aaron said: [[ { 2d8+4 + @{target|Target1|constitution_mod}, 1d1}kh1 ]] Thank you very much. Can you explain what you did?
1556759457
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm not the Aaron (hardly!) but that's called grouping rolls . It allows you to  perform a series of rolls, and then compare each roll to a common check (like a success roll). The 1d1 is in there because you can't compare integers. However 1d1 will always result in 1. You could also do 0d0+n, where n is whatever static value you want. The kh1 after the group tells the roller to keep the highest 1 roll. It will never return less than 1.
1556761707
The Aaron
Roll20 Production Team
API Scripter
Thanks Keith, I was on my phone between kid things. =D  One thing to note is that if the grouping is only integers, you can use an integer constant, so: [[ {3+@{someIntegerAttribute}, 1}kh1 ]] Basically, if there are dice, they must all have dice.
1556762073
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That is something I have now learned. Thanks!