function ADVR.onLoad() achievement.psvrID = 12 achievement.hideDescription = false achievement.predecessors = {achievements.HAMMER_TIME, achievements.A_CONTRACT_BREACHED} achievement.category = "combat" NpcIdKeyPrimary = "blacksmith_crossbowdagger_primary" NpcIdKeySecondary = "blacksmith_crossbowdagger_secondary" end function ADVR.onProgressBought(npcId) if (npcId ~= NpcIdKeyPrimary and npcId ~= NpcIdKeySecondary) or HasBoughtAtLeast5Upgrades() == false then return end achievement.Unlock() -- Refresh the achievement UI. game.RefreshHomeBaseUIs() end -- Failsafe function ADVR.onSpawnInHomeBase() if HasBoughtAtLeast5Upgrades() == true then achievement.Unlock() -- Refresh the achievement UI. game.RefreshHomeBaseUIs() end end function HasBoughtAtLeast5Upgrades() local boughtCount = 0 for progressRepresentation in game.progressHandler.GetProgressesByNpc(NpcIdKeyPrimary) do if progressRepresentation.IsBought() then boughtCount = boughtCount + 1 end end for progressRepresentation in game.progressHandler.GetProgressesByNpc(NpcIdKeySecondary) do if progressRepresentation.IsBought() then boughtCount = boughtCount + 1 end end return boughtCount >= 5 end