Junior Member
Join Date: Nov 2013
Location: Sugar Land, TX
Posts: 27
|
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. |
#1 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
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 |
#2 |
Junior Member
Join Date: Nov 2013
Location: Sugar Land, TX
Posts: 27
|
I pasted it in real quick and no change in the result. Thanks for responding though.
|
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
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"? Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
|
#4 |
Junior Member
Join Date: Nov 2013
Location: Sugar Land, TX
Posts: 27
|
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 by Tengu1958; October 15th, 2014 at 06:19 AM. |
#5 |
Junior Member
Join Date: Nov 2013
Location: Sugar Land, TX
Posts: 27
|
I forgot to mention that it still does not function.
|
#6 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
This is the point in time where you start testing the timing, I suggest trying Post-Levels 10000 with the wDamMelee field
|
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
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:
debug "Start" doneif (tagis[Helper.FtDisable] <> 0) debug "Not Disabled" foreach pick in hero from BaseWep where "wCategory.Melee & (wClass.Light | wClass.OneHanded)" debug "Found: " & eachpick.field[name].text if (eachpick.tagis[Hero.MainHand] + eachpick.tagis[Hero.OffHand] = 1) then debug eachpick.field[name].text & " is equipped" eachpick.field[wDamBonus].value += 2 debug "Damage Bonus: " & eachpick.field[wDamBonus].value endif nexteach Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
#8 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
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?
|
#9 |
Junior Member
Join Date: Nov 2013
Location: Sugar Land, TX
Posts: 27
|
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. |
#10 |
|
|