Scriptname ArtifactTrackerPlayer extends ReferenceAlias FormList Property ETR_ItemsNew Auto FormList Property ETR_ItemsFound Auto FormList Property ETR_ItemsStored Auto Keyword Property LocTypePlayerHouse Auto bool bAtHome = false int iFollowerIndex event OnInit() OnPlayerLoadGame() endevent Event OnPlayerLoadGame() if ! IsLoaded() ETR_ItemsNew.Revert() ETR_ItemsFound.Revert() ETR_ItemsStored.Revert() UnregisterForUpdate() Debug.Notification("Failed to initialize ArtifactTracker.dll") return endif if skse.GetPluginVersion("Ahzaab's moreHUD Plugin") >= 30800 ahzmorehud.RegisterIconFormList("dbmNew", ETR_ItemsNew) ahzmorehud.RegisterIconFormList("dbmFound", ETR_ItemsFound) ahzmorehud.RegisterIconFormList("dbmDisp", ETR_ItemsStored) endif if skse.GetPluginVersion("Ahzaab's moreHUD Inventory Plugin") >= 10017 ahzmorehudie.RegisterIconFormList("dbmNew", ETR_ItemsNew) ahzmorehudie.RegisterIconFormList("dbmFound", ETR_ItemsFound) ahzmorehudie.RegisterIconFormList("dbmDisp", ETR_ItemsStored) endif if SKSE.GetPluginVersion("QuickLootRE") >= 292 QuickLootRE.RegisterNewItemsList(ETR_ItemsNew) QuickLootRE.RegisterDisplayedItemsList(ETR_ItemsStored) QuickLootRE.RegisterFoundItemsList(ETR_ItemsFound) endif ; Rebuild all lists to avoid discrepancies, stale data, and broken records RescanStoredArtifacts() RescanFoundArtifacts() RescanNewArtifacts() Location currentLocation = (GetReference() as ObjectReference).GetCurrentLocation() bAtHome = currentLocation && currentLocation.HasKeyword(LocTypePlayerHouse) if bAtHome RegisterForModEvent("AT_HomeInventoryUpdate", "OnHomeInventoryUpdate") else UnregisterForModEvent("AT_HomeInventoryUpdate") endif EndEvent Event OnLocationChange(Location akOldLoc, Location akNewLoc) bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse) if bAtHome RegisterForModEvent("AT_HomeInventoryUpdate", "OnHomeInventoryUpdate") elseif akOldLoc && akOldLoc.HasKeyword(LocTypePlayerHouse) UnregisterForModEvent("AT_HomeInventoryUpdate") endif int iCurrentFollowers = 0; Actor[] aFollowers = GetPlayerFollowers() int i = aFollowers.length while i > 0 i -= 1 iCurrentFollowers += aFollowers[i].GetFormID() endwhile if iCurrentFollowers != iFollowerIndex iFollowerIndex = iCurrentFollowers RegisterForSingleUpdate(5.0) ; wait until followers load into the location endif endEvent Event OnUpdate() Debug.Notification("Team changed, updating ETR_ItemsFound") RescanFoundArtifacts() EndEvent event OnHomeInventoryUpdate() if bAtHome Debug.Notification("Triggered AT_HomeInventoryUpdate") SyncCellStorage() endif endevent ; NATIVE FUNCTIONS bool function IsLoaded() native global function RescanStoredArtifacts() native global function RescanFoundArtifacts() native global function RescanNewArtifacts() native global ObjectReference function GetCellStorage() native global function SyncCellStorage(int FormID = 0) native global Actor[] function GetPlayerFollowers() native global