• 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

Armor Training-type feat doesn't find any armor to select

unforgivn

Well-known member
I'm trying to create a feat that improves max Dex and armor check penalties by 1 like Armor Training for a selected type of armor (similar to Weapon Focus). The problem is that entering EquipType.Armor in the custom expression field (restricted to All Things) always results in a "Nothing to choose from" message when the feat is added to a character.

Also, disabling the user selection entirely still has no effect on any purchased armors. Here's my simplified script:

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

      ~ If we haven't chosen anything, get out now
      ~doneif (field[usrChosen1].ischosen + tagis[Target.?] = 0)

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

      ~Improve the armor check penalty and max dex stats of our armors.
      foreach pick in hero from BaseArmor
        eachpick.field[arArmorChk].value += field[abValue].value
        eachpick.field[arMaxDex].value += field[abValue].value
      nexteach

The script timing is the same as those from Weapon Focus since I started with a copy of that feat as my base.

Thanks in advance.
 
Last edited:
The script timing is the same as those from Weapon Focus since I started with a copy of that feat as my base.

Could you please tell us that phase and priority, since you have it in front of you?

How does that compare to the phase and priority of the fighter's armor training class special? - In general, weapons and armor are checking their details at different times, so I'd look for an armor-related script to get timing from, rather than a weapon-related script.
 
EquipType.Armor isn't added to armor until it's been selected.

You can use "component.BaseArmor & !ArmorClass.Shield & !ArmorClass.Tower" if you're looking for things (EquipType.Armor would work if you were looking for the picks on the hero).
 

~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)
My guess is this is the problem as that is testing to see if the Class Special is active or not. As a feat is not a Class Special the test will always fail and end the script. Never getting to the later lines of code.

As your using field[abValue].value are you setting a Hard Coded Value.? tag on the feat then? Otherwise if you don't have some other Thing or script setting the value it will just be zero.
 
Could you please tell us that phase and priority, since you have it in front of you?

How does that compare to the phase and priority of the fighter's armor training class special? - In general, weapons and armor are checking their details at different times, so I'd look for an armor-related script to get timing from, rather than a weapon-related script.

Pre-levels/5000

EquipType.Armor isn't added to armor until it's been selected.

You can use "component.BaseArmor & !ArmorClass.Shield & !ArmorClass.Tower" if you're looking for things (EquipType.Armor would work if you were looking for the picks on the hero).

It doesn't find picks on the hero, either.

My guess is this is the problem as that is testing to see if the Class Special is active or not. As a feat is not a Class Special the test will always fail and end the script. Never getting to the later lines of code.

As your using field[abValue].value are you setting a Hard Coded Value.? tag on the feat then? Otherwise if you don't have some other Thing or script setting the value it will just be zero.

That was actually an old version in my clipboard (apparently I didn't copy the new one like I thought). The references to abValue had been changed to a constant 1.
 
I changed the timings to match Armor Training, and the bonuses work now. Adding in Mathias' suggested custom expression works, but it shows some things that really shouldn't be choices (Custom/Magic Armor, and other such placeholders). This isn't really a big deal, though.

Can anyone tell me how I should format the if statement to check that the eachpick being looked at is the same as the one chosen? I can't think of any feats or whatnot that use a similar selection method for armor to "borrow" code from.
 
Code:
field[usrChosen1].chosen.field[arArmorChk].value += 1
field[usrChosen1].chosen.field[arMaxDex].value += 1

no need for a foreach.

Sorry, I forgot about the custom armor. Try adding:

Code:
& !Helper.CustomItem & !Helper.Helper
to the end of the expression.
 
Code:
field[usrChosen1].chosen.field[arArmorChk].value += 1
field[usrChosen1].chosen.field[arMaxDex].value += 1

no need for a foreach.

Sorry, I forgot about the custom armor. Try adding:

Code:
& !Helper.CustomItem & !Helper.Helper
to the end of the expression.

Modifying the expression fixes that issue more or less, but replacing the foreach loop with your code results in this error whenever I actually choose anything from the list:

2vljivd.jpg


And the bonuses don't work.
 
Oops - I forgot, you're looking up a thing, then you need to use that to find all the picks that correspond to it.

Code:
var searchexpr as string
searchexpr = field[usrChosen1].chosen.tagids[thingid.?]
 
foreach pick in hero from BaseArmor where searchexpr
  eachpick.field[arArmorChk].value += field[abValue].value
  eachpick.field[arMaxDex].value += field[abValue].value
  nexteach
 
I realized I didn't think to handle custom/magic armors of the correct type.

In the next update, I'll make handling the armors and custom/magic versions of the same armor easier to accomplish, but for now, you'll need to add a second foreach to your script to search the custom/magic armors (add this at the bottom of the script):

Code:
foreach pick in hero from BaseArmor where "thingid.iMagArmor"
  if (eachpick.gizmo.tagcountstr[searchexpr] <> 0) then
    eachpick.field[arArmorChk].value += field[abValue].value
    eachpick.field[arMaxDex].value += field[abValue].value
    endif
  nexteach

(I haven't tested that yet, so please tell me if I missed anything)
 
Back
Top