Make sound follow player (or be ambient)?

Discussion in 'Plugin Development' started by Rixterz, Oct 28, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Rixterz

    Hello,
    I have used the following code to play a sound at a player's location:
    Code:java
    1.  
    2. Location l = player.getEyeLocation();
    3. PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect("halloween.wave2", l.getX(), l.getY(), l.getZ(), 1F, 1F);
    4. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
    5.  

    However, when the player moves away from the location once the sound is playing, the volume fades out. I'd like the track to be heard all around the world, wherever anyone moves to. This is possible as Mineplex does it :)
    If anyone can help on this I'd greatly appreciate it.
    -Rixterz
     
  2. Offline

    CraftCreeper6

  3. Offline

    Rixterz

    But if I repeated the sound playing, wouldn't it start a new one each time and end up with loads of them playing at the same time?
     
  4. Offline

    CraftCreeper6

    Rixterz
    How long does the sound last?
    EDIT: By the way, you could just increase the last two numbers on line 2.
     
  5. Offline

    Rixterz

    About 5 seconds
     
  6. Offline

    CraftCreeper6

  7. Offline

    Rixterz

    I just want the player to hear it at full volume until it finishes
     
  8. Offline

    CraftCreeper6

    Rixterz
    "EDIT: By the way, you could just increase the last two numbers on line 2."
     
  9. Offline

    Rixterz

    Perfect, it works on 5F as the first parameter. Thanks for helping.
     
  10. Offline

    CraftCreeper6

Thread Status:
Not open for further replies.

Share This Page