Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

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

Old December 8th, 2017, 07:49 PM
Hi everyone, still working on the Battle Lord class, up to 12th abilities now, thanks to all of your gracious help.

I've hit a mental block on one ability. I want the script to find all skills that have a minimum number of ranks equal to half the character's class level, and place those in a item selection drop down. Then, once the user makes a selection, grant a bonus to the selected skill.

I got started with a foreach pick in hero from BaseSkill where "helper.hasRanks" to narrow the list. After that, I thought I would use the #skillranks macro to identify which ones met the criterion, but I got stuck when I didn't know how to point the macro to all skills.

I can figure out how to do the bonus to the user pick, but can't figure out the middle part of the recipe. Any suggestions?
Bob G is offline   #1 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old December 8th, 2017, 10:05 PM
See if you can draw from this example to accomplish what you want:

Code:
  <thing id="cMedKnoTal" name="Knowledge of Tales" description="A storyteller gains a +1 bonus on all Knowledge skill checks with Knowledge skills in which he’s trained. This bonus increases by 1 for every 4 medium levels that he possesses.\n\nThis ability replaces spirit bonus." compset="ClSpecial">
    <tag group="abAction" tag="None"/>
    <tag group="abRange" tag="Personal"/>
    <tag group="abDuration" tag="Constant"/>
    <tag group="AbilType" tag="Extra"/>
    <tag group="Helper" tag="SpecUp"/>
    <eval phase="PostLevel" priority="10000"><![CDATA[
      field[abValue].value += round(field[xAllLev].value/4,0,-1) + 1

      ~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)

      ~ If we're disabled, do nothing
      doneif (tagis[Helper.SpcDisable] <> 0)

      foreach pick in hero from BaseSkill where "Helper.SkCatKnow & fieldval:skRanks > 0"
        eachpick.field[Bonus].value += field[abValue].value
        nexteach
      ]]></eval>
    </thing>
Hint: You can set variables and include them with tag expressions.
Aaron is offline   #2 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old December 14th, 2017, 09:49 AM
Hi Aaron, thanks for the challenge. I took it up to the best of my ability, but was not able to figure out how variables could help me, nor could I get the results of my foreach loop dumped into a usr field.

~Set abValue to half the battle lord class levels, rounded down.
field[abValue].value += round(field[xTotalLev].value/2,0,-1)

~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)

~ If we're not activated, just get out now
doneif (field[abilActive].value = 0)

foreach pick in hero from BaseSkill where "Helper.HasRanks & fieldval:skRanks >= field[abValue].value"

That's as far as I was able to get. How do I tell the editor to put the results of the foreach into a usr field?
Bob G is offline   #3 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old December 14th, 2017, 02:16 PM
You got the important elements (calculate the number of ranks you want to check for, then combine it with the fieldval element looking at the skRanks field), so good job on that! The bit you're missing is that when building a tag expression like the one you are using in this foreach, only certain types of info can be included. The "field[abValue].value" being included directly into the tag expression isn't understood, but you can have the program alter it into a simple number and incorporate that by placing it outside the "". You need to include and & when appending a value like that though.

Code:
foreach pick in hero from BaseSkill where "fieldval:skRanks >= " & field[abValue].value
I think that should work.
Aaron is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 14th, 2017, 02:25 PM
Also, double-check your doneifs - you changed one of them from the original example, which was a pair of tests designed for use on class specials to a single doneif that uses a tag designed for feats. Since you're building a class special, like the original example, that shouldn't have changed.
Mathias is offline   #5 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old December 14th, 2017, 04:31 PM
Quote:
Originally Posted by Mathias View Post
Also, double-check your doneifs - you changed one of them from the original example, which was a pair of tests designed for use on class specials to a single doneif that uses a tag designed for feats. Since you're building a class special, like the original example, that shouldn't have changed.
You're right, Mathias, I'm not sure how that happened, but it wasn't intentional. I've changed it back to the original.

Thanks for the catch!
Bob G is offline   #6 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old December 14th, 2017, 04:40 PM
Quote:
Originally Posted by Aaron View Post
You got the important elements (calculate the number of ranks you want to check for, then combine it with the fieldval element looking at the skRanks field), so good job on that! The bit you're missing is that when building a tag expression like the one you are using in this foreach, only certain types of info can be included. The "field[abValue].value" being included directly into the tag expression isn't understood, but you can have the program alter it into a simple number and incorporate that by placing it outside the "". You need to include and & when appending a value like that though.

Code:
foreach pick in hero from BaseSkill where "fieldval:skRanks >= " & field[abValue].value
I think that should work.
Thanks Aaron, that makes sense. The 'HasRanks' tag is redundant if skRanks is greater than zero.

So, once the foreach has proper syntax, I want to throw all positive results from the foreach into a usr field...would this be the right way?
Code:
eachpick.field[usr1].value = field[abValue].value
        nexteach
Bob G is offline   #7 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old December 14th, 2017, 10:54 PM
Well, you want to build up the candidate expression field, right? So you can store the thing id of each skill it foreaches over with a splice. BTW the field you are probably wanting isn't usr1, it is usrCandid1

Code:
foreach pick in hero from BaseSkill where "fieldval:skRanks >= " & field[abValue].value
  field[usrCandid1].text = splice(field[usrCandid1].text, eachpick.tagids[thingid.?], " | ")
  nexteach
Splice has 3 elements inside the (), the first is the string of text you are inserting into, the second is the text inserted, and the third is a divider that comes before element 2, but is only inserted if element one is not empty. So if the first skill you iterate to in the foreach is Acrobatics will insert "thingid.skAcrobat", and the second is Bluff it will add " | thingid.skBluff"
Aaron is offline   #8 Reply With Quote
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old December 15th, 2017, 01:09 PM
Yes, a candidate expression is what I was looking for. We use the splice command to basically say "take the picks that meet the qualifications in the foreach, and place them into a drop-down menu for the user to select. The final element of the splice tells the command to keep looking until it finds no more matching results. I tried it and worked perfectly. Thanks.

Now I want to tell the editor to take the user's selection, and apply a competence bonus to that selection. I tried
Code:
field[usrChosen1] = hero.child[usrChosen1].field[BonComp].value += 5
but it gave me an error on the field context. How do I point it correctly to the user's selection?
Bob G is offline   #9 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 15th, 2017, 01:16 PM
Back to the scripting tutorials:
http://forums.wolflair.com/showthread.php?t=21688

You're doing math here, so what does the math tutorial say about how you can use an abbreviation to save yourself a lot of typing when doing arithmetic?

Once you've got that fixed, then we'll do another fix for this line - competence bonuses are non-stacking, so you're not actually adding a bonus in the correct way. As written, your bonus will stack with anything else that's adding a competence bonus. But still best to make sure you understand how to set up the basic math, and then we'll do a lesson on how to apply non-stacking bonuses.
Mathias is offline   #10 Reply With Quote
Reply


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 07:30 PM.


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