• 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

Derived Statistics in Editor

Hello world. I'm new to the forums! Now, I've been using the character generator for SW for a long time, and I'm just starting to add my own derived statistic. I can get it to show up, but I can't figure out how to actually DERIVE it from something. If it matters, I'm trying to get a statistic that equals half of the Spirit die -2 for a Mana statistic. Any suggestions???

~Umbra
 
Sorry to take so long to respond. You just need to set up an Eval Script to handle it. I find looking at examples, but seeing what's going on in other data files, to be helpful.

So in this case, for example, you could do something on the Derived Trait tab and select "New (Copy)" and maybe pick Toughness from the list (2+Half Vigor, so close to what you want with just a different attribute). Then modify the text and name and all to match up what you want it to say for Mana. Then look at the Eval Script that is set on it. It's set to run at Traits/4000 and looks like:

Code:
      ~toughness is 2 plus half the character's Vigor, but we track attributes at
      ~the half value (2-6), so we add Vigor directly; we get the Vigor by using
      ~the "#trait" macro
      ~Note: We must also handle an overage beyond d12 on a +1 per 2 full points basis.
      ~Note: We ADD the amount in case other effects have already applied adjustments.
      var bonus as number
      bonus = #trait[attrVig]
      if (bonus >= 6) then
        bonus = 6 + round(hero.child[attrVig].field[trtRoll].value / 2,0,-1)
        endif
      perform field[trtBonus].modify[+,bonus,"Half Vigor"]
      ~equipped armor should add to the Toughness, so we add that from the armor

All of the stuff that starts with a "~" is just there for us to read and explain what's going on, the program completely ignores it. So looking at only the actual code we'd need to change a few things. I think this is probably something about what you're looking to do:

Code:
      var bonus as number
      bonus = #trait[attrSpi]
      if (bonus >= 6) then
        bonus = 6 + round(hero.child[attrVig].field[trtRoll].value / 2,0,-1)
        endif
      perform field[trtBonus].modify[+,bonus,"Half Spirit"]

Finally you should make sure to change the "Base Value" field from "2" to "-2" to fit your needs and set the Display sequence to something appropriate (usually 5 to put it at the bottom of the list of traits).

Hope that helps and welcome to the forums!
 
Thanks, thanks, and thanks! I copied the Toughness eval and it's working perfectly. My eternal gratitude, zarlor.

~Umbra

~sent prematurely...
 
Last edited:
I have it all down, but it still isn't moving from zero. I changed the Base Value to -2 and the display sequence is 5, but it still comes up with zilch. I'll keep messing around with it but I think the code may have an issue with setting a non-integer as a base value.
 
Last edited:
Have you tried it with a base value of 0 (or blank)? If that works then you can probably just set that bonus line to something like

bonus = #trait[attrSpi] - 2

I think that might work.
 
Still not getting anything. But I tried making a duplicate of Toughness and calling it something else and it didn't even show up, so I think it might be conflicting with the original code, although I can't tell where. I tried to change the sequence but unless it's a multiple of 1000 it gets angry so I'm not sure what to do. I might just make a custom character sheet and do it manually, but that would really be a pain.
 
Works fine for me... Let's see... you copied Toughness, then changed the name to Mana, UniqueID to something unique (say trHRMana), clicked on Eval Scripts, either pasted over what is there with my code above or just replaced every occurrence of attrVig with attrSpi, then scrolled down and deleted the second script that's there (it deals with armor, you won't need it), set an appropriate Short Name, Abbreviation, Base Value of -2, and changed Display sequence to 5?

Did you set a Source? If not it should show up everywhere just fine, if you did then you also need to make sure you character is set to use that source (Character -> Configure Hero).

I'm also assuming you either compiled your data file or at least just saved it an restarted Hero Lab. Would that be right?
 
UmbralHero,

Where you ever able to get this to work? I does work for me, even with a -2 base. I can probably send you something like this in a .user file if you're still having problems with it.
 
Hey I've been messing around with stuff and I think I originally typed it as AttrSip instead of AttrSpi. I recopied the Toughness block and it's working just fine now. Thanks for your help :)
 
Exactly, Caped. I know that never happens to me... ever. Really. ;)

Glad to hear it's working now, UmbralHero!
 
And every programmer reading that says to themselves "Wow, and that NEVER happens to me!"

Oh yeah!!! Bane of existence for everyone who dabbles in coding. That's why debugging code is akin to serving time in purgatory! Painful and seemingly endless!
 
Back
Top