![]() ![]() Which, when ran in game, say " hi" instead of it being executed by my player. ![]() So I went and tried it out myself by creating the following function file called "schedulehi"Įxecute as run schedule function bosses:sayhi 1s Then I stumbled across this page via Google, under the comments, stating " schedule does not keep context like other commands, so it'll always be the server running it." from u/Godlander (btw thanks a ton Godlander). I tried method after method after method of crazy ideas not understanding why everything was error-free but simply not doing anything. I thought "Hey, this is perfect for schedule!". This basically will activate the command block at the position you set, after a delay of however many ticks you set.This is purely info for those who don't know, I just spent 2 days slamming my head into a brick wall trying to make a Cooldown for my ability in my minigame. The following command will summon an AEC that disappears in 100 ticks (5 seconds), because an unspecified Duration defaults to 0: summon minecraft:area_effect_cloud ~ ~ ~ Īlong with the other commands, this command will work to start a delay. When its Age gets to its Duration, the AEC will disappear. Their Age will increase at a rate of 1 per tick. Functions should use /schedule to schedule another function.Īrea effect clouds (AECs) have a Duration tag and an Age tag. Note that this does not work for functions. If you are unwilling to set up a scoreboard because you think excess scoreboards are a waste of space, a better method would be the Area Effect Cloud method. To do this, simply increase the timer only conditionally instead of every tick, for example like this: execute if block ~ ~1 ~ stone run scoreboard players add $timer timer 1īut make sure to change whatever the command is checking for directly afterwards, otherwise it keeps ticking up by 1 every tick as long as the condition is matched. This concept can also be used to do something every x times something happens. So at the end of your command block chain or ticked function, you put this: execute if score $timer timer matches 100 run scoreboard players set $timer timer 0 If you want to repeat something every x seconds/minutes/…, you can just reset the timer after you have done whatever you want to do with it. If you want a variable starting time, compared to someone else's score, you can for example use >= points instead of matches 100. If you want to do something repeatedly after 5 seconds, simply replace 100 with 100. Now you can do something once the timer reaches your desired number of ticks like this: execute if score $timer timer matches 100 run say 5 seconds are over! If you do not want it to show up in a scoreboard sidebar display, start the name with a # character. The name " $timer" cannot possibly be a real player name, so it is a good choice for a dummy player name. In a repeating command block or ticked function, execute this command: scoreboard players add $timer timer 1 The " dummy" type is one that is not affected by anything except commands. ![]() This needs a little bit more resources, because it actively does something every tick, but it shouldn't cause noticeable lag.Īs a preparation, you need a scoreboard: /scoreboard objectives add timer dummy If you cannot or do not want to use functions or /schedule, you can still use the old scoreboard timer method. Usually you'll want to do this under some condition, so that it doesn't keep looping forever. To loop execution, you can simply use the /schedule command at the end of your function. If you want to replace all existing schedules of this function with the current one, you can use replace or just provide no mode at all, replace is the default. If you want to schedule multiple executions, you can use append instead of replace. If you have changed your mind, you can abort a scheduled function execution like this: /schedule clear abc:test The in-game days unit is not affected by sleeping or /time. So if you for example want to execute the function named "test" in the namespace "abc" in 1 hour, which equals 3 in-game days, you can use any of these commands: /schedule function abc:test 3d ![]() For functions there is a built-in way to do this: /schedule function ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |