Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
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? |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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? |
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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 |
#3 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
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. |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Quote:
foreach pick in hero where "wCategory.RangeThrow & !wCategory.Melee" just a note - that expression's not going to find javelins and daggers. |
|
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Quote:
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 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). |
|
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Quote:
Range increment is wRangeInc. |
|
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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. |
#8 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
Thanks for the "!" trick mghel, that should be helpful in the future.
|
#9 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
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 |
#10 |
Thread Tools | |
Display Modes | |
|
|