Creating Multiple Sounds For The Same Entity

Started by Sylvia Hartley on Tue, 10/08/2019 - 14:35

Topic category: User side tutorials

Last seen on 16:50, 15. Oct 2019
Joined Sep 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Creating Multiple Sounds For The Same Entity
Tue, 10/08/2019 - 14:35

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:16, 15. Oct 2019
Joined Aug 2019
User points:

Statistics:

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

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

Last seen on 16:50, 15. Oct 2019
Joined Sep 2019
User points:

Statistics:

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

Then it is what it is XD

Last seen on 04:26, 14. Oct 2019
Joined Sep 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 16:50, 15. Oct 2019
Joined Sep 2019
User points:

Statistics:

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

Well it works fine for me.