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

Success or Failure Macro

I am looking to set up a Success or Failure Macro.  Basically, it's d20 system and I want to build a Macro that allows a user to target another token and compare their attack roll against the defenses of the target.  If it's successful, display one set of text, if failure, display another.  Ideas?
1588706607

Edited 1588706643
GiGs
Pro
Sheet Author
API Scripter
Macros cannot display prepared text, they cant do any kind of conditional actions, like "if this is a success, display this text." You can do this /roll [[1d20+5]]>@{target|AC} and it will tell you if you succeeded or failed, but the output might not be what you wanted and you cant change it. It will prompt you to select a target token, and will use the AC attribute of the character that token is linked to.
1588750650
Ziechael
Forum Champion
Sheet Author
API Scripter
If you don't want/need to see the actual roll and only care about the result you can use this trick to get custom text for your success/failure messages.
Is there a way to get the macro that GiGs posted to use the actual attacks from your character sheet? I tried plugging in the >@{target|AC} to the end of a regular attack and it didn't work. Ideally, it would figure out how to automatically take damage off too, but I'll settle for the confirmation that it hits. 
1588806602
GiGs
Pro
Sheet Author
API Scripter
Tell us what your regular attack looks like, and we';ll tell you how to add the AC. You can reference attributes by using @{strength} or @{level} or whatever - you have to know the the attribute name. Those work if its an Ability on your character sheet. if you're using a general macro, you need to define the character whose stats you are using, like @{selected|strength} or @{Bilbo|strength}. More here:&nbsp; <a href="https://wiki.roll20.net/Macros#Attribute_Macros" rel="nofollow">https://wiki.roll20.net/Macros#Attribute_Macros</a>
I have a GWF Paladin using a greatsword. His regular attack code looks like this. (when I click it off the character sheet) I'm not really someone who knows much about code or anything. Everything I've figured out so far is from the forum and youtube videos. I'm wondering if there's an easy addition to this code to make it into a macro. Thanks for looking.&nbsp; @{Lance Algar|wtype}&amp;{template:atkdmg} {{mod=+7}} {{rname=Greatsword}} {{r1=[[@{Lance Algar|d20}cs&gt;20 + 4[STR] + 3[PROF]]]}} @{Lance Algar|rtype}cs&gt;20 + 4[STR] + 3[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[d6ro&lt;2+d6ro&lt;2 + 4[STR]]]}} {{dmg1type=Slashing}} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[d6ro&lt;2+d6ro&lt;2[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=}}&nbsp; &nbsp;{{spelllevel=}} {{innate=}} {{globalattack=@{Lance Algar|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Lance Algar|global_damage_mod_type}}} ammo= @{Lance Algar|charname_output}
1588830497
GiGs
Pro
Sheet Author
API Scripter
You can use that code as a macro, directly. Just add it to your macros tab, or to an ability on your character sheet. The numbers should probablky have inline roll brackets around them, like &nbsp;{{damage=[[1]]}}&nbsp; But maybe they aren't needed.
Sorry. I meant to add a vs target ac on the attack. I think it would be &gt;@{target|AC}&nbsp; between the 3[PROF]]]}} and {{attack=1}} so it looks like this. But the only thing that happens when I roll with this code is it asks for a target, but it doesn't say vs ac or anything. I'm guessing I don't have the right amount of brackets, but I don't really know what the brackets do. Thanks for answering.&nbsp; @{Lance Algar|wtype}&amp;{template:atkdmg} {{mod=+7}} {{rname=Greatsword}} {{r1=[[@{Lance Algar|d20}cs&gt;20 + 4[STR] + 3[PROF]]]}} @{Lance Algar|rtype}cs&gt;20 + 4[STR] + 3[PROF]]]}} &gt;@{target|AC} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[d6ro&lt;2+d6ro&lt;2 + 4[STR]]]}} {{dmg1type=Slashing}} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[d6ro&lt;2+d6ro&lt;2[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=}}&nbsp; &nbsp;{{spelllevel=}} {{innate=}} {{globalattack=@{Lance Algar|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Lance Algar|global_damage_mod_type}}} ammo= @{Lance Algar|charname_output}
1588839041
GiGs
Pro
Sheet Author
API Scripter
One thing to be aware of, if you get this working, is that using &gt;@{target|AC}, it will not show the number you rolled. It will only show a 1 or a 0, with 1 meaning you hit and 0 meaning you missed. But if you wnat to work, you need to put it inside the set of {{ }} brackets like so: {{r1=[[ [[@{Lance Algar|d20}cs&gt;20 + 4[STR] + 3[PROF]]]}} @{Lance Algar|rtype}cs&gt;20 + 4[STR] + 3[PROF] ]]&gt;@{target|AC}]]}}&nbsp; It also needs a set of brackets arounf the roll before the &gt;. A normal ( ) might work, but I used [[ ]] just to be safe. But you can try this version too: {{r1=[[ (@{Lance Algar|d20}cs&gt;20 + 4[STR] + 3[PROF]]]}} @{Lance Algar|rtype}cs&gt;20 + 4[STR] + 3[PROF] )&gt;@{target|AC}]]}}&nbsp; This might mess up the way criticals are shown though. I don't use this sheet so I'm not familiar with the rolltemplate.
Thanks. I'll play around with it and post results.