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

Is there an API/Macro I can use a single roll for 3 calculations?

1440161200

Edited 1440161374
I'm running D&D Basic (with 5e Character sheets) and I have a 'generic' monster using thac0 that i can grab for any normal rabble. I want to roll a d20 once and it calculate a hit with thaco of 19,18,17,16 and 15. It would look something like this on the attack line, MonsterA hits AC 8|7|6|5|4. So in the above case an '11' was rolled on the d20 resulting in the above hits to ac based on a 19|18|17|16|15 THAC0. This will fit for many many monsters by my looking at it's THAC0. For example, seeing a 17 THAC0 for my goblin chieftain and the resulting roll knowing exactly which AC I hit (6 in this example). I have Pro status and can use API's. I want to make a custom macro using this or some other API. Anyone have any experience with this? Currently I use the standard formula that looks like this..&{template:default} {{name=Monster}} {{Attack=hit AC [[@{Monster|thac0}-{1d20}]]|[[@{Monster|thac0}-1-{1d20}]]|[[@{Monster|thac0}-2-{1d20}]]}} {{causing=[[d6]] damage}} for THAC0 of 19,18,17 (the formula uses THAC0 19 from the sheet and then subtracts 1 then 2 for the subsequent rolls). But doing it this way uses three separate d20's and the end result looking often times like this "MonsterA hits AC -1|9|3. As you can see the first roll (19 THAC0) hit AC -1 but the lower THAC0's only hit a worse AC because they used a separate roll that was in this case worse. Sure it works, but players look at it like "waitwut?". I just want it to look cleaner.
1440162220

Edited 1440162523
It can be done somewhat with PowerCards, I think.
1440165172

Edited 1440165796
DK Heinrich
Marketplace Creator
Sheet Author
ok - really quick and dirty using PowerCards (I dont have a D&D game set up so I dont have AC or any of that so its not pretty) A drop down query pops up and asks you for the monsters THAC0. you answer. it then subtracts that number from a 1d20 roll (looking at this the math might be backwards as I have not used THAC0 in 20 years) - it spits out the result and compares it to the targets DEF (switch to AC for you I think).  This will only report for the THAC0 you select so it should be more clear for your players (hovering over the call out box will show the d20 roll +/1 your THAC0 modifier) If you get this to work, you then could add a 2nd roll query to put in your damage options and have them roll on a success (1st --?? line).  !power{{ --emote|The Monster attacks! --name|THAC0 Roll --Result|[[ [$result] ?{THAC0|20, 0|19, -1|18, -2} + 1d20]] --?? $result >= @{target|DEF} ?? hit|Hit (insert roll query for damage options here) --?? $result < @{target|DEF} ?? miss|Miss (insert cute 'you missed'  text here) }} 
Existing API's like PowerCards should be able to do it, or by creating your own little API scriptlet to make a roll and assign it to a variable that you can re-use. Otherwise base macro system would need to be broken into two separate macros... one to roll, and another with a roll query to generate the table. ex.  Macro1:   /w GM Attack: [[d20]] Macro2: .&{template:default} {{name=Monster}} {{Attack=hit AC [[ @{Monster|thac0} -  @{What did they roll?|0} ]] | [[ @{Monster|thac0} -1 - @{What did they roll?|0}  ]] | [[ @{Monster|thac0}-2 - @{What did they roll?|0}  ]] }} {{Causing=[[d6]] damage}}
The problem with drop down queries is in a room with 17 male goblins and 23 female goblins all getting an attack, I don't want to answer 40 queries each round. I guess I'll have to stick with the individual rolls for each thaco in my macro.
1440173373
DK Heinrich
Marketplace Creator
Sheet Author
yeah, that can be tedious - but not sure its more or less tedious than having multiple answers to manually parse each round.  could do a single power card that gives you X number of results - then just go down the list of badguys.  hit macro - 1st time is for male goblins - pick your THAC0 1 time - it poops out a list of say 20 rolls. use the 1st 17 of them. hit macro again. - 2nd time is for female goblins - pick your THAC0 1 time - it poops out a list of 20 rolls. use all 20. on a total side note - I am so happy that most games have stopped giving a crap about male vs. female in their mechanics.  
1440173856

Edited 1440173871
DK Heinrich
Marketplace Creator
Sheet Author
!power {{ --emote|The Monster attacks! --name|THAC0 Roll --Result 1|[[ ?{THAC0|20, 0|19, -1|18, -2} + 1d20]] --Result 2|[[ ?{THAC0} + 1d20]] --Result 3|[[ ?{THAC0} + 1d20]] --Result 4|[[ ?{THAC0} + 1d20]] --Result 5|[[ ?{THAC0} + 1d20]] }}   In this one it only asks you one time what the THAC0 is then spits out 5 'rolls' - with a bit of time you could even have a damage roll following the attack roll so you have it ready IF the result is a hit. I don't think you could have it automatically tell you if its a hit or miss because you would have different targets with different AC's  but in this example you could see that Fred has an AC of 17, and the 1st 5 goblins all attack Fred... Fred is hit 2 times (and takes x damage if you add that part to the macro). 
Something like this?
You can use Extended Expressions to do something like: !extend &{template:default} {{name=Monster}} {{Attack=hit AC `@{Monster|thac0}-1d20[roll]`|`@{Monster|thac0}-1-${roll}`|...}} {{causing=[[1d6]] damage}} But it might be a better idea to use individual character sheets for each monster type and then do: &{template:default} {{name=Monster}} {{Attack=hit AC [[@{selected|thac0}-1d20]]}} {{causing=[[1d6]] damage}}
1440211845
The Aaron
Pro
API Scripter
GenKitty wanted me to write something like GroupInitiative but would do group ability checks. That sounds like what you are describing. I should probably dust that project off at some point. 
OldSchoolChris said: Something like this? YES! Exactly! Could you post the code for that please?
I used targeted the monster token that was doing the attack as the token. If you want to have one particular token you use for all monster combat rolls, I can explain that as well. Same principle, but you use a token that you never move from it's page and you need to adjust the !token-mod and roll template accordingly. You set the attack roll into a token bar via !token-mod as so: !token-mod --set bar2_value|[[1d20]] ( i don't use bar two on my monsters tokens, so this worked fine for me) Have the token's bar 2 associated with the monster's @{Thac0Roll} attribute (that you create) Then you call your template: &{template:5eDefault} {{title=Monster's Attack}} {{subheader=[[@{ThAC0}]]**|**[[@{ThAC0}-1]]**|**[[@{ThAC0}-2]]**|**[[@{ThAC0}-3]]**|**[[@{ThAC0}-4]]}} {{freetext=d20 Result:[[@{Thac0Roll}]] AC hit:[[@{ThAC0}-(@{Thac0Roll})]]**|**[[@{ThAC0}-1-(@{Thac0Roll})]]**|**[[@{ThAC0}-2-(@{Thac0Roll})]]**|**[[@{ThAC0}-3-(@{Thac0Roll})]]**|**[[@{ThAC0}-4-(@{Thac0Roll})]]}} I use the 5eDefault roll template in all my sheets. I like freetext!!
manveti said: You can use Extended Expressions to do something like: !extend &{template:default} {{name=Monster}} {{Attack=hit AC `@{Monster|thac0}-1d20[roll]`|`@{Monster|thac0}-1-${roll}`|...}} {{causing=[[1d6]] damage}} But it might be a better idea to use individual character sheets for each monster type and then do: &{template:default} {{name=Monster}} {{Attack=hit AC [[@{selected|thac0}-1d20]]}} {{causing=[[1d6]] damage}} It seems the "!extend" command doesn't work at all for me. Nothing happens, no error message of any type, when I attempt that macro. (I left out that last "|...")