How to hide players and NPCs🔗
BetonQuest allows you to hide players and NPCs dynamically based on conditions. This is useful for creating private quest instances, story areas, or secret locations without affecting other players. Choose the implementation that best fits your use case.
The basic idea is:
- Player visibility is controlled with the
player_hidersection. - NPC visibility is controlled with the
hide_npcssection. - Visibility changes automatically whenever the configured conditions change.
- The
updatevisibilityaction can be used to force an immediate refresh instead of waiting for the next update interval.
The following example hides all players inside a secret room from each other.
player_hider:
secretRoom:
source_player: inSecretRoom #(1)!
target_player: inSecretRoom #(2)!
conditions:
inSecretRoom: "location 100;100;100;world 10" #(3)!
- Players meeting this condition will no longer see the target players.
- Players matching this condition become invisible to all matching source players.
- Defines the area in which players become invisible to each other.
The following example hides an NPC while a specific condition is met.
npcs:
dummy: "citizens 20"
npc_conversations:
dummy: "dummyTheYummy"
hide_npcs:
dummy: "alreadyTalkedToDummy" #(1)!
actions:
hideNPC: "folder addTagTalked,hideInstantly" #(2)!
addTagTalked: "tag add talkedToDummy"
hideInstantly: "updatevisibility" #(3)!
conditions:
alreadyTalkedToDummy: "tag talkedToDummy" #(4)!
conversations:
dummyTheYummy:
quester: "Dumbum"
first: "dialog_1_1"
NPC_options:
dialog_1_1:
text: "Hey! You look new around here. What's your name?"
pointers: "dialog_1_1_1,dialog_1_1_2"
dialog_1_2:
text: "Nice to meet you, %player%! I have to leave now, but come back tomorrow and I'll send you on an adventure."
pointers: "dialog_1_1_3"
dialog_1_3:
text: "Oh, you don't want to tell me? That's okay. I have to leave now anyway. Maybe you'll tell me tomorrow when I'm back."
pointers: "dialog_1_1_3"
player_options:
dialog_1_1_1:
text: "My name is %player%."
pointers: "dialog_1_2"
dialog_1_1_2:
text: "That's a secret."
pointers: "dialog_1_3"
dialog_1_1_3:
text: "See you tomorrow!"
actions: "hideNPC" #(5)!
- The NPC is hidden from players that meet the
alreadyTalkedToDummycondition. - After the conversation ends, the player receives the tag and the NPC visibility is updated.
- Forces an immediate visibility update instead of waiting for the configured
npc_update_interval. - Once the player has the
talkedToDummytag, the NPC is hidden from them. - The NPC disappears immediately after the player finishes the conversation.