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

If/Then?

I've looked all over and I haven't been able to find a conditional API. I'm playing DnD 5e and I was looking for something that would allow me to roll to-hit against the target's AC. More specifically, check if the roll is higher, and if so, roll damage. If possible, I would like to combine it with the alter bar script to also reduce health. I found a couple old posts mentioning the possability of an API, but no script I can find. Help?
You'd have to write a script to do that for you.
One doesn't exist, huh? That's a shame.
1423667171
Sungrass
Plus
Sheet Author
There is a mathematical way to do this specific thing without using the API, but it involves math. Specifically, multiplication. /roll [[{1d20+?{Modifier|0}}>?{DC|10}]]*(?{Damage|0}) Modifier is the bonus to your attack, DC is the number to hit (usually the AC of the target) and Damage is the total damage expression of the weapon, like 2d6+3. It will either spit out a 0 if the attack missed, or a damage number if it hit.
I suppose I could use that for attacks against the player, but how would that work against monsters who have different AC?
1423669644
Sungrass
Plus
Sheet Author
You would put in the AC of the monster. The limitation of Roll20's dice system (without using the API) means that you need to put in a number to roll against. If telling your players the AC of your monsters is a problem, then this won't be as useful.
1423669774

Edited 1423669818
-Edit- Calle answered it while I was typing :P
Yeah. That's why I was asking if I was just missing it. As far as script functions go, this seems like it would fairly simple, but I haven't written in years so I doubt I could hammer one out myself.
I use a macro, which whipers the AC of the target to me, the player attacking sees it, but they have attacked it, so they have earned the Ac, and the enmity of the target. /em @{selected|token_name} attacks @{target|token_name} hits AC: [[@{selected|bar3} - (1d20 + ?{Total Adjustments|0})]] /w GM @{target|token_name}'s AC: @{target|bar2}