RMMV [MV] Slash command that can play a sound effect while a message is still typing?

kanyatanishande

Veteran
Veteran
Joined
Mar 3, 2021
Messages
34
Reaction score
4
First Language
English
Primarily Uses
RMMV
Hiya! It's me once again. Now, please read through as I don't want you to get confused with message sound effects, those that play a little beep every time a character is printed, I'm talking about sound effects like a "tada", "congrats", etc.

Is there a plugin that allows you to call a sound effect while a message is typing?
Like, for example, \s[filename], which looks for an ogg file with that name? I want to do something cool with a message box where in an event something random is chosen, then it goes like "You got...", waits a moment, then says "[result]!" and plays a sort of tada sound effect (with a command). Obviously, in this situation it wouldn't fit before or after, and it's not possible to fit it in between without a plugin. Any help?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,471
Reaction score
1,863
First Language
EN
Primarily Uses
RMMZ
I have a plugin that lets you script your own text codes:
New codes are set up in the plugin parameters. In this case you'll want what my plugin calls a "Process" type code, so it runs mid-message. There are some example scripts in the help section, including one for playing a SE. If you have trouble then refer to this old thread for details:
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
569
Reaction score
244
First Language
PT-BR
Primarily Uses
RM2k3
Obviously, in this situation it wouldn't fit before or after, and it's not possible to fit it in between without a plugin. Any help?
It is possible to do this without a Plugin, but it would have to synchronize, and for that you would have to know the waiting interval for the sound to play in each message.

You would need to create a common event in a parallel process, which must be activated by a Switch, and using two variables you would determine the time and the SE file.

Map event (NPC) ->
Code:
◆Control Variables:#0031 SE-Synch (fps) = 30
◆Control Variables:#0032 SE-Selected = 2
◆Control Switches:#0011 Msg-Play-SE = ON
◆Text:None, Window, Bottom
:    :Hello!\.\.\.
:    :Wait...

Common Event -> Trigger: Process Parallel -> Switch: MsgBox-PlaySE ->
Code:
◆If:Count-fps ≥ SE-Synch (fps)
  ◆If:SE-Selected = 1
    ◆Play SE:Beep-Bop! (90, 100, 0)
    ◆
  :End
  ◆If:SE-Selected = 2
    ◆Play SE:Boing (90, 100, 0)
    ◆
  :End
  ◆If:SE-Selected = 3
    ◆Play SE:Telephone-ringing-1 (90, 100, 0)
    ◆
  :End
  ◆Comment://Reset variables for prevention
  ◆Control Variables:#0031 SE-Synch (fps) = 0
  ◆Control Variables:#0032 SE-Selected = 0
  ◆Control Variables:#0033 Count-fps = 0
  ◆Control Switches:#0011 Msg-Play-SE = OFF
  ◆
:End
◆Wait:1 frame
◆Control Variables:#0033 Count-fps += 1

It's just a theory, you probably need to make more changes.

Edited:
Apparently it works, but I need to improve it to be able to put more sound effects in a single text box.


Good luck
 
Last edited:

kanyatanishande

Veteran
Veteran
Joined
Mar 3, 2021
Messages
34
Reaction score
4
First Language
English
Primarily Uses
RMMV
I'll give it a try and see if I can make something out of it.
Unfortunately, I couldn't. I don't code stuff in advanced programming languages, especially Javascript... I barely even code at all anymore. At first I thought when previewing the message with the custom slash command that I had done it right, but it turns out that RPGMaker just cuts out anything with a slash in it, so even if I put \poop in there (which wasn't what I put into the plugin), RPGMaker would still cut it out.

How I found out it wasn't working was that it wasn't playing the sound effect I wanted to play. This is why I hate languages like these, because I don't know them and never will.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,495
Reaction score
14,823
First Language
English
Primarily Uses
RMMV

@kanyatanishande , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,471
Reaction score
1,863
First Language
EN
Primarily Uses
RMMZ
Unfortunately, I couldn't...
Maybe try this premade example (click spoiler to reveal code):
JavaScript:
["{\"Code\":\"se\",\"Arguments\":\"[\\\"Text\\\",\\\"Integer\\\"]\",\"Delimiters\":\"[]\",\"Replacer\":\"\\\"var se = {};\\\\nse.name = arguments[1];\\\\nse.volume = parseInt(arguments[2], 10);\\\\nse.pitch = 100;\\\\nse.pan = 0;\\\\nAudioManager.playSe(se);\\\"\"}"]
To use it:
  1. Copy the long line of code from the spoiler above.
  2. Open the Plugin Manager and edit (double-click) Cae_CustomEscCodes.
  3. Edit (double-click) the Process Escape Codes parameter.
  4. If you see a text box now (older version of editor), skip to step 5.
    Otherwise, select the Text tab and the list should turn into a one-line text box.
  5. Paste the copied line of code into that text box.
  6. Click OK to get out of the Plugin Manager.
  7. Save your project to apply Plugin Manager changes.
Example of use in a message:
Then in a Show Text command you can do something like this:
Code:
\se[Bob1, 20]Welcome to the inn!\!
\se[Bob2, 30]Here for a room?
I.e. play SE "Bob1" at 20% volume, show "Welcome to the inn!", wait for player input, play SE "Bob2" at 30% volume, then show "Here for a room?".
 

kanyatanishande

Veteran
Veteran
Joined
Mar 3, 2021
Messages
34
Reaction score
4
First Language
English
Primarily Uses
RMMV
I tried changing "SE" to "SFX" to avoid confusion with the PlayMsgWndCharSE plugin (that plugin already uses SE, and isn't case sensitive iirc) but it showed "[sfx name, 90]" in the message. That triggers me.
 

Latest Threads

Latest Posts

Latest Profile Posts

New version of my wife's art for Tundra's opening map. No new version of Katrina yet, but I think this looks awesome.1624062754755.png
Devil May Cry-Style Action Shooter in RPG Maker 2000! | RPG Maker News #75

So many good stat names, how do people chose!? :p
I am often just about to give in and ask for help in the forums, when I eventually figure things out myself. Spent almost the whole day with a minor issue, but in the and it's so satisfying that I didn't need to open a thread :D

Forum statistics

Threads
112,346
Messages
1,067,626
Members
145,992
Latest member
Baghead
Top