Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System

Notices

Reply
 
Thread Tools Display Modes
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old September 1st, 2009, 06:22 AM
I'm trying to swap the Dex mod for the Wis mod on all ranged attack rolls but

I can't find any code examples that show how to implement this. The modifier will be applied by a feat and not a class.

The weapon finesse feat seems to be similar but that only applies to light weapons and doesn't actually alter the attack bonus, I think it relies on the player to remember it.

Any ideas?
bodrin is offline   #1 Reply With Quote
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old September 1st, 2009, 10:20 AM
I am doind a similar feat called Brutal Throw. The only problem is I don't know how to say "not" in the Foreach statement.

foreach pick in hero where "wCategory.RangeThrow and not wCategory.Melee"

"&" is and, "|" is or, what is not?
Lawful_g is offline   #2 Reply With Quote
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old September 1st, 2009, 10:21 AM
Here is my example code, for reference

~ If our dexterity bonus is higher than our strength bonus, do nothing and get out now.
var dexterity as number
var strength as number
dexterity = hero.child[aDEX].field[aModBonus].value
strength = hero.child[aSTR].field[aModBonus].value
if (dexterity >= strength) then
done
endif

~ Since our Strength is higher than our dexterity and we passed, iterate through all weapons which are thrown, and subtract dexterity and add strength instead to our attack rolls.

foreach pick in hero where "wCategory.RangeThrow Missing stuff here"
each.field[wAttBonus].value = each.field[wAttBonus].value - dexterity + strength
nexteach
Lawful_g is offline   #3 Reply With Quote
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old September 1st, 2009, 11:52 AM
Zen archery is the feat i'm looking at complete warrior page 106.
I think your on the right track with this though.

If you look at this thread

http://forums.wolflair.com/showthrea...=graceful+edge

it contains a custom expression that ignores specific weapons and kind of explains the usage of the & tags.

I think [wCategory.Range?] ignores anything that doesn't have a specific range increment.

I don't know if that will give you any pointers for your code Lawful_g.

Last edited by bodrin; September 1st, 2009 at 11:56 AM.
bodrin is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old September 1st, 2009, 11:57 AM
Quote:
Originally Posted by Lawful_g View Post
I am doind a similar feat called Brutal Throw. The only problem is I don't know how to say "not" in the Foreach statement.

foreach pick in hero where "wCategory.RangeThrow and not wCategory.Melee"

"&" is and, "|" is or, what is not?
"!"

foreach pick in hero where "wCategory.RangeThrow & !wCategory.Melee"

just a note - that expression's not going to find javelins and daggers.
Mathias is online now   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old September 1st, 2009, 12:10 PM
Quote:
Originally Posted by Lawful_g View Post
Here is my example code, for reference

~ If our dexterity bonus is higher than our strength bonus, do nothing and get out now.
var dexterity as number
var strength as number
dexterity = hero.child[aDEX].field[aModBonus].value
strength = hero.child[aSTR].field[aModBonus].value
if (dexterity >= strength) then
done
endif

~ Since our Strength is higher than our dexterity and we passed, iterate through all weapons which are thrown, and subtract dexterity and add strength instead to our attack rolls.

foreach pick in hero where "wCategory.RangeThrow Missing stuff here"
each.field[wAttBonus].value = each.field[wAttBonus].value - dexterity + strength
nexteach
to condense your code, may I suggest the following:

Code:
var bonus as number
bonus = maximum(hero.child[aDEX].field[aModBonus].value - hero.child[aSTR].field[aModBonus].value , 0)
doneif (bonus= 0)
 
foreach pick in hero where "wCategory.RangeThrow & !wCategory.Melee"
eachpick.field[wAttBonus].value += bonus
nexteach
That way, taking the maximum of your difference and 0 means that if STR is greater than DEX, it will add +0 - and your if statement can be compressed into one line with doneif.

Your code was fine, except that you should be using eachpick. instead of each. within your foreach loop (the other will still work, but only because the program still supports legacy code).
Mathias is online now   #6 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old September 1st, 2009, 12:20 PM
Quote:
Originally Posted by bodrin View Post
I think [wCategory.Range?] ignores anything that doesn't have a specific range increment.
Actually, check out a weapon in the editor. Near the top you'll find a selector named "Category" which has options like "Melee", "Thrown", "Projectile", etc. - those are the wCategory tags. [wCategory.Range?] finds "wCategory.RangeThrow" and "wCategory.RangeProj" - thrown and projectile, respectively.

Range increment is wRangeInc.
Mathias is online now   #7 Reply With Quote
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old September 1st, 2009, 12:28 PM
Because of the way the tags work now, any weapon that has both the melee and throwing tag (like javelins and daggers) already uses Strength to determine it's attack roll (assuming by default that they are wielded in melee and ignoring the possibility of using them as ranged weapons, especially incorrect for javelins because they should be taking a penalty for melee use but are not). I think I have mentioned this error before.

Anyway, I have worked around this by creating custom Throwing versions (IE Dagger, Throwing) of those weapons with the projectile and throwing tags so that they correctly use Dex for attack rolls and Str for damage rolls.
Lawful_g is offline   #8 Reply With Quote
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old September 1st, 2009, 12:29 PM
Thanks for the "!" trick mghel, that should be helpful in the future.
Lawful_g is offline   #9 Reply With Quote
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old September 7th, 2009, 03:57 PM
I can't get this code to apply the Wisdom Modifier to ranged attacks i've tried altering the timing but to no avail.

Timing final phase 10000

Code:
var bonus as number
bonus = maximum(hero.child[aWIS].field[aModBonus].value - hero.child[aDEX].field[aModBonus].value , 0)
doneif (bonus= 0)
 
foreach pick in hero where "wCategory.RangeProj & wCategory.RangeThrow & !wCategory.Melee"
eachpick.field[wAttBonus].value += bonus
nexteach
Any pointers on what i'm doing wrong.
bodrin is offline   #10 Reply With Quote
Reply

Thread Tools
Display Modes

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 07:44 AM.


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