Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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? |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
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 |
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
100 before - Post-Attributes 9900 or Final 9900.
|
#4 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
Still no effect when placed 100 before.
Last edited by Lawful_g; March 8th, 2010 at 02:11 PM. |
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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. |
#6 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
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 |
#7 |
|
|