preezerk Posted March 15, 2019 Share Posted March 15, 2019 (edited) 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 March 15, 2019 by preezerk Link to comment Share on other sites More sharing options...
Yulliah Posted March 16, 2019 Share Posted March 16, 2019 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 mandatoryGlobalVariable Property Z_PlayerCache_Health Auto ConstGlobalVariable 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 EndIfObjectReference PlayerRef = Game.GetPlayer() as ObjectReferenceHealthCache = 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 ObjectReferencefloat currentVal = PlayerRef.GetValue(ActorValueToDamage)float difference = currentVal - CachedValueIf (difference <= 0 as float)return EndIfPlayerRef.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 EndIfObjectReference PlayerRef = Game.GetPlayer() as ObjectReferencefloat 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 = 1out_stage = timerID * 10If (out_stage >= 0 && out_stage < 5000)(Self as Quest).SetStage(out_stage)EndIfEndEvent Function DamageValuesBackToCachedValues()Self.DamageValueBackToCachedValue(Health, HealthCache)EndFunction Link to comment Share on other sites More sharing options...
Yulliah Posted March 16, 2019 Share Posted March 16, 2019 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 Questscript_z_levelupevent kmyQuest = __temp as script_z_levelupeventkmyQuest.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 Questscript_z_levelupevent kmyQuest = __temp as script_z_levelupeventkmyQuest.UpdateHealingAfter()Self.stop()EndFunction Link to comment Share on other sites More sharing options...
preezerk Posted March 18, 2019 Author Share Posted March 18, 2019 (edited) 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 mandatoryGlobalVariable Property Z_PlayerCache_Health Auto ConstGlobalVariable 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 EndIfObjectReference PlayerRef = Game.GetPlayer() as ObjectReferenceHealthCache = (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 ObjectReferencefloat currentVal = PlayerRef.GetValue(ActorValueToDamage)float difference = currentVal - CachedValueIf (difference <= 0 as float)return EndIfPlayerRef.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 EndIfObjectReference PlayerRef = Game.GetPlayer() as ObjectReferencefloat 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 = 1out_stage = timerID * 10If (out_stage >= 0 && out_stage < 5000)(Self as Quest).SetStage(out_stage)EndIfEndEvent Function DamageValuesBackToCachedValues()Self.DamageValueBackToCachedValue(Health, HealthCache)EndFunction Edited March 18, 2019 by preezerk Link to comment Share on other sites More sharing options...
Recommended Posts