Member
Join Date: Sep 2018
Posts: 30
|
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? |
#1 |
Member
Join Date: May 2021
Posts: 84
|
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 |
#2 |
Member
Join Date: Sep 2018
Posts: 30
|
Beautiful. This worked perfectly. Thank you!
|
#3 |
Member
Join Date: Sep 2018
Posts: 30
|
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?
|
#4 |
Member
Join Date: May 2021
Posts: 84
|
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 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. |
#5 |
Member
Join Date: Sep 2018
Posts: 30
|
This is awesome. Thank you so much!
|
#6 |
Thread Tools | |
Display Modes | |
|
|