• 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

Reducing abilities via template

AndrewD2

Well-known member
So the template I'm working on halves a lot of stuff, all DR, resistance, fast healing/regen, channel resistance, etc.

I came up with this code:

Code:
foreach pick in hero from Ability where "SpecType.DR|SpecType.Resist|SpecType.SR|SpecType.FastHeal|thingid.xChanRes"
   if (eachpick.field[abValue].value >=1) then
     eachpick.field[abValue].value = round(eachpick.field[abValue].value/2, 0, -1)		  
   endif
nexteach

Which is compiling just fine, but it doesn't seem to be working. Hoping maybe another set of eyes can help.
 
Phase & Priority are critical if you want to multiply or divide a total, because you need to slip in after all the other things have been added, but before the total is displayed.
 
Yeah I just realized I forgot to provide and was just coming to do it. I've run it at First/Post-Attributes/Final 10000
 
The bigger issue to worry about is that many of those abilities like DR are bootstrapped with a Value.? tag to set the value not via script. This means just changing the abValue is most of the time not going to work. This is also why even the CORE adjustment for adjusting DR values does not work 90% of the time. My "Set DR" adjustment does of course. ;)

So you will need to grab not only the abValue but also the tag value of Value.? to find the value. Then cut the max of those two values into half.
 
Ok, I'm a step closer thanks Shadow. New code

Code:
foreach pick in hero from Ability where "SpecType.DR|SpecType.Resist|SpecType.SR|SpecType.FastHeal|thingid.xChanRes"
    perform eachpick.pulltags[Value.?]
    eachpick.field[abValue].value = round(maximum(eachpick.field[abValue].value, tagvalue[Value.?])/2, 0, -1)
    perform eachpick.delete[Value.?]
nexteach

Now it's working, but then there's some extra ... it seems to give EVERY form of DR, even if the monster only has 1.
 
Some slight modifications so I could get some debug info going:

Code:
var ability as number
debug "Before Loop"
debug "ability: " & ability
debug ""
debug "Entering Loop"

foreach pick in hero from Ability where "SpecType.DR|SpecType.Resist|SpecType.SR|SpecType.FastHeal|thingid.xChanRes"

   ability = 0
   perform eachpick.pulltags[Value.?]

   debug eachpick.idstring & "   Value: " & tagvalue[Value.?]
   debug eachpick.idstring & " AbValue: " & eachpick.field[abValue].value
   debug eachpick.idstring & " ability1: " & ability
   ability = maximum(eachpick.field[abValue].value, tagvalue[Value.?])
   debug eachpick.idstring & " ability2: " & ability
   
   perform eachpick.delete[Value.?]

   eachpick.field[abValue].value = round(ability/2, 0, -1)
   debug eachpick.idstring & " Final: " & eachpick.field[abValue].value
nexteach

And what it appears is happening is no matter what pick it's on in the loop tagvalue[Value.?] is always equal to whatever the first Ability's value is (I'm my test it's 4)

Is there a command I need to clear the tagvalue at the end of every loop?
 
Last edited:
SUCCESS:

Final script:
Code:
foreach pick in hero from Ability where "SpecType.DR|SpecType.Resist|SpecType.SR|SpecType.FastHeal|thingid.xChanRes"

   eachpick.field[abValue].value = round(maximum(eachpick.field[abValue].value, eachpick.tagvalue[Value.?])/2, 0, -1)
   perform eachpick.delete[Value.?]

nexteach

I didn't realize I didn't have to do a pulltags to get the value.

One last thing I need to do with this template is turn Immunity into Energy Type in to ER 30 and other kinds of Immunities (fear, poison, etc) into a +8 bonus to the saves. Any ideas?
 
Last edited:
That's a question? :-P
LOL no. I had questions on my mind as I working on a bunch of issues at work and was simultaneous writing a support email to IBM with a bunch of questions.

So I guess it should have been a "!" instead but sort of funny as a question as maybe you don't feel good afterwards. Everyone is different. :p
 
Back
Top