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

PF2nd Compare and add more dice to the damage if the current level is X times bigger than the base level

I really wanted to automatize somethings in the Pathfinder 2e's character sheet. Recently I started dabbing into macros and functions, when I tried to add my precision damage to my weapon damage. So far, I decided to try to automatize the spells, specially the ones that scale with character level (cantrips and focus spells). Until now, I've managed to automatize some, but with mostly makeshift measures and not really that easy or fast to copy. What I'm really trying to manage is to make the damage work around the spell level, something like: (Base Spell Damage) + (If current_level is X times bigger than the base_level, add Y dice). For example, one of my players use Force Fang, I want to make the base damage 1d4+1 plus 1d4+1 each 2 levels above 1. But I don't know how to do that. 
1642393693

Edited 1642393886
John D.
Pro
Sheet Author
I'm not familiar with that sheet, but I would approach the problem like this... HTML <button type="roll" name="roll_weapon_attack" value="@{dynamic_weapon_roll}"></button> <input type="hidden" name="attr_dynamic_weapon_roll" value="" /> JS const weaponDamage = Math.round(level/2); const weaponRoll = `&{template:weaponroll} {{damage=${weaponDamage}d4+${weaponDamage}}`; In the HTML you can insert any string you want for the roll button via a hidden input.  Just sort out which events you would need to update the roll on, such as level up or when the weapon is added, and you can change up the values that should appear in the roll template as needed.  Not just the damage.
1642416092
Andreas J.
Forum Champion
Sheet Author
Translator
John D. said: I'm not familiar with that sheet, but I would approach the problem like this... It's a "by Roll20" sheet, and we don't have access to it's sourcecode, so your suggestions aren't applicable. Besides it think they where talking purely of a macro/API solution to this, not editing char sheet sourcecode. Scaling DMG based on level macro What I'm really trying to manage is to make the damage work around the spell level, something like: (Base Spell Damage) + (If current_level is X times bigger than the base_level, add Y dice). For example, one of my players use Force Fang, I want to make the base damage 1d4+1 plus 1d4+1 each 2 levels above 1. But I don't know how to do that. If I understood you correctly, the dmg is 1d4+1 on lvl.1 , increased to 2d4+2 on lvl 3 , and 3d4+3 on lvl 5 , right? Think I figured it out. This is the dmg calculation for any level: [[1d4+1 + [[floor(0.5*(@{level}-1) )]]d4 + [[floor(0.5*(@{level}-1) )]] ]] While this part represents the bonus damage beyond 1st level: [[floor(0.5*(@{level}-1) )]]d4 + [[floor(0.5*(@{level}-1) )]] I added the second macro in the Other -section of an attack's damage, and it seems to work. As this is a magic attack, you want to add it in the additional damage section where you can specify the damage type as well: [[floor(0.5*(@{level}-1) )]]d4 + [[floor(0.5*(@{level}-1) )]] force But I looked at the description of Force Fang , and it says the bonus 1d4+1 comes if the spell is heightened, and not that it scales with the character's level. If you want a toggle for casting it normal vs heightened, the damage bonus damage part could look like: ?{Heightened?|No, 0|Yes(1), 1|Yes(2), 2}d4 + ?{Heightened?|No, 0|Yes(1), 1|Yes(2), 2} It would ask once if the spell is heightened, and then add the relevant bonus damage.
Andreas J. said: But I looked at the description of Force Fang , and it says the bonus 1d4+1 comes if the spell is heightened, and not that it scales with the character's level. You're not wrong, but focus spells are automatically heightened to half your character level rounded up, just like cantrips are. Nevertheless, it works! Thank you so much for this!