diff --git a/Scripts/ETR_TrackFoundItems.pex b/Scripts/ETR_TrackFoundItems.pex index 1bdc9b8..0e1b1e4 100644 Binary files a/Scripts/ETR_TrackFoundItems.pex and b/Scripts/ETR_TrackFoundItems.pex differ diff --git a/Source/Scripts/ETR_TrackFoundItems.psc b/Source/Scripts/ETR_TrackFoundItems.psc index 7a031d6..42ad628 100644 --- a/Source/Scripts/ETR_TrackFoundItems.psc +++ b/Source/Scripts/ETR_TrackFoundItems.psc @@ -16,6 +16,7 @@ int iFollowerIndex = 0 bool bAtHome = false bool bRescanHome = false bool bRescanPersistent = false +bool bRescanFollowers = false ObjectReference lastDestContainer = None bool lastDestIsPersistent = false int iUpdateCount @@ -39,20 +40,8 @@ Event OnLocationChange(Location akOldLoc, Location akNewLoc) bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse) lastDestContainer = None - int iCurrentFollowers = 0; - Actor[] aFollowers = ETR_Functions.GetPlayerFollowers() - int i = aFollowers.length - while i > 0 - i -= 1 - iCurrentFollowers += aFollowers[i].GetFormID() - endwhile - - if iCurrentFollowers != iFollowerIndex - iFollowerIndex = iCurrentFollowers - bRescanHome = false - bRescanPersistent = false - RegisterForSingleUpdate(5.0) ; wait until followers load into the location - endif + bRescanFollowers = true + RegisterForSingleUpdate(3.0) endEvent @@ -65,6 +54,25 @@ EndEvent Event OnUpdate() + if bRescanFollowers + bRescanFollowers = false + + int iCurrentFollowers = 0; + Actor[] aFollowers = ETR_Functions.GetPlayerFollowers() + int i = aFollowers.length + while i > 0 + i -= 1 + iCurrentFollowers += aFollowers[i].GetFormID() + endwhile + + if iCurrentFollowers == iFollowerIndex + return + endif + + iFollowerIndex = iCurrentFollowers + Debug.Notification("Team changed, rescanning") + endif + if UI.IsMenuOpen("ContainerMenu") RegisterForMenu("ContainerMenu") return @@ -81,11 +89,12 @@ Event OnUpdate() Debug.Notification("Running Found OnUpdate " + iUpdateCount) if bRescanHome + bRescanHome = false + if lastDestContainer && lastDestContainer as Actor && (lastDestContainer as Actor).IsPlayerTeammate() lastDestContainer = None return endif - bRescanHome = false if lastDestContainer && lastDestContainer as PlayerBookShelfContainerScript int iLimit = 10