Topic category: Help with MCreator software
I have a mod I'm making that requires that a certain block function as an ambient sound generator, as in, it needs to constantly play the same sound on a loop.
There is an event trigger that allows the block to do this, but either only once, or multiple times AT once, which causes the sound effect to play over itself repeatedly.
An option to "wait" a certain amount of time within the event trigger would be very convenient.. It would look something like this.
Event Trigger
(( Play at x:[x] y:[y] z:[z] level:[1] pitch:[1] sound:[CUSTOM:MySound] )) <-- The sound being played
(( Wait tics:[1500] )) <--- The suggested function
(( [Replay Event Trigger] )) <--- The suggested function
If something along the lines of this has already been implemented, or if there already is a way to make a sound only be played once at a time, please let me know.
You can already create a timer yourself and make the sound only play if that timer > duration of sound
I suggest you check our tutorials collection playlist on our YouTube channel which contains many examples and tutorials that can help you get started with MCreator: https://www.youtube.com/playlist?list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei
Oooh wait.. If I set the event to activate every tick, a timer WOULD work! I'd just have to calculate how many ticks would equal the length of the sound file I wish to play, and then add an
(( If (Variable: [Number] > [#]
then (( Play at x:[x] y:[y] z:[z] level:[1] pitch:[1] sound:[CUSTOM:MySound] ))
Else (Variable: [Number] + [1] ))
Like that, right?
(( If (Variable: [Number] > [#]
then (( Play at x:[x] y:[y] z:[z] level:[1] pitch:[1] sound:[CUSTOM:MySound] ))
set variable to 0.
Else (Variable: [Number] + [1] ))
Don't forget to set the variable back to 0 when using the sound! This makes sure it is on cooldown. (:
I don't see an "edit post" button so I'll just have to make another post..
The video "MCreatur Tutorial | How to make a global timer" was exactly what I needed, and with that, I was
able to make a block that executes a function based on a timer!
Thank you!
Ticks are full numbers, this will wait 0 ticks, also wait is asynchronous, it will trigger all 220 at the same time.
Wait can't be blocking.