Recommended Posts

Warbucks    1,873
Posted (edited)

Hello! Like the title says that's what me and my friend need help figuring out, thanks for your time and any help :D

Edited by Warbucks

Share this post


Link to post
Share on other sites
Warbucks    1,873

Okay, so I remembered Woodie plays music which only his player can hear it so I checked out his code and found

"TheFocalPoint", using this to emit sound seems to work fine in non-caves world, but in caves-world the sound doesn't even emit? Help me pleeaaaseee :wilson_ecstatic:! Thanks for your time and help, have a great day :D!

Share this post


Link to post
Share on other sites
CarlZalph    2,609

TheFocalPoint last I recall exists only on the client.

Woodie's code relies on the client knowing that he's in beaver mode to start playing the audio.  Since the audio doesn't change it doesn't need to be networked so the controller is just a single bit (beaver on/off).  It may be packed into a byte with other fields, but the idea is the same.

 

If you want to play arbitrary audio onto only one player in specific that's controlled by the server, then you're going to need to use a string netvar to hold the sound name and helper netvars to tell the client what it should do with it.

Otherwise you'll have netvars for specific events that play static sound files like Klei did with Woodie.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
Warbucks    1,873

Is there any examples for how to do this? I'm not really good with coding stuff and don't really know where to start and would really like the sound to only player for the player not everyone, welp

Edited by Warbucks

Share this post


Link to post
Share on other sites
CarlZalph    2,609
8 hours ago, Warbucks said:

Is there any examples for how to do this? I'm not really good with coding stuff and don't really know where to start and would really like the sound to only player for the player not everyone, welp

Well if it's a set sound effect and you want it played, then look at how Woodie's is handled, it uses the netvar for beavermode.

Otherwise you'll be creating at least one string netvar and have the client play the string as a sound whenever it changes.

Edited by CarlZalph

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now