Creating Quests with Command Blocks: Problem Testing Unset Objectives

Creating Quests with Command Blocks: Problem Testing Unset Objectives - Woman Sitting at Table in Middle of Meadow and Producing Perfumes from Flowers

I've got a Realms server, and I'm trying to create a series of quests that people can complete to up their overall "Defender of the Realm" score. However, I only want them to be able complete each quest only once.

I check a quest specific score variable for 0 to "start" them on their quest, e.g. @p[score_quest_a=0]. Each step of the quest adds 1 to this variable and it's how I determine the logic for the quest progression. This ensures that once you get to "step 3" or whatever the final step is, the system knows you've completed it and you can't start the quest again.

Here's the problem: the selector @p[score_quest_a=0] doesn't work unless someone has had their quest_a score explicitly set to 0. I need to do that check before setting the variable or else I risk blowing out their quest progress (someone with a quest_a score of 2 pressing the starting button would get their progress reset to 0). Is there a way to say "if quest_a score is not set or is set to 0"?

Here's the full set of commands I'm using (for reference):

/tell @p[r=4,score_medical_quest=0] A ship carrying medical supplies crashed just west of the castle... bring back the supplies and you will be rewarded! 
/tell @p[r=5,score_medical_quest=1,score_medical_quest_min=1] Hurry! People are sick and need those supplies! 
/tell @p[r=6,score_medical_quest=2,score_medical_quest_min=2] Thank you! Here are some diamonds for your troubles! (FYI: quest score set to 2 at quest completion point) 
[ REPEATER ]
/scoreboard players set
@p[r=10,score_medical_quest=0] medical_quest 1 
/give @p[r=8,score_medical_quest=2,score_medical_quest_min=2] diamond 3
[ REPEATER ] 
/scoreboard players add @p[r=9,score_medical_quest=2,score_medical_quest_min=2] global_quests 1 
[ REPEATER ] 
/scoreboard players set @p[r=9,score_medical_quest=2,score_medical_quest_min=2] medical_quest 3 
/tell @p[r=9,score_medical_quest_min=3]

Thanks again for your help, the people are in your debt!






Pictures about "Creating Quests with Command Blocks: Problem Testing Unset Objectives"

Creating Quests with Command Blocks: Problem Testing Unset Objectives - From above of glasses for correcting bad eyesight placed on white mirrored surface
Creating Quests with Command Blocks: Problem Testing Unset Objectives - White sculpture of Apollo with medical mask on face in bright neon light on purple background
Creating Quests with Command Blocks: Problem Testing Unset Objectives - Frustrated African American female in casual clothes looking at pregnancy test in hand while standing in light living room at home





How To Make Quests With NPCs In Minecraft Bedrock Edition!




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Ron Lach, Harrison Haines, Alena Shekhovtcova, SHVETS production