Hello, I am trying to create a selection screen where crouching will allow the player to select one of three modes. Basically, I have a scoreboard timer that goes as follows:
execute as @a[scores={class=5,spellbook=3,spell=1,spell_select=20}] run say spell 1
execute as @a[scores={class=5,spellbook=3,spell=1,spell_select=40}] run say spell 2
execute as @a[scores={class=5,spellbook=3,spell=1,spell_select=60}] run say spell 3
scoreboard players set @a[scores={class=5,spellbook=3,spell=1,spell_select=60}] spell_select 0
(spell_select is under the criteria, minecraft.custom.minecraft.sneak_time. The rest of the scoreboard objectives are dummies)
Every second (20 ticks) that you are sneaking, it selects a new mode for the player to use. How would I go about resetting the spell_select score when the player stands up.
You could use a walk_one_cm/sprint_one_cm objective so that it would reset whenever the player isn't crouching. The following could work.
Objective initialization:
/scoreboard objectives add resetSpell walk_one_cm
Spell_select reset (repeat):
/scoreboard players set @a[scores={class=5,spellbook=3,spell=1,resetSpell=1..}] spell_select 0
resetSpell reset (chain, conditional, connected to previous):
/scoreboard players set @a[scores={class=5,spellbook=3,spell=1,resetSpell=1..}] resetSpell 0
As a note, you would have to duplicate this for each movement option (aviate_one_cm, boat_one_cm, climb_one_cm, sprint_one_cm, swim_one_cm, walk_on_water_one_cm, walk_under_water_one_cm) that you want to reset the spell_select score (though not all are required depending your map).
Hello, I am trying to create a selection screen where crouching will allow the player to select one of three modes. Basically, I have a scoreboard timer that goes as follows:
execute as @a[scores={class=5,spellbook=3,spell=1,spell_select=20}] run say spell 1
execute as @a[scores={class=5,spellbook=3,spell=1,spell_select=40}] run say spell 2
execute as @a[scores={class=5,spellbook=3,spell=1,spell_select=60}] run say spell 3
scoreboard players set @a[scores={class=5,spellbook=3,spell=1,spell_select=60}] spell_select 0
(spell_select is under the criteria, minecraft.custom.minecraft.sneak_time. The rest of the scoreboard objectives are dummies)
Every second (20 ticks) that you are sneaking, it selects a new mode for the player to use. How would I go about resetting the spell_select score when the player stands up.
Thanks in advance!
The Big Dog
You could use a walk_one_cm/sprint_one_cm objective so that it would reset whenever the player isn't crouching. The following could work.
Objective initialization:
Spell_select reset (repeat):
resetSpell reset (chain, conditional, connected to previous):
As a note, you would have to duplicate this for each movement option (aviate_one_cm, boat_one_cm, climb_one_cm, sprint_one_cm, swim_one_cm, walk_on_water_one_cm, walk_under_water_one_cm) that you want to reset the spell_select score (though not all are required depending your map).
Actually, if you create a new scoreboard objective and do a comparison, you can immediately detect if the player stands up.
Initialization:
Comparison:
Set check_reset equal to spell_select:
With these commands, whenever the player stands up, spell_select will be reset to zero.
If you're not sure how this works, just let me know.
Have a good day!
Should be spell_select at the end (for the score set). Works great with that change tho. Use his OP.
Fixed!
Thank you all so much for the help!
The Big Dog
No problem!