• 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

Applying different modifier to attack rolls

bodrin

Well-known member
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?
 
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?
 
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
 
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/showthread.php?t=8335&highlight=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:
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.
 
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).
 
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.
 
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.
 
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.
 
Back
Top