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

D&D E5 Sheet: NPC Damage roll with modifications

Hello, I'm trying to have a damage roll that scales to a user's HP, and rounds up, but it doesnt look like i can parse out the result from %{selected|repeating_npcaction_$0_npc_dmg}. Ideally the roll would look something like this: %{selected|repeating_npcaction_$0_npc_dmg}*(@{selected|bar1}/@{selected|hp|max}) But it doesn't look like i can do any kind of modifications to the npc damage roll. The output of that roll above is: Damage 1 piercing, where the dice roll only recognizes the 1d8+0 npc damage. Is there any way i can modify the output of that npc damage roll?
Well... after messing around for a while I just figured this out... kind of. I've set the NPC damage in the sheet to ceil((1D8+3)*(@{selected|bar1}/@{selected|hp|max})). In this way i can get a damage roll that's relative to the health of the NPC. So the sheet looks like this: Ranged Weapon Attack:+7, Range 150 Hit: 7 (ceil((1D8+3)*(@{selected|bar1}/@{selected|hp|max}))) piercing damage Now when i use %{selected|repeating_npcaction_$0_npc_dmg}, i get something like this: Damage: 3 piercing, where the damage calculation is: Rolling ciel((1d8+3)*(10/14))+0 (i'm not sure what the +0 is at the end there, but it seems innocuous) That seems like a pretty roundabout way to extract the actual dice roll from a hit though... Is there a way i can do this from a macro? Seems like something that might come in handy.
teamgaur said: Hello, I'm trying to have a damage roll that scales to a user's HP, and rounds up, but it doesnt look like i can parse out the result from %{selected|repeating_npcaction_$0_npc_dmg}. That's because %{selected|repeating_npcaction_$0_npc_dmg} isn't a value, it's a roll command, and it has an output that will look something like:  @{wtype}&{template:npcdmg} @{damage_flag} {{dmg1=[[@{attack_damage}+0]]}} {{dmg1type=@{attack_damagetype}}} {{dmg2=[[@{attack_damage2}+0]]}} {{dmg2type=@{attack_damagetype2}}} {{description=@{show_desc}}}" Ideally the roll would look something like this: %{selected|repeating_npcaction_$0_npc_dmg}*(@{selected|bar1}/@{selected|hp|max}) I've set the NPC damage in the sheet to ceil((1D8+3)*(@{selected|bar1}/@{selected|hp|max})). In this way i can get a damage roll that's relative to the health of the NPC. The attribute you're looking for is @{selected|repeating_npcaction_$0_attack_damage}, which could be used in a formula like this: [[ceil((0@{selected|repeating_npcaction_$0_attack_damage})*[[@{selected|bar1}/@{selected|bar1|max}]])]] I've done a few things: 1. I added a 0 before the 'attack_damage' reference, in case the listed attack does not have a damage value , such as 'Multiattack' for many NPCs.  2. I changed the 'hp|max' to be 'bar1|max' in case you are using a script like MonsterHitDice to randomly assign NPC health values.  If you're not then it won't be any different than using 'hp|max'. 3. I added square brackets around the health calculation and another set of parentheses around the damage calculation so that the health calculation would be multiplied against the entire damage, instead of just the modifier at the end. So the sheet looks like this: Ranged Weapon Attack:+7, Range 150 Hit: 7 (ceil((1D8+3)*(@{selected|bar1}/@{selected|hp|max}))) piercing damage This is probably still the better way of doing it if you're only modifying a single NPC.  If you're planning on setting up a macro that can be used for any NPC, then you'll want to create a series of macros for each repeating attack. Here's what the first repeating attack macro would look like: @{selected|wtype}&{template:npcfullatk} {{attack=1}} @{selected|repeating_npcaction_$0_damage_flag} @{selected|npc_name_flag} {{rname=@{selected|token_name}}} {{r1=[[@{selected|d20}+(@{selected|repeating_npcaction_$0_attack_tohit}+0)]]}} @{selected|rtype}+(@{selected|repeating_npcaction_$0_attack_tohit}+0)]]}} {{dmg1=[[ceil((0@{selected|repeating_npcaction_$0_attack_damage})*[[@{selected|bar1}/@{selected|bar1|max}]])]]}} {{dmg1type=@{selected|repeating_npcaction_$0_attack_damagetype}}} {{dmg2=[[ceil((0@{selected|repeating_npcaction_$0_attack_damage2})*[[@{selected|bar1}/@{selected|bar1|max}]])]]}} {{dmg2type=@{selected|repeating_npcaction_$0_attack_damagetype2}}} {{crit1=[[@{selected|repeating_npcaction_$0_attack_crit}+0]]}} {{crit2=[[@{selected|repeating_npcaction_$0_attack_crit2}+0]]}} {{description=@{selected|repeating_npcaction_$0_show_desc}}} @{selected|charname_output} Then you'd need to create a similar one where you substitute out all $0 for $1, then $2, etc for each repeating attack.  After that you could create a Chat Menu that links to each of those macros to make it easier to pick which attack you want to roll. If you're using the Universal Statblock MacroMule , I could modify the 'NPCActionsList' pretty easily to link to a series of modified 'NPC Scaled Attack' outputs instead.
Thanks Jarren, really helpful advice, and i've got some much better macros based off this feedback. Will definitely look into the macromule too.