• 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

How to add an attack or damage bonus with singular weapon.

Manalishi66

Well-known member
How do you add a bonus (attack and/or damage) to one singular weapon (not all weapons or groups). Such as a class gets a +1 damage bonus with his dagger (only) per 3 levels?
 
How do you add a bonus (attack and/or damage) to one singular weapon (not all weapons or groups). Such as a class gets a +1 damage bonus with his dagger (only) per 3 levels?
The concept is exactly the same use of a "foreach" loop regardless if its a "group" of weapons or a single weapon. So see THIS post which shows how to do it for a weapon group.

So for the ENTER YOUR SEARCH TAGS HERE you need to fill in the "thingid.?" tag for the weapon. So for daggers it would be "thingid.wDagger"...
 
Ok. Got how to add bonus as you described. But I want to allows the class to choose his weapon (any) and have this bonus only apply to the one weapon from the list.
 
Ok. Got how to add bonus as you described. But I want to allows the class to choose his weapon (any) and have this bonus only apply to the one weapon from the list.
So the above is still 99% of what you need. The only difference is you need to pull the "thingid.?" tag directly from what was chosen.

Code:
~ If we have not chosen then get out now
doneif (field[usrChosen1].ischosen <> 1)

var search as string

~ Get the weapons thing id TAG
search = field[usrChosen1].chosen.tagids[thingid.?]
The above variable "search" will contain the "thingid.?" of the Thing that was chosen in the drop down. So if they choose dagger it would be "thingid.wDagger".

In the above post replace the whole "ENTER YOUR SEARCH TAGS HERE" including the double quotes with the variable search. As instead of a hard-coded string we are using a variable.
 
Last edited:
Ok., better but not there yet. It is applying the bonus to all weapons on the character. I just want it to apply to one weapon type such as a dagger, longsword, battle axe, longbow...whatever the class wants to choose from a list of all weapons. Help? Code so far below....


~ If we have not chosen then get out now
doneif (field[usrChosen1].ischosen <> 1)

var search as string

~ Get the weapons thing id TAG
search = field[usrChosen1].chosen.tagids[thingid.?]

var bonus as number
bonus = 1 + #levelcount[KEN]/2
bonus = round(bonus, 0,-1)

foreach pick in hero from BaseWep where "thingid.?"
~ Set the bonus on each weapon found
eachpick.field[wDamBonus].value += bonus
nexteach
 
Ok. I admit I'm green at this, what do I need to fix. i.e., what is the script that I need to make it work.
You have to combine the two script examples together into a single one.

Here
Code:
[COLOR="Green"][B]~ If we have not chosen then get out now[/B][/COLOR]
doneif (field[usrChosen1].ischosen <> 1)

var search as string

[COLOR="Green"][B]~ Get the weapons thing id TAG[/B][/COLOR]
search = field[usrChosen1].chosen.tagids[thingid.?]

[B][COLOR="Green"]~ Loop through all weapons of the chosen type[/COLOR][/B]
foreach pick in hero from BaseWep where search
   [B][COLOR="Green"]~ Set the bonus on each weapon found[/COLOR][/B]
   eachpick.field[Bonus].value += 1
nexteach
 
Last edited:
Back
Top