Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
saintaurik
Member
 
Join Date: Oct 2013
Posts: 46

Old November 11th, 2013, 01:04 PM
I have a race that uses shortbows and gains a +1 bonus to attack with them. It shows up fine for a normal shortbow or composite shortbow but when a magical shortbow is equipped the bonus +1 does not get added in. I'm very new to this and not sure if I did the eval right.
Here it is:

~find all our shortbows and add +1 to hit

foreach pick in hero from BaseWep where "IsWeapon.wShortbow | wCategory.RangeProj"
eachpick.field[wAttRanged].value += 1
nexteach
saintaurik is offline   #1 Reply With Quote
Kendall-DM
Spy
 
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220

Old November 12th, 2013, 09:48 AM
I don't know the code right off the top of my head at the moment, but when you have magical weapons (and masterwork weapons as well), you need to reference the parent container of the object that is getting the bonus. This is an oddity of custom weapons and armor that I've run into more than a few times when coding HL.

A little pseudo-code that might help:

if (container.ishero <> 0)
field[wRanged].value += 1
else
container.parent.field[wRanged].value += 1
endif

Hope that helps!
Kendall-DM is offline   #2 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old November 12th, 2013, 10:02 AM
When you have a magic weapon (or masterwork weapon), you get a minimum +1 bonus to attack built in. This bonus is applied to the field [wAttBonus]. Without going through the exercise, my guess is that when this happens, the bonus you are applying to [wAttRanged] is not stacking. If you adjust your script to change wAttBonus instead, it would probably work.

Also, the addition of "wCategory.RangeProj" in the foreach seems extraneous based on your description of the ability.

Last edited by Sendric; November 12th, 2013 at 10:04 AM.
Sendric is offline   #3 Reply With Quote
Kendall-DM
Spy
 
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220

Old November 12th, 2013, 10:39 AM
I'm not sure this is the correct logic Sendric, magic weapons get their EnhanceBonus set, which gives both a +1 to hit and +1 to damage. If you only want a weapon to assign an attack bonus, you modify the wAttBonus or wRanged (I think that is the right name of the field). A masterwork weapon has this field set to 1, if you then somehow add an EnhanceBonus to that weapon, say through a Magic Weapon spell (using an Adjustment to that weapon) you will have +2 to hit and +1 to damage. Magic weapons don't exclude the masterwork +1 through the wAttBonus (or whatever it is called).

What is happening is that the gMagWpn (? again, just from the top of my head) item that designates a custom magic weapon as magical has a child of Shortbow. The Shortbow needs to be able to reference its parent to give it the bonus. Of course, I am working strictly from memory, but I believe that is how it works, I've done a ton of work for my campaign in regard to this and it came up all the time. Of course, I could also be wrong, as my memory is full of holes sometimes. I'll check for sure when I get home later today.
Kendall-DM is offline   #4 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old November 12th, 2013, 11:51 AM
I can't say I followed everything you just said. However, I did create a special that adds +1 attack to all shortbows (normal, mwk, and magical), and tried out several fields. Here's the one that seems to work:

Code:
foreach pick in hero from BaseWep where "IsWeapon.wShortbow"
  eachpick.field[wRanAttBAB].value += 1
nexteach
It also stacks with Weapon Focus. And for the record, mwk and magical do apply their bonuses differently. I only looked at masterwork earlier, so sorry about that.

Last edited by Sendric; November 12th, 2013 at 11:54 AM.
Sendric is offline   #5 Reply With Quote
Kendall-DM
Spy
 
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220

Old November 12th, 2013, 05:33 PM
Wouldn't wRanAttBAB actually give you a better Base Attack Bonus. So a level 5 warrior of that race would actually get two attacks with the Shortbow when it should not. Though I'm not sure HL BAB works the same as one would expect it to.

Sorry for the jargon above, I was just riffing off the top of my head at the end of my lunch at work.
Kendall-DM is offline   #6 Reply With Quote
Kendall-DM
Spy
 
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220

Old November 12th, 2013, 05:55 PM
This will do what you want. Make a Special ability for your race and add this eval script:

@Pre-Levels 10000
Code:
~ Add +1 to Shortbows for *race*.
foreach pick in hero from BaseWep where "IsWeapon.wShortbow"
  if (eachpick.container.ishero <> 0) then
    eachpick.field[wRanAtk].value += 1
  elseif (eachpick.container.ishero = 0) then
    eachpick.container.parent.field[wRanAtk].value += 1
  endif
nexteach
Kendall-DM is offline   #7 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old November 13th, 2013, 06:06 AM
Quote:
Originally Posted by Kendall-DM View Post
Wouldn't wRanAttBAB actually give you a better Base Attack Bonus. So a level 5 warrior of that race would actually get two attacks with the Shortbow when it should not. Though I'm not sure HL BAB works the same as one would expect it to.

Sorry for the jargon above, I was just riffing off the top of my head at the end of my lunch at work.
Damn. I didn't test that possibility. I'm not sure, and since your method is certainly better, I'm not going to worry about it.
Sendric is offline   #8 Reply With Quote
saintaurik
Member
 
Join Date: Oct 2013
Posts: 46

Old November 14th, 2013, 01:54 PM
Thank you all for the responses. All of you have been a valuable help to my novice level skills with Hero Lab.
saintaurik is offline   #9 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:00 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.