Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game

Notices

Reply
 
Thread Tools Display Modes
wdmartin
Senior Member
 
Join Date: May 2013
Posts: 240

Old April 24th, 2020, 11:34 AM
I'm working on a custom magic item set: a pair of scimitars (Cinea and Nalayam). They're scaling weapons that gain additional abilities based on the hero's level. That part is working fine.

Per the item description, the swords only get their scaling bonuses if you are wielding both at once. So I need some way to check that both weapons are equipped, and that check has to happen very early in the process so that tag expression in the bootstrap conditions for the weapon properties can check for it.

I began by defining a pair of custom tags in a .1st file, thus:

Code:
<group id="CinNal" name="CinNal">
	<value id="Cinea"  name="Cinea"/>
	<value id="Nalayam"  name="Nalayam"/>
</group>
Then, each sword has a script that checks to see if it's in the PC's inventory and if so whether it's equipped or not. Here's the one for Cinea:

Code:
~ Runs at First/750
foreach pick in hero from BaseWep
	~ The weapon has to be Cinea
	if (eachpick.tagis[thingid.iCinea] <> 0) then
		~ Hero must have the weapon equipped.
		if (eachpick.field[gIsEquip].value <> 0) then
			perform hero.assign[CinNal.Cinea]
		endif
	endif
nexteach
There's a duplicate one for Nalayam. The idea is that if the hero has tags for both Cinea and Nalayam, then they're both equipped. At First/1000, I can safely bootstrap a weapon property with a tag expression in the conditon field like this:

Code:
(count:hero#Classes.? >= 7)&(count:hero#CinNal.Cinea > 0)&(count:hero#CinNal.Nalayam > 0)
And in the eval script for enhancement bonuses at Post-Levels/5000, I can just:

Code:
~ Must be wielding both swords.
doneif (hero.tagexpr[CinNal.Cinea & CinNal.Nalayam] <> 1)
As far as it goes, everything is working great -- with just one wrinkle that I can't seem to resolve: field[gIsEquip] does not get set to 1 when the weapon is equipped in the PC's off-hand.

If I equip Cinea in the PC's main hand, they get the CinNal.Cinea tag just fine. Ditto for Nalayam. But equipping one of them in the off-hand means that script fails.

I tried working around this by checking for the tags Hero.MainHand and Hero.OffHand on the weapons. But those tags are not assigned at First/750, and I suspect they don't get assigned until long after the bootstrap phase is done. I'm not sure how to find out exactly when a tag gets assigned. I generated a timing report, which proved to be 196,740 lines of XML listing everything that ever happens, but I couldn't locate anything containing the phrase "MainHand" or "OffHand" that would tell me when that happens.

So ... I'm stuck. Is it a bug or a design choice that wielding something in your off hand does not update field[gIsEquip]? Is there some other approach I'm not seeing?
wdmartin is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old April 24th, 2020, 11:49 AM
gIsEquip is the checkbox that means it's held in the main hand - keep looking for another field that means it's held in the off hand.

Also, debug the tags - you're looking for an "I'm equipped" tag that's applied no matter which hand the item is held in, since the better solution would be to have a single test that works regardless of which hand the character equips it in.
Mathias is offline   #2 Reply With Quote
wdmartin
Senior Member
 
Join Date: May 2013
Posts: 240

Old April 24th, 2020, 02:12 PM
Ah, I found field[wMenuEquip] and checked whether that is 1 (main hand) or 2 (off hand) and that did the trick.

Everything seems to work now, though it's slightly wonky in some ways. If you un-equip one of the two swords, unlocked properties (flaming on Cinea, frost on Nalayam, holy on both) continue to show up on the weapons tab even though they have been removed from the weapon. Triggering a full evaluation of the rules clears them out. Enhancement bonuses and the threat range (from Keen) drop normally.

So that's slightly weird, but I don't think it's going to be a huge issue for my one PC. I'll just tell the player to leave the swords equipped and it should be fine.

Thanks for the assistance.
wdmartin is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old April 24th, 2020, 04:06 PM
The off-hand field is wIs2nd. I don't remember what wMenuEquip is, but I do know that's not how we test "are we equipped" on our own weapons.

This is copied from the script on a Luck Blade:
Code:
      ~ If we're not equipped, get out
      doneif (field[gIsEquip].value + field[wIs2nd].value = 0)
Mathias is offline   #4 Reply With Quote
wdmartin
Senior Member
 
Join Date: May 2013
Posts: 240

Old April 25th, 2020, 11:02 AM
Hmm! Well, I missed seeing that in the list. There were several hundred fields in there.

It works notably better than wMenuEuip -- unequipping one of the swords now makes all of the scaling bonuses go away. Thanks!
wdmartin is offline   #5 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:49 PM.


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