View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,214

Old January 25th, 2009, 08:00 PM
Adding a damage bonus to all ranged weapons is going to be complex.

You'll need a foreach...nexteach loop to cycle through every ranged weapon on the hero. Since it already needs a foreach to modify the damage and range increment, might as well directly modify the weapon's attack bonus while we're there.

timing: UserPreLv, 100

Code:
 
foreach pick in hero where "wCategory.Range?"
   eachpick.field[wAttBonus].value +=2
   eachpick.field[wDamBonus].value +=2
   eachpick.field[wRangeInc].value +=20
nexteach
Explaining everything in that script:
wCategory.Range? finds both wCategory.RangeProj (projectile weapons) and wCategory.RangeThrow (throwing weapons), and putting in the "?" wildcard allows the foreach loop to find both types of ranged weapons (but not wCategory.Melee or wCategory.Unarmed).

Each line starts with "eachpick", which changes the context to whatever selection the foreach loop is currently working on.

The "Reference Information" page I mentioned earlier, at the bottom, details weapons, which is where I found the specific fields I wanted to modify.
Mathias is online now   #12 Reply With Quote