Member
Join Date: Apr 2014
Posts: 52
|
I'm trying to add an ability that only works on an equipped shield.
So I am building a spell effect - and have "current armor" in my showmenu #1 The code I'm using is this: Code:
doneif (field[pIsOn].value = 0) doneif (field[pChosen].ischosen = 0) var isShield as number isShield = 1 isShield = compare(field[pChosen].chosen.field[arCategory].text,"Shield") if (isShield = 0) then doneif (field[pChosen].chosen.field[gIsEquip] = 0) if (hero.child[xSplRs].field[abValue].value = 0) then #value[xSplRs] = 10 done endif if (hero.child[xSplRs].field[abValue].value > 0) then if ((hero.child[xSplRs].field[abValue.value + 5) then #value[xSplRs] = 10 done endif #value[xSplRs] += 5 endif |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Lot easier to just test the tag on the hero for an equipped shield actually. Text compare is really slow in HL.
If you equip a shield and look at the tags on the hero you find two really helpful ones. Hero.EquipShld and ShldClass.? (Light, Heavy, Buckler). You can change your script to: Code:
~ If we have a shield equipped get out now! doneif (hero.tagis[Hero.EquipShld] = 1) Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Just for information. field[arCategory].text can't be used for the test as it contains no text (ie Value). If you look at the field in debug you can see that it only has a 'Final' not a "Value".
Shhield.jpg You can't access the "Final" value only something that is in the "Value" column. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
#3 |
Member
Join Date: Apr 2014
Posts: 52
|
Yeah I wasn't sure about that - I just honestly wasn't sure how else to check for a shield - I think the herotag method works better honestly.
Thank you! |
#4 |
Member
Join Date: Apr 2014
Posts: 52
|
As a follow up using the hero tag worked perfectly and did exactly what I wanted - including the character loosing the bonus if the shield was unequipped.
Thanks again! |
#5 |
|
|