Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old November 10th, 2018, 08:12 PM
Hi again folks, this time working on a class special that adds a damage bonus equal to the number of sneak attack dice at a given level. At 11th level, the bonus doubles. I want the listname and livename to list the bonus as it scales in level. My code is
Code:
~only do this if we are the first copy
     doneif (tagis[Helper.FirstCopy] = 0)

~Set abValue
     if (#levelcount[LegeRogu] >= 11) then
     field[abValue].value += (field[xCount].value + 1) * 2
     else
     field[abValue].value += field[xCount].value + 1
     endif

~ Set the listname
     field[listname].text = field[thingname].text & " " & signed(field[abValue].value)

~ Set the livename
     field[livename].text = field[thingname].text & " " & signed(field[abValue].value)
The ability scales at every odd level, but the output in the class abilities tab and the Specials tab aren't calculating correctly. What did I screw up?
Bob G is offline   #1 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old November 10th, 2018, 08:50 PM
Is this script running on the sneak attack pick? I think you need to transition to Sneak Attack and check xCount there, or else whatever other field it stores its value in.
Aaron is offline   #2 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old November 10th, 2018, 09:08 PM
The class has the sneak attack ability, so I could have the script check xCount there. But what would the pick be? Transitioning is something I've always struggled with...
Bob G is offline   #3 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old November 10th, 2018, 09:29 PM
You know what? I just figured it out. The pick IS the class ability "cSneakAtt". That's a big breakthrough for me! I just changed the code, and it works (almost) perfectly. Thank you Aaron.

The listname is still updating the first instance of the ability at level 3 with the actual bonus, and the remaining instances at later levels have no bonus listed at all.
Bob G is offline   #4 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old November 10th, 2018, 10:15 PM
So you're saying the First Copy is setting the listname, but the others are not? Do you have anything like that in your script?
Aaron is offline   #5 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old November 11th, 2018, 07:16 AM
Quote:
Originally Posted by Aaron View Post
So you're saying the First Copy is setting the listname, but the others are not? Do you have anything like that in your script?
Not that I can see:
Code:
~ If we're not shown, just get out now
     doneif (tagis[Helper.ShowSpec] <> 1)
~ if we've been disabled, get out now
     doneif (tagis[Helper.SpcDisable] <> 0)

~Set abValue
     if (#levelcount[LegeRogu] >= 11) then
     field[abValue].value += hero.child[cSneakAtt].field[xCount].value * 2
     else
     field[abValue].value += hero.child[cSneakAtt].field[xCount].value
     endif

~ Set the listname
     field[listname].text = field[thingname].text & " " & signed(field[abValue].value)
~ Set the livename
     field[livename].text = field[thingname].text & " " & signed(field[abValue].value)
Bob G is offline   #6 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old November 12th, 2018, 08:45 AM
Quote:
Originally Posted by Bob G View Post
Not that I can see:
Code:
~ If we're not shown, just get out now
     doneif (tagis[Helper.ShowSpec] <> 1)
~ if we've been disabled, get out now
     doneif (tagis[Helper.SpcDisable] <> 0)

~Set abValue
     if (#levelcount[LegeRogu] >= 11) then
     field[abValue].value += hero.child[cSneakAtt].field[xCount].value * 2
     else
     field[abValue].value += hero.child[cSneakAtt].field[xCount].value
     endif

~ Set the listname
     field[listname].text = field[thingname].text & " " & signed(field[abValue].value)
~ Set the livename
     field[livename].text = field[thingname].text & " " & signed(field[abValue].value)
In your first set of code you had a doneif checking if there was no Helper.FirstCopy tag. That does not seem to be included in the code you posted immediately before this reply.

I would have thought removing the FirstCopy check would have solved your issue, but if you still aren't seeing what you expect I think it's time to add some debugs.

For example
Code:
debug "===================="
debug "this is " & this.idstring
debug "this copy's index is " & field[xIndex].value
debug "this copy is meant to be added at level " & tagvalue[ClSpecWhen.?]
debug "===================="
~ If we're not shown, just get out now
     doneif (tagis[Helper.ShowSpec] <> 1)
debug "it passes the first doneif"
~ if we've been disabled, get out now
     doneif (tagis[Helper.SpcDisable] <> 0)
debug "it passes the second doneif"

~Set abValue
     if (#levelcount[LegeRogu] >= 11) then
dubug "this copy doubles the sneak attack dice"
debug "before adding, abValue is " & field[abValue].value
     field[abValue].value += hero.child[cSneakAtt].field[xCount].value * 2
debug "after adding, abValue is " & field[abValue].value
     else
dubug "this copy adds the sneak attack dice once"
debug "before adding, abValue is " & field[abValue].value
     field[abValue].value += hero.child[cSneakAtt].field[xCount].value
debug "after adding, abValue is " & field[abValue].value
     endif

~ Set the listname
debug "before script sets the text, listname is " & field[listname].text
     field[listname].text = field[thingname].text & " " & signed(field[abValue].value)
debug "after script sets the text, listname is " & field[listname].text
~ Set the livename
debug "before script sets the text, livename is " & field[livename].text
     field[livename].text = field[thingname].text & " " & signed(field[abValue].value)
debug "after script sets the text, livename is " & field[livename].text
To get the debug output, go to Develop and Enable Data File Debugging (if you haven't already turned that on). Then Develop -> Floating Info Windows -> Show Debug Output. You should be able to follow along through the script and see what it is doing, and identify how each copy is doing it.

One other thing. I would strongly urge you not to use the #levelcount macro to determine the level of something in a script, because that limits the reusability of the pick. There are fields which store what the level is for the pick, xAllLev for class specials, xTotalLev for custom specials, and the values for those are available from the start of the PostLevels phase. If for some reason you need the current level earlier than those fields have values, you can use the "foctoclass" procedure which sets the focus to whatever class an ability is added to, and then check the cTotalLev field on that class.
Aaron is offline   #7 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old November 19th, 2018, 03:36 PM
Thanks Aaron, I'll debug and see if I can get to the bottom of this.
Bob G is offline   #8 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old November 27th, 2018, 07:35 PM
Hi Aaron, I tried out the debugging on this ability, and learned what was happening, but not why it's happening. The debug output shows the script is successful in passing both doneif conditions at level 3, and produces the desired result. However, it fails the first doneif at level 5 and afterwards. The reason (I believe) is because the tag Helper.ShowSpec is present at level 3, but not at level 5. Can you provide any insight into why this happens?
Bob G is offline   #9 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old November 28th, 2018, 08:16 AM
Why don't you e-mail me the .user file and I'll take a look. I'm currently having some trouble with my work address so send it to lawfulg at yahoo.com.
Aaron is offline   #10 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 04:57 AM.


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