Creating Multiple Sounds For The Same Entity

Started by Sylvia Hartley on

Topic category: User side tutorials

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!

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? (:

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

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.

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.