• 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

Selectable Damage Resistances

DeathSheep

Well-known member
I am trying to create a barbarian-like ability where you can choose three damage types, and when you are raging, you have resistance to them. I think I'm on the right track in terms of coding, but when I test the power, the dropdown has a ton of stuff but not the damage types. Additionally I only see 2 dropdowns. I'm sure it is something simple like having the wrong tag name, but I don't know exactly what to use. Here is the code:

Code:
  <thing id="cBerPRDewbInst" name="Dewback&apos;s Instinct" description="Choose three damage types other than true damage. While raging, you have resistance to the chosen damage types." compset="CustomSpec" uniqueness="unique">
    <fieldval field="usrCandid1" value="component.DamageType & (dType.Acid|dType.Cold|dType.Fire|dType.PRForce|dType.PRIon||dType.Lightning|dType.Necrotic|dType.Poison|dType.Psychic|dType.PRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid2" value="component.DamageType & (dType.Acid|dType.Cold|dType.Fire|dType.PRForce|dType.PRIon||dType.Lightning|dType.Necrotic|dType.Poison|dType.Psychic|dType.PRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid3" value="component.DamageType & (dType.Acid|dType.Cold|dType.Fire|dType.PRForce|dType.PRIon||dType.Lightning|dType.Necrotic|dType.Poison|dType.Psychic|dType.PRSonic) & !Helper.Helper"/>
    <tag group="Helper" tag="Primary"/>
    <tag group="abCategory" tag="BersInstinct"/>
    <tag group="abRange" tag="Personal"/>
    <tag group="abDuration" tag="ConstRage"/>
    <tag group="SpecSource" tag="cHelpBrs"/>
    <tag group="Helper" tag="Helper"/>
    <tag group="Helper" tag="Free"/>
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)
      doneif (field[usrChosen2].ischosen = 0)
      doneif (field[usrChosen3].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]
      perform field[usrChosen2].chosen.pulltags[DamageRes.?]
      perform field[usrChosen3].chosen.pulltags[DamageRes.?]

      perform forward[DamageRes.?]]]></eval>
    </thing>

Any suggestions as to what I'm missing would be appreciated!
 
  1. I didn't realize there were more than chooser fields, so I'm no help with getting the third to display.
  2. For the tag expressions, I usually go with this format for damage types: thingid.dtAcid. That always works for me when everything else is working properly.
  3. I'm not familiar with the "forward" function. I usually use perform hero.pushtags[DamageRes.?] and that does the trick (depending on timing, of course).
  4. Make sure you're establishing what pool of things the tag expression is pulling from. On the editor, this is the "Restrict First List To..." box. For this, you want to pull from all things. If you were to select All Things from that drop-down, you'd see it assigns the tag "ChooseSrc1.Thing" to this feature. I would recommend trying to add that and "ChooseSrc2.Thing", etc.
  5. I don't know if it's part of your text editor or something that you're using to pull this up, but my code within the editor never uses "&". I always just have "&". Again, might just be a translation thing from the editor to your post, but I'm trying to find anything else I can. ;)

EDIT: Thinking about the third box thing; if all else fails, you can always make a second copy of this feature that just features the third box and bootstrap it to the first copy. It's less elegant, but it works.
 
Last edited:
1. I wasn't sure if that could be done. Your workaround should do it once I get the first two working
2. Changed the formula to
Code:
    <fieldval field="usrCandid1" value="component.DamageType & (thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
3. I pulled that from the code for the Bear Totem feature for barbarians...figured I could just switch out the user chosen fields. I changed it to:
Code:
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)
      doneif (field[usrChosen2].ischosen = 0)
      doneif (field[usrChosen3].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]
      perform field[usrChosen2].chosen.pulltags[DamageRes.?]
      perform field[usrChosen3].chosen.pulltags[DamageRes.?]

      perform hero.pushtags[DamageRes.?]]]></eval>
4. Where do I find the "Restrict First List To..." box? I've been hand typing these in the editor in the Fields section. If there's an easier way, I'd love to know!
5. Yes, it's the text editor. The "amp;" doesn't show up in the Editor.
 
Last edited:
1. I wasn't sure if that could be done. Your workaround should do it once I get the first two working
2. Changed the formula to
Code:
    <fieldval field="usrCandid1" value="component.DamageType & (thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
3. I pulled that from the code for the Bear Totem feature for barbarians...figured I could just switch out the user chosen fields. I changed it to:
Code:
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)
      doneif (field[usrChosen2].ischosen = 0)
      doneif (field[usrChosen3].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]
      perform field[usrChosen2].chosen.pulltags[DamageRes.?]
      perform field[usrChosen3].chosen.pulltags[DamageRes.?]

      perform hero.pushtags[DamageRes.?]]]></eval>
4. Where do I find the "Restrict First List To..." box? I've been hand typing these in the editor in the Fields section. If there's an easier way, I'd love to know!
5. Yes, it's the text editor. The "amp;" doesn't show up in the Editor.
 
I see where the "Restrict First List To..." box s, but the "Select From..." box doesn't have damage types as an option.
 
Yeah the "select from" is useless 4/5 times, because it has so few things. If "select from" doesn't have what you need, you define your own tag expression in the next box, like you did.
 
First off, I REALLY appreciate your advice. I've learned a ton just reading your responses.

That said, that code doesn't seem to be working either. I'm still getting a list of random things that aren't the damage types I specified in the dropdown. I'm really baffled. Here is the code as it stands now:

Code:
  <thing id="cBerPRDewbInst" name="Dewback's Instinct" description="Choose three damage types other than true damage. While raging, you have resistance to the chosen damage types." compset="CustomSpec" uniqueness="unique">
    <fieldval field="usrCandid1" value="component.DamageType & (thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid2" value="component.DamageType & (thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid3" value="component.DamageType & (thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <tag group="Helper" tag="Primary"/>
    <tag group="abCategory" tag="BersInstinct"/>
    <tag group="abRange" tag="Personal"/>
    <tag group="abDuration" tag="ConstRage"/>
    <tag group="SpecSource" tag="cHelpBrs"/>
    <tag group="Helper" tag="Helper"/>
    <tag group="Helper" tag="Free"/>
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)
      doneif (field[usrChosen2].ischosen = 0)
      doneif (field[usrChosen3].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]
      perform field[usrChosen2].chosen.pulltags[DamageRes.?]
      perform field[usrChosen3].chosen.pulltags[DamageRes.?]

      perform hero.pushtags[DamageRes.?]]]></eval>
    </thing>

I tried taking the third choice out in case that was giving the compiler a nervous breakdown, but nothing changed.
 
At least in the code you posted, I don't see "ChooseSrc1.Thing". Make sure you have that:
Code:
    <tag group="ChooseSrc1" tag="Thing"/>
    <tag group="ChooseSrc2" tag="Thing"/>
    <tag group="ChooseSrc3" tag="Thing"/>
 
Yes, those were definitely missing. I added them in, but I'm still getting all kinds of trash in the dropdown boxes. Here is the latest code:
Code:
  <thing id="cBerPRDewbInst" name="Dewback&apos;s Instinct" description="Choose three damage types other than true damage. While raging, you have resistance to the chosen damage types." compset="CustomSpec" uniqueness="unique">
    <fieldval field="usrCandid1" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid2" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid3" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thinid.dtPRIon||thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <tag group="abCategory" tag="BersInstinct"/>
    <tag group="abRange" tag="Personal"/>
    <tag group="abDuration" tag="ConstRage"/>
    <tag group="SpecSource" tag="cHelpBrs"/>
    <tag group="Helper" tag="Helper"/>
    <tag group="Helper" tag="Free"/>
    <tag group="ChooseSrc1" tag="Thing"/>
    <tag group="ChooseSrc2" tag="Thing"/>
    <tag group="ChooseSrc3" tag="Thing"/>
    <tag group="Helper" tag="Primary"/>
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)
      doneif (field[usrChosen2].ischosen = 0)
      doneif (field[usrChosen3].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]
      perform field[usrChosen2].chosen.pulltags[DamageRes.?]
      perform field[usrChosen3].chosen.pulltags[DamageRes.?]

      perform hero.pushtags[DamageRes.?]]]></eval>
    </thing>
 
So...I figured it out. You've got some typoes in your Tag Expression. Look at "|thinid.dtPRIon||"

You're missing a "g" on "thingid", and you have an empty spot between two "|"s, which basically tells Hero Lab "or anything". So fix those and you're good to go. I tested it myself (without your extra damage types since I don't have those programmed).

Still not sure about displaying the third box. I'd do what I mentioned earlier; make a second ability with the chooser box, and bootstrap it to the first ability. But if you do figure out how to show the third box in the same ability, please share!
 
There is one way you could do the third box, though it's messier. You'd use an Array-Based menu, manually list out each of the available types, then add an eval script that manually looks at which is chosen (field[usrIndex].value) and assigns the corresponding DamageRes.? tag. You'd have to type each damage resistance tag out with multiple if/elseif statements for each possible usrIndex value. But you'd have it all together.
 
There is one way you could do the third box, though it's messier. You'd use an Array-Based menu, manually list out each of the available types, then add an eval script that manually looks at which is chosen (field[usrIndex].value) and assigns the corresponding DamageRes.? tag. You'd have to type each damage resistance tag out with multiple if/elseif statements for each possible usrIndex value. But you'd have it all together.

I think I'll go with the easier option for now. If I get through the rest of my stuff I may revisit it. How do I bootstrap it and have it automatically add when I choose the first one? And how do I get the second ability to not show up in the initial list of choices. These are custom abilities not class specials, but even if I don't choose an ability table, the second one just shows up as another choice.

I really appreciate your advice...there is a bit of a learning curve here, but I'm starting to get on top of things slowly.
 
(On the second ability) try playing around with some of the tags that label it as an ability for the spec, like <tag group="abCategory" tag="BersInstinct"/>. Remove that and see if it still shows up. Just go into the bootstraps of the first ability and select the second one. Without any conditions, it will go onto the character whenever you select the first. There *may* be an issue with how Hero Lab handles bootstrapped class specials, but we'll take that one step at a time.
 
Okay here's how things look. The primary version is coded like this:
Code:
  <thing id="cBerPRDewbInst" name="Dewback&apos;s Instinct" description="Choose three damage types other than true damage. While raging, you have resistance to the chosen damage types." compset="CustomSpec" uniqueness="unique">
    <fieldval field="usrCandid1" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thingid.dtPRIon|thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid2" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thingid.dtPRIon|thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <fieldval field="usrCandid3" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thingid.dtPRIon|thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <tag group="abCategory" tag="BersInstinct"/>
    <tag group="abRange" tag="Personal"/>
    <tag group="abDuration" tag="ConstRage"/>
    <tag group="SpecSource" tag="cHelpBrs"/>
    <tag group="Helper" tag="Helper"/>
    <tag group="Helper" tag="Free"/>
    <tag group="ChooseSrc1" tag="Thing"/>
    <tag group="ChooseSrc2" tag="Thing"/>
    <tag group="ChooseSrc3" tag="Thing"/>
    <tag group="Helper" tag="Primary"/>
    <bootstrap thing="cBerPRDewbInst2"></bootstrap>
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)
      doneif (field[usrChosen2].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]
      perform field[usrChosen2].chosen.pulltags[DamageRes.?]


      perform hero.pushtags[DamageRes.?]]]></eval>
    </thing>

The second one like this:

Code:
  <thing id="cBerPRDewbInst2" name="Dewback&apos;s Instinct" description="Choose three damage types other than true damage. While raging, you have resistance to the chosen damage types." compset="CustomSpec" uniqueness="unique">
    <fieldval field="usrCandid1" value="(thingid.dtAcid|thingid.dtCold|thingid.dtFire|thingid.dtPRForce|thingid.dtPRIon|thingid.dtLightning|thingid.dtNecrotic|thingid.dtPoison|thingid.dtPsychic|thingid.dtPRSonic) & !Helper.Helper"/>
    <tag group="abRange" tag="Personal"/>
    <tag group="abDuration" tag="ConstRage"/>
    <tag group="SpecSource" tag="cHelpBrs"/>
    <tag group="Helper" tag="Helper"/>
    <tag group="Helper" tag="Free"/>
    <tag group="ChooseSrc1" tag="Thing"/>
    <eval phase="First" index="3"><![CDATA[
       doneif (hero.tagis[Hero.Raging] = 0)

       doneif (tagis[Helper.Disable] <> 0)

      ~ If nothing chosen then get out now!
      doneif (field[usrChosen1].ischosen = 0)

       ~ Collect selected types of damage and pull the Resistance tags from them.
      perform field[usrChosen1].chosen.pulltags[DamageRes.?]



      perform hero.pushtags[DamageRes.?]]]></eval>
    </thing>

With this configuration, the second one is not automatically added, but shows up as an additional choice in the list of abilities. It *seems* like the bootstrap is just adding it to the list instead of adding the power automatically.
 
So I had this idea that I could use the syntax for the Skilled feat and do essentially the same thing for damage resistance. I've created this procedure:

Code:
    var NumOfRes as number

    ~ Increase number of damage resistances
    if (NumOfRes <> 0) then
      hero.childfound[cfg5CRes].field[cToolMax].value += NumOfRes

I just need to know what to replace cToolMax with to affect resistances. THEN I need to know how to create the cfg5CRes helper thing to add a resistances tab. In theory then I can create a new tab called Resistances that has the ability to choose as many damage types as specified. I'm confident this will work. I'm just stuck on how exactly to do the last couple pieces.
 
Back
Top