• 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

Question about checking a pick to see if it's a shield

Ckorik

Well-known member
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

However it bombs at the if (isShield = 0) - I'm not sure why - any ideas?
 
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)
 
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.
 
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!
 
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!
 
Back
Top