
Hi All,
This is my new Mod for displaying an NPC Stat Block in chat. It's for the D&D 5E (2014) by Roll20 character sheet. It requires the Scriptcards API mod.
******As of the writing of this, the 2024 content will work with this Mod, as 2024 NPC's are still using the 2014 character sheets. I don't know if that is changing in the future, but I suspect it may when the 2024 sheet is out of BETA****
What Does This Mod Do?
This mod displays the selected token's NPC Stat Block in chat, it is displayed as closely to the 2014 monster manual stat block as I could get it. There are buttons for all Skills, Saves, Traits and Actions; including bonus, reaction, legendary and mythic actions.
Installation Instructions
This mod requires a custom template to be installed. To create a custom template, create a new character called "ScriptCards_TemplateMule" without the quotes, it is case sensitive. Then create two new abilities on the character. One called "Reset Templates" and put !sc-reloadtemplates as the macro(use this to reset templates any time you make a change to one.). For the second ability, name it "statblock" without the quotes. This is the template/style for the Mod. Add the code below:
boxcode::{div style='background-image: url("https://files.d20.io/images/105716505/oymO0pnVyLCv-tQDw2vddA/med.png") ; background-size: 100% 100% ; display: block ; text-align: left ; font-size: 12px ; padding-top: 1em ; font-family: serif ; font-style: normal ; line-height: 1.2em ;'}|| titlecode::{div style='background-image: url("https://files.d20.io/images/105716694/59KW_4mBR3y_Iz45sQw2-g/med.png") !important ; background-size: 101% 4px ; width: 101% ; height:4px; display: block ; border: 1px solid #2f2112; border-radius: 2px ; vertical-align: top ; position: relative ; top: -15px ; left: -3px'}{/div}{div style='margin: 0em .25em 0em .25em ; font-size: 24px ; font-variant: small-caps ; font-family: serif ; color: #6e2425 ; display: block ; font-weight: bold ; font-style: normal ; vertical-align: top ; position: relative ; top: -10px; left: 4px';}|| textcode::{/div}{div}{div style='color: #611b1c ; font-weight: normal; display: inline-block; margin: 0 1em 0 1em; vertical-align: top ; position: relative ; top: -10px';'}|| buttonwrapper::{div style='display: block ;'}{div style='background-image: url("https://files.d20.io/images/105716694/59KW_4mBR3y_Iz45sQw2-g/med.png") !important ; background-size: 111% 4px ; width: 111% ; height:4px; display: block ; border: 1px solid #2f2112; border-radius: 2px ; vertical-align: bottom ; position: relative ; bottom: -10px ; left: -14px'}{/div}|| buttonstyle::style='color: #611b1c ; background-color: transparent ; padding: 2px ; border: none'|| footer::
Run your Reset Templates
Now create your new macro and add the code below:
!Script{{ --/|Script Name : Tim's NPC Statblock Mod (Scriptcards) for D&D 5E 2014 --/|Version : 2.0.1 --/|Author : Timothy Beasley --/|Description : This script displays an NPC statblock that mimics the 2014 Monster Manual in chat that has buttons for all --/| rolls; Skills, Saves, Traits, and Actions(bonus, reaction, Legendary, Mythic). --/| --/|Usage : This script is for the 2014 edition of the official D&D 5E Character Sheet by Roll20 and requires the --/| installation of the ScriptCards MOD using a pro account with API access. --/| This script also requires the installation of a custom ScriptCards template. Instructions for installing --/| a custom style template can be found on the Roll20 wiki page for ScriptCards. The code for the scriptcard --/| template can be found in the post associated with this Script on the Roll20 forums below; --/| https://app.roll20.net/forum/post/12267264/tims-npc-stat-block-mod-scriptcards-d-and-d-5e-2014 --/| or on my GitHub below as statblock.css; --/| https://github.com/VirulentArc/ScriptCards --/| Make sure the template "macro" name is stablock or change #overridetemplate to whatever name you'd prefer --/| it to have. --#Debug|0 --#overridetemplate|statblock --#Whisper|self --#sourceToken|@{selected|token_id} --#title|[*S:npc_name] --#emoteState|0 --?"[*S:npc_actype]" -ne ""|&NPCactype;([*S:npc_actype]) --?"[*S:hp]" -ne ""|&BaseHP; [*S:hp] / --&Divider|[t][tr][td height=5px][/td][/tr][/t][t][tr][td width=100% style="border: none; border-top: 0.10em solid transparent; border-bottom: 0.25em solid transparent; border-left: 14em solid #7e2d40; line-height: 1.25em; font-size: 1.4em; display: block;"][/td][/tr][/t][t][tr][td height=5px][/td][/tr][/t] --&Space|[t][tr][td height=8px][/td][/tr][/t] -->Header| -->StatsBlock| --Rfirst|[*S:character_id];repeating_npctrait --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|>TraitLoop --Rfirst|[*S:character_id];repeating_npcaction --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|>ActionLoop;action --Rfirst|[*S:character_id];repeating_npcbonusaction --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|>ActionLoop;bonusaction --Rfirst|[*S:character_id];repeating_npcreaction --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|>ActionLoop;reaction --Rfirst|[*S:character_id];repeating_npcaction-l --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|>ActionLoop;action-l --Rfirst|[*S:character_id];repeating_npcaction-m --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|>ActionLoop;action-m -->SkillBlock| --X| --:Header| --+|[t width=100%] --+|[tr][td][F::12][#000][i][*S:npc_type] [/i][/#][/F][/td][/tr] --+|[tr][td][&Divider][/td][/tr] --+|[tr][td][F::12][b]Armor Class[/b] [*S:npc_ac] [&NPCactype][br][/F][/td][/tr] --+|[tr][td][F::12][b]Hit Points[/b][&BaseHP] [*S:hp^] ([*S:npc_hpformula])[br][b]Speed[/b] [*S:npc_speed][/F][/td][/tr][/t] --+|[&Divider] --&SkillBlock|[t width=106% style="text-align: center; position: relative ; left: -6px"][tr] --&SkillBlock|+[td width=80px][F::14][b][button]STR [*S:strength] ([*S:strength_mod])::~selected|npc_str[/button] |[/b][/F][br][button]save::~selected|npc_str_save[/button][/td] --&SkillBlock|+[td width=80px][F::14][b][button]DEX [*S:dexterity] ([*S:dexterity_mod])::~selected|npc_dex[/button] |[/b][/F][br][button]save::~selected|npc_dex_save[/button][/td] --&SkillBlock|+[td width=80px][F::14][b][button]CON [*S:constitution] ([*S:constitution_mod])::~selected|npc_con[/button][/b][/F][br][button]save::~selected|npc_con_save[/button][/td][/tr] --&SkillBlock|+[tr][td width=80px][F::14][b][button]INT [*S:intelligence] ([*S:intelligence_mod])::~selected|npc_int[/button] |[/b][/F][br][button]save::~selected|npc_int_save[/button][/td] --&SkillBlock|+[td width=80px][F::14][b][button]WIS [*S:wisdom] ([*S:wisdom_mod])::~selected|npc_wis[/button] |[/b][/F][br][button]save::~selected|npc_wis_save[/button][/td] --&SkillBlock|+[td width=80px][F::14][b][button]CHA [*S:charisma] ([*S:charisma_mod])::~selected|npc_cha[/button][/b][/F][br][button]save::~selected|npc_cha_save[/button][/td] --&SkillBlock|+[/tr][/t] --+|[&SkillBlock] --+|[&Divider] --<| --:StatsBlock| --&SecondBlock|[t width=100%][tr][td style="width: 240px ; display: block ; font-size: 12px ; "] --~|array;define;SaveArray;str;dex;con;int;wis;cha --%SaveLoop|foreach;SaveArray --?"[*S:npc_[&SaveLoop]_save_base]" -gt 0|[ --~SaveTitle|string;totitlecase;[&SaveLoop] --&AddSave|+[&SaveTitle] [*S:npc_[&SaveLoop]_save_base], --]| --%| --?"[&AddSave]" -ne ""|[ --&SavingThrows|[b]Saving Throws [/b] --]| --=SecondBlockCalc|[&AddSave(length)] - 7 --&SecondBlock|+[&SavingThrows][&AddSave(0,[$SecondBlockCalc.Raw])][/td][/tr][/t] --+|[&SecondBlock] --&ThirdBlock|[t width=100%][tr][td style="width: 240px ; display: block ; font-size: 12px ; "] --~|array;define;SkillArray;acrobatics;animal_handling;arcana;athletics;history;insight;intimidation;investigation;medicine;nature;perception;performance;persuasion;religion;sleight_of_hand;stealth;survival --%SkillLoop|foreach;SkillArray --?"[*S:npc_[&SkillLoop]_base]" -gt 0|[ --~SkillTitle|string;totitlecase;[&SkillLoop] --&AddSkill|+[&SkillTitle] [*S:npc_[&SkillLoop]_base], --]| --%| --?"[&AddSkill]" -ne ""|[ --&SkillHeading|[b]Skills [/b] --]| --=ThirdBlockCalc|[&AddSkill(length)] - 7 --&ThirdBlock|+[&SkillHeading][&AddSkill(0,[$ThirdBlockCalc.Raw])][/td][/tr][/t] --+|[&ThirdBlock] --#parameterDelimiter|$$$ --?"[*S:npc_vulnerabilities]" -ne ""|&FourthBlock$$$[tr][td][F::12][b]Damage Vulnerabilities[/b] [*S:npc_vulnerabilities][/F][br][/td][/tr] --?"[*S:npc_resistances]" -ne ""|&FourthBlock$$$+[tr][td][F::12][b]Damage Resistances[/b] [*S:npc_resistances][/F][br][/td][/tr] --?"[*S:npc_immunities]" -ne ""|&FourthBlock$$$+[tr][td][F::12][b]Damage Immunities[/b] [*S:npc_immunities][/F][br][/td][/tr] --?"[*S:npc_condition_immunities]" -ne ""|&FourthBlock$$$+[tr][td][F::12][b]Conditions Immunities[/b] [*S:npc_condition_immunities][/F][br][/td][/tr] --?"[*S:npc_senses]" -ne ""|&FourthBlock$$$+[tr][td][F::12][b]Senses[/b] [*S:npc_senses][/F][br][/td][/tr] --?"[*S:npc_languages]" -ne ""|&FourthBlock$$$+[tr][td][F::12][b]Languages[/b] [*S:npc_languages][/F][br][/td][/tr] --?"[*S:npc_challenge]" -ne ""|&FourthBlock$$$+[tr][td][F::12][b]Challenge[/b] [*S:npc_challenge] [*S:npc_xp]xp[/F][br][/td][/tr] --?"[*S:npc_pb]" -ne 0|&FourthBlock$$$+[tr][td][F::12][b]Proficiency Bonus[/b] [*S:npc_pb][/F][br][/td][/tr] --&FourthBlock|+[/t] --+|[&FourthBlock] --+|[&Divider] --#parameterDelimiter|; --<| --:TraitLoop| --&TraitOutput|[t width=240px] --~|array;fullrepeatingsection;Traits;[*S:character_id];repeating_npctrait;name:description;| --%TraitLoop|foreach;Traits --~TraitSplit|string;split;|;[&TraitLoop] --Rfind|[*S:character_id];[&TraitSplit1];repeating_npctrait;name --?"[*R:name]X" -ne "X"|[ --&TraitOutput|+[tr][td title="[&TraitLoop]" style="width: 200px ; display: inline-block ; white-space: nowrap ; overflow: hidden ; text-overflow: ellipsis ; color: #000 ; font-weight: bold ; "][i][&TraitSplit1][/i][/td][td style="width: 40px ; display: inline-block ; text-align: right ; "][F::14]|[sheetbutton]📜::@{selected|character_name}::[*R>npc_roll_output][/sheetbutton]|[/F][/td][/tr] --]| --%| --&TraitOutput|+[/t] --+|[&TraitOutput] --+|[&Space] --<| --:ActionLoop| --&Action|[%1%] --?"[&Action]" -eq "action-l"|&ActionName;Legendary Action|&ActionName;[&Action] --?"[&Action]" -eq "action-m"|&ActionName;Mythic Action --&ActionOutput|[t width=100%] --&ActionOutput|+[tr][td][F::20][&ActionName(totitlecase)]s[/F][hr #922610][/td][/tr] --?"[&Action]" -inc "action-l"|[ --&ActionOutput|+[tr][td][F::12][#000][*S:npc_legendary_actions_desc][/#][/F][/td][/tr] --]| --?"[&Action]" -inc "action-m"|[ --&ActionOutput|+[tr][td][F::12][#000]@{selected|npc_mythic_actions_desc}[/#][/F][/td][/tr] --]| --?"[&Action]" -eq "reaction"|&ButtonURL;[*R>npc_roll_output]|&ButtonURL;[*R>npc_action] --~|array;fromrepeatingsection;actionarray;[*S:character_id];repeating_npc[&Action];name --%ActionLoop|foreach;actionarray --Rfind|[*S:character_id];[&ActionLoop];repeating_npc[&Action];name --&ToolTip|[*R:name]|[*R:description] --?"[*R:name]X" -ne "X"|[ --&ActionOutput|+[tr][td title="[&ToolTip]" style="width: 200px ; display: inline-block ; white-space: nowrap ; overflow: hidden ; text-overflow: ellipsis ; color: #000 ; font-weight: bold ; "][i][*R:name][/i][/td][td style="width: 40px ; display: inline-block ; text-align: right ; "][F::14]|[sheetbutton]⚔️::@{selected|character_name}::[&ButtonURL][/sheetbutton]|[/F][/td][/tr] --]| --%| --&ActionOutput|+[/t] --+|[&ActionOutput] --+|[&Space] --<| --:SkillBlock| --+|[hr #922610] --&SkillOutput|[t width=100% style="text-align: center ; "] --&SkillOutput|+[tr][td][button]Acrobatics::~selected|npc_Acrobatics[/button] | [button]Animal Handling::~selected|npc_Animal_Handling[/button] | [button]Arcana::~selected|npc_Arcana[/button][/td][/tr] --&SkillOutput|+[tr][td][button]Athletics::~selected|npc_Athletics[/button] | [button]History::~selected|npc_History[/button] | [button]Insight::~selected|npc_Insight[/button] | [button]Intimidation::~selected|npc_intimidation[/button][/td][/tr] --&SkillOutput|+[tr][td][button]Investigation::~selected|npc_Investigation[/button] | [button]Medicine::~selected|npc_Medicine[/button] | [button]Nature::~selected|npc_Nature[/button] | [button]Perception::~selected|npc_Perception[/button][/td][/tr] --&SkillOutput|+[tr][td][button]Performace::~selected|npc_Performance[/button] | [button]Persuasion::~selected|npc_Persuasion[/button] | [button]Religion::~selected|npc_Religion[/button][/td][/tr] --&SkillOutput|+[tr][td][button]Sleight of Hand::~selected|npc_Sleight_of_Hand[/button] | [button]Stealth::~selected|npc_Stealth[/button] | [button]Survivial::~selected|npc_Survival[/button][/td][/tr] --+|[&SkillOutput] --<| --X| }}
2025-03-24 Updated to include conditional to check if resource exists but is blank, do not output.
2025-03-30 Updated to remove the red line image and replace it with inline css. statblock style needs to be updated as well, don't forget to reset your templates.
2025-04-03 Updated to 1.1.0, formatting overhaul, just for consistency across platforms and browsers and fixes formatting problems with the bottom bar widening the longer the statblock is. Not a necessary update if what you're using is working for you. If you do update, also replace template code and reset your templates.
2025-04-06 Updated to 1.1.1. Found and fixed a bug with Skills and Saves. If there were multiple of any of them it completely broke the statblock. Did a bunch of complicated(for me) stuff to fix it. Also changed the size of the title a fraction, so update and reset templates as well.
2025-04-14 Updated to 2.0.0. Did a rewrite to create a dynamic loop that displays all different actions. Reduced the overall code by about a quarter.
2025-04-14 Updated to 2.0.1. Found a formatting bug, if the NPC has a double digit attribute bonus it didn't fit and broke the formatting. Other small bug fixes.