• 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

Modifying Two weapon defense script!

bodrin

Well-known member
I'm trying to fathom out how to modify Two Weapon defense to only apply a Bucklers Shield bonus for the feat Improved Buckler defense.

Code:
~Improved Two Weapon Defense

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

      ~ Check to see if we have something equipped in each hand
      if (hero.tagis[Hero.EquipMain] + hero.tagis[Hero.EquipOff] < 2) then
        done
        endif

      ~ Check to see that we have at least two weapons equipped, or a double
      ~ weapon
      if (hero.tagcount[Hero.EquipWep] < 2) then
        if (hero.tagcount[Hero.EquipDbl] = 0) then
          done
          endif
        endif

      ~ Check to see if our Unarmed Strike is selected in either main or off
      ~ hands
      if (hero.child[wUnarmed].tagis[Hero.MainHand] + hero.child[wUnarmed].tagis[Hero.OffHand] > 0) then
        done
        endif

      ~ Otherwise, add a +2 Shield bonus to our AC
      hero.child[ArmorClass].field[tACShield].value = maximum(hero.child[ArmorClass].field[tACShield].value, 2)

I've managed to modify the script for the Complete warrior versions of the Improved and Greater Two weapon defense by altering the value number at the end from 1 to 2 to 3 respectively.

However I don't want to add a shield bonus I just need to keep the Bucklers Shield bonus active whilst ignoring any other kind of shield, but I can't seem to assign the mBuckler or EquipShld tags correctly.

Any help or thoughts greatly appreciated!
 
Try creating a test character wielding two weapons and a buckler. They get the buckler's shield bonus. So, that bug needs to be fixed before you can enter this feat's script.
 
Try creating a test character wielding two weapons and a buckler. They get the buckler's shield bonus. So, that bug needs to be fixed before you can enter this feat's script.

I looked at the Bucklers Eval Rule Script to see if I could figure out why the bonus is applied and how to modfiy it but I keep getting an undefined THING error!

Vanilla code follows
Code:
      ~ Work out if we're equipped, or, if we're the child of a magic item, if
      ~ our parent is equipped
      var result as number
      result = field[gIsEquip].value
      if (container.ishero = 0) then
        result += container.parent.field[gIsEquip].value
        endif

      ~ Taking an off-hand is ok with this shield, but you get -1 to hit
      if (result <> 0) then
        [i]result = hero.assign[Hero.ShldOffOK][/i]
        result = hero.assign[Hero.OffShlP1]
        endif

I presume that modifying the Hero.OffShlP1 line or deleting it entirely wouldn't apply the -1 penalty to hit so I didn't touch that.

The only thing i can think to do is edit the Hero.ShldOffOK line to check for a valid condition on a Hero.Tagis with the field [Hero.mBuckler] only assigned but when i try all i get is an undefined thing mBuckler error.

I suggest that the bug displaying the shield on the hero when 2 weapons and a buckler are equipped is somehow connected to the ShldOffOK line also
 
I think all you need to do is remove the -1 to hit if you have the feat, right? Create your own version of the buckler that replaces the old one, and change the script as follows (changes shown in bold):

Code:
      ~ Work out if we're equipped, or, if we're the child of a magic item, if
      ~ our parent is equipped
      var result as number
      result = field[gIsEquip].value
      if (container.ishero = 0) then
        result += container.parent.field[gIsEquip].value
        endif

      ~ Taking an off-hand is ok with this shield, but you get -1 to hit
      if (result <> 0) then
        result = hero.assign[Hero.ShldOffOK]
[b]       if (#hasfeat[fImpBuckDf] = 0) then[/b]
          result = hero.assign[Hero.OffShlP1]
[b]         endif[/b]
        endif

That way you get the penalty as normal if you don't have the feat. Does that work?
 
Actually, the -1 to hit stays (and it works in HL). If you attack with an arm that's also wearing a buckler, you lose the shield bonus for the rest of the round. I'm guessing it wasn't implemented in HL in the first place because you do have the bonus until you attack, and HL doesn't distinguish between before and after your action except in the tactical console. The feat takes away losing the shield's bonus.
 
Actually, the -1 to hit stays (and it works in HL). If you attack with an arm that's also wearing a buckler, you lose the shield bonus for the rest of the round. I'm guessing it wasn't implemented in HL in the first place because you do have the bonus until you attack, and HL doesn't distinguish between before and after your action except in the tactical console. The feat takes away losing the shield's bonus.

The Improved Buckler Defense feats' benefit is to negate the -1 penalty if you attack with a weapon in your offhand. The AC Shield bonus from the buckler is still applicable when wielding two weapons. I created a replacement buckler for the standard one and copied the code directly, applied the feat and equipped two weapons and a buckler on a test character, but it adds another +1 shield bonus on top of the bucklers shield AC instead of assigning only the +1 Shield bonus any ideas why?

Code:
~ Work out if we're equipped, or, if we're the child of a magic item, if
      ~ our parent is equipped
      var result as number
      result = field[gIsEquip].value
      if (container.ishero = 0) then
        result += container.parent.field[gIsEquip].value
        endif

      ~ Taking an off-hand is ok with this shield, but you get -1 to hit
      if (result <> 0) then
        result = hero.assign[Hero.ShldOffOK]
      [b] if (#hasfeat[fImpBucDef] = 1) then (Had to modify this line to = 1 to get the code to work.)[/b]
          result = hero.assign[Hero.OffShlP1]
         endif
        endif
 
Last edited:
Are we working with different versions of the Complete Warrior book? Page 100, bottom left:

"Benefit: When you attack with a weapon in your off hand, you may still apply your buckler's shield bonus to your Armor Class."

The version I'm reading doesn't mention the penalty to hit for wearing a buckler while wielding two weapons.
 
Are we working with different versions of the Complete Warrior book? Page 100, bottom left:

"Benefit: When you attack with a weapon in your off hand, you may still apply your buckler's shield bonus to your Armor Class."

The version I'm reading doesn't mention the penalty to hit for wearing a buckler while wielding two weapons.

I concur mgehl it doesn't mention the removal of the attack penalty, it only confers the Shield Bonus. Foolishly I had misinterpreted the information.
However I still get +2 on the shield bonus whilst having 2 weapons and the buckler equipped. I don't understand why!
 
I've just spotted my error in the eval script for the feat. I'd not changed the Shield bonus to +1 from +2, (i'd just copied and pasted the code from another feat.)
 
Last edited:
Back
Top