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

[5E OGL] templated macro help request

Tried to decipher the wiki to create a template macro found here...&nbsp; <a href="https://wiki.roll20.net/5e_OGL_Roll_Templates" rel="nofollow">https://wiki.roll20.net/5e_OGL_Roll_Templates</a> for the Attack & Damage template.&nbsp; Wanting it to roll twice as the charsheets default to always roll for advantage, as well as reference the "player/token" to pull certain variables (dex mod, pb)&nbsp; but so far all my trial and errors are yielding chat spams of "TypeError: Cannot read property 'substring' of undefined" &{template:atkdmg} {{mod=}} {{rname=Rapier}} {{r1=[[1d20+@{Nerileth Dranall|dexterity_mod}+@{Nerileth Dranall|pb}]]}} @{rtype} {{r2=[[1d20+@{Nerileth Dranall|dexterity_mod}+@{Nerileth Dranall|pb}]]}} {{range=melee}} {{desc=attacks with rapier!}} {{charname=Nerileth Dranall}} and include a roll query for " + ?{Sneak Attack|No, 0|Yes, [[ ceil((@{base_level}) / 2) ]]d6 [Sneak Attack]} "
1507558153

Edited 1507558209
Firstly @{rtype} is an attribute so will need a character sheet to reference so you will need to change that to @{Nerilith Dranall|rtype} say. Secondly, I think &nbsp;rtype includes the {{r2=[[1d20 bit so you should replace that with your rtype attribute call. Hope that helps. As for the sneak attack query, which part of the template would you like it to go?
1507567904

Edited 1507568052
the wiki documentation isn't 100% clear as to How to write them... granted with enough time and lots of trial and error I probably could figure it out. just wish there was actual examples instead of just the attribute fields. as for the sneak attack portion, wouldn't that be included in the {r1} {r2} portions?&nbsp; just have to do the html conversion bit inside the macro? after editing to reflect the change to rtype it "sorta" works...&nbsp; does the description part but no roll or anything else. &nbsp;&{template:atkdmg} {{mod=}} {{rname=Rapier}} {{r1=[[d20+@{Nerileth Dranall|dexterity_mod}+@{Nerileth Dranall|pb}]]}} @{Nerileth Dranall|rtype} {{range=melee}} {{desc=attacks with rapier!}} {{charname=Nerileth Dranall}}
The wiki should be getting updated soon to reflect the changes from the update to the character sheet. That being said you are using the atkdmg template. There are 4 sections for rolls (r1, r2, dmg1, and dmg2). The first two sections are typically used for the 'attack' rolls whereas the last two sections are the 'damage' rolls. If you want the sneak attack to be separate from the rapier damage, put it in the dmg2 section; otherwise add it to the rapier damage in dmg1 (both of which are missing in your above macro. To fix the rtype not actually showing up in the macro, you are missing the second half of the r2. An example rtype attribute is {{always=1}} {{r2=[[@{d20} , you then will need to add whatever modifiers to the roll (in your case +@{Nerileth Dranall|dexterity_mod}+@{Nerileth Dranall|pb}]]}} )
An easy way to figure out how the attacks work in the character sheet is roll an attack from the sheet and then click the up arrow in the chat window. This will give you the last run command, in this case the atk (or atkdmg depending on character settings) roll template complete with all of the information.
1507581097

Edited 1507615245
sorry, I should have been more clear.&nbsp; the end goal is the atkdmg macro.&nbsp; but for learning purposes its just the atk portion and will include the dmg as i build my understanding of the macro... your last post however should yield more enlightenment on functionality.&nbsp; this is throwing errors, and I am assuming it is the query that is the problem... @{Nerileth Dranall|wtype}&{template:atkdmg} {{mod=+5}} {{rname=Rapier}} {{r1=[[@{Nerileth Dranall|d20}cs&gt;20 + 3[DEX] + 2[PROF]]]}} @{Nerileth Dranall|rtype}cs&gt;20 + 3[DEX] + 2[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[DEX] + ?{Sneak Attack|No, 0|Yes, [[ ceil((@{base_level}) / 2) ]]d6 [Sneak Attack]}]]}} {{dmg1type=Piercing }} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[1d8[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=}}&nbsp; &nbsp;{{spelllevel=}} @{Nerileth Dranall|global_attack_mod} @{Nerileth Dranall|global_damage_mod} @{Nerileth Dranall|global_damage_mod_crit} {{globaldamagetype=@{Nerileth Dranall|global_damage_type}}} ammo= @{Nerileth Dranall|charname_output} not sure what I changed but this is working for me now... @{Nerileth Dranall|wtype}&{template:atkdmg} {{mod=+5}} {{rname=Rapier}} {{r1=[[@{Nerileth Dranall|d20}cs&gt;20 + 3[DEX] + 2[PROF]]]}} @{Nerileth Dranall|rtype}cs&gt;20 + 3[DEX] + 2[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[DEX] + ?{Sneak Attack|No, 0|Yes, [[ ceil((@{Nerileth Dranall|base_level}) / 2) ]]d6 [Sneak Attack]}]]}} {{dmg1type=Piercing }} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[1d8[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=}}&nbsp; &nbsp;{{spelllevel=}} @{Nerileth Dranall|global_attack_mod} @{Nerileth Dranall|global_damage_mod} @{Nerileth Dranall|global_damage_mod_crit} {{globaldamagetype=@{Nerileth Dranall|global_damage_type}}} ammo= @{Nerileth Dranall|charname_output}