I used to write a few scripts in the past for a warrior character that enhanced his physical abilities, one of them was increased Health by a certain value.
What i did back then was a script that checked the PC level and added the corresponding leveled ability, so i had to make like 10 spells (Abilities) on the editor, each with a Fortify Health effect...
However the Fortify Health effect obviously was constant, this time i wanted to make it variable, for example 10% of the base PC's health.
I thought it was going to be simple, but so far im having trouble with the GetBaseAV, i thought it returned the Base value, without any effects applied, however seems it doesn't...
Here is the script so far...
float baseHealthfloat increasedAmountbegin ScriptEffectUpdateset PCLevel to player.getlevel if baseHealth != player.getBaseAV health set baseHealth to player.getBaseAV health set reDo to 1 endif
So it declares the variables, the script starts, PCLevel is set, now if it is the first time running, the if should run, set baseHealth to PC base health and reDo to 1.
Now the other part
if PCLevel >= 10 if reDo == 1 player.removeSpellNS aaFitnessAb set increasedAmount to baseHealth * 18 / 100 SetNthEIMagnitude increasedAmount aaFitnessAb player.addSpellNS aaFitnessAb set reDo to 0 else return endif elseif PCLevel >= 5 if reDo == 1 player.removeSpellNS aaFitnessAb set increasedAmount to baseHealth * 14 / 100 SetNthEIMagnitude increasedAmount aaFitnessAb player.addSpellNS aaFitnessAb set reDo to 0 else return endif else if reDo == 1 player.removeSpellNS aaFitnessAb set increasedAmount to baseHealth * 10 / 100 SetNthEIMagnitude increasedAmount aaFitnessAb player.addSpellNS aaFitnessAb set reDo to 0 endif endifend
The scripts runs the levels check, and if the Player level is 1 the last section should run, (Well all the sections are the same only changing the % increasedAmount will get)
increasedAmount should be set to 10% of players base Health, the magnitude of the Fortify Health ability is set and then added to the player, reDo is set to 0, and the script updates.
reDo shouldn't be set to 1, unless the base health of the Player has changed, for some reason it's always set to 1, and so everything loops...
I tried this instead...
if baseHealth != player.getBaseAV health set baseHealth to player.getBaseAV health set reDo to 1
if reDo == 1 player.removeSpellNS aaFitnessAb set baseHealth to player.getBaseAV health set increasedAmount to baseHealth * 10 / 100 SetNthEIMagnitude increasedAmount aaFitnessAb player.addSpellNS aaFitnessAb set baseHealth to player.getBaseAV health set reDo to 0 endif
But it didn't work, thing is im kind of blocked right now, some help would be appreciated...
If you think there is a better way to do it, please give me some tips or advice.
Sorry for the messy post.
Thank You.
PS: Perhaps you noticed my english is not very good, but you could help me out to get better!