Scrivener07 / FO4_Games

Play classic games in Fallout 4.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UI display scripts do not work correctly on a game reload.

Scrivener07 opened this issue · comments

OnInit only occurs once ever during the entire lifetime of a script. The problem is likely the function OnInit on the Games:Shared:UI:Display. Maybe F4SE/Scaleform does not persist injected UI elements across game reloads? I will try to use the OnPlayerLoadGame - Actor event to reload the UI display onto the target menu.

Papyrus

Event OnInit()
	If (Data())
		Load()
	EndIf
EndEvent

Instead of loading only inside of OnInit, I now also do a reload with the OnPlayerLoadGame event.

Games:Shared:UI:Display

Event OnInit()
	RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
	OnGameReload()
	WriteLine(self, "Initialization is complete for "+ToString())
EndEvent


Event Actor.OnPlayerLoadGame(Actor akSender)
	OnGameReload()
	WriteLine(self, "Reload is complete for "+ToString())
EndEvent


Event OnGameReload()
	If (Data())
		Load()
	EndIf
EndEvent

Fixed with commit 256e24f