• 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

Feat with multiple choices?

TCArknight

Well-known member
I've got a feat that lets you choose two of 4 Craft skills.

How can I implement this? All I see is feats with one chooser....
 
Use a custom expression "thingid.XXXX|thingid.XXX" where XXX is the unique id of each of the craft skills.
 
True, that'll let me choose the craft skill for one dropdown, but is there a way to have a second dropdown on the same feat?
 
I'm afraid that feats don't have access to a second selector. You can create a helper feat and bootstrap it from the main feat to offer the second selector.

Since I believe you're familiar with using a text editor to alter the things defined for HL, you can add the following line:

<tag group="Helper" tag="Helper"/>

among the rest of the tags, in order to make your helper feat not show up in the list of feats the user can select from.
 
I see!

I can create a 'first choice' feat and a 'second choice' feat. The main feat can bootstrap each of the two choice feats and I can have the livename of the main feat modify itself based on the choices for the display.

how would I hide the helper feats from the summary and char. sheet?
 
Helper.Helper should already handle hiding them from display.

Actually, you can have the first choice on the main feat and the second choice on the helper, but two identical helpers works, too.
 
Mathias,

It's working to let me add and make the choices, but they're not being hidden.

This is what I've got:
Code:
  <thing id="fBuilder" name="Builder" description="{b}Benefit{/b}: +2 bonus for 2 of 4 Craft skills" compset="Feat" uniqueness="useronce">
    <usesource source="srcD20Mod"/>
    <tag group="fCategory" tag="General" name="General" abbrev="General"/>
    <bootstrap thing="fChsBld1"></bootstrap>
    <bootstrap thing="fChsBld2"></bootstrap>
    <eval phase="PreLevel" priority="5000"><![CDATA[
      ~ If we're disabled, do nothing
      doneif (tagis[Helper.FtDisable] <> 0)

      ~#skillbonus[choice 1] += 2
      ~#skillbonus[choice 2] += 2]]></eval>
    </thing>

  <thing id="fChsBld1" name="Builder - First Choice" compset="Feat">
    <fieldval field="ftCandExpr" value="thingid.kCraftChem|thingid.kCraftElec|thingid.kCraftMech|thingid.kCraftStru"/>
    <usesource source="srcD20Mod"/>
    <tag group="fCategory" tag="featHelp" name="Helper Feat"/>
    <tag group="Helper" tag="Helper"/>
    </thing>

  <thing id="fChsBld2" name="Builder - Second Choice" compset="Feat">
    <fieldval field="ftCandExpr" value="thingid.kCraftChem|thingid.kCraftElec|thingid.kCraftMech|thingid.kCraftStru"/>
    <usesource source="srcD20Mod"/>
    <tag group="fCategory" tag="featHelp" name="Helper Feat"/>
    <tag group="Helper" tag="Helper"/>
    </thing>

Also, how do I get the value I need for the #skillbonus[] macro?
 
You'll put the #skillbonus[] entries on the helpers.

I'd suggest creating the helpers by starting with skill focus - that's what this really is - two skill focus feats for the price of one, with limited selection options.
 
I was incorrect about Helper.Helper hiding things from the printout - it handles hiding things from user selection. Sorry about that.

Helper.FtHide is used to hide them in the printout and feats summary panel.
 
Well, it also appears to hide it from the feat selection completely. :)

It adds, but only the main feat appears on the Feat tab. The helpers don't and I get a popup error message about:

Attempt to access non-live child pick 'fChsBld1' from script

Suggestions?

Thanks!
Thomas
 
Sorry again, I've been looking at single pieces of the program without considering the larger picture.

I think just stick with Helper.Helper, and accept that they're going to be displayed on the printout.
 
's ok :)

What about starting with the Helper tag, then, after both are chosen and have updated the livename of the main feat, deleting the 'Helper' and assigning the 'FtHide' tag?
 
Whether or not a feat is displayed in the feats list is controlled by whether the Helper.FtHide tag is present after all the phases are finished. Whether it's added as part of the thing definition or in a script, it's still present at the end, so the feat isn't shown.

Code:
if (state.isoutput <> 0) then
  perform assign[Helper.FtHide]
  endif

That will only assign Helper.FtHide during the calculation pass that happens while the character sheet or the statblock are being generated.

I'd personally not bother with it - I'd say it's not a big enough problem that the feat is displayed in the output, but it's your choice.
 
Ah, ok. :)

I've tried this for the Education feat:
Code:
<eval phase="PreLevel" priority="5000"><![CDATA[
      ~ If we're disabled, do nothing
      doneif (tagis[Helper.FtDisable] <> 0)

      ~if the user hasn't selected both classes to apply this feat to,
      ~there's nothing more we can do, so just get out
      doneif (hero.child[fChsEdu1].field[fChosen].ischosen = 0)
      doneif (hero.child[fChsEdu2].field[fChosen].ischosen = 0)
 
       ~get the chosen skill names and store it in a variable
       var Choice1 as string
       var C1Len as number
       Choice1 = hero.child[fChsEdu1].field[fChosen].chosen.field[name].text
       C1Len = length(Choice1) - 11
       Choice1 = right(Choice1,C1Len)

       var Choice2 as string
       var C2Len as number
       Choice2 = hero.child[fChsEdu2].field[fChosen].chosen.field[name].text
       C2Len = length(Choice2) - 11
       Choice2 = right(Choice2,C2Len)

      ~#skillbonus[hero.child[fChsEdu2].field[fChosen].chosen.thingid] += 2
      ~#skillbonus[] += 2

      ~ Set our name properly
      field[livename].text = field[name].text & " - " & Choice1 & ", " & Choice2
      
      var result as number
      
      result = hero.child[fChsEdu1].delete[Helper.Helper]
      result = hero.child[fChsEdu1].assign[Helper.FtHide]
      result = hero.child[fChsEdu2].delete[Helper.Helper]
      result = hero.child[fChsEdu2].assign[Helper.FtHide]

      ]]></eval>

It seems to work in letting the Choices be present until both are chosen, then it hides them from the Feat tab and from the character sheet. However, it doesn't hid from the Feat summary, and it doesn't hide from the Feat tab until after the tab is left and returned to.

The #skillbonus macro I've got above doesn't seem to work either. I get error due to 'non-existent thing 'hero' used in script'
 
I repeat - use the Skill focus feat as your starting point, and put the scripts that handle the bonus on the helpers. That way you don't have to worry about changing context like this, because I really have no idea how to incorporate that into the #skillbonus macro.

You can have your helpers use the root. transition to lookup the thing that added them and modify its livename.

If you add Helper.FtHide to the helper, that means that after the user selects something on both, the helpers disappear, and the user can't change their mind about what was selected.

There's no need to delete Helper.Helper - it only controls what feats the user sees when selecting feats, so deleting it from a copy that's already there won't change anything.

The reason it's not disappearing from the feat tab or the summary is that those tables aren't set up to force HL into updating them for every change - additions and removals are only checked when the user makes other additions or removals (so if the user added another feat after making the changes to this one, the helpers should vanish when that new feat is added and everything is checked for whether it belongs in the list). Doing a print-preview will also update things, since the main window is re-rendered when you close print preview.
 
Sorry, I missed where you'd mentioned about looking at Skill Focus :(

However, I did manage a solution. :) Yes, it won't let them go back and change their mind, but they can delete the Educated feat and start over. :)

Code:
  <thing id="fEducated" name="Educated" description="{b}Benefit{/b}: +2 bonus for 2 Knowledge skills" compset="Feat" uniqueness="useronce">
    <usesource source="srcD20Mod"/>
    <tag group="fCategory" tag="General" name="General" abbrev="General"/>
    <bootstrap thing="fChsEdu1"></bootstrap>
    <bootstrap thing="fChsEdu2"></bootstrap>
    <eval phase="PreLevel" priority="5000"><![CDATA[
      ~ If we're disabled, do nothing
      doneif (tagis[Helper.FtDisable] <> 0)

      ~if the user hasn't selected both classes to apply this feat to,
      ~there's nothing more we can do, so just get out
      doneif (hero.child[fChsEdu1].field[fChosen].ischosen = 0)
      doneif (hero.child[fChsEdu2].field[fChosen].ischosen = 0)
 
       ~get the chosen skill names and store it in a variable
       var Choice1 as string
       var C1Len as number
       var C1thing as string
       Choice1 = hero.child[fChsEdu1].field[fChosen].chosen.field[name].text
       C1Len = length(Choice1) - 11
       Choice1 = right(Choice1,C1Len)
       C1thing = hero.child[fChsEdu1].field[fChosen].chosen.idstring

       var Choice2 as string
       var C2Len as number
       var C2thing as string
       Choice2 = hero.child[fChsEdu2].field[fChosen].chosen.field[name].text
       C2Len = length(Choice2) - 11
       Choice2 = right(Choice2,C2Len)
       C2thing = hero.child[fChsEdu2].field[fChosen].chosen.idstring
       ~notify C2thing
 
       ~ Loop through all skills
       var result1 as number
       var result2 as number
       
       foreach pick in hero where "component.BaseSkill"
         result1 = compare(eachpick.idstring,C1thing)
         result2 = compare(eachpick.idstring,C2thing)
         if (result1 = 0) then
           eachpick.field[Bonus].value += 2
           endif
         
         if (result2 = 0) then
           eachpick.field[Bonus].value += 2
           endif
       nexteach

       ~ Set our name properly
       field[livename].text = field[name].text & " - " & Choice1 & ", " & Choice2
       
       var result as number
       result = hero.child[fChsEdu1].assign[Helper.FtHide]
       result = hero.child[fChsEdu2].assign[Helper.FtHide]

      ]]></eval>
    </thing>

  <thing id="fChsEdu1" name="Educated - First Choice" compset="Feat">
    <fieldval field="ftCandExpr" value="thingid.kKnow?"/>
    <usesource source="srcD20Mod"/>
    <tag group="Helper" tag="Helper"/>
    </thing>

  <thing id="fChsEdu2" name="Educated - Second Choice" compset="Feat">
    <fieldval field="ftCandExpr" value="thingid.kKnow?"/>
    <usesource source="srcD20Mod"/>
    <tag group="Helper" tag="Helper"/>
    </thing>

It seems like I could clean it up a bit, but missing where at the moment. Any suggestions?
 
Set the main feat to offer the first of the skill selections, and give it this script:

Code:
<eval phase="PreLevel" priority="4500"><![CDATA[
~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)
 
call fTargetFoc
doneif (state.isfocus = 0)
 
~ Add 2 to our chosen skill
focus.field[Bonus].value += 2
 
~ Set our 'short name'
field[fShortName].text = "Focus: " & focus.field[name].text
 
~Add our name to our livename
field[livename].text = field[name].text & " - " & focus.field[name].text ]]></eval>

Don't set the helper to have selections - a script will derive what it should select from by looking up what the pick that's adding it selects from.

The first script here retrieves the "Custom Expression" from the pick that bootstrapped this one. (Yes, this script is after the other, but the custom expression is actually only needed at the end of the calculation cycle - and making use of the calculation will happen in a new calculation cycle, so this should work). (The timing here is important - if you use a "Select From" for your feat, instead of a "Custom Expression", that's converted into the "Custom Expression" at PreLevel/5000 - so, this will pick up feats set up both ways.)

The second adds a bonus to the selected thing and modifies the name of the root pick.

Note that the root pick is generating its name slightly before this one is adding to that name.

Code:
<eval index="1" phase="PreLevel" priority="5500"><![CDATA[
  ~get our list of things to select from from our root
  if (isroot <> 0) then
    field[fCandExpr].text = root.field[fCandExpr].text
    endif
  ]]></eval>
<eval index="2" phase="PreLevel" priority="5000"><![CDATA[
  ~ If we're disabled, do nothing
  doneif (tagis[Helper.FtDisable] <> 0)
 
  ~construct our name from our parent's name
  if (isroot <> 0) then
    field[livename].text = root.field[name].text & " Helper"
    endif
 
  call fTargetFoc
  doneif (state.isfocus = 0)
 
  ~ Add 2 to our chosen skill
  focus.field[Bonus].value += 2
 
  ~ Set our 'short name'
  field[fShortName].text = "Focus: " & focus.field[name].text
 
  ~Add our name to our root
  if (isroot <> 0) then
    root.field[livename].text &= ", " & focus.field[name].text
    endif
 
  ~don't show us when printed
  if (state.isoutput <> 0) then
    perform assign[Helper.FtHide]
    endif
  ]]></eval>

Also, since I noticed that you're talking about a feat named education and another named builder, I've made the helper completely generic. Both Education and Builder can bootstrap the same helper - the helper will get its name and custom expression from what bootstraps it.
 
Many thanks!

It does look a bit cleaner, but I do get an error when I make a selection on the main feat:

Attempt to access pick information or behaviors for read-only thing 'kCraftElec'
Location: Procedure 'fTargetFoc' near line 6

I take it that's something with the call in the Helper? I chose Craft: Electronics (kCraftElec) for the main feat.
 
In the editor entry for that feat, there's a "Restrict To" selector. For a feat that adds a bonus to a thing that exists on the hero, that needs to be set to "Picks on Hero", not left blank.
 
Back
Top