Need help playing certain music/sound based on the y level and the duration of the sound.

Started by Bsod2 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need help playing certain music/sound based on the y level and the duration of the sound.

I would like some help on how to make the game play certain music or sound based on the (y level) and the (duration) of the sound.

I used block.amethyst_block.place and block.anvil.place as a test on different y level, but when I go to the y level I set it to, every entity is spamming the same sound on that level. My game lags a lot from too much sounds.

I also want to create multiple sections on what music/sound it plays. Music only above 0 - 49, and 50 - 256+

 

(Its not letting me upload a picture so here you go in character form)

 

 

(start trigger) On loaded entity tick update

 

(flow control) If [(Y position of (Event/target entity)) > {50}]

do [Play at x: {x} y: {y} z: {z} level: {1} category: (master) sound: (block.amethyst_block.place)]

 

(flow control) If [(Y position of (Event/target entity)) > {0}]

do [Play at x: {x} y: {y} z: {z} level: {1} category: (master) sound: {block.anvil.place}]

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I got an idea for this make…
Thu, 11/11/2021 - 22:49

I got an idea for this

make a logic player lifetime variable called 'SoundOn' with an initial value of false

then on player tick update

if get Y level of event target entity > 50 AND get global:'SoundOn' = false

 do play at x y z sound

       set Global:'SoundOn' to true

       wait <Number of seconds sound lasts>

             do set Global:'SoundOn' to false

 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@RexCerv ty!
Fri, 11/12/2021 - 00:58

@RexCerv ty!