• 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

Trouble Modifying wClass

areteas

Well-known member
I'm trying to put together a data package for 4 Winds Fantasy's Strategists & Tacticians book; one of the feats is giving me some trouble:

Careful Stringing (Combat)
Even when fighting at range, you remain prepared for melee combat.
Prerequisite: Dex 15.
Benefit: You can fire a bow normally while wielding a one-handed melee weapon.

I figured the easiest way to do this would be to change the wclass of all bows in the hero's inventory when he had a light or 1-handed melee weapon equipped in one hand. Thus:
Code:
~ Timing: Pre-levels, 4000 (also tried 5000)
~ Check if hero has a 1H melee weapon equipped.
field[abValue].value = 0
foreach pick in hero from BaseWep where "wCategory.Melee & Hero.MainHand | Hero.OffHand"
    if ( eachpick.tagis[wClass.OneHanded] <> 0) then
      field[abValue].value += 1
    elseif ( eachpick.tagis[wClass.Light] <> 0 ) then
      field[abValue].value += 1
    endif
  nexteach

~ Halt if user has no 1H melee weapons equipped.
doneif (field[abValue].value = 0)

~ Change hero's bows to 1H class
foreach pick in hero from BaseWep where "wFtrGroup.Bows"
  perform eachpick.tagreplace[wClass.TwoHanded,wClass.OneHanded]
  nexteach
The timing I nabbed from this thread on difficulties modifying wclass for the sawtooth saber. However, I'm still unable to get both the bow and the 1h melee weapon equipped (bow's wclass doesn't change). I also tried referencing the bows individually as wLongbow, wCompBow, wShortbow & wCompShort, so that doesn't seem to be the issue.

Anyone got advice on how to accomplish this? Doesn't necessarily have to be via modifying wClass if there's some other, easier route I'm missing.
 
Hero.MainHand and Hero.OffHand aren't assigned until Pre-Levels/10000, but you need to change the wClass before the script that determines how many hands the weapon requires, which happens at Pre-Levels/5000 - so that the script that assigns Hero.MainHand and Hero.OffHand knows what tags to assign where.

So, you'll need to use the equip fields, rather than the finished tag:

Code:
foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)"
  if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
    field[abValue].value += 1
    endif
  nexteach

BTW, a note about your first foreach - I believe booleans are evaluated from left-to-right unless there are parentheses to tell the computer differently, so you're actually asking:

"(wCategory.Melee & Hero.MainHand) | Hero.OffHand"

Also, does it really matter if the hero has equipped a weapon for the effect you want to apply to the bows?

Will anything about the stats of the bow change if it's always a one-handed weapon? That way, once the bow is one-handed, the hero has the option to equip a melee weapon or not, and HL's going to take care of checking that they don't equip a bow and a two-handed weapon. That cuts your script down to just the last foreach.
 
Hero.MainHand and Hero.OffHand aren't assigned until Pre-Levels/10000, but you need to change the wClass before the script that determines how many hands the weapon requires, which happens at Pre-Levels/5000 - so that the script that assigns Hero.MainHand and Hero.OffHand knows what tags to assign where.

So, you'll need to use the equip fields, rather than the finished tag:
Thanks for the quick reply, Mathias. I tried that but am still stuck... ended up taking the whole if statement out of the equation to see why wClass was so stubbornly unchanging (see below).
BTW, a note about your first foreach - I believe booleans are evaluated from left-to-right unless there are parentheses to tell the computer differently,
Whoops! Yeah, I screwed that one up. Thanks for the heads up. :D

Also, does it really matter if the hero has equipped a weapon for the effect you want to apply to the bows?
Will anything about the stats of the bow change if it's always a one-handed weapon? That way, once the bow is one-handed, the hero has the option to equip a melee weapon or not, and HL's going to take care of checking that they don't equip a bow and a two-handed weapon. That cuts your script down to just the last foreach.
What I was trying to avoid there was the user being able to equip two bows, or a bow and a crossbow, or a bow and a sling, etc... the feat as-written is for melee weapons only, thus my concern (the awesomeness of dual wielding one's dual wield aside).

In any case, I've currently reduced the script to just this for testing purposes and still am unable to touch the wClass, it seems*:
Code:
~Pre-levels, Priority 4999, Index 1
~ Change hero's bows to 1H class
foreach pick in hero from BaseWep where "wFtrGroup.Bows"
  perform eachpick.tagreplace[wClass.TwoHanded,wClass.OneHanded]
  nexteach
I've also tried it with wLongbow instead of wFtrGroup.Bows just to see if that was the bit that was gumming up the works, but no dice. Something I'm missing?

* Edit - With some timing tweaks I've changed the bow class to 1H (reflected when I hover over a bow's ? icon), but on the weapons tab it still shows a checkbox for 'Both' instead of two separate hand checkboxes. Is there another tag or field I should be changing as well?
 
Last edited:
Ah, found the issue. Had to remove Helper.Always2H as well as change the class. Final code works fine (including penalties for TWF - not sure if that is RAI, but that's what I'm going with).
Code:
~ Check if hero has a 1H melee weapon equipped.
field[abValue].value = 0
foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)"
    if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
      field[abValue].value += 1
    endif
  nexteach

~ Halt if user has no 1H melee weapons equipped.
doneif (field[abValue].value = 0)

~ Change hero's bows to 1H class
foreach pick in hero from BaseWep where "wFtrGroup.Bows"
  perform eachpick.tagreplace[wClass.?,wClass.OneHanded]
  perform eachpick.delete[Helper.Always2H]
  nexteach
 
Back
Top