Modding AV Health - values not right

Post » Sat May 03, 2014 2:55 am

I am setting up clean water supplies for player to drink from starting with a trough (activator). Idea is AV is increased by 10 when player drinks IF player's health is below BaseValue. Script explains it better...

Event OnActivate(ObjectReference akActionRef)Float fPlayerHealth = Game.GetPlayer().GetBaseActorValue("Health")Float fPlayerCurrentHealth = Game.GetPlayer().GetActorValue("Health")If fPlayerCurrentHealth < fPlayerHealthGame.GetPlayer().ModActorValue("health", 10.0)debug.notification("Health Restored.")elsedebug.notification("Health is Full.")EndifEndEvent

This kind of works. I've tested so far by player with full health attempting to drink and gets message "Health is full". I set the player on fire, fun, for damage reasons and then took a drink. The first 2 "slurps" gave the message "Health Restored" but even though the player's health bar wasn't full further "slurps" generated the debug "Health is full" when visually it wasn't. I'm sure it has something to do with GetBaseActorValue but am confused on how bearing in mind players will have upgraded health quite a bit during their game play. Advice please.

User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Return to V - Skyrim