Creating Multiple Sounds For The Same Entity

Started by Sylvia Hartley on

Topic category: User side tutorials

Active 5 years ago
Joined Sep 2019
Points:
680

User statistics:

  • Modifications: 2
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 31
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!

Active 5 years ago
Joined Aug 2019
Points:
1024

User statistics:

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

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

Active 5 years ago
Joined Sep 2019
Points:
680

User statistics:

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

Then it is what it is XD

Active 4 years ago
Joined Sep 2019
Points:
736

User statistics:

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

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

Active 5 years ago
Joined Sep 2019
Points:
680

User statistics:

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

Well it works fine for me.

Active 3 months ago
Joined Sep 2020
Points:
596

User statistics:

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

This straight up doesnt work.

Active 6 days ago
Joined May 2019
Points:
1211

User statistics:

  • Modifications: 0
  • Forum topics: 13
  • Wiki pages: 2
  • MCreator plugins: 1
  • Comments: 845
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