Scrivener07 / FO4_Games

Play classic games in Fallout 4.
MIT License
19 stars 3 forks source link

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

Closed Scrivener07 closed 6 years ago

Scrivener07 commented 6 years ago

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
Scrivener07 commented 6 years ago

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
Scrivener07 commented 6 years ago

Fixed with commit 256e24f