Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - d20 System (http://forums.wolflair.com/forumdisplay.php?f=46)
-   -   How to reference whether a weapon is equipped? (http://forums.wolflair.com/showthread.php?t=11496)

Kaelryk October 16th, 2010 03:13 PM

How to reference whether a weapon is equipped?
 
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!

Quote:

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

Kaelryk October 20th, 2010 05:46 AM

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!

Lawful_g October 20th, 2010 05:54 AM

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

Lawful_g October 20th, 2010 05:54 AM

Hope that helps. Sleep time in Korea now.

Kaelryk October 20th, 2010 12:08 PM

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

Mathias October 20th, 2010 12:21 PM

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).

Kaelryk October 20th, 2010 01:16 PM

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:

Quote:

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

Mathias October 20th, 2010 01:31 PM

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.

Kaelryk October 20th, 2010 02:28 PM

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:

ShadowChemosh October 20th, 2010 02:36 PM

[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


All times are GMT -8. The time now is 12:23 AM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.