Roll20 Macro Roll Again if Crit

Pretty new. Looking for a macro that either on 20 rolls crit or links to another macro that would be the crit. Thanks for the help

Unfortunately, the macros are primarily a dice rolling and text reporting system. They are not a programming language and lack many features of such: conditional logic, looping, and setting persistent variables, for instance.

What keith says is true for complex crit logic. However, if you just want to roll another die or something simple on a crit (roll>n) roll on a d20, there are a couple options, depending on what character sheet you are using. Many sheets, like the 5E D&D for Roll20 sheet for example, have crits are built into it. Assuming it is not built in to your sheet (since you probably wouldn't be asking the question), there is a trick that I saw from one of Oosh's posts recently that uses the default template and inline roll referencing that is pretty neat. Take the simple example below. 1d20 with no modifiers for attack (crit on 20), 1d8+3 normal damage, and another 1d8 on a crit.  &{template:default} {{name=Attack Macro}} [[[[floor([[1d20cs>20]]/20)]]d8[CRIT]]] {{Atk $[[0]] atk, [[1d8+3]]+$[[2]] dmg}} The [[floor(....]] function returns 1 on a 20, and returns 0 for less than 20. So the crit damage is either 0d8 or 1d8 depending on the roll. $[[0]] returns the value of the first inline roll (the d20), while the $[[2]] returns the (0or1)d8 inline roll. Not used here is the 2nd inline roll evaluation $[[1]], which is just going to be either 0 or 1 as described above, and generally not useful to report on it's own. Also note, unfortunately you can't use the $[[n]] references for any additional math (so $[[2]]+5 doesn't work). Just a quirk of the system. Sample output for a non crit: Sample output for a crit: You can easily replace the static modifiers with character attribute calls, as required. E.g. @{strength_mod} or @{selected|strength_mod}, etc. Note, however : If a modifier is added to the attack roll, you would need to replace the "/20" in the floor function with "/(20+total modifier)". So, if the attack roll ended up being 1d20+5 after all modifiers, you would use "/25" in the floor function. Finally, I was told this trick only works when using the default template. I checked with some 5E templates with no luck .  EDIT: Oosh clarified why this wasn't working for me before. Unrelated to the floor/$[[n]] trick. 

Nice one! I'll try to remember to link back to this post next time I see the question come up, so much more clarity than the rambling mess I usually leave. David M. said: Finally, I was told this trick only works when using the default template. I checked with some 5E templates with no luck. Speaking of my rambling mess, if you're referring to the thread I think you are, it was a different trick I was referring to as only working in the default template. Namely the "Number of attacks" query only outputting the desired number of rows by exploiting the default template behaviour or overwriting a row if it has the same value on the left as a previous row (so that macro in question, if you input 1 attack, it actually does all 10 rows but since the KH1 operator labels them all as {{1= <math> .... the template only prints the 10th roll. The rows just overwrite each other.) So the macro you've got above should work fine in 5e templates. You just can't turn it into a big variable multiattack macro unless you want to manually build a whopper of a Query. It just needs to be slightly rejigged for the field names: &{template:npcaction} {{rname=Attack Macro}} {{name=npcaction template}} [[[[floor([[1d20cs>20]]/20)]]d8[CRIT]]] {{description=Atk $[[0]] atk, [[1d8+3]]+$[[2]] dmg}} The $[[0]] calls even work in {{r1}} and {{r2}} fields, which surprised me a little, I thought you had to have some actual math in those fields or they wouldn't output. I guess it still counts! Anyway, probably not much use to OP but I thought I'd clarify that in case I was going to get the blame for spreading misinformation :)

I was intrigued by this method, but noticed that if the OP does have a bonus to apply, it makes it complicated to implement. And also though that since you are working out the critical, you might as well work out total damage instead. So here's a tweak: &{template:default} {{name=Attack Macro}} [[ [[1d8+?{Damage|0}]] + [[ [[floor([[1d20cs>20+?{Attack|0}]]/[[20 + ?{Attack|0}]])]]d8+?{Damage|0}[CRIT] ]]]] {{Attack =$[[1]]}} {{Damage=$[[0]]+$[[4]] = $[[5]]}} To the original OP, if you actually want to use this message, and want to use attribute values for the attack, just find each  +?{Attack|0}  and replace with +@{attribute name} Likewise to add damage bonus, just find each  +?{Damage|0}  (again, there are two) and replace with your desired damage bonus.

Regarding the actual question, I think everyone missed the second part: Bradley B. &nbsp;said: Pretty new. Looking for a macro that either on 20 rolls crit&nbsp; or links to another macro that would be the crit. You can link to a macro using the API button method described here:&nbsp; <a href="https://wiki.roll20.net/API:Chat#Entering_API_Buttons_In_Chat" rel="nofollow">https://wiki.roll20.net/API:Chat#Entering_API_Buttons_In_Chat</a> So using the default rolltemplate you could do&nbsp; &amp;{template:default} {{name=Attack Roll}} {{Attack:&nbsp; [[1d20cs&gt;20+?{Attack|0}]] =&nbsp; [Critical](!&amp;#13;#CriticalMacro)}} Replace the #CriticalMacro &nbsp;part with whatever your macro called. The &amp;#13; part is a html entity , and you need to be careful with macros containing those. They'll be erased if you ever reopen the macro containing them, so once you save the macro dont reopen it (and save a copy somewhere else just in case). If it's an ability on a character sheet (generally better), use this format instead: &amp;{template:default} {{name=Attack Roll}} {{Attack:&nbsp;[[1d20cs&gt;20+?{Attack|0}]] =&nbsp; [Critical](~Frodo|CriticalMacro)}} Replace Frodo with the character name. They will look something like this:

Thanks for the clarification, Oosh! It's true, the only examples I tried on the 5E templates were for the multi-attack thread you mentioned. Edited my post. GiGs, also true that it starts to get messier if you want to continue adding more of the pre-rolled inline rolls to reference later. This is only needed if you want to explicitly output every modifier in the yellow boxes, though. If you don't mind mousing over the initial damage to see the math behind it, it should be as straightforward as just adding an @{Attribute} to the att/damage fields.&nbsp; E.g. if the character had a strength mod of +3, and the game system added STR to attack &amp; damage, it would be something like: &amp;{template:default} {{name=Attack Macro}} [[[[floor([[1d20cs&gt;20+@{strength_mod}]]/23]d8[CRIT]]] {{Atk $[[0]] atk, [[1d8+@{strength_mod}]]+$[[1]] dmg}} I'd test and include a screenshot of output for the OP, but I seem to be dealing with the dreaded corrupted chat log problem this morning, and the usual fixes aren't working :( Might need some intervention from the Devs. But that's for another thread... Yesterday I briefly tried adding variable mods to the floor denominator, like /(20+@{strength_mod}), but it didn't work for me right away. It would be cool if that could be added, since hardcoding makes me a bit uncomfortable as a general rule. Good advice for the chat buttons. I had actually meant to include that approach in my post (part of the "couple options" I mentioned - but I only gave one!). I must have been so excited sharing Oosh'd trick that I just forgot, haha! Actually, that's probably the preferable way to do it , especially if the crit is a more complicated expression.&nbsp;

David M. said: Yesterday I briefly tried adding variable mods to the floor denominator, like /(20+@{strength_mod}), but it didn't work for me right away. It would be cool if that could be added, since hardcoding makes me a bit uncomfortable as a general rule. Likely you need to wrap that in inline roll brackets.&nbsp; Thats what I did.

(Facepalm). Thanks, I figured it was something simple. Guess I should read posts more carefully :)&nbsp;

Thank you all for the suggestions.&nbsp; This is a lot to chew on.&nbsp; I will use these for reference as I continue learning.

borregowhatumbigh.blogspot.com

Source: https://app.roll20.net/forum/post/8964119/if-slash-then-crit-macro

0 Response to "Roll20 Macro Roll Again if Crit"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel