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 macroing

Is it possible to set up a macro such that if a creature rolls an attack vs a target's ac the macro will auto roll damage or automatically perform an action if the attack is higher then the ac?
1433971847
The Aaron
Roll20 Production Team
API Scripter
There is not. The closest you can come is getting a purely success result: [[ {0d0,1d20+@{bonus}}>[[@{target|ac}]] ]] Something like that should tell you if they hit or not, but you'd have to look at the hover text to know the roll. Macros are really no more than a collection of commands you would type in chat, so the options for things you can do are mostly dice expressions, see the Dice Reference for more info.
1433972036
Gen Kitty
Forum Champion
There's two ways to make this happen. Route 1, via API. Powercards v3 recently added this ability. This requires the creator of the campaign in question have a Mentor-level subscription. Route 2, via roll templates. However , I don't know if this ability is part of the default roll template or if you need to make a custom roll template -- which requires a Mentor-level subscription.
The Aaron said: There is not. The closest you can come is getting a purely success result: [[ {0d0,1d20+@{bonus}}>[[@{target|ac}]] ]] Something like that should tell you if they hit or not, but you'd have to look at the hover text to know the roll. Macros are really no more than a collection of commands you would type in chat, so the options for things you can do are mostly dice expressions, see the Dice Reference for more info. When I am using this, what does the 0d0, signify or do? @GenKitty Alright, we will have to talk to see if we want to chip in to get mentor level. Thanks!
1433975935
The Aaron
Roll20 Production Team
API Scripter
Some operations require a group. I'm not certain that > is one of them, but I think it is. 0d0 is a 0 die, which is then part of the { } group along with the 1d20+@{bonus}. It automatically fails the test of >. It's written as 0d0 because a group must have a homogenous selection of values and the 1d20+@{bonus} is a die expression, so the 0 must be written as a die expression.
1433978297

Edited 1433978512
I wouldn't necessarily suggest it, because you'd have no way of knowing what the actual roll was (nested inlines only give you the total, you can't see the formula or any contained rolls), but you could multiply the above success-count formula by your damage formula to yield damage on hit and 0 on miss: [[ [[ {0d0, 1d20+@{bonus}}>[[@{target|ac}]] ]] * [[@{damage}]] ]] Like I said, I'd strongly advise against it because you have no way of knowing if there's a mistake in the formula. In practice, I find that just rolling to hit and damage in one macro, and ignoring damage for misses, works out fine: [[1d20+@{bonus}]] to hit (vs [[@{target|ac}]] AC) [[@{damage}]] damage Or better yet: @{template:default} {{name=Attack}} {{tohit=[[1d20+@{bonus}]] vs [[@{target|ac}]]}} {{damage=[[@{damage}]]}}
Chris: Here's an example of the conditionals you can use in PowerCards... !power {{ --name|Longsword --leftsub|Melee Attack --rightsub|Reach 5 ft. --format|player --title|[[ [$AtkType] ?{Attack Std (0), Dis (1), or Adv(2)|0} + 0d0 ]] --?? $AtkType == 0 ?? Attack:|[[ [$AtkStd] 1d20 + 4 [Str Mod] + 2 [Proficiency] + ?{Misc. Attack Modifier|0} [Misc. Mod] ]] vs @{target|AC} AC --?? $AtkType == 1 ?? Attack:|[[ [$AtkDis] {2d20}KL1 + 4 [Str Mod] + 2 [Proficiency] + ?{Misc. Attack Modifier|0} [Misc. Mod] ]] vs @{target|AC} AC --?? $AtkType == 2 ?? Attack:|[[ [$AtkAdv] {2d20}KH1 + 4 [Str Mod] + 2 [Proficiency] + ?{Misc. Attack Modifier|0} [Misc. Mod] ]] vs @{target|AC} AC --?? $AtkType == 0 AND $AtkStd.base == 1 ?? Critical Miss:|You critically missed! --?? $AtkType == 0 AND $AtkStd.base <> 1 AND $AtkStd.total < @{target|AC} ?? Miss:|You missed! --?? $AtkType == 0 AND $AtkStd.base <> 1 AND $AtkStd.total >= @{target|AC} AND $AtkStd.base <> 20 ?? Hit:|[[ 1d8 + 4 [Str Mod] ]] slashing damage --?? $AtkType == 0 AND $AtkStd.base == 20 ?? Critical Hit:|[[ [nh] 2d8 + 4 [Str Mod] ]] slashing damage --?? $AtkType == 1 AND $AtkDis.base == 1 ?? Critical Miss:|You critically missed! --?? $AtkType == 1 AND $AtkDis.base <> 1 AND $AtkDis.total < @{target|AC} ?? Miss:|You missed! --?? $AtkType == 1 AND $AtkDis.base <> 1 AND $AtkDis.total >= @{target|AC} AND $AtkDis.base <> 20 ?? Hit:|[[ 1d8 + 4 [Str Mod] ]] slashing damage --?? $AtkType == 1 AND $AtkDis.base == 20 ?? Critical Hit:|[[ [nh] 2d8 + 4 [Str Mod] ]] slashing damage --?? $AtkType == 2 AND $AtkAdv.base == 1 ?? Critical Miss:|You critically missed! --?? $AtkType == 2 AND $AtkAdv.base <> 1 AND $AtkAdv.total < @{target|AC} ?? Miss:|You missed! --?? $AtkType == 2 AND $AtkAdv.base <> 1 AND $AtkAdv.total >= @{target|AC} AND $AtkAdv.base <> 20 ?? Hit:|[[ 1d8 + 4 [Str Mod] ]] slashing damage --?? $AtkType == 2 AND $AtkAdv.base == 20 ?? Critical Hit:|[[ 2d8 + 4 [Str Mod] ]] slashing damage }} Basically, top to bottom... in the --title tag, you put in a query for the player or DM to enter whether you have advantage (2), disadvantage (1), or just hit enter if you have neither (0). It then rolls an attack based on that query using either a 1d20, 2d20kh1 (adv), or 2d20kl1 (dis). After that, it looks at the AtkType and the attack roll from the proper attack. It may look like a huge macro, but all you're going to see in chat is this: