4
Fork 0

Increased delay before showing health bars on game load, fixes some actors not showing up

master
Eddoursul 2 years ago
parent 655d84bc41
commit 53b5d3bc08
  1. BIN
      scripts/_00e_gui_actorhealthbar.pex
  2. 47
      source/scripts/_00e_gui_actorhealthbar.psc

@ -121,24 +121,15 @@ event OnGameReload()
_currentlyDisplayedActors = new Form[4] _currentlyDisplayedActors = new Form[4]
endif endif
UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors")
RegisterForModEvent("Enderal_ShowActorHealth", "AddActors") RegisterForModEvent("Enderal_ShowActorHealth", "AddActors")
RegisterForModEvent("Enderal_HideActorHealth", "RemoveActors") RegisterForModEvent("Enderal_HideActorHealth", "RemoveActors")
UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors") Utility.Wait(FadeOutDuration / 1000.0 + 1.0)
Actor PlayerRef = Game.GetForm(0x14) as Actor Actor PlayerRef = Game.GetForm(0x14) as Actor
if ! PlayerRef.IsInCombat()
int n = _currentlyDisplayedActors.Length
While n > 0
n -= 1
_currentlyDisplayedActors[n] = None
EndWhile
return
endif
Utility.Wait(FadeOutDuration / 1000.0 + 0.05)
int i = _currentlyDisplayedActors.Length int i = _currentlyDisplayedActors.Length
While i > 0 While i > 0
i -= 1 i -= 1
@ -150,15 +141,15 @@ event OnGameReload()
EndIf EndIf
EndWhile EndWhile
Cell kCell = PlayerRef.GetParentCell() Actor[] aFollowers = EnderalFunctions.GetPlayerFollowers()
Int iIndex = kCell.GetNumRefs(43) ; NPC i = aFollowers.length
While iIndex while i > 0
iIndex -= 1 i -= 1
Actor akActor = kCell.GetNthRef(iIndex, 43) as Actor if aFollowers[i] && _currentlyDisplayedActors.find(aFollowers[i]) < 0
if akActor && akActor.IsPlayerTeammate() AddActors(aFollowers[i])
AddActors(akActor)
endif endif
EndWhile endwhile
Endevent Endevent
Function UpdateWidgetScale() Function UpdateWidgetScale()
@ -189,29 +180,25 @@ Function AddActors(Form aForm)
if ! aForm if ! aForm
return return
endif endif
AddActorRaw(aForm)
if _currentlyDisplayedActors.find(aForm) < 0 if _currentlyDisplayedActors.find(aForm) < 0
int i = _currentlyDisplayedActors.length int i = _currentlyDisplayedActors.find(none)
while i > 0 if i >= 0
i = i - 1 _currentlyDisplayedActors[i] = aForm
if _currentlyDisplayedActors[i] == None endif
_currentlyDisplayedActors[i] = aForm
i = 0 ; Break
Endif
Endwhile
;we do not have enough place in the array - the added actor will not be save game persistent ;we do not have enough place in the array - the added actor will not be save game persistent
endif endif
AddActorRaw(aForm)
EndFunction EndFunction
Function RemoveActors(Form aForm) Function RemoveActors(Form aForm)
if ! aForm if ! aForm
return return
endif endif
RemoveActorRaw(aForm)
int i = _currentlyDisplayedActors.find(aForm) int i = _currentlyDisplayedActors.find(aForm)
if i >= 0 if i >= 0
_currentlyDisplayedActors[i] = None _currentlyDisplayedActors[i] = None
Endif Endif
RemoveActorRaw(aForm)
EndFunction EndFunction
Function AddActorRaw(Form aActor) Function AddActorRaw(Form aActor)

Loading…
Cancel
Save