• 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

Help with Natural Armor Script

Lawful_g

Well-known member
I am working on Elephant's Hide, a wild feat that sets the druid's natural armor to 7, which supercedes any natural armor they already have. This is the script I wrote.

Phase: PreLevels (Users) 11000
if (field[hIsOn1].value <> 0) then
if (hero.child[ArmorClass].field[tACNatural].value >= 7) then
done
else
hero.child[ArmorClass].field[tACNatural].value = 7
endif
endif

Unfortunately, rather than setting the natural armor to 7, it is adding 7... What is going wrong here?
 
It's likely running before something else that adds natural armor. Therefore, the natural armor is already set to 7 by this before the other thing runs.

In the "Floating Info Windows" option in the Develop menu, select "Show Selection Tasks", and then find "Armor Class" in that list. That will tell you when the scripts involved in the armor class are running (well, actually, only the ones that are on the Armor Class pick itself, not external things that modify the armor class). Try putting your script immediately before (10 or 100 priorities before) one of the scripts listed there. You should be able to find a point at which you can set the AC before it's used, which is still after everything else that's adding natural armor.

P.S. Here's a simpler way to write your script:

if (field[hIsOn1].value <> 0) then
hero.child[ArmorClass].field[tACNatural].value = minimum(hero.child[ArmorClass].field[tACNatural].value, 7)
endif
 
I am using the Gargoyle race since that was included in the HL base files

The Task list for Armor Class has 4 things on it, a "field calculate - field (AC from natural armor)" at Post Attributes 10000, an Eval Script 1 at Final 10000, and then 2 at Final 99999 that are probably unconnected.

Moving the script to be after either of those (Post Attributes 10100 and Final 10100) results in no change when the button is clicked.
 
Ah, I found the reason there was no effect. I was using your script above, but I think you must have meant "maximum(hero.child[ArmorClass].field[tACNatural].value, 7)"... the fact that it was minimum meant that nothing was being changed, because the Gargoyle has a 4 nat armor which is lower than 7.

Upon switching it to maximum, and putting the script at Post Attributes 10100 the thing works.
 
It wasn't stacking with enhancement bonuses to Natural Armor, so I switched it to modify mNatural. It now correctly modifies base Natural Armor, which can then be modded by Amulets of natural armor, etc.

For the curious, this is what I came up with at the end.

PreLevels : 500

if (field[hIsOn1].value <> 0) then
hero.child[mNatural].field[Bonus].value = maximum(hero.child[mNatural].field[Bonus].value, 7)
endif
 
Back
Top