I've been working on a script that adds 1 to a stat max when the linked skill levels up.
The idea was that this would work in tandem with a script which would set the skill at 100 when it reached 101, with normal stat increases from leveling (and indeed leveling itself) turned off.
I initially assumed that I could use some maths with ModActorValue to make this work like so (because '+' doesn't work with modactorvalue):
ScriptName WZTestOneHanded extends QuestEvent OnStoryIncreaseSkill(string OneHanded)if (Game.GetPlayer().GetActorValue("OneHanded") == 101) Game.GetPlayer().ModActorValue("Health", -100) Game.GetPlayer().ModActorValue("Health", 101)endIfendEvent
This would include a hundred more entries that each substract and add to effectively increase max Health by 1 every time the skill leveled. But this script only increases Health by 1 no matter how many times the skill levels. Apparently ModActorValue sets the Permanent Modifier rather than altering it? So I would have to use a script like this:
ScriptName WZTestOneHanded extends QuestEvent OnStoryIncreaseSkill(string OneHanded)if (Game.GetPlayer().GetActorValue("OneHanded") == 101) Game.GetPlayer().ModActorValue("Health", 101)endIf
So every time a skill levels up, the max health modifier is altered to a number equal to the level. This however means repeatedly leveling up a skill to 101 would not increase the stat, nor would leveling up a different skill. Interesting to note that this script has no effect on the first time a skill levels after loading (possibly after entering an area as well).
As far as I can tell not SetActorValue, DamageActorValue, ForceActorValue or RestoreActorValue won't help me pull this off.
Any ideas? Could I do this with SKSE? Or am I doing something wrong/missing something obvious?
Alternatively, would it be possible to create a spell effect or something that does this? Like if Health starts at 100, and every time an applicable skill levels a 1% increase spell effect is cast on the player?
EDIT: Update
Ok, I created a spell to Fortify player health 1 point on skill level.
ScriptName WZTestOneHanded extends QuestSpell Property WZTestFortifyHealthAbility AutoEvent OnStoryIncreaseSkill(string OneHanded)(Game.GetPlayer().AddSpell(WZTestFortifyHealthAbility))if (Game.GetPlayer().GetActorValue("OneHanded") == 101)Game.GetPlayer().SetActorValue("OneHanded", 100)endIfendEvent
Still not working though...
Log says:
error: Cannot add a None spell to the actor
stack:
[ (00000014)].Actor.AddSpell() - "
TLDR: Got it working, now trying to write a script to repeatedly increase the magnitude of the spell