• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

listname/livename not tallying correctly

Bob G

Well-known member
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?
 
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.
 
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...
 
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.
 
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?
 
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)
 
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.
 
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?
 
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.
 
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.

Hi Aaron, thanks for the offer, but it's really just a cosmetic problem. I can live with the ability as it exists now. I have bigger whales to hunt. :o
 
Back
Top