Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game

Notices

Reply
 
Thread Tools Display Modes
ultodrago
Junior Member
 
Join Date: Dec 2019
Posts: 10

Old October 24th, 2020, 11:20 AM
So I have a template that features the following CR-scaling feature that I'm having a headache trying to get working right.

Should a creature have X HD, they get Y+CR Spell Resistance. The issue is that, like Celestial, the template can change the CR based on the HD as well, and I feel like that might be contributing to my issues.

However, I use the following code to calculate everything, but the SR never gets properly applied to the sheet. The values on each respective field is correct when debugged, but it doesn't actually show up on the statblock when at the Final Phase or later. If set to run before the Final Phase, the SR doesn't properly calculate.

Code:
      ~ Set up the amount of damage we resist
      var damage as number
      var nac as number
      if (herofield[tHitDice].value < 5) then
        damage = 3
      elseif (herofield[tHitDice].value < 11) then
        damage = 5
      elseif (herofield[tHitDice].value < 16) then
        damage = 7
      else
        damage = 10
        endif
      if (herofield[tHitDice].value >= 10) then
        nac = 2
      else
        nac = 0
        endif

      var essar as number
      essar = damage + herofield[tCR].value
      debug essar
      hero.child[xSplRs].field[abValue].value = essar
      hero.child[ArmorClass].field[tACNatural].value += nac
      hero.child[xDamRsCold].field[abValue].value = damage
      hero.child[xDamRsElec].field[abValue].value = damage

      ~ Set up our damage reduction
      hero.child[xDamRdGood].field[abValue].value = damage
Is there any way to get this to work as intended (where the changed values, when the correct numbers, are applied to the sheet) or is this a limitation of how Hero Lab does things?
ultodrago is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 12,807

Old October 29th, 2020, 10:01 AM
Let me walk you through the steps to find this information for yourself - so the troublesome input is herofield[tCR].value, right?


In the Develop menu, make sure the debugging tools are enabled at the very top, and then near the bottom of the list, choose "Floating Info Windows" and "Show Selection Field Histories". Then since this is a herofield, filter for "Hero", and you'll see "Hero (Totals)" - choose that and click OK. In the info window that pops up, filter the list to "tCR", and look at when that changes - specifically, when is the very last change to it?


Once you have that information, you know that you need to put this script after that last change in order for it to be able to look up the CR and use that to calculate the right SR.
Mathias is offline   #2 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:49 PM.


Powered by vBulletin® - Copyright ©2000 - 2020, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.