Jump to content

No healing when level up


preezerk

Recommended Posts

I currently use the Level-Up healing removal mod by Zawinul, the maker of the Horizon mod. It puts your HP back to what it was right before you leveled up, removing that auto healing when leveling up.

 

https://www.nexusmods.com/fallout4/mods/20160/?

 

It is fantastic. However it does not add in the natural HP gain when you level up seen below:

 

HitPointsPerLevel = 2.5 + (Endurance × 0.5)

Every time I level up the mod puts my hit points back to what it was before the level up, like it should. But if I was at 90/100 and level up with an Endurance of 5 my health goes to 90/105. It should be 95/105 with the natural hp per level increase. That way it accurately shows I had lost 10hp.
I'm going to try and either learn how to edit Zawinul's mod to add in that extra level up HP math or make a new one from scratch. However if anyone out there knows how to do this I'd be more than happy to commission you to help me or knock this one out. I'm lvl 0 when it comes to any Mod making/editing. I contacted Zawinul but sadly they are too busy with Horizon to do this one.
Thank you.
Edited by preezerk
Link to comment
Share on other sites

Alright, I took a look... No amount of FO4Edit will do what you want though... It seems to be in the script, which I decompiled for you... However, my scripting is not good enough yet to change this... So I'll give you the decompiled script... Ask someone good with scripting to change the script for you, and once done, send me a DM... I'll add the new script to the mod for you...

 

 

ScriptName Script_Z_LevelUpEvent extends Quest
;-- Properties --------------------------------------
ActorValue Property Health Auto Const mandatory
GlobalVariable Property Z_PlayerCache_Health Auto Const
GlobalVariable Property Z_PlayerCache_Level Auto Const
;-- Variables ---------------------------------------
float HealthCache
;-- Functions ---------------------------------------
Function CacheValuesBefore()
If (Z_PlayerCache_Level.GetValue() == 0 as float)
ElseIf (Game.GetPlayer().GetLevel() as float != Z_PlayerCache_Level.GetValue())
return
EndIf
ObjectReference PlayerRef = Game.GetPlayer() as ObjectReference
HealthCache = PlayerRef.GetValue(Health)
Z_PlayerCache_Level.SetValue(Game.GetPlayer().GetLevel() as float)
Z_PlayerCache_Health.SetValue(HealthCache)
EndFunction
Function DamageValueBackToCachedValue(ActorValue ActorValueToDamage, float CachedValue)
ObjectReference PlayerRef = Game.GetPlayer() as ObjectReference
float currentVal = PlayerRef.GetValue(ActorValueToDamage)
float difference = currentVal - CachedValue
If (difference <= 0 as float)
return
EndIf
PlayerRef.DamageValue(ActorValueToDamage, difference)
EndFunction
Function UpdateHealingAfter()
Self.UpdateCurrentInstanceGlobal(Z_PlayerCache_Level)
If (Game.GetPlayer().GetLevel() == Z_PlayerCache_Level.GetValueInt() || Z_PlayerCache_Level.GetValueInt() == 0)
return
EndIf
ObjectReference PlayerRef = Game.GetPlayer() as ObjectReference
float healthTrueMax = PlayerRef.GetValue(Health)
Self.UpdateCurrentInstanceGlobal(Z_PlayerCache_Health)
HealthCache = Z_PlayerCache_Health.GetValue()
Debug.Notification("Level advanced: " + Z_PlayerCache_Level.GetValueInt() as string + " to " + Game.GetPlayer().GetLevel() as string)
Self.DamageValuesBackToCachedValues()
Z_PlayerCache_Level.SetValue(Game.GetPlayer().GetLevel() as float)
EndFunction
Function Start_LevelTimer(float in_time, int in_timerID)
Self.StartTimer(in_time, in_timerID)
EndFunction
Event OnTimer(int timerID)
int out_stage = 1
out_stage = timerID * 10
If (out_stage >= 0 && out_stage < 5000)
(Self as Quest).SetStage(out_stage)
EndIf
EndEvent
Function DamageValuesBackToCachedValues()
Self.DamageValueBackToCachedValue(Health, HealthCache)
EndFunction
Link to comment
Share on other sites

Sorry there are 2 more scripts: Though these seem to be just for setting the right stage during the quest that runs the script...

ScriptName Fragments:Quests:QF_Z_LevelUp_Poll_02001741 extends Quest Const hidden
;-- Properties --------------------------------------
float Property LoopTimerDuration = 0.5 Auto Const
;-- Variables ---------------------------------------
;-- Functions ---------------------------------------
Function Fragment_Stage_0010_Item_00()
Quest __temp = Self as Quest
script_z_levelupevent kmyQuest = __temp as script_z_levelupevent
kmyQuest.CacheValuesBefore()
kmyQuest.Start_LevelTimer(LoopTimerDuration, 1)
EndFunction
Function Fragment_Stage_0000_Item_00()
Debug.Notification("Level-up started.")
Self.SetStage(10)
EndFunction
-------------------------------------------------------------------------------------------------------AND--------------------------------------------------------------------------------------------------------------
ScriptName Fragments:Quests:QF_Z_LevelUp_Event_02001742 extends Quest Const hidden
;-- Functions ---------------------------------------
Function Fragment_Stage_0010_Item_00()
Quest __temp = Self as Quest
script_z_levelupevent kmyQuest = __temp as script_z_levelupevent
kmyQuest.UpdateHealingAfter()
Self.stop()
EndFunction
Link to comment
Share on other sites

Ok, I THINK I did this right. I only changed 1 script, the long one. Didn't need to touch the other 2.

 

In line 20 I changed

 

HealthCache = PlayerRef.GetValue(Health)

 

to

 

HealthCache = (PlayerRef.GetValue(Health)+2.5+(PlayerRef.GetValue(Endurance)*0.5))

 

 

Now that SHOULD mean the saved health would be current health plus the value of the level up health (2.5 + End * 0.5) .

 

But this is the first time I've changed this. Do you know how I can compile this back into a mod so I can test it out and debug it? I figure I'll have to try over and over to get it right.

 

 

ScriptName Script_Z_LevelUpEvent extends Quest
;-- Properties --------------------------------------
ActorValue Property Health Auto Const mandatory
GlobalVariable Property Z_PlayerCache_Health Auto Const
GlobalVariable Property Z_PlayerCache_Level Auto Const
;-- Variables ---------------------------------------
float HealthCache
;-- Functions ---------------------------------------
Function CacheValuesBefore()
If (Z_PlayerCache_Level.GetValue() == 0 as float)
ElseIf (Game.GetPlayer().GetLevel() as float != Z_PlayerCache_Level.GetValue())
return
EndIf
ObjectReference PlayerRef = Game.GetPlayer() as ObjectReference
HealthCache = (PlayerRef.GetValue(Health)+2.5+(PlayerRef.GetValue(Endurance)*0.5))
Z_PlayerCache_Level.SetValue(Game.GetPlayer().GetLevel() as float)
Z_PlayerCache_Health.SetValue(HealthCache)
EndFunction
Function DamageValueBackToCachedValue(ActorValue ActorValueToDamage, float CachedValue)
ObjectReference PlayerRef = Game.GetPlayer() as ObjectReference
float currentVal = PlayerRef.GetValue(ActorValueToDamage)
float difference = currentVal - CachedValue
If (difference <= 0 as float)
return
EndIf
PlayerRef.DamageValue(ActorValueToDamage, difference)
EndFunction
Function UpdateHealingAfter()
Self.UpdateCurrentInstanceGlobal(Z_PlayerCache_Level)
If (Game.GetPlayer().GetLevel() == Z_PlayerCache_Level.GetValueInt() || Z_PlayerCache_Level.GetValueInt() == 0)
return
EndIf
ObjectReference PlayerRef = Game.GetPlayer() as ObjectReference
float healthTrueMax = PlayerRef.GetValue(Health)
Self.UpdateCurrentInstanceGlobal(Z_PlayerCache_Health)
HealthCache = Z_PlayerCache_Health.GetValue()
Debug.Notification("Level advanced: " + Z_PlayerCache_Level.GetValueInt() as string + " to " + Game.GetPlayer().GetLevel() as string)
Self.DamageValuesBackToCachedValues()
Z_PlayerCache_Level.SetValue(Game.GetPlayer().GetLevel() as float)
EndFunction
Function Start_LevelTimer(float in_time, int in_timerID)
Self.StartTimer(in_time, in_timerID)
EndFunction
Event OnTimer(int timerID)
int out_stage = 1
out_stage = timerID * 10
If (out_stage >= 0 && out_stage < 5000)
(Self as Quest).SetStage(out_stage)
EndIf
EndEvent
Function DamageValuesBackToCachedValues()
Self.DamageValueBackToCachedValue(Health, HealthCache)
EndFunction
Edited by preezerk
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...