I'm making a map, and, to put it simply, I need to run a command when some music finishes (played via a playsound command), and my only solution at the moment is a huge room full of repeaters making a delay as long as the music, with the command block at the end, which would work, but, for obvious reasons, I don't really want to do that. Can anyone help? If you have any more questions, ask in the comments, and I'll try and get back to you. Thanks in advance!
2 Answers
You can create an structure like that:
And when music start to sound execute /time set command substracting 20 to 22340 by each seconds you want to delay the command.
For example:
If music duration is 10 seconds you must delay the command by 10 seconds so:
22340-(10*20) = 22140
So you must execute
/time set 22140
when music starts soundIf music duration is 17 seconds you must delay the command by 17 seconds so:
22340-(17*20) = 22000
So you must execute
/time set 22000
when music starts to sound
I hope I've explained that clearly
-
This is a good answer and I see how it works, but I don't really want to change the time on my map (Most of my map is outside). This solution would also run the command every time it turned day, which would get annoying. Thanks for the response, though, it is appreciated, but not quite what I'm looking for. Commented Aug 1, 2016 at 9:16
-
@Ultimatro You could make your own dummy objective that works like the time. Commented Aug 11, 2017 at 13:50
You could have a dispenser with arrows in it pointing towards a wooden button and when the music starts trigger the dispenser. The arrow will despawn in 60 seconds (1 minute). For example, (I did this very same contraption) I played records.11 and triggered the dispenser, shot one arrow, and afterward I had a line of repeaters (4 tick) that triggered a tp command in the end.