• 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

Adjustment: Potions don't count in Gear Value

AllusiveMan

Active member
Hi all. I'm looking to create a new adjustment, similar to "Equipment Don't Count in Gear Value," except instead of allowing you to select one item from a picklist of your gear, it would loop through all of your gear and assign the Helper.Free tag to all potions (so they aren't counted in your Total Gear Value calculation).

Then I want to create an adjustment that does the exact same thing for scrolls.

I'm guessing this wouldn't take more than 6-10 lines of code, but it's beyond me. Help?
 
You can duplicate that adjustment using the editor, and make the following two changes:

1. Get rid of the text in the "Custom Expression" entry in the details, to remove the item selection menu.

2. Replace the script with this (for potions).
Code:
   ~ If we're not enabled, get out now
   doneif (field[pIsOn].value = 0)

   ~ iterate over picks in hero container and tag all potions as free
   foreach pick in hero from MyGear where "gType.OilPotion"
      perform eachpick.assign[Helper.Free]
   nexteach

For scrolls, the relevant tag would be "gType.Scroll" instead.
 
Follow up question. If I wanted to exclude wands--but only those that have a "Cure" spell or "Restoration" spell on them, how do I test for that?
 
It's a little more complicated if you want to get more specific.

I'm going to limit it to spells of the Healing subschool in the script below, because that is relatively simple.

Code:
   ~ If we're not enabled, get out now
   doneif (field[pIsOn].value = 0)

   ~ iterate over picks in hero container and check wands for conjuration (healing) tags
   foreach pick in hero from MyGear where "gType.Wand"
   
      if (eachpick.tagis[thingid.sCustomWnd] <> 0) then
          
          ~ this is a custom wand, so check the spell inside
          if (eachpick.gizmo.firstchild["portal.iwSpells"].tagis[sSubschool.Healing] <> 0) then
                perform eachpick.assign[Helper.Free]
          endif
          
      elseif (eachpick.tagis[iSubschool.Healing] <> 0) then
      
          ~ this wand is a predefined item (the school/subschool should be tagged directly on the item)
          perform eachpick.assign[Helper.Free]
            
      endif
      
   nexteach

(Note that the school/subschool tag groups are different for items and spells, prefixed with i and s respectively.)

If you wanted to limit it to a different set of spells, you would need to figure out a tag that they all have in common, or use extendthing to add a tag to all the spells you want (and any pre-made wand items with those spells). Then change the script to use that tag instead of the healing subschool tags used above.
 
Back
Top