diff --git a/scripts/_00e_gui_actorhealthbar.pex b/scripts/_00e_gui_actorhealthbar.pex index 941c2b42..c4370f8b 100644 Binary files a/scripts/_00e_gui_actorhealthbar.pex and b/scripts/_00e_gui_actorhealthbar.pex differ diff --git a/source/scripts/_00e_gui_actorhealthbar.psc b/source/scripts/_00e_gui_actorhealthbar.psc index bac3a8df..b9134e27 100644 --- a/source/scripts/_00e_gui_actorhealthbar.psc +++ b/source/scripts/_00e_gui_actorhealthbar.psc @@ -121,24 +121,15 @@ event OnGameReload() _currentlyDisplayedActors = new Form[4] endif + UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors") + RegisterForModEvent("Enderal_ShowActorHealth", "AddActors") RegisterForModEvent("Enderal_HideActorHealth", "RemoveActors") - UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors") + Utility.Wait(FadeOutDuration / 1000.0 + 1.0) 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 While i > 0 i -= 1 @@ -150,15 +141,15 @@ event OnGameReload() EndIf EndWhile - Cell kCell = PlayerRef.GetParentCell() - Int iIndex = kCell.GetNumRefs(43) ; NPC - While iIndex - iIndex -= 1 - Actor akActor = kCell.GetNthRef(iIndex, 43) as Actor - if akActor && akActor.IsPlayerTeammate() - AddActors(akActor) + Actor[] aFollowers = EnderalFunctions.GetPlayerFollowers() + i = aFollowers.length + while i > 0 + i -= 1 + if aFollowers[i] && _currentlyDisplayedActors.find(aFollowers[i]) < 0 + AddActors(aFollowers[i]) endif - EndWhile + endwhile + Endevent Function UpdateWidgetScale() @@ -189,29 +180,25 @@ Function AddActors(Form aForm) if ! aForm return endif + AddActorRaw(aForm) if _currentlyDisplayedActors.find(aForm) < 0 - int i = _currentlyDisplayedActors.length - while i > 0 - i = i - 1 - if _currentlyDisplayedActors[i] == None - _currentlyDisplayedActors[i] = aForm - i = 0 ; Break - Endif - Endwhile + int i = _currentlyDisplayedActors.find(none) + if i >= 0 + _currentlyDisplayedActors[i] = aForm + endif ;we do not have enough place in the array - the added actor will not be save game persistent endif - AddActorRaw(aForm) EndFunction Function RemoveActors(Form aForm) if ! aForm return endif + RemoveActorRaw(aForm) int i = _currentlyDisplayedActors.find(aForm) if i >= 0 _currentlyDisplayedActors[i] = None Endif - RemoveActorRaw(aForm) EndFunction Function AddActorRaw(Form aActor)