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

Custom output for crit hits using random table that includes text output and damage

That was a mouthful! (that's what she said)

I have found several articles that get me close to what I want but I can't figure out how to convert them to what I want. Here is what I am looking for:

Attack -

if non-crit - do nothing

if crit - roll on specific damage table (piercing, slashing, etc)

    Table will be random, and have the following output: damage and a text message saying something happened (pushed back 10 ft, limb cut off, etc)

So in my head it will look something like this:

"Hits for 20 slashing damage, cutting off the enemies' left arm!"


Here's what I've tried so far: I created a rollable table (called slashing) and had a macro (called slashing crit hit) reference it. I then put [[ 1t[slashing-crit-hit] ]] in the crit section on a character sheet. Got the output "couldn't find the table." I then just had it reference just the table (slashing) so the formula now read [[ 1t[slashing] ]] It read the table but didn't give me an output (I put one item on that table so I would get something) I then realized that a table will not auto roll, so at this point I feel like I need a script. Thoughts?


Also, I never made it past "hello world!" so small words please...

December 28 (5 years ago)

I'm guessing that if it is even possible you would need the API which is a Pro subscription perk in order for this to work. Since you are a pro subscriber i'm sure that the recursive tables script would be one of the things you need. Hopefully somebody that knows more will help you?

December 28 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter


Psycopuppy said:

That was a mouthful! (that's what she said)

I have found several articles that get me close to what I want but I can't figure out how to convert them to what I want. Here is what I am looking for:

Attack -

if non-crit - do nothing

if crit - roll on specific damage table (piercing, slashing, etc)

    Table will be random, and have the following output: damage and a text message saying something happened (pushed back 10 ft, limb cut off, etc)

So in my head it will look something like this:

"Hits for 20 slashing damage, cutting off the enemies' left arm!"


Here's what I've tried so far: I created a rollable table (called slashing) and had a macro (called slashing crit hit) reference it. I then put [[ 1t[slashing-crit-hit] ]] in the crit section on a character sheet. Got the output "couldn't find the table." I then just had it reference just the table (slashing) so the formula now read [[ 1t[slashing] ]] It read the table but didn't give me an output (I put one item on that table so I would get something) I then realized that a table will not auto roll, so at this point I feel like I need a script. Thoughts?

You are running into two different limitations of roll20 here. The first: Rolls cant do conditional things - you can't have one output on a critical, and a different output on a non-critical. The second: tables cant include rolls. (Also, I seem to remember there's an issue with table entries whose first character is a number.)

Aaron's RecursiveTable script will likely do the table part of what you need, as it can handle rolls within tables, and table results can call other tables.

You still have the problem of conditional effects, and one way to handle that is to output an API button with your attack roll. i dont follow exactly what you need, but you could, for example, have a macro that makes an attack roll and a damage roll, and prints out a a "Critical" button with them. Then the player looks at the attack roll, and if a critical is scored, they click that button, which triggers a roll on the table. 



GiGs said:


Psycopuppy said:

That was a mouthful! (that's what she said)

I have found several articles that get me close to what I want but I can't figure out how to convert them to what I want. Here is what I am looking for:

Attack -

if non-crit - do nothing

if crit - roll on specific damage table (piercing, slashing, etc)

    Table will be random, and have the following output: damage and a text message saying something happened (pushed back 10 ft, limb cut off, etc)

So in my head it will look something like this:

"Hits for 20 slashing damage, cutting off the enemies' left arm!"


Here's what I've tried so far: I created a rollable table (called slashing) and had a macro (called slashing crit hit) reference it. I then put [[ 1t[slashing-crit-hit] ]] in the crit section on a character sheet. Got the output "couldn't find the table." I then just had it reference just the table (slashing) so the formula now read [[ 1t[slashing] ]] It read the table but didn't give me an output (I put one item on that table so I would get something) I then realized that a table will not auto roll, so at this point I feel like I need a script. Thoughts?

You are running into two different limitations of roll20 here. The first: Rolls cant do conditional things - you can't have one output on a critical, and a different output on a non-critical. The second: tables cant include rolls. (Also, I seem to remember there's an issue with table entries whose first character is a number.)

Aaron's RecursiveTable script will likely do the table part of what you need, as it can handle rolls within tables, and table results can call other tables.

You still have the problem of conditional effects, and one way to handle that is to output an API button with your attack roll. i dont follow exactly what you need, but you could, for example, have a macro that makes an attack roll and a damage roll, and prints out a a "Critical" button with them. Then the player looks at the attack roll, and if a critical is scored, they click that button, which triggers a roll on the table. 



I don't think I was clear. Roll20 already has the capability to do several things depending on the outcome of ththe dice roll (at least 5e character sheet does.) For example, if you attack with a weapon it will give you a different output based on if it crits or doesn't. Granted, this is a very basic formula. But it means that the possibility is there to change it further (at least in my head it does.)


Aaron's RecursiveTable looks like what I want, but I dont want my players to have to type out a command each time they want to attack. Any idea if I can input the script into their character sheet?

December 28 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Psycopuppy said:
I don't think I was clear. Roll20 already has the capability to do several things depending on the outcome of ththe dice roll (at least 5e character sheet does.) For example, if you attack with a weapon it will give you a different output based on if it crits or doesn't. Granted, this is a very basic formula. But it means that the possibility is there to change it further (at least in my head it does.)

Roll Templates do some behind the scenes trickery with dice that you cannot do with normal dice commands. They can choose to display certain aspects of a roll based on the outcome, but even then must still roll all the dice possible in the initial throw. It's a conditional display due to code in the character sheet.


Aaron's RecursiveTable looks like what I want, but I dont want my players to have to type out a command each time they want to attack. Any idea if I can input the script into their character sheet?

Absolutely. Type the script commands into a Character Ability, set to "Show as Token Action". They will get a button for the command that displays whenever they have their token selected. If you do a lot of play without tokens on the board, it could be set to "Show in Macro Bar" below, and thus be always available.


Alright. I've got pictures. Lets see if this makes sense:

 

 formula is [[ 1t[slashing-crit] ]] I have also tried [[ 1t[slashing] ]]

Output if I do [[ 1t[slashing-crit] ]]

Output if I do [[ 1t[slashing] ]]





I feel like this article: https://app.roll20.net/forum/post/4098424/5e-ogl-5e-char-sheet-trigger-script-on-crit is what I'm going for, but I cant seem to get the coding right...

December 29 (5 years ago)

Edited December 29 (5 years ago)


holy poop im...at least close!


Alright, any ideas on how to get rid of the number next to the text and have it just display the text?