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

Target and Ac on 5e character sheet

1427325530

Edited 1427326820
Is there any chance someone could add target selection and ac of target into the weapon and spell rolls on the 5e character sheet? I have this bit of script "Template:5eDefaul&{template:default} {{name=Greataxe}} {{ Attack:[[1d20cs>@{selected|meleeweaponcritrange1} + @{selected|meleetohit1} + (@{selected|global_melee_attack_bonus}) ]]]]=*vs* AC [[ @{target|Target2|npc_AC}]] }" that i replace all the text before the damage calculates. I wanted to know if anyone could tell me how or if its not too complex integrate this into a custom character sheet so i would not have to edit and replace each attack and spell macro. Thanks for any help.
If you are a mentor you can make a custom sheet to do this relatively easily. It also wouldn't be difficult to make this a token action macro. It is possible that you could use the new class actions as well to simulate this to some degree. I for one would not support adding this to the default sheet, I am of the opinion that this adds unnecessary clicks and slows down play (based on how I have things setup and configured).
Any help would be appreciated i'm not a code person so I just cut and paste trial and error with my macros and actions. Token actions are just what i am wanting, i understand the consensus is people do not want targeting as defualt as it slows down play, but my players love the ability to select which monster they are individually attacking, so i have tweaked each of the token actions by cut and paste and template output to the chat box to make a custom token action for each of their attacks. I would love a bit of script or code i could easily change in the character sheet to do token actions with target and ac if anyone can help me out.
Without going to deep into it, I think I see a few issues offhand ...melee_attack_bonus}) ]]]] should only have two ]] at the end instead of four. ..AC [[ @{target|Target2|npc_AC}]] should probably just be AC [[ @{target|npc_AC} ]] if "npc_AC" is an attribute on all your npc's and they're all linked to sheets. You only need the "Target2" middle piece if you're using more than one target in the macro. Otherwise it's often far far easier to link to a BAR on the token so you can change it quickly/easily. AC [[ @{target|bar3} ]] } for example, but I don't know how that would integrate into the sheet.
Thanks for the info like i said i am just cutting and pasting to experiment and the token actions work but im sure they have errors and are clumsy, thanks for showing me where to streamline the target info and the suggestion to link to bars is a good idea. Thanks for any and all input I will continue experimenting around and may ask a friend of mine to look at the html code with me to see where i can edit to add the target info to output as a token macro.
1427328727
Kryx
Pro
Sheet Author
API Scripter
Hey Shawn, With Mark G's cleaned up code I could likely add this as an optional config in the settings tab of the Shaped sheet which applies to all weapon attacks. I'll look into it.
1427347819
Wes
Sheet Author
Here is a quick and dirty fix that you might like, I have a couple more Ideas, but I need to sleep... Token Action Template Code: &{template:5eDefault} {{weapon=1}} {{title=@{meleeweaponname1}}} {{subheader=@{selected|token_name}}} {{subheaderright=Melee Attack}} {{emote=Attacking @{Target|token_name}'s AC of @{Target|npc_AC} }} {{attack=[[1d20cs>@{meleeweaponcritrange1} + @{meleetohit1} + (@{global_melee_attack_bonus}) ]]}} {{attackadv=[[1d20cs>@{meleeweaponcritrange1} + @{meleetohit1} + (@{global_melee_attack_bonus}) ]]}} {{damage=[[@{meleedmg1} + @{meleedmgbonus1} + (@{global_melee_damage_bonus}) + 0d0]] @{meleedmgtype1}}} {{critdamage=Additional [[@{meleecritdmg1}]] damage}} Picture of Output: This Template can be pasted into any Characters Token actions and it will grab the Values from the character sheet. It uses the Emote Template Field to Display the Target Information.
You can actually use the regular action call and append it with the emote. In the abilities page make a macro for a token action that is like this %{selected|meleeweapon1} {{emote=Attacking @{Target|token_name}'s AC of @{Target|npc_AC} }} It will append the weapon roll. The output will be the same and you can add your own flavor to the emote per player character. You also don't have rewrite everything. I love these roll templates, they are so flexible!
1427385810
Wes
Sheet Author
Nice! I'll check that out.
1427478799

Edited 1427478855
Kryx
Pro
Sheet Author
API Scripter
@Shawn, I added this as an optional setting on the Shaped sheet. I also adjusted the paddings on the roll templates to not be as big. See below for where to set it an examples of it activated and de-activated.
Oh wow thanks so much, its very appreciated. I'm going to have to reset all my characters with that this eve thank you so much.
Hello. Good work. A doubt... I opened the Shaped sheet right now and have not found the option about AC. Do you take it off? Thanks
1427789970

Edited 1427790146
Kryx
Pro
Sheet Author
API Scripter
Daniel N. said: Hello. Good work. A doubt... I opened the Shaped sheet right now and have not found the option about AC. Do you take it off? Thanks Armor is configured under the armor tab, just like the normal sheet. There is unarmored AC and armored AC - same as the normal sheet. I calculate the highest of these to display the overall AC on that page and also in the shield on the "Core" page. If it is not working check your attributes to ensure that there is no "ac" attribute there. If you're talking about NPCs it should work as well. I need need to fully revamp NPCs though to fully use the core sheet. Most of the works, but I need to figure out how to do attacks. I also want to write a conversion script for mentors to go from old NPC to new NPCs, but we'll see. (For AC technically I take the greatest of PC and NPC AC to get AC). Please let me know if there are any other issues. :)
Hey Mark. Thanks for the answer. Talking about the option: Show Target's AC on attacks. Maybe not updated in the system yet... Thx again, c ya!
1427831870

Edited 1427832053
Kryx
Pro
Sheet Author
API Scripter
Daniel N. said: Hey Mark. Thanks for the answer. Talking about the option: Show Target's AC on attacks. Maybe not updated in the system yet... Thx again, c ya! Hi Daniel, I assume you're using the sheet as included on roll20 as you're not a mentor. In that case it takes a while for them to update that sometimes. Steve was on vacation last week so my pull request has been sitting for 6 days for this and a few other things. See Github: <a href="https://github.com/Roll20/roll20-character-sheets/" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/</a>... Likely they'll integrate it today (US time) or tomorrow, but I can't be sure. If you become a mentor or if any others come by another option is to pull my code directly: <a href="https://github.com/mlenser/roll20-character-sheets" rel="nofollow">https://github.com/mlenser/roll20-character-sheets</a>... I hope that info helps!
ooohhh i see. I thought so later, because the update date on the card. Glad we will soon have it. I'm still not mentor, when I have more time I'm interested to work more in L5R system. Thx! Have a nice day.
1427871353
Falcon
Pro
Sheet Author
Mark - how are you calculating which AC to choose?
1427878270

Edited 1427879654
Kryx
Pro
Sheet Author
API Scripter
Black Falcon said: Mark - how are you calculating which AC to choose? Details here, but I'm sure you read it: Mark said: Armor is configured under the armor tab, just like the normal sheet. There is unarmored AC and armored AC - same as the normal sheet. I calculate the highest of these to display the overall AC on that page and also in the shield on the "Core" page. If you're talking about NPCs it should work as well. I need need to fully revamp NPCs though to fully use the core sheet. Most of the works, but I need to figure out how to do attacks. I also want to write a conversion script for mentors to go from old NPC to new NPCs, but we'll see. (For AC technically I take the greatest of PC and NPC AC to get AC). To clarify my variables: attr_AC = highest value of attr_AC_calc and attr_npc_AC attr_AC_calc = highest value of attr_AC_armor_calc and attr_AC_no_armor_calc attr_AC_armor_calc = exact same as Actoba's sheet. Sum of worn armors. attr_AC_no_armor_calc = exact same as Actoba's sheet. Sum of 10 + dex + unarmored class bonus + unarmored armors. attr_npc_AC = exact same as Actoba's sheet. defined by the user. Defaults to 10. Which means "AC" can be used for PCs and NPCs in the bar of a token and it will always work when armor is deselected in the armor page. One edge case I see while typing this out: If a PC has an AC below 10 it will still show 10 due to NPC which is hidden from the user normally. That will likely cause me to go back to using npc_AC for the NPCs...
1427879543

Edited 1427882886
Kryx
Pro
Sheet Author
API Scripter
Committed changes based on above: ac is just for PCs, npc_ac is for NPCs. attr_AC = highest value of attr_AC_armor_calc and attr_AC_no_armor_calc attr_AC_armor_calc = exact same as Actoba's sheet. Sum of worn armors. attr_AC_no_armor_calc = exact same as Actoba's sheet. Sum of 10 + dex + unarmored class bonus + unarmored armors. attr_npc_AC = exact same as Actoba's sheet. defined by the user. Defaults to 10. Could've kept it have it was and removed the default "10" for npc_ac, but that would've assumed to take 10+dex even if npc_ac was set to -5. So I think this is best. EDIT: This creates a problem when targeting AC as some DMs could use a PC sheet as enemies.. I will assume it targets npc_AC and not support targeting "ac" from PC sheets.. at least for now. I could easily add as part of this toggle that all targets are against normal ac, but that would assume the group always fights PC sheets, which is unlikely. If anyone wants that I can easily add it.
1427899114
Falcon
Pro
Sheet Author
Mark said: Black Falcon said: Mark - how are you calculating which AC to choose? Details here, but I'm sure you read it: Mark said: Armor is configured under the armor tab, just like the normal sheet. There is unarmored AC and armored AC - same as the normal sheet. I calculate the highest of these to display the overall AC on that page and also in the shield on the "Core" page. If you're talking about NPCs it should work as well. I need need to fully revamp NPCs though to fully use the core sheet. Most of the works, but I need to figure out how to do attacks. I also want to write a conversion script for mentors to go from old NPC to new NPCs, but we'll see. (For AC technically I take the greatest of PC and NPC AC to get AC). To clarify my variables: attr_AC = highest value of attr_AC_calc and attr_npc_AC attr_AC_calc = highest value of attr_AC_armor_calc and attr_AC_no_armor_calc attr_AC_armor_calc = exact same as Actoba's sheet. Sum of worn armors. attr_AC_no_armor_calc = exact same as Actoba's sheet. Sum of 10 + dex + unarmored class bonus + unarmored armors. attr_npc_AC = exact same as Actoba's sheet. defined by the user. Defaults to 10. Which means "AC" can be used for PCs and NPCs in the bar of a token and it will always work when armor is deselected in the armor page. One edge case I see while typing this out: If a PC has an AC below 10 it will still show 10 due to NPC which is hidden from the user normally. That will likely cause me to go back to using npc_AC for the NPCs... I was hoping you could share the actual code. I can go into the characters sheet and take a look. I have a Star Frontiers character sheet that I am looking to do something similiar. The biggest issue is that I use both PC and NPC ACs for attacks. Why can't you just have one AC? Since you don't use both PC or NPC options - both can show the same thing. I do this on my Star Frontiers character sheet and it works very well.
1427899519
Kryx
Pro
Sheet Author
API Scripter
Black Falcon said: I was hoping you could share the actual code. I can go into the characters sheet and take a look. I have a Star Frontiers character sheet that I am looking to do something similiar. The biggest issue is that I use both PC and NPC ACs for attacks. Why can't you just have one AC? Since you don't use both PC or NPC options - both can show the same thing. I do this on my Star Frontiers character sheet and it works very well. Here you go: &lt;input type="number" name="attr_AC" value="((@{AC_armor_calc} + @{AC_no_armor_calc} + abs(@{AC_armor_calc} - @{AC_no_armor_calc})) / 2)" disabled="disabled"&gt; &lt;input type="number" name="attr_AC_armor_calc" value="(@{armoractive1}+@{armoractive2}+@{armoractive3}+@{armoractive4}+@{armoractive5}+@{armoractive6}+@{armoractive7}+@{armoractive8}+@{armoractive9}+@{armoractive10})" disabled="disabled"&gt; &lt;input type="number" name="attr_AC_no_armor_calc" value="(10+@{dexterity_mod}+floor(@{unarmored_class_bonus})+@{armoractiveunarmored1}+@{armoractiveunarmored2}+@{armoractiveunarmored3}+@{armoractiveunarmored4}+@{armoractiveunarmored5}+@{armoractiveunarmored6}+@{armoractiveunarmored7}+@{armoractiveunarmored8}+@{armoractiveunarmored9}+@{armoractiveunarmored10})" disabled="disabled"&gt; I hope that helps. attr_AC uses math to get the highest of the other 2. Second answer here outlines it: <a href="http://math.stackexchange.com/questions/58792/how-to-calculate-maximum-or-minimum-of-two-numbers-without-using-if" rel="nofollow">http://math.stackexchange.com/questions/58792/how-to-calculate-maximum-or-minimum-of-two-numbers-without-using-if</a>
1428373356
Falcon
Pro
Sheet Author
Mark - Awesome - Math. LOVE IT! But that obviously only works for 2 fields - you couldn't do that for more than 2, right?
1428394807

Edited 1428398697
Kryx
Pro
Sheet Author
API Scripter
Black Falcon said: Mark - Awesome - Math. LOVE IT! But that obviously only works for 2 fields - you couldn't do that for more than 2, right? I'm sure there is a mathematical formula to find the highest value of more than 2. It'd surely be more complicated. Try googling or asking on the specific use. Another option is to chain it and compare 2 and then compare that result with another 1 and then compare that result with another. So on and so forth. If you do chain them I suggest saving the result of each chain to a variable to make the code easier to read.