• 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 reference whether a weapon is equipped?

Kaelryk

Member
I'm attempting to reproduce the Bladesinger prestige class, specifically the Bladesong Style ability, but I cannot find the correct field value to reference whether or not a given weapon is wielded/equipped. If I use the script below, it returns a valid condition whenever the character possesses the weapon, whether or not it is wielded. Any help would be greatly appreciated!

if (hero.childlives[wLongsword] <> 0) then
 
Last edited:
Anyone know the tag I'm looking for? Devs, anyone? I've tried variations on this:

if (hero.tag[IsEquip.wLongsword] <> 0) then

but I keep getting errors, so I'm obviously not guessing correctly. I know there has to be some tag that indicates whether or not a given item is equipped; I just can't find it. I would greatly appreciate any help or input anyone could provide. Thanks in advance!
 
You should look for the field[gIsEquip] instead.

foreach pick in hero from BaseWep where "IsWeapon.wLongsword"
if (each.field[gIsEquip].value <> 0) then
whatever you want to happen when equipped
endif
nexteach
 
Awesome!! That's exactly what I was looking for! I really appreciate your help--I've been trying to figure this out for days, and it's been driving me nuts! Thank you for helping me retain my sanity (what little of it remains...) :D
 
A revision:

Code:
var hasweapon as number
foreach pick in hero from BaseWep where "IsWeapon.wLongsword"
  if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
    hasweapon = 1
    endif
  nexteach
 
if (hasweapon <> 0) then
  ~whatever you want to happen if it's equipped
  endif

You want to check for the longsword equipped in the off-hand, too, in case a charactee is dual-wielding longswords. Also, if a character is wielding two longswords, you don't want to apply your changes twice (heck, they could be a Marilith wielding 6 longswords).
 
I didn't know about the 'wIs2nd' field, but then I'm sure there are quite a few fields I don't know about. I assume it indicates a second copy of the referenced item in inventory? Since I don't have open access to the source code, I just sorta make this stuff up as I go along... :D

I used this:

if (hero.tagis[Hero.EquipOff] <> 0) then
result = assign[Helper.SpcDisable]
done
endif

to ensure an empty off hand, and I have the elf/half-elf race as a requirement for the prestige class (should keep those pesky mariliths away). So far everything seems to be working fine, but if there's a way to exploit something I've missed, I'm sure my players will find it! lol
 
If your ability is already requiring that nothing's equipped in the off-hand, then you don't need to test for whether the longsword's equipped in the off-hand, and can go with Lawful_g's version of the script.
 
So what exactly does the [wIs2nd] field represent? I thought at first it was to indicate a second copy of the item in the inventory, but since you referenced it in your code, I thought it must refer to a second copy of the item being equipped, but then wouldn't it be called [gIs2nd], to keep the naming conventions consistent? :confused:
 
[wIs2nd] tells you if the weapon is equipped in the off-hand or 2nd hand. The primary hand being considered the 1st hand.

So the following is basically saying that IF equipped in the primary hand or off-hand then do something:
Code:
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
 
Back
Top