A downloadable plugin

Buy Now$4.00 USD or more

This plugin allows you to define specific spots on the map where sound effects originate. You can use them in events and move routes alike. You can use this for sound-based puzzles, or just perhaps some extra immersion. This is an upgraded version of the regular Focused Sound Effects plugin also available in the shop; only use the standard or Pro version, not both.

In events, call a Plugin command as follows:

PlayFocusedSE nameOfSEFile parameter=X parameter=X...

Or, in the Pro version, you can play a BGS (only one at a time) with focused effects!

PlayFocusedBGS nameOfBGSFile parameter=X parameter=X...

While the parameters are technically all optional aside from the name of the SE/BGS file, you'll probably want to include them to get full use out of this plugin. 

Location, Location, Location...

The first thing you need to do is define where the sound is coming from. You can just use the event that is calling the command as the source - that requires no parameters - but if you want a different location, you have two ways of doing it. The first:

x=19 y=32

...is to simply define the X,Y coordinates on the map. The second way:

event=49 

or 

event=DrippyFaucet

...is to define an event that will be the source of the sound. You may refer to the event either by ID number or by name (if you use name, make sure it has no spaces in it, and be forewarned that it will pick the first event on the map with the correct name that it finds, so make sure the names are unique.)

Sound Fading

By default, it will play at full volume no matter where you are. But that's not what you want, is it? Give it some fade parameters!

fadeDistance=5

If the player is within the fadeDistance range, the sound effect will play at full volume. Fading will begin once you leave that distance. "0" would mean that it only plays at full volume when the player is literally on top of it, while "1" would let it play at full volume when standing next to it.

fadeRate=10

Put a number from 0 to 100 into fadeRate. Fade rate is a percentage representing how fast, exponentially, the sound fades away when you're outside the fadeDistance. Or, in layman's terms, the higher the number, the quicker the sound fades away. With 0, the sound won't fade, period. With 100, the sound will be completely impossible to hear outside the fadeDistance.

If you make the fadeRate, say, 10, then you'll hear the sound at 90% volume if you're one tile outside the fadeDistance, 81% volume (90% * 90%) if you're two spaces outside, and so on.

The fadeRate is 100 by default, so I recommend setting it if you're using fadeDistance.

Pan

Pan is handled by the plugin automatically by comparing the X-coordinate of the sound source's position to the position of the screen. But if you want to override that...

pan=50

...it's as easy as that! Now it'll play with a pan value of 50 no matter where the event is.

Other Parameters

Just the usual sound parameters.

volume=85

The base volume for the sound effect -- specifically, what the volume will be within the fadeDistance. Default is 100.

pitch=90

The pitch for the sound effect, same as how it works everywhere else. Default is 100.

Movement Routes

If you want to put focused sound effects in a movement route, you can, but you'll have to do it as a Script. Write it as follows:

this.playFocusedSE("nameOfSEFile parameter=X parameter=X...");

Make sure you have those quotation marks around the parameters! It works exactly the same otherwise. (This feature is not supported for BGS effects due to their looping nature, though of course a BGS can still be assigned to an event with a Plugin command.)

PRO VERSION: Sounds can move even after they start playing!

With the standard version of this plugin, sounds will start at a given location, but will not have their pan or volume settings updated as you move. Not the Pro version! As you or the events attached to an effect move, so too will the sound! This is automatic and does not require any extra settings.

Notes about map transitions

It is usually recommended you manually stop long focused effects before changing maps, but this is not enforced. If you don't:

1. If any SEs are attached to an event whose numerical ID does not exist on the new map, all SEs (focused or not) will stop playing.

2. Similarly, if the BGS is a focused effect attached to an event that doesn't exist, it too will stop playing.

3. Otherwise, effects set to an X,Y position will continue playing at the same coordinates (even if those coordinates don't exist on the map), and those attached to an event will play at the location of the event on the new map with the same numerical ID as the old event.

StatusReleased
CategoryTool
Rating
Rated 4.8 out of 5 stars
(4 total ratings)
AuthorHeroicJay
TagsRPG Maker

Purchase

Buy Now$4.00 USD or more

In order to download this plugin you must purchase it at or above the minimum price of $4 USD. You will get access to the following files:

Jay_FocusedSoundEffectsPro.js 14 kB

Development log

Comments

Log in with itch.io to leave a comment.

(+1)

Will this come to MZ?

Excellent plugin work, solves my exact use case! I may extend the code a little as well.

I want to see if I can extend this to work for sounds played via an animation being called. That way I can have an event running in parallel playing an animation with these added sound controls. Otherwise I have to decouple the sound from the animation and play it separately. Not a big deal but a little annoying.

(+1)

Hm, I hadn't considered this one for animations, though that is a valid case for it. It may be complicated - battles and the overworld are completely separate concepts, and animations can be called through both - but the voice acting plugin can do similar things to this plugin. There's also the fact that I don't know if animations can accept plugin calls. I have a lot on my plate right now, but it's something to mull over.

no worries, I'll see about implementing it myself.

(1 edit)

Does this plugin works with MZ? 

Doubtful. I sorta I overlooked this one when I updated my plugins for MZ.

To anyone else reading this thread: The issue turned out to be the default parameters after all. Apparently he was somehow running a probably-obsolete JavaScript interpreter that didn't recognize them. We sorted this out off of itch.io.

Hello, I'm attempting to make use of the pro version of the plugin and it somehow doesn't work, despite running literally the example command. The only way i DID get it to work was when I got the free version. I don't really know what I can do, can you help? Not even the features of the free version function in the pro. Thank you.

(3 edits) (+1)

Not enough information to go on, I'm afraid. Could it be two plugins conflicting with one another? If you press F12 [EDIT: meant F8] while debugging the game, do you see any errors reported? Did you remember to point your plugin list at the Pro version? And which "example command" do you mean?

Thank you for responding! 

I disabled all the other plugins just to be sure but it continues not to work. 

I don't really have any experience with debugging so bear with me if possible... Pressing F12 when I'm in the F8 debug menu while focused on the dev tools or the game does nothing which is strange as I thought it was supposed to reset the game.

I'm not sure what you mean by pointing the plugin list at the Pro version, could you elaborate?

By Example command, I meant the one in the help file(I obviously made a lillypad event):

"

Example:

PlayFocusedSE Frog event=Lillypad volume=80 fadeDistance=5 fadeRate=10

"

- as in it's not that I wrote it wrong. Please let me know if you need any more info. 

This is the F8 menu, hopefully helps a bit.

https://drive.google.com/file/d/1ZrtzUrwLzK1QWQO8WYKAHDmuF-YVjx7o/view

Sending plugin list just to be sure...

https://drive.google.com/file/d/1U2aaq7erv6MdTCdFzX9SfveZ1KrrDIXs/view

Thank you again.

(1 edit) (+1)

Sorry, I meant F8. Mixed up my commands.

That at least points me in the right direction, but I don't see the error on my side. Perhaps something got corrupted in your download. Can you open the plugin in a text editor and look for the line that defines the playFocusedSound function? It'll be line 155, the one flagged in the first picture. It should look like this:

AudioManager.playFocusedSound = function(xCoord, yCoord, args, type, eventId = -1) {

If that's not what you see, let me know what you do.

And if the plugin is corrupted, try downloading it again.

(4 edits)

Hi, I downloaded the plugin again and no luck so far, same goes for the line in the .js file - It's precisely as you wrote it. Can't really think of anything to do to be honest. :/ 

Edit: small progress since i accidentally clicked the plugin in file explorer

---------------------------

Windows Script Host

---------------------------

Script: C:\Users\Adam\Documents\Games\fuckass\js\plugins\Jay_FocusedSoundEffectsPro (3).js

Line: 155

Char: 78

Error: Expected ')'

Code: 800A03EE

Source: Microsoft JScript compilation error

---------------------------

OK   

---------------------------


For some reason the part after eventId is being troublesome it seems. 

If i try to delete the part after EventId, it results in another error on the line 264 char 46.

I am So confused

(1 edit) (+1)

I get the same error when I double-click on the file, but that's now how plugins are supposed to be used anyway. It sounds like your version of RPG Maker's JavaScript interpreter doesn't recognize default parameters... but why it wouldn't I can't begin to fathom, as I've never had that problem.

Deleted 3 years ago