• 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

One hand weapon damage bonus

Tengu1958

Active member
I am trying to add +2 damage to the hero when they fight with a single one-hand melee weapon. My current results give every weapon +2 damage.


Pre-attributes Priority 10000 Index 1


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

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

~ Add to our damage bonus
hero.child[Damage].field[tDamBonus].value += field[abValue2].value


Thanks for any insight you can provide.
 
Something like this

Code:
      doneif (tagis[Helper.FtDisable] <> 0)

      foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)"
        if (eachpick.tagis[Hero.MainHand] + eachpick.tagis[Hero.OffHand] = 1) then
          eachpick.field[wDamage].value += 2
        endif
      nexteach

This is untested, but should give you a good start
 
Code:
      ~ If we're disabled, do nothing
      doneif (tagis[Helper.FtDisable] <> 0)
 
      foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)"
      if (eachpick.field[gIsEquip].value <> 0) then
     field[abValue].value += 1
      endif
      nexteach
  
      ~ Add to our damage bonus
      hero.child[Damage].field[tDamBonus].value += field[abValue2].value

Thanks for any insight you can provide.
Lets take a quick look at your above logic and it what its done in plain english.

Loop through all "weapons" that are on the character that are Melee and Light or One-handed. For each one you find that is equipped in the main hand only add one to a variable.

Then at the very end you have that variable add to the "Damage" bonus Pick which adds to "EVERY" weapon on the character. So the more equipped weapons on your character the more damage it does.

Andrew's code is 99% correct. But it includes ALL the code you want to include so you especially want to remove the hero.child[Damage] logic that adds to all weapons.

The only part of Andrew's code that is off is the "field[wDamage]" as that is actually the "die size" of the weapon. So that needs to be changed. But I think its best for a person to learn how to find the field themselves.

So go to "Develop->Enable Data File Debugging". Then add a weapon to your character and right click on the "?". In the new window click on "Show Debug Fields for xxxxx". This will display a huge list of "fields" that exist on this "Pick" (ie Weapon) and what its final value is. Do you see any "field" that would work for adding to for "Bonus Damage"?
 
I did not know I could look at those lists of fields like that with the right clicking. Pretty cool. I saw a bunch of fields that might work and tried them all and still not getting bonus weapon damage. This is how my code looks now:

Pre-Levels Priority 5000 Index 1

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

foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)"
if (eachpick.tagis[Hero.MainHand] + eachpick.tagis[Hero.OffHand] = 1) then
eachpick.field[wDamBonus].value += 2
endif
nexteach


I also tried it with wDamMelee and several of the dmmXXXXXX fields as well, such as enhancement bonus and trait bonus for damage.
 
Last edited:
This is the point in time where you start testing the timing, I suggest trying Post-Levels 10000 with the wDamMelee field
 
Andrew has a good point. Also you are "equipping" a weapon on the "Weapon" tab right? The above script logic is designed to only work for a light/one-handed weapon that is equipped in the main or off-hand.

The "next" idea also is to use "debug" commands to debug your script. Once added you can see the results by going to "Debugging->View Floating Info Windows->Debug Output". I am not near HL but think that is right so the wording will be close not exact. Sorry:

Code:
[B]debug "Start"[/B]
doneif (tagis[Helper.FtDisable] <> 0)
[B]debug "Not Disabled"[/B]
      foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)"
[B]debug "Found: " & eachpick.field[name].text[/B]
        if (eachpick.tagis[Hero.MainHand] + eachpick.tagis[Hero.OffHand] = 1) then
[B]debug eachpick.field[name].text & " is equipped"[/B]
          eachpick.field[wDamBonus].value += 2
[B]debug "Damage Bonus: " & eachpick.field[wDamBonus].value[/B]
        endif
      nexteach
 
There is also an important question to answer, is this only supposed to work if you're wielding 1 and only 1 weapon in a hand? Or does it work wielding say 2 daggers one in each hand?
 
I have been trying this with a long sword equipped.

The timing change did the trick. Apparently I need to study this timing thing a bit more. I also used the wDamMelee. When I was looking at the fields list it seemed the most logical choice.

And to answer you question about wielding. This is for a single one hand weapon wielder. It should not work for a dual wielder, though shields are fine.

And I just added a dagger and that weapon has the bonus damage as well. Let me look at the code Shawdow Chemosh posted.

Thanks both of you for the help. Not a programmer so I have tough time figuring the logic out some times.
 
I removed "+ eachpick.tagis[Hero.OffHand]" and now it works the way I intended.

Once again I appreciate you guys patience and assistance.
 
Back
Top