// QuestVisibility.cs // Shows this object only to players who have got far enough in a quest, e.g. a treasure chest that appears when the quest // is completed, or a bridge that appears once the quest is under way. Everyone else does not see it. using IHXR.Simulation; public class QuestVisibility : ScriptBase { [Tooltip("The quest's title (or id).")] public string Quest = ""; [Tooltip("Shown from this point of the quest on.")] public QuestState ShowFrom = QuestState.Completed; [Tooltip("Hide it again at that point instead (show it only before).")] public bool ShowOnlyBefore = false; public override void Start() { SetObjectVisible(false); // nobody sees it until their quest says so ListenForQuest(Quest, quest => { bool reached = quest.State >= ShowFrom; SetObjectVisible(ShowOnlyBefore ? !reached : reached, quest.Username); }); } }