• 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

Increase selectable enerygy resistance only if already exists?

risner

Well-known member
I'm trying to create a feat that requires you select an energy type, and then adds 10 to it IF you already have it otherwise do nothing.

I have a feat (fSSInuredE) with a custome Item Selection Custom Expression:
thingid.xDamRsAcid|thingid.xDamRsCold|thingid.xDamRsFire|thingid.xDamRsElec

I have a script at First Priority 10000:

~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)

doneif (hero.tagis[SpecSource.fSSUnuredE] <> 0)

~#applyresist[xDamRsCold, hero.child[thingid.xDamRs] + 10]

foreach pick in hero where "SpecType.Resist"
#applyresist[xDamRsSonic, hero.child[thingid.xDamRsSonic] + 10]
#applyresist[xDamRs, 10]
nexteach

~foreach pick in hero from BaseWep where "IsWeapon.wPcDwaDor"
~ perform eachpick.tagreplace[wClass.TwoHanded,wClass.OneHanded]
~ nexteach

I can't figure out how to use the selected type, to then run through all the energy resistance, exclude the ones from the feat (fSSInuredE) and if you find one of the same type, add 10.

I've worked many hours trying to fix this one feat, can anyone help?

The script above is totally not working, for example I was just trying to twiddle with Sonic to see a change. I guess I simply don't understand a lot of the low level mechanics (despite reading all I can from the tutorial and examples.)
 
Last edited:
Phase: Final, Priority: 9500

Code:
~if nothing's been chosen, there's nothing we can do
doneif (field[usrChosen1].ischosen = 0)
 
~if the selected energy type currently has no value, we don't do anything
doneif (field[usrChosen1].chosen.field[abValue].value + field[usrChosen1].chosen.tagmax[Value.?] = 0)
 
~we need to merge the abValue and Value.? tags on the target now, so
~we can add a bonus that does stack with what's there.
field[usrChosen1].chosen.field[abValue].value = maximum(field[usrChosen1].chosen.field[abValue].value, field[usrChosen1].chosen.tagmax[Value.?])
 
~now we can add 10
field[usrChosen1].chosen.field[abValue].value += 10
 
Phase: Final, Priority: 9500
Code:
~ fChosen on d20, usrChosen1 on Pathfinder
~ Value on d20, abValue on Pathfinder

~if nothing's been chosen, there's nothing we can do
doneif (field[fChosen].ischosen = 0)
 
~if the selected energy type currently has no value, we don't do anything
doneif (field[fChosen].chosen.field[Value].value + field[fChosen].chosen.tagmax[Value.?] = 0)
 
~we need to merge the Value and Value.? tags on the target now, so
~we can add a bonus that does stack with what's there.
field[fChosen].chosen.field[Value].value = maximum(field[fChosen].chosen.field[Value].value, field[fChosen].chosen.tagmax[Value.?])
 
~now we can add 10
field[fChosen].chosen.field[Value].value += 10

I tried to modify your code to work on d20 also, but I guess I don't know all the differences between d20 and Pathfinder data sets?
 
What errors are you receiving? I can't find anything obviously wrong with your d20 script.

No error, it compiles. Just doesn't work.

In pathfinder, it works perfectly, the DRFire goes from 5 to 15 and Inured shows up in special as 15. In D20, DRFire stays at 5 and no special is listed for the feat.
 
No Special appears for the feat? In the d20 editor, the "Show in Specials List?" checkbox isn't as early in the list of options as it is in the Pathfinder editor, but that won't affect the script.

May I suggest making use of the debugging information to figure out what's going wrong?

In the develop menu, make sure that "Enable Data File Debugging" at the top is checked, and then find this special and the Fire Resistance special on the Special tab and right-click on them. Select "Show Debug Fields for XXX" and "Show Debug Tags for XXX", and you can find out information about the final state of the pick.

Also, within your code, you can add debug statements to provide you information:
Code:
~ fChosen on d20, usrChosen1 on Pathfinder
~ Value on d20, abValue on Pathfinder
 
debug "We've Started"
 
~if nothing's been chosen, there's nothing we can do
doneif (field[fChosen].ischosen = 0)
 
debug "First Test Passed"
debug field[fChosen].chosen.field[name].text
 
debug field[fChosen].chosen.field[Value].value
debug field[fChosen].chosen.tagmax[Value.?]
 
~if the selected energy type currently has no value, we don't do anything
doneif (field[fChosen].chosen.field[Value].value + field[fChosen].chosen.tagmax[Value.?] = 0)
 
debug "Second Test Passed"
~we need to merge the Value and Value.? tags on the target now, so
~we can add a bonus that does stack with what's there.
field[fChosen].chosen.field[Value].value = maximum(field[fChosen].chosen.field[Value].value, field[fChosen].chosen.tagmax[Value.?])
 
debug field[fChosen].chosen.field[Value].value
 
~now we can add 10
field[fChosen].chosen.field[Value].value += 10

The debug information is viewed from the develop menu - "Floating Info Windows"..."Show Debug Output"
 
"Show in Specials List?"

debug field[fChosen].chosen.field[Value].value
"Show Debug Output"

Oops missed the Show in Specials List, fixed.

Awesome, never knew about the debug command. That is awesome.

I get:
We've Started
First Test Passed
Damage Resistance, Fire
0
0

So it's value is showing 0 despite me having a special (racial) providing 5 and that special shows 5 for Value.

I added field[fChosen].chosen.field[xName].text because the Fields for the racial DRFire in specials shows xName as a field, It is blank but in specials it showed "DR Fire (5)" instead.
 
Last edited:
You made sure you kept the phase: Final, Priority: 9500 in the transition?

Yes Final 9500

Just tried 19500 also, no difference.

<thing id="fSSInuredE" name="Inured to Energy" description="You can resist energy attacks more efficiently than normal.\n\n{b}Prerequisite:{/b} Resistance to the energy type you specify when taking the feat.\n{b}Benefit:{/b} Your existing resistance to one type of energy increases by 10. You can use this feat only to enhance existing resistances, not to gain resistance to a new type of energy.
For example, a demon can increase its resistance to acid, cold, or fire, but it cannot gain sonic resistance with this feat.\n\n{b}Special:{/b} You can gain this feat multiple times. Its effects stack. Each time you take the feat, you can either apply it to another type of energy to which you already have resistance, or increase an existing resistance." compset="Feat" summary="+10 Energy Resistance">
<fieldval field="ftCandExpr" value="thingid.xDamRsAcid|thingid.xDamRsCold|thingid.xDamRsFire|thingid.xDamRsElec"/>
<tag group="fCategory" tag="General" name="General" abbrev="General"/>
<tag group="Helper" tag="ShowSpec"/>
<eval phase="Final" priority="9500"><![CDATA[~ fChosen on d20, usrChosen1 on Pathfinder
~ Value on d20, abValue on Pathfinder

debug "We've Started"

~if nothing's been chosen, there's nothing we can do
doneif (field[fChosen].ischosen = 0)

debug "First Test Passed"
debug field[fChosen].chosen.field[name].text
debug field[fChosen].chosen.field[xName].text
debug field[fChosen].chosen.field[livename].text

debug field[fChosen].chosen.field[Value].value
debug field[fChosen].chosen.tagmax[Value.?]

~if the selected energy type currently has no value, we don't do anything
doneif (field[fChosen].chosen.field[Value].value + field[fChosen].chosen.tagmax[Value.?] = 0)

debug "Second Test Passed"
~we need to merge the Value and Value.? tags on the target now, so
~we can add a bonus that does stack with what's there.
field[fChosen].chosen.field[Value].value = maximum(field[fChosen].chosen.field[Value].value, field[fChosen].chosen.tagmax[Value.?])

debug field[fChosen].chosen.field[Value].value

~now we can add 10
field[fChosen].chosen.field[Value].value += 10]]></eval>
</thing>
 
Last edited:
I can't figure out what's going wrong.

The damage resistance specials kept their Ids and phase: Final, priority: 10000 in the d20-Pathfinder transition.

Your script is getting in just before Final/10000, but it's not finding anything.

The special has a value of 5 at the end.

What's going on here?

Could you try it with other races or other energy types? See if it's something specific to your test case?

Aasimar, Hound Archon, Quasit (some ideas for races with energy resistance)
 
I copied your feat, and changed the "Restrict To..." and it did change the result.

Go ahead and email me your file. My email address is my user name here, @wolflair.com.
 
The timing on your script was set to Phase: Validation, Priority: 19500 (your mouse probably slipped when choosing the phase, since Validation is right below Final)

Since the damage resistance specials set their final value and names at Final/10000, your script needs to run just before that. That way, other things that are setting resistances have time to add their own values, and then your script sees that something's already there, so it goes ahead and adds its own value.

On the file you sent me, I changed the timing from Validation/19500 to Final/9500 and it worked (just as a reminder, if you're only looking at the Specials tab for whether or not your change affected the resistance - if you press "Test Now!" it clears any user settings for that thing, like which resistance has been selected, so don't forget to go back to the Feats tab after each change and re-select the energy type).
 
The timing on your script was set to Phase: Validation, Priority: 19500

Yes, but it was also at Final/9500 originally.

It was at Validation, because I've spend 30-40 minutes setting it to all kind of crazy settings.

Crap...
so don't forget to go back to the Feats tab after each change and re-select the energy type).

However, despite me having done this several times, I just did this and it worked. I didn't do it every thing, it was more of a "well that didn't work, maybe this will" thing I occasionally tried.

Anyway, I'm sorry I wasted so much time.
 
Last edited:
Back
Top