Jump to content

Workbench plays a sound while inside, stops when you exit


BadZombie

Recommended Posts

Hi all,

 

Just wondering if this is possible at all.

 

Ideally what I am trying to get is when a player opens a workbench a sound plays - maybe on a loop - although for now just a sound would be a good starting point.

The sound then stops playing when a player exits the workbench.

If the player opens the workbench again the sound starts over from the beginning.

I have tried it using the 'OpenSound' property in blocks.xml but I've found in testing the problem is if I quickly open and close the workbench lets says 10 times in 5 seconds the sound plays 10 times so it's an unpleasant cacophony of noise. Also, for example a 30 second sound plays in it's entirety even if the player exits the workbench after 10 seconds.

I'm just wondering if the request is possible or if there are any mods with similar functionality I could take a look at and adapt?

 

Cheers!

Link to comment
Share on other sites

In sounds.xml, have you set a time for how soon the noise is removed (as per the notes at the top of that file)? I haven't really tried anything like this, but I think if you set it to time="1", you might see it end quickly. Or maybe not--just spitballing here. As for the playing in rapid succession problem, there's also a MaxRepeatRate that can be set. That sounds like a promising way to possibly keep from being inundated with the same sound repeatedly in quick succession.

Link to comment
Share on other sites

22 hours ago, Cranberry Monster said:

In sounds.xml, have you set a time for how soon the noise is removed (as per the notes at the top of that file)? I haven't really tried anything like this, but I think if you set it to time="1", you might see it end quickly. Or maybe not--just spitballing here. As for the playing in rapid succession problem, there's also a MaxRepeatRate that can be set. That sounds like a promising way to possibly keep from being inundated with the same sound repeatedly in quick succession.


I've been testing this method, I created a sound file which is 2 minutes long to test with.

Then set the 'OpenSound' property in blocks.xml to use this sound whenever the workstation is opened.

 

I've found that adjusting the 'time' setting in sounds.xml does nothing, also the MaxRepeatRate doesn't have any effect on it either, it seems.

It plays out the entire 2 minute sound file each time, even when I leave the area.

 

Then I was thinking, is there something in buffs maybe that I could use instead, perhaps use the action 'PlaySound' when the workstation is opened and 'StopSound' when the workstation is closed, but I can't find anything to trigger with... there is no workstationopen/workstationclose trigger.

 

 

Link to comment
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
×
×
  • Create New...