Creating Multiple Sounds For The Same Entity

Started by Sylvia Hartley on

Topic category: User side tutorials

Last seen on 15:12, 21. Oct 2019
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Creating Multiple Sounds For The Same Entity

Event trigger-triggered by external call or when (global trigger): Entity attacked
If is current entity (sub)type of [entity]
do
    if random[o,1) < 0.9
    do Play at x: x y: y z: z level: 1 pitch: 1 sound: (chosen sound)
    else if random[o,1) > 0.9
    do Play at x: x y: y z: z level: 1 pitch: 1 sound: (chosen sound)

 

This is the code for when it is attacked. If you want it to be death sounds, replace Entity attacked with Entity dies. For instance, I want the Golem to sound like a villager when it's hit. Okay, so, Here's how the code will be set up:

 

Event trigger-triggered by external call or when (global trigger): Entity attacked
If is current entity (sub)type of EntityIronGolem
do
    if random[o,1) < 0.9
    do Play at x: x y: y z: z level: 1 pitch: 1 sound: entity.irongolem.hurt
    else if random[o,1) > 0.9
    do Play at x: x y: y z: z level: 1 pitch: 1 sound: entity.villager.hurt

 

The 0.9 is an example. It can be any number. But if you want to make the sounds evenly used or something, make both numbers the same for both like mine. Hope this helps you!

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What if Random[0,1] produces…
Tue, 10/08/2019 - 15:28

What if Random[0,1] produces 0.9? (:

Last seen on 15:12, 21. Oct 2019
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Then it is what it is XD
Tue, 10/08/2019 - 18:41

Then it is what it is XD

Last seen on 16:15, 8. Dec 2020
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That is not how you would…
Wed, 10/09/2019 - 19:48

That is not how you would use random on something like this.

Last seen on 15:12, 21. Oct 2019
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well it works fine for me.
Wed, 10/09/2019 - 19:53

Well it works fine for me.

Last seen on 03:38, 20. Mar 2024
Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This straight up doesnt work.
Fri, 09/11/2020 - 11:16

This straight up doesnt work.

Last seen on 17:16, 16. Mar 2024
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why else if random[o,1) > 0…
Fri, 09/11/2020 - 13:20

Why else if random[o,1) > 0.9?

You can just use else