• 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

2 knowledge skills, only one gets the bonus

Gumbytie

Well-known member
So back into coding things for Beats & Barbarians to name a few.

Have an Edge that should apply a +2 bonus to 2 specific Knowledge Skills. So I have some code, but it only ever applies the bonus to ONE of them. I am a bit code rusty so I am probably just missing something obvious:

Set at Pre-Traits 5000, with Calc trtFinal in apparopriate spot.

Code:
if (field[abilActive].value <> 0) then
~go through all knowledge skills and find an "Arcana" one
foreach pick in hero where "thingid.skKnow"
   if (compare(lowercase(eachpick.field[domDomain].text),"arcana") = 0) then
      perform #traitprof[skKnow,+,2,"Demon Hunter"]
   endif
   if (compare(lowercase(eachpick.field[domDomain].text),"religion") = 0) then
      perform #traitprof[skKnow,+,2,"Demon Hunter"]
   endif
nexteach
endif

It boils down to whichever I happen to purchase first, it ends up with the bonus only.

Even when I separated these into 2 separate Eval scripts same results.
 
By separating you mean something like this?

Code:
if (field[abilActive].value <> 0) then
~go through all knowledge skills and find an "Arcana" one
  foreach pick in hero where "thingid.skKnow"
    if (compare(lowercase(eachpick.field[domDomain].text),"arcana") = 0) then
      perform #traitprof[skKnow,+,2,"Demon Hunter"]
   endif
  nexteach
  foreach pick in hero where "thingid.skKnow"
   if (compare(lowercase(eachpick.field[domDomain].text),"religion") = 0) then
      perform #traitprof[skKnow,+,2,"Demon Hunter"]
   endif
  nexteach
endif

That would be the other way I would think might work. I'm way, way rusty at coding things these days, though. Been a while since I've done a data file.
 
Zarlor,

I hear you, 2 years plus away from working in Hero Lab and zero gaming so I am way rusty as well.

Your version of the code is like mine, it only applies the bonus to one of the Knowledge skills, never both. It will apply it to whichever you choose first. Go figure.

I am just trying to finish up Beasts and Barbarians and move onto their Jalizar book and some others. I don't get to game anymore but still own the books and felt like working in Hero Lab again...

I will keep plugging away at this until someone with more recent experience than you and I has a better suggestion :)
 
Ah...
It's the PERFORM. It's operating against the first skKnow it finds. It needs to address the eachpick. Not sure how to code that right off-hand (not at my home computer at the moment). I don't know if you can use the #traitprof, you may need to use:

Code:
eachpick.field[trtRoll].value += 2
 
Try this to mimic the #traitprof:

Code:
perform eachpick.field[trtNoStack].modify[+,2,"Demon Hunter"]

I think that should work... :)
 
For some closure for others who might encounter this problem. The solution posted by
TCArknight solved the problem. Thank you very much to all who chime in with solutions. Cheers!
 
Back
Top