#the schedule command does not work
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1750542355:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
it does workl but not how you think it does
scheduled functions alway run as the server and at world spawn.
to make your code work, you have to mark your arrow and run the function as the marked entity with target selectors
an easy way is to store the result of a scheuled function in the score of the arrow and once the function runs, check the current time, store it in a score and compare it to existing entities, The entity that you stored the schedule scorte in will have the exact same value than the current time that it is when the schedule runs.
k, i understand but i have no clue howw to do any of that im a beginner.
is there anything like schedule?
i just needed a way to have a 'wait' command
what I just said
k
it's really simple
im dumb lmao, ill try my best but ty
how do i check the time
first, you store the result of the schedule in the entity execute store result score <your entity> schedule_time run schedule <your function> append
To check the time you can use a simple time check prediocate
[35mexecute [34mas [36m@e[33m[[37mtype[34m=[32marrow[34m,[37m<additional checks if necessary>[33m] [34mif predicate [33m{[37mcondition[34m:[32m"minecraft:time_check"[34m,[37mvalue[34m:[35m{[37mmin[34m:{[37mtype[34m:[32m"minecraft:score"[34m,[37mtarget[34m:[32m"this"[34m,[37mscore[34m:[32m"schedule_time"[34m},[37mmax[34m:{[37mtype[34m:[32m"minecraft:score"[34m,[37mtarget[34m:[32m"this"[34m,[37mscore[34m:[32m"schedule_time"[34m}[35m}[33m} [34mrun [0m<your delayed function>
make sure to use your own score instead of schedule_time
this is a time check predicate in the command
in this case it comparse the current time against a range (the range being the stored score of the entity both for max and min)
if they match it runs the command
If you already know it's an arrow, add that as a type check like I did. It saves perfromance as the command doesn't have to search every entity if they are the correct one but only arrows.
and all of this goes in tick.mcfunction?
hell no
Whatever triggers the function to be scheduled needs to do the scheduling with the store command and the rest happens in the scheduled function
sorry if itys a dumb question im just new to creating data packs
the scheduled function however should only do this
and everything else in that called function
it's fine, that's what this is all about
this should go in the function i have already created?
from what I see, you schedule the function every tick rn. This is not good.
What should trigger this?
what i want to trigger the schedule is whenever the bow gets shot. That command is in the tick function
oh
or at least we use conditions in the tick function
what other methods are there that will work the same way
ok, I had th ewrong advancement in mind. It only works for crossbows. But we can use a statistic that keeps track of shot crossbows in a scoreboadr and check that.
For the bow we need the statistic
I need to ckeck what it was called
scoreboard objectives add a minecraft.used:minecraft.bow
this needs to go in the load function
a is just a placeholder, you can name it whatever you want
every time you use a bow it will go up by 1.
in the tick function we can detect that and run commands based on that.
i figured there would be a scoreboard obj for it
[35mexecute [36m@a[33m[[37mscoes[34m=[35m{[37ma[34m=[32m1[35m..}[33m] [34mas [36m@e[33m[[37mtype[34m=[32marrow[34m,[37m<additional checks>[33m] [34munless score [36m@s [0mschedule_time [32m1[35m.. [34mstore result score [36m@s [0mschedule_time [34mrun [35mschedule [0m<delayed function> <time> [34mappend
it looks a bit wild
cant i just reset the score to 0 after the function and then just check if the scoreboard 'a' = 1
It looks so wild I even forgoit parts and made mistakes, give me a second
[35mexecute [36m@a[33m[[37mscores[34m=[35m{[37ma[34m=[32m1[35m..}[33m] [34mas [36m@e[33m[[37mtype[34m=[32marrow[34m,[37m<additional checks>[33m] [34munless score [36m@s [0mschedule_time [32m1[35m.. [34mrun [35mfunction [33mnamespace:scheduler_function
scheduler_function
[35mscoreboard [34mplayers reset [36m@a [0ma
[35mexecute [34mstore result score [36m@s [0mschedule_time [34mrun [35mschedule [0m<delayed function> <time> [34mappend
wow this is alot so far, i gtg for now and ill try to when i get back tyy!
Yeah, it's not that simple to delay a function like saying "run in n seconds" but that's often with commands, seemingly simple stuff can be quite the undertaking but seemingly complex stuff can be done in 1 command.
i have tested it and it appears that this line of code does not seem to run the function (i have checked)
ive tried to see what might be the problem but at this point its getting confusing for me
is the 'schedule_time' defined or is it a built in thing or smth
you have to define that in te load fuction (as dummy)
scoreboard objectives add schedule_time dummy
is that how you do it
im not to sure
yes
added it and the function still doesnt seem to run
i reset my scoreboard for 'a' ingame
and when its 1, the function doesnt run
This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.
This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.
This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.