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

Random element in attack or as a macro w/o using table

April 06 (3 months ago)
Cron
Pro

Is there a way to use the Attack section or a macro and roll and state a random element in attack plus roll damage?

More difficult then that actually. Chaos bolt added onto a crossbow.

Normal attack, Damage1 = 1d8+1d6, Damage2 = 1d8 (so I can check for doubles on the d8s since chaos bolt can bounce).  

Currently in the description part I just have text saying 1-8 = w/e element corresponding and the second d8 = Element.

But I would like something that maybe could say both d8 rolls to see if they match and 2nd d8 gives element type output as full damage the extra +1d6 total.

I have no idea how to even start this or if it is possible but thought I would check with the experts. I know some script can be added to an Attack but a macro might be easier. I think.. I remember seeing something about $1 and $2 to call the numbers again but I have no idea how to randomize the elements w/o using a table. 

Thanks for any help.

First off, what character sheet are you using? I can think of a few approaches to this problem, but some are contingent on a specific sheet.
April 06 (3 months ago)

Edited April 06 (3 months ago)
Cron
Pro

OGL. I got the calling rolls, it was $[[0]] for the rolls. So can do rolls, new line total damage and then check element somehow.

The 2014 D&D 5e sheet by Roll20? Good, that gives us some options.

Now, the problem is, you can't do all of adding two rolls together, checking if they are both 8, and use single dice to determine the damage type at the same time (essentially you can only use a given roll once). But I think I should be able to figure something usable. 

I have a session coming up, so I can't delve into it right now, but later today I'll take a crack at it!

April 06 (3 months ago)

Edited April 06 (3 months ago)
Cron
Pro

Thank you.


So far I got this that works.

&{template:default} [[ [[1d8]] + [[1d8]] + [[1d6]] ]] {{name=My Attack}} {{$[[0]] + $[[1]] + $[[2]]==$[[3]] %NEWLINE%
Dupe Check = $[[0]] - $[[1]]
}}

I need to change this to an attack template cause I still need to rolls to hit then figure out damage, if the 1d8s are a match for bounce and then figure out element.
April 06 (3 months ago)
Cron
Pro

Trying to figure this out on my own as template because I have no idea how to call aspects of attack from character sheet. I figure some commands are the same.


I found this that you made, is there a way to have it be same color if both rolls match???

 [[[1d8]]](#" style=" color: white; background-color: green; padding: 0px 3px) [[[1d8]]](#" style=" color: white; background-color: red; padding: 0px 3px)

For Chaos Bolt if the d8's match the damage bounces to another target within 30ft.

So, the issue of using rolls only once also extends to using them as links - the triple brackets break if there's an already used roll inside them. While it's possible to use rolls to change the color in inline CSS with some trickery, here it isn't an option. However, I remembered I had already written something for this exact problem, and I sat down and adjusted it to default template (it used a template from a different sheet originally), as well as making some improvements. Save these two abilities, with the names provided above the macro:

chaos-bolt

&{template:default} {{name=Chaos Bolt [ ](#" hidden null=)
}} {{[Attack](#" hidden)=
}} {{[1](#" hidden)=Attack roll [ ](#" hidden null=)
}} {{[[[ {[[?{advantage|none,@{d20}|advantage,{@{d20},@{d20}}kh1|disadvantage,{@{d20},@{d20}}kl1}+@{spell_attack_bonus}]],0}>[[20+@{spell_attack_bonus}]] ]]](#" hidden)=[Critical hit!!](!/
%{@{character_name}|chaos-bolt-damage})[ ](#" hidden null=)
}} [[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]] {{[0](#" hidden)=[ ](#" hidden null=)
}} {{[0]=[ ](#" hidden null=)
}} {{[1]=[[1+1+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[2]=[[1+2+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]]Cold or Acid damage[ ](#" hidden null=)
}} {{[3]=[[2+2+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[4]=[[1+3+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Fire damage[ ](#" hidden null=)
}} {{[5]=[[1+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Force damage[ ](#" hidden null=)
}} {{[6]=[[2+3+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Fire damage[ ](#" hidden null=)
}} {{[7]=[[3+3+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[8]=[[2+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Force damage[ ](#" hidden null=)
}} {{[9]=[[1+5+((?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Lightning damage[ ](#" hidden null=)
}} {{[10]=[[3+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Force damage[ ](#" hidden null=)
}} {{[11]=[[2+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Lightning damage[ ](#" hidden null=)
}} {{[12]=[[1+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Poison damage[ ](#" hidden null=)
}} {{[13]=[[4+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[14]=[[3+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Lightning damage[ ](#" hidden null=)
}} {{[15]=[[2+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Poison damage[ ](#" hidden null=)
}} {{[16]=[[1+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Psychic damage[ ](#" hidden null=)
}} {{[17]=[[4+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Lightning damage[ ](#" hidden null=)
}} {{[18]=[[3+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Poison damage[ ](#" hidden null=)
}} {{[19]=[[2+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Psychic damage[ ](#" hidden null=)
}} {{[20]=[[1+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Thunder damage[ ](#" hidden null=)
}} {{[21]=[[5+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[22]=[[4+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Poison damage[ ](#" hidden null=)
}} {{[23]=[[3+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Psychic damage[ ](#" hidden null=)
}} {{[24]=[[2+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Acid damage[ ](#" hidden null=)
}} {{[25]=[[5+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning or Poison damage[ ](#" hidden null=)
}} {{[26]=[[4+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Psychic damage[ ](#" hidden null=)
}} {{[27]=[[3+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Thunder damage[ ](#" hidden null=)
}} {{[28]=[[6+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Poison damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[29]=[[5+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning or Psychic damage[ ](#" hidden null=)
}} {{[30]=[[4+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Thunder damage[ ](#" hidden null=)
}} {{[31]=[[6+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Poison or Psychic damage[ ](#" hidden null=)
}} {{[32]=[[5+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning or Thunder damage[ ](#" hidden null=)
}} {{[33]=[[7+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Psychic damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[34]=[[6+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Poison or Thunder damage[ ](#" hidden null=)
}} {{[35]=[[7+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Psychic or Thunder damage[ ](#" hidden null=)
}} {{[36]=[[8+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Thunder damage, [the spell bounces to another target!](`%{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[cleaner](#)}}{{[[[{1,2,4,5,7,9,11,12,14,16,18,20,22,23,25,27,29,31,33,35,37,38,40,42,44,46,48,50,51,53,55,57,59,60,62,64}<[[1d64]] -1]]]=[ ](#)
}} {{[0](#" hidden)= [ ](#" hidden null=)
}} {{[Attack](#" hidden)=$[[0]] [ ](#" hidden null=)
}}

chaos-bolt-damage

&{template:default} {{name=Chaos Bolt critical damage [ ](#" hidden null=)
}} [[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]] {{[0]=[ ](#" hidden null=)
}} {{[1]=[[1+1+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[2]=[[1+2+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]]Cold or Acid damage[ ](#" hidden null=)
}} {{[3]=[[2+2+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[4]=[[1+3+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Fire damage[ ](#" hidden null=)
}} {{[5]=[[1+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Force damage[ ](#" hidden null=)
}} {{[6]=[[2+3+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Fire damage[ ](#" hidden null=)
}} {{[7]=[[3+3+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[8]=[[2+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Force damage[ ](#" hidden null=)
}} {{[9]=[[1+5+((?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Lightning damage[ ](#" hidden null=)
}} {{[10]=[[3+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Force damage[ ](#" hidden null=)
}} {{[11]=[[2+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Lightning damage[ ](#" hidden null=)
}} {{[12]=[[1+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Poison damage[ ](#" hidden null=)
}} {{[13]=[[4+4+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[14]=[[3+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Lightning damage[ ](#" hidden null=)
}} {{[15]=[[2+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Poison damage[ ](#" hidden null=)
}} {{[16]=[[1+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Psychic damage[ ](#" hidden null=)
}} {{[17]=[[4+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Lightning damage[ ](#" hidden null=)
}} {{[18]=[[3+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Poison damage[ ](#" hidden null=)
}} {{[19]=[[2+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Psychic damage[ ](#" hidden null=)
}} {{[20]=[[1+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Acid or Thunder damage[ ](#" hidden null=)
}} {{[21]=[[5+5+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[22]=[[4+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Poison damage[ ](#" hidden null=)
}} {{[23]=[[3+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Psychic damage[ ](#" hidden null=)
}} {{[24]=[[2+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Cold or Acid damage[ ](#" hidden null=)
}} {{[25]=[[5+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning or Poison damage[ ](#" hidden null=)
}} {{[26]=[[4+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Psychic damage[ ](#" hidden null=)
}} {{[27]=[[3+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Fire or Thunder damage[ ](#" hidden null=)
}} {{[28]=[[6+6+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Poison damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[29]=[[5+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning or Psychic damage[ ](#" hidden null=)
}} {{[30]=[[4+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Force or Thunder damage[ ](#" hidden null=)
}} {{[31]=[[6+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Poison or Psychic damage[ ](#" hidden null=)
}} {{[32]=[[5+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Lightning or Thunder damage[ ](#" hidden null=)
}} {{[33]=[[7+7+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Psychic damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[34]=[[6+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Poison or Thunder damage[ ](#" hidden null=)
}} {{[35]=[[7+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Psychic or Thunder damage[ ](#" hidden null=)
}} {{[36]=[[8+8+(?{spell level|1|2|3|4|5|6|7|8|9}-1)d6 ]] Thunder damage, [the spell bounces to another target!](`&percnt;{@{character_name}|Chaos-Bolt})[ ](#" hidden null=)
}} {{[[[{1,2,4,5,7,9,11,12,14,16,18,20,22,23,25,27,29,31,33,35,37,38,40,42,44,46,48,50,51,53,55,57,59,60,62,64}<[[1d64]] -1]]]=[ ](#)
}}

This is, in truth, a very complex problem that might be better resolved with scripts, but this is a working solution. If you want to access it from the sheet directly, you can make a custom attack on the sheet, check off attack and damage (to disable the queries and extra rolls), and simply add this to the description field:

}} [[1/0]]
%{edit your character name here|Chaos-Bolt}
[[1/0]]

April 06 (3 months ago)
Cron
Pro

Wow than you.

This isn't the spell though. It's a custom magic item. An Artificer Infusion Repeating Light Cross Bow that has the Chaos Bolt as Ammo. 

I think I said in the first post it was added to a crossbow. Sorry if I didn't, my mistake.


I was thinking is there a way to do it in the description?


I got the first part correct, its the damages since its 3 dice, (1d8 twice to check for matches and the 1d6, all together for dmg) and how to pick element type.


&{template:atkdmg} {{mod=+12}} {{rname=RLC + Chaos Bolt}} {{r1=[[@{Blue|d20}cs>20 + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC]]]}} {{normal=1}} {{attack=1}} {{range=80ft/320ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=dmg1}} {{dmg1type=dmg1type}} {{dmg2flag=1}} {{dmg2=dmg2}} {{dmg2type=dmg2type}} {{description=description}} {{charname=Blue}}


Before in the Attack section on the character sheet I just had dmg1 = 1d8+1d6 and dmg2 = 1d8. I would have to hover over the first roll results to see if I got matching on the d8s. This is why I wanted to see if there is a better way.

April 06 (3 months ago)

Edited April 06 (3 months ago)

Ah, I misunderstood, my bad - could you give the full description that you have on how this specific weapon works? I'm not quite clear on that from your initial description.

(EDIT: Though a quick and simple way to check numbers of a composite roll is $[[0.computed]] + $[[1.computed]] + $[[2.computed]] = [[ [[1d8]] + [[1d8]] + [[1d6]] ]]  - you'll just have to check the numbers manually and check the damage type. If you have other rolls on the same line before this, you may need to adjust the numbers in the roll index references.)

April 06 (3 months ago)

Edited April 06 (3 months ago)
Cron
Pro

This is my work in progress/what I had before.




&{template:atkdmg} {{mod=+12}} {{rname=RLC + Chaos Bolt}} {{r1=[[@{Blue|d20}cs>20 + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC]]]}} {{normal=1}} {{attack=1}} {{range=80ft/320ft}} {{desc= Dupe Check = [[1d8]] [[1d8]]


If you roll the same number on both d8s, the chaotic energy leaps from the target to a different creature of your choice within 30 feet of it. Make a new attack roll against the new target, and make a new damage roll, which could cause the chaotic energy to leap again.


1-Acid, 2-Cold, 3-Fire, 4-Force, 5-Lightnings, 6-Poison, 7-Psychic, 8-Thunder


+FS: Archery}} {{damage=1}} {{dmg1flag=1}} {{dmg1=$[[1]]}} {{dmg1type=Element}} {{dmg2flag=1}} {{dmg2=$[[1]]+$[[2]]+[[1d6]]+@{Blue|intelligence_mod}[INT]}+2{FS:Archery]}} {{dmg2type=Total}} {{charname=Blue}}





Breakdown: Attack roll + INT mod (for being a Battle Smith using INT to hit/dmg)  +5 PB +3 Magic.

Roll 2 d8s to see if they match and get a 2nd attack on another target for free.

Use 1st d8 to see what element and add both d8s + 1d6 + 4 INT + 3 Magic +2 Fighting Stance: Archery= Total damage.


Trying to figure out a way for it to say element damage type selected and that's what I have no idea on how to do and any way to streamline this.


Alright, so, using the sheet attack & damage template, you can't have both damage type in words and the damage added together with a macro, as that requires trickery that these template don't allow. What you can do is have 8 tables, each named in the fashion of "1-damagetype", "2-damagetype" and so on (without quotes), with the damage type as the sole entry of that table. Then, [[ 1t[[[1d8]]-damagetype] ]] in the damage type field should bring up the correct damage type in text, and you can then call the d8 roll from the index to display it.

But if you want both the damage type in text and the damage total added together, you're going to need more involved tricks that don't work with that template.

April 06 (3 months ago)
Cron
Pro

Can't use tables as its not my game. Not married to the template, I just wanted it to look like a normal attack, but if that can't be, no biggie. Plus, I have no idea what can be put in the Attack section on the character sheet if that's easier. I just understand the template formatting better. IE I smash on the keyboard like a monkey till something works. lol. Thank you so much for your help, it is really apricated.

The attack section of the character sheet just outputs the template, it's just that it's convenient to access the macro by clicking an attack alongside the rest of your attacks.

&{template:default} {{name=Reloading Crossbow + Chaos Bolt [ ](#" hidden null=)
}} {{[0]=[ ](#" hidden null=)
}} {{[1]=[[1+1d8cs=1cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Acid Damage! [ ](#" hidden null=)
}} {{[2]=[[2+1d8cs=2cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Cold Damage! [ ](#" hidden null=)
}} {{[3]=[[3+1d8cs=3cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Fire Damage! [ ](#" hidden null=)
}} {{[4]=[[4+1d8cs=4cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Force Damage! [ ](#" hidden null=)
}} {{[5]=[[5+1d8cs=5cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Lightning Damage! [ ](#" hidden null=)
}} {{[6]=[[6+1d8cs=6cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Poison Damage! [ ](#" hidden null=)
}} {{[7]=[[7+1d8cs=7cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Psychic Damage! [ ](#" hidden null=)
}} {{[8]=[[8+1d8cs=8cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Thunder Damage! [ ](#" hidden null=)
}} {{[[[1d8-1]]]=[ ](#)
}}

Here's a quick damage macro I wrote that's closer to what you wanted, it shows the damage type based on the first roll, and if the second d8 matches, the roll is highlighted, and all the damage is added together. How does your weapon interact with criticals, in regards to the extra dice and the damage type/bouncing? I can probably account for that too, though right now I'm too tired to write more.

April 06 (3 months ago)

Edited April 06 (3 months ago)
Cron
Pro

That macro gives me - TypeError: Cannot read properties of undefined (reading 'substring'). Figured out I was meant to put this as ability.

Crits are normal. Roll 2x all 3 rolls. So second chance for doubles for bounce.

What I mean is, in case of a crit, do you check matches between the new pair of dice, or matches with the die that determined the damage type?

April 07 (3 months ago)
Cron
Pro
You check first set of d8s and then the crit set of d8. So the crit gives an additional chance for match bounce.
April 07 (3 months ago)
Cron
Pro

Idk how but I got the addition to work on the attdmg template.




&{template:atkdmg} {{mod=+12}} {{rname=RLC + Chaos Bolt}} {{r1=[[@{Blue|d20}cs>20 + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC]]]}} {{normal=1}} {{attack=1}} {{range=80ft/320ft}} {{desc= Dupe Check = [[1d8]] [[1d8]]


If you roll the same number on both d8s, the chaotic energy leaps from the target to a different creature of your choice within 30 feet of it. Make a new attack roll against the new target, and make a new damage roll, which could cause the chaotic energy to leap again.


1-Acid, 2-Cold, 3-Fire, 4-Force, 5-Lightnings, 6-Poison, 7-Psychic, 8-Thunder


+FS: Archery}} {{damage=1}} {{dmg1flag=1}} {{dmg1=$[[1]]}} {{dmg1type=Element}} {{dmg2flag=1}} {{dmg2=[[[[1d8]] + [[1d8]] + [[1d6]] + 4[INT] + 3[Magic]]]}} {{dmg2type=Total}} {{charname=Blue}} 


Since that works I can try changing template. Now I guess I can try adding crit to dmg2.


I had a dangerous idea. Since I can't use templates, instead could attributes section be used on the character sheet?




The reason it adds together is that nested rolls are prioritized over outer rolls, so the called reference doesn't stop it from being used. However, that renders the called roll unusable, so you still can't get the element in words out of it. Additionally, attributes and abilities are expanded out before inline rolls, so you can't use an inline roll to determine an attribute to call in the same parsing. However, knowing how the crits are resolved, the rest is simple: first save these two abilities under the names given:

rlc+chaosbolt

&{template:default} {{name=Reloading Crossbow + Chaos Bolt [ ](#" hidden null=)
}} {{[0]=[ ](#" hidden null=)
}} {{[1]=[[1+1d8cs=1cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Acid Damage! [ ](#" hidden null=)
}} {{[2]=[[2+1d8cs=2cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Cold Damage! [ ](#" hidden null=)
}} {{[3]=[[3+1d8cs=3cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Fire Damage! [ ](#" hidden null=)
}} {{[4]=[[4+1d8cs=4cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Force Damage! [ ](#" hidden null=)
}} {{[5]=[[5+1d8cs=5cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Lightning Damage! [ ](#" hidden null=)
}} {{[6]=[[6+1d8cs=6cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Poison Damage! [ ](#" hidden null=)
}} {{[7]=[[7+1d8cs=7cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Psychic Damage! [ ](#" hidden null=)
}} {{[8]=[[8+1d8cs=8cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Thunder Damage! [ ](#" hidden null=)
}} {{[[[1d8-1]]]=[ ](#)
}}

rlc+chaosbolt_crit

&{template:default} {{name=And additional[ ](#" hidden null=)}} {{[0]=[ ](#" hidden null=)
}} {{[1]=[[1+1d8cs=1cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[2]=[[2+1d8cs=2cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[3]=[[3+1d8cs=3cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[4]=[[4+1d8cs=4cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[5]=[[5+1d8cs=5cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[6]=[[6+1d8cs=6cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[7]=[[7+1d8cs=7cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[8]=[[8+1d8cs=8cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{[[[1d8-1]]]=[ ](#)
}}

And lastly, fill out the attack entry on the character sheet as usual, turn off automatic damage rolls, and add in this line at the end of the description:

}} {{rname=[RLC + Chaos Bolt](!/&NewLine; &percnt;{@{character_name}|rlc+chaosbolt})}} {{rnamec=[RLC + Chaos Bolt](!/&NewLine; &percnt;{@{character_name}|rlc+chaosbolt} &NewLine; &percnt;{@{character_name}|rlc+chaosbolt_crit})

This, if set up right, should give you the normal attack template, with a button to call the custom damage macro, including the extra critical damage if the attack is a crit. This isn't flawless, as it means you can't add global damage modifiers to it, but it gets you the damage type in words, and highlights doubles for both the base damage roll and the critical extra dice.

April 07 (3 months ago)

Edited April 07 (3 months ago)
Cron
Pro

Copied and pasted both titles and data to ensure no errors. Crit does not seem to be working. Took me forever to roll a crits but checked it 4x. Normal damage comes out perfect but nothing different happens on crit. The damage highlights on doubles correctly too.

I was not worried about global damage mods. I added the only one in already, the Fighting Style Archery.

Your the pro, what you wrote is beyond me. I looked for an obvious typo or something but I didn't see anything.

If I hit it under abilities it rolls.

I need to fix FS: Archery, I was getting it and bracers of archery mixed up. It adds to attack, no damage.

April 07 (3 months ago)

Edited April 07 (3 months ago)

Hmm, I'm not sure why it wouldn't work if you copy pasted everything and named things right - do you get any error messages? There were supposed to be two messages sent, one containing the normal damage and the other the critical. However, I thought of a way to combine them together, which might fix the issue, whatever it is:

rlc+chaosbolt_crit

&{template:default} {{name=Reloading Crossbow + Chaos Bolt [ ](#" hidden null=)
}} {{[0]=[ ](#" hidden null=)
}} {{[1]=[[1+1d8cs=1cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Acid Damage! [ ](#" hidden null=)
}} {{[2]=[[2+1d8cs=2cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Cold Damage! [ ](#" hidden null=)
}} {{[3]=[[3+1d8cs=3cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Fire Damage! [ ](#" hidden null=)
}} {{[4]=[[4+1d8cs=4cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Force Damage! [ ](#" hidden null=)
}} {{[5]=[[5+1d8cs=5cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Lightning Damage! [ ](#" hidden null=)
}} {{[6]=[[6+1d8cs=6cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Poison Damage! [ ](#" hidden null=)
}} {{[7]=[[7+1d8cs=7cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Psychic Damage! [ ](#" hidden null=)
}} {{[8]=[[8+1d8cs=8cf<0+1d6cs>7cf<0+@{intelligence_mod}[INT]+3[MAGIC]+2[ARCHERY]]] Thunder Damage! [ ](#" hidden null=)
}} {{[[[1d8-1]]]=[ ](#)
}} {{ [0]=[ ](#" hidden null=)
}} {{ [1]=[[1+1d8cs=1cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [2]=[[2+1d8cs=2cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [3]=[[3+1d8cs=3cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [4]=[[4+1d8cs=4cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [5]=[[5+1d8cs=5cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [6]=[[6+1d8cs=6cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [7]=[[7+1d8cs=7cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [8]=[[8+1d8cs=8cf<0+1d6cs>7cf<0]] Critical Damage! [ ](#" hidden null=)
}} {{ [[[1d8-1]]]=[ ](#)
}}

and with that, replace the string in the description with

}} {{rname=[RLC + Chaos Bolt](!/&NewLine; &percnt;{@{character_name}|rlc+chaosbolt})}} {{rnamec=[RLC + Chaos Bolt](!/&NewLine; &percnt;{@{character_name}|rlc+chaosbolt_crit})

The custom damage template should look something like this on a crit:

EDIT: And the explain a little of how this works, template rows overwrite any previous rows with the same name, and if you use triple brackets instead of double brackets for an inline roll, it causes a glitch that renders the result in plain numeric enclosed by single brackets - you can't use inline rolls to overwrite template rows (as they're effectively unique), but using trick, the parser doesn't treat them as inline rolls when the template is constructed. This, combined with a trick with the CSS that lets us manipulate the template CSS (in this case, to hide rows), lets us use a die roll to select from a number of rows to display.

April 07 (3 months ago)

Edited April 07 (3 months ago)
Cron
Pro

Do I still need the rlc+chaosbolt section if you combined them? I guess yes since the description line calls both.

I get no errors.

Here is a screen shot of both sections. I also selected whole line for description and pasted it as well. The button works.



Yeah, the way the attack template works is if the attack is a crit, it shows the rnamec row, and if it's not, it shows rname instead - and the attack name is a link to the sheet-generated damage macro. By putting the string in the description, we replace both of those rows with buttons for our own custom damage macros instead (non-crit and critical). Technically, you could do this with only the crit macro with a slight modification, but there isn't really any reason to (you can have unlimited abilities on a character sheet) and it would make non-critical damage rolls slower than they need to be, as all the hidden rolls are still rolled.

As far as I can tell, it looks like you've got it all set up right - am I understanding right that it works now on criticals too?

April 07 (3 months ago)
Cron
Pro

No. It still only is displaying normal damage. I thought maybe an API I running was interfering but I disabled them and still does not roll crit. Copied and pasted the desc line again sill no luck. 

}} {{rname=[RLC + Chaos Bolt](!/&NewLine; &percnt;{@{character_name}|rlc+chaosbolt})}} {{rnamec=[RLC + Chaos Bolt](!/&NewLine; &percnt;{@{character_name}|rlc+chaosbolt_crit})



April 07 (3 months ago)

Edited April 07 (3 months ago)

Hmm, then the issue must be on the attack macro not displaying rnamec on critical. Can you show me the settings on the attack?

EDIT: Oh, and also, a screenshot of the tooltip if you hover over the critical attack roll?

April 07 (3 months ago)

Edited April 07 (3 months ago)
Cron
Pro

 


I did edit out the +2[Archery] as I made mistake confusing FS and bracers of archery, the bonus is to attack not damage. So just added 2 to mod section of attack. The damage is correctly displaying w/o it.



This is very odd. I can't see any reason why the crit wouldn't come out. Do other, normal attacks successfully print out the critical damage?

April 07 (3 months ago)

Edited April 07 (3 months ago)
Cron
Pro

Sorry do not mean this to be a headache. Other attacks crit normally. 


Think it could be jumpgate?

April 07 (3 months ago)

Edited April 07 (3 months ago)

Don't worry, I don't mind helping - that said, I am running out of ideas. Could you set up a fresh test game and see if it works there? I don't really see how the game would break this specific thing, but I also can't think of anything else that could be doing it. 

EDIT: I thought about the Jumpgate angle too, and tested it in a Jumpgate test game - it printed out crits as intended.

April 07 (3 months ago)
Cron
Pro

Thanks for the help, I have learned a few things and that's worth it alone. I started a new legacy game, no api, copied and imported character. Same. No Crit roll. I even redid attack entry, attack works, button works, damage works, just no crit. So idk.

Alright, what if you make a new character, new attack, copy over the abilities, and see if that works? That is literally the last thing I can think of right now, that somehow the character sheet itself is corrupted in some way too specific way that breaks this.

April 07 (3 months ago)
Cron
Pro

Bingo! New Character and the crit worked. So I will remake my character onto a new sheet and see if that works,


April 08 (3 months ago)

Edited April 08 (3 months ago)
Cron
Pro

It works. Thank you so much.

April 08 (3 months ago)
timmaugh
Forum Champion
API Scripter

I understand you have a working solution for this, but if I might offer one of the "script solutions" Tuo was hinting at, earlier...

Granted, I'm not certain which components of the rolls need to be in dmg1 vs dmg2. Pulling those parts out of what I'm about to share, they read like this:

{{dmg1=[[[[1d8]] + [[1d6]]]]}}

{{dmg2=[[[[1d8]] + 4[INT] + 3[Magic]]]}}

...which is my best guess at what your initial post said that it would be a 1d8+1d6 in dmg1, and a 1d8 in dmg2. Then you had the Intelligence mod and magic component in dmg2, so I left them there.

So, full disclosure:

This might be treating the numbers incorrectly, but that can be fixed. Also, if the damage was going to need to be totaled, all together, it might be nice to have this number somewhere. With the metascripts (the scripts I am using to accomplish this), it's easy to reuse rolls for different purposes (comparing them here, adding them, there, looking up against a table with them in another place).

Solution

!&{template:atkdmg} {{mod=+12}} {{rname=RLC + Chaos Bolt}} {{r1=[[@{Blue|d20}cs>20 + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC]]]}} {{normal=1}} {{attack=1}} {{range=80ft/320ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[[[1d8]] + [[1d6]]]]}} {{dmg1type=Element}} {{dmg2flag=1}} {{dmg2=[[[[1d8]] + 4[INT] + 3[Magic]]]}} {{dmg2type=Total}} {{charname=Blue}} {{desc={&if $[[1]] = $[[3]]}Chaotic energy in the form of {&if $[[1]] = 1}Acid{&elseif $[[1]] = 2}Cold{&elseif $[[1]] = 3}Fire{&elseif $[[1]] = 4}Force{&elseif $[[1]] = 5}Lightning{&elseif $[[1]] = 6}Poison{&elseif $[[1]] = 7}Psychic{&else}Thunder{&end} leaps from this target to a different creature of your choice within 30 feet of it. Make a new attack roll against the new target, and make a new damage roll, which could cause the chaotic energy to leap again. %NEWLINE% [Let Chaos Reign](^~Blue|ChaoticBolt) %NEWLINE% {&end}+FS: Archery}} {&simple}{&escape ^}

This will compare the 1d8s to see if they're the same. If they are, the value will be checked against 1-8 for the kind of chaotic energy it produces. It will also produce a button to allow a quick way to attack again (for the next creature targeted by the chaotic bolt. For that button to work (given the way this macro is written, the above solution would need to be saved in an ability on the Blue character. The ability would be named "ChaoticBolt". Obviously, change that as you want, but reflect the change in the solution so that the correct ability is triggered by the button. Here are 2 runs of this ability... one where it fired a chaotic effect, and then the result of clicking the button to generate it again but did NOT generate the chaotic bolt:


April 08 (3 months ago)
Cron
Pro

Metascripts Toolbox? Never used that one so I have no idea about it. I was wondering if there was a way to do if then. I probably should of listed what api I know me and the dm use in common. I might be able to talk the dm of the game to add another.

I absolutely love the additional button on match. That makes it so nice. Plus it looks like a regular attack.

I am not dead set on it looking like a normal attack but I really like that it does, if it makes it easier to display all information/total etc. I had been working on a default template one that shows all info since its what I could figure out on my own. Before Tuo gave me the info and I finally got it working.


&{template:default} {{name=RLC + Chaos Bolt}} &{template:atkdmg} {{Attack=[[@{Blue|d20}cs>20 + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC] +2[FS:Archery] ]]}} {{range=80ft/320ft}} {{desc= If you roll the same number on both d8s, the chaotic energy leaps from the target to a different creature of your choice within 30 feet of it. Make a new attack roll against the new target, and make a new damage roll, which could cause the chaotic energy to leap again.


1-Acid, 2-Cold, 3-Fire, 4-Force, 5-Lightnings, 6-Poison, 7-Psychic, 8-Thunder


+FS: Archery}}  {{Damage= [[ [[1d8]] + [[1d8]] + [[1d6]] + 3[Magic] +4[INT] ]]}} {{Element=$[[1]] **Dupe Check** $[[1]]  $[[2]]}}



The FS: Archery is added to attack correctly now since I had it added to damage before. I figure I can add an image to name to replace the default purple banner.

If your willing to make it work to give total damage for ether template I would be grateful. I really like the match button and how the text changes for element. Dupe Check is not needed with button. Could you make it display message element on all attacks? That would be easy way to remove need to show element # being displayed. I think that would make it easier to display full total???


April 08 (3 months ago)
timmaugh
Forum Champion
API Scripter

I understand that the first d8 is determining the element, even if there isn't a duplicate match between the d8 dice. That's easy enough to add....

...and I take it from you adding the "+FS:Archery" to the attack roll that you shouldn't need it in the output. Is that also correct?

Totaling the damage is not a problem, either... but I don't use the attack template very much, so if I tweak what I have to account for this, what do you want in the dmg1 field compared to the dmg2 field...?

I'm thinking I should put the total damage in dmg1...

[[ [[1d8]] + [[1d8]] + [[1d6]] + 3[Magic] +4[INT] ]]

...but what would you need in dmg2?

April 08 (3 months ago)
Cron
Pro

Yes on the d8s. Do not need output on FS: Archery it adds to attack only, not damage.

If you have button on matches, text on element in desc, then idk if I even need a dmg2. The button and element in desc eliminates the need for another number displayed I think. I have no idea how it would work on a crit. Crit rolls 2 more d8s that gives another chance for doubles and bounce to another target. So maybe crit damage in dmg2 if a crit happens???

April 08 (3 months ago)
timmaugh
Forum Champion
API Scripter

What would constitute a critical? A 20 on the d20 from the to-hit?

I can definitely render the same damage equation for a dmg2 result, and generate a second button for if the dmg2 duplicates... But if I can test for a critical in the first place, I might be able to suppress the output before you ever see it.

April 08 (3 months ago)
Cron
Pro

Yes, a 20 on to-hit.


April 09 (3 months ago)

Edited April 09 (3 months ago)
timmaugh
Forum Champion
API Scripter

OK, here is what that looks like for an attack template:

!&{template:atkdmg} {{mod=+12}} {{rname=RLC + Chaos Bolt}} {{r1=[[[[@{Blue|d20}cs>20]] + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC] + 2[FS:Archery] ]]}} {{normal=1}} {{attack=1}} {{range=80ft/320ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[ [[1d8]] + [[1d8]] + 1d6 + 3[Magic] +4[INT] ]]}} {{dmg1type=Element}} {&if $[[0]] = 20} {{dmg2flag=1}} {{dmg2=[[ [[1d8]] + [[1d8]] + [[1d6]] + 3[Magic] +4[INT] ]]}} {{dmg2type=Crit}} {&end} {{charname=Blue}} {{desc=**Chaotic form: ChaosType$[[2]].value ** {&if $[[2]] = $[[3]] || ($[[0]] = 20 && $[[4]] = $[[6]])}{&cr}Chaotic ChaosType$[[2]].value energy leaps from this target to a different creature of your choice within 30 feet of it. Make a new attack roll against the new target, and make a new damage roll, which could cause the chaotic energy to leap again.{&if $[[2]] = $[[3]]}{&cr}[Let Chaos Reign](^~Blue|ChaoticBolt){&end}{&if $[[0]] = 20 && $[[4]] = $[[6]]}{&cr}[Let Chaos Reign - Crit](^~Blue|ChaoticBolt) {&end} {&end} }} {&simple}{&escape ^} {&global ([ChaosType1]Acid)([ChaosType2]Cold)([ChaosType3]Fire)([ChaosType4]Force)([ChaosType5]Lightning)([ChaosType6]Poison)([ChaosType7]Psychic)([ChaosType8]Thunder)}

And some example outputs... Note, for these I lowered the bar for what constituted a "critical" so that I wouldn't have to run endless cycles before I got representative cases -- that's why the initial to-hit number on these will not all depict the same value (the highest possible value on a d20 followed by static modifiers). Instead, the bar was "everything greater than a 5" on the d20, producing a range of to-hit roll results that still generated a critical.

This is ONLY for the examples below; the version I am sharing with you has been recorrected back to 20 as the bar.

With no critical and no chaotic expansion:

With a critical but no chaotic expansion:


With no crit but the first hit sending another chaotic bolt:

With a crit happening, and only the 1st attack spawns a chaos bolt:


With a crit happening, and only the 2nd attack spawns a chaos bolt:


With a crit happening and *both* attacks sending chaotic bolts:


April 09 (3 months ago)
Cron
Pro

Wow this is go great! Thank you so much.

Now I have a non api version , thanks to Tuo, and an api version for w/e the case may be. Plus I can mod them for other applications since we end up with custom weapons a lot. A friend has a bow that does the same thing. The element is random each shot so I can make a few mods and set him up too.

April 09 (3 months ago)
Cron
Pro

I did just notice one mistake. On crit you have it adding in the +3 magic and +4 int again. For crits its only the dice that double isn't it?

April 09 (3 months ago)
timmaugh
Forum Champion
API Scripter

Probably. I don't play 5e, so I was just going by what you had provided. Feel free to remove those!

April 09 (3 months ago)
Cron
Pro

Just take them off dmg2 right?

April 09 (3 months ago)
timmaugh
Forum Champion
API Scripter

Right... so dmg2 would look like this, instead:

{{dmg2=[[ [[1d8]] + [[1d8]] + [[1d6]] ]]}}
April 09 (3 months ago)
Cron
Pro

Thank you thank you! I am loving this macro so much lol.


April 09 (3 months ago)
Cron
Pro

I added ro to end of damage rolls to remove red/green highlight on min/max roll for any of the damage dice. However, I am not getting red/green on 1/20 roll on to-hit. I see cs>20 in there that should highlight crit 20 right? I tried to change it to cf<1cs>20 so it would show crit fail and crit success but neither highlight. Is there a different command I should be using?

April 09 (3 months ago)
timmaugh
Forum Champion
API Scripter

I think what is happening, there, is that I've nested the d20 of the to-hit *inside* another roll... I wanted to be able to reference the d20 directly, later, when I checked to see if it had critted. That drives whether you see the dmg2 portion of the template.

If we promote it out of the nested roll it will retain its proper fumble/crit formatting.

We'll just have to test for the d20 in another way.

We could test by duplicating/maxxing the original roll (ie, if the roll is d20 + mod1 + mod2 + mod3, we'll just compare to **20** + mod1 + mod2 + mod3 to see if they're the same)... but your original roll is not solely retrieving the mods from the character sheet via attribute calls. It also has some fixed/arbitrary values you're putting in ("+3[MAGIC]" and "+2[FS:Archery]"). That means if those ever changed, you'd have to change them in the original equation and in the comparison, later.

I'm a big fan of single-point storage... if you have to update multiple points of your command line in the same way, you introduce the potential for human error.

So instead of testing that way, let's use a getDiceByVal() function with Plugger, and extract the d20 from the roll. Of course, the roll indices are going to change; that initial roll will now become $[[0]]. That will make our getDiceByVal() function look like:

{&eval}getDiceByVal($[[0]] 20 included count){&/eval}

That says to "count the included dice from roll $[[0]] that are equal to 20" ("included" as in "not dropped"... this will make it work if later it is rolled with some sort of advantage mechanic like "2d20k1cs>20".

Altogether, those changes would look like this:

!&{template:atkdmg} {{mod=+12}} {{rname=RLC + Chaos Bolt}} {{r1=[[@{Blue|d20}cs>20 + @{Blue|intelligence_mod}[INT] + @{Blue|PB}[PROF] + 3[MAGIC] + 2[FS:Archery] ]]}} {{normal=1}} {{attack=1}} {{range=80ft/320ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[ [[1d8]] + [[1d8]] + 1d6 + 3[Magic] +4[INT] ]]}} {{dmg1type=Element}} {&if {&eval}getDiceByVal($[[0]] 20 included count){&/eval} > 0} {{dmg2flag=1}} {{dmg2=[[ [[1d8]] + [[1d8]] + [[1d6]] ]]}} {{dmg2type=Crit}} {&end} {{charname=Blue}} {{desc=**Chaotic form: ChaosType$[[1]].value ** {&if $[[1]] = $[[2]] || ({&eval}getDiceByVal($[[0]] 20 included count){&/eval} > 0 && $[[3]] = $[[5]])}{&cr}Chaotic ChaosType$[[1]].value energy leaps from this target to a different creature of your choice within 30 feet of it. Make a new attack roll against the new target, and make a new damage roll, which could cause the chaotic energy to leap again.{&if $[[1]] = $[[2]]}{&cr}[Let Chaos Reign](^~Blue|ChaoticBolt){&end}{&if {&eval}getDiceByVal($[[0]] 20 included count){&/eval} > 0 && $[[3]] = $[[5]]}{&cr}[Let Chaos Reign - Crit](^~Blue|ChaoticBolt) {&end} {&end} }} {&simple}{&escape ^} {&global ([ChaosType1]Acid)([ChaosType2]Cold)([ChaosType3]Fire)([ChaosType4]Force)([ChaosType5]Lightning)([ChaosType6]Poison)([ChaosType7]Psychic)([ChaosType8]Thunder)}

April 09 (3 months ago)
Cron
Pro

ok, thank you for the rework. We use fumbles and I have shot a friendly in the back more than once lol.

April 09 (3 months ago)
timmaugh
Forum Champion
API Scripter

*insert Austin Powers gif, "You shot me! You shot me right in the arm"*


=D