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

Help: Critical Damage not displayed

Hi! I have a script that is listining to chat messages and creates a new message for the players (DnD 5e). The string is defined as follows:             var finalmsg ='&{template:atkdmg} {{attack=1}} {{damage=1}} {{dmg1flag=1}} {{dmg2flag=1}} {{name=' + name[1] +             '}} {{rname=' + weapon[1] + '}} {{r1=[[' + Atk1Total.toString() + ']]}} {{always=1}} {{r2=[[' + Atk2Total.toString() +             ']]}} {{dmg1=[[' + Dmg1[1] + ']]}} {{dmg1type=' + Dmg1Type + '}} {{crit=1}} {{crit1=[[' + Crit1[1] + ']]}} {{dmg2=[[' + Dmg2[1] +             ']]}} {{dmg2type=' + Dmg2Type + '}} {{crit2=[[' + Crit2[1] + ']]}} {{description=targeting ' + attacker_name + '}}'; This works quite well, it looks like a 'regular' template message, except that the critical damage is not shown (even if e.g. Crit1[1] > 0). What am I missing here? 
No one? Any idea? I tried with and without those brackets ( [ ] ) and also tried another template (npcaction), but I where or how can I look for the cause of the missing display of the criticals? Here's a screenshot, to clarify my situation: (don't know why the image is shown twice here) Topmost is the result of an attack, almost standard, only exception: I add information about the target (i.e. its token_id) in the description. My script catches then those phrases ("attacking" && message contains rolls), creates those links you can see between the roll templates (these are calling "applydamage" with the different amounts of damage: standard, standard with second damage type, standard with crit, and with 2nd damage plus crit). Those links are just for me as GM and they work as intended. Now, I also want to show the player some facts of the creature's attack, actually I am still playing with it (showing the creature's name or not, for example, if that type of creature is yet unknown to the characters), and therefore I create the second output, visible to the players, that you can see at the botton. This output is create by a sendChat command which uses the string variable I have presented in the top message in this thread. It is on purpose that the numbers do not show the formula used to create the values, so the players can't see the bonus (or boni); they have to learn just like the characters have to. After a couple of turns and rounds, both of them will be able to make an educated guess about the creature's abilities.:-) But I wanted to list the damage done by critical hits separately, that's why I tried to enter the corresponding values in the template as well. Of course, I just can change my mind and easily add those values (dam1 + crit1 and, if applicable, dam2+crit2). But that is not useful, because the script does not know about the critical status of an attack: Does is have to add the critical value or not: I have to decide that by using the approbiate link. (And, yes, of course there are situations which can't be handled by those four links). I am puzzled: Why doesn't it work? I still have much to learn about Roll20 and scripting so maybe I am missing an important thing here?
1592964583
The Aaron
Roll20 Production Team
API Scripter
If I had to guess, I'd say that the critical deduction is based on a die being rolled. If you're providing a static number, there's no roll for it to check. Probably if you make the roll that's was a critical something like: {{r1=[[ [[' + Atk1Total.toString() + ' + 1d1cs1cf0 -1 ]] ]]}} It will properly trigger the critical format, but you'd want to do it conditional on it being a critical. For failures, use 1d1cf1cs0.
That makes sense, somehow  ... I am still testing and expanding my script, so I can't test your suggestion, but I am convinced that it will do. Oh, by the way: I think you can use 0d1cs0cf1 also (for success), then you don't have to substract the 1. Another question, it does not really fit into this thread, but I wondered about it while scripting ... Roll20 creates macros like (only slightly altered): /em jabs swiftly with her scimitar! @{Edda|wtype}&{template:atkdmg} {{mod=+7}} {{rname=Scimitar}} {{r1=[[@{Edda|d20}cs>20 + 4[STR] + 3[PROF]]]}} @{Edda|rtype}cs>20 + 4[STR] + 3[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d6 + 4[STR]]]}} {{dmg1type=Slashing}} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[1d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=attacking @{target|token_id} @{target|token_name}}} {{spelllevel=}} {{innate=}} {{globalattack=@{Edda|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Edda|global_damage_mod_type}}} ammo= @{Edda|charname_output} (edited for improved readability) What's the meaning of those two zeros?
1593098862
The Aaron
Roll20 Production Team
API Scripter
Unfortunately, this doesn't work: [[0d1cf0cs1]] because nothing is rolled.  However, this does: [[1d0cf1cs0]] So, that's cool. =D My guess is that those 0s are the default values of some attributes that would otherwise have some template stuff in them.
Yes, I noticed that my suggestion wasn't working, just recently. The very idea of a d0 is ... interesting. But it works, that's good :-)