Do certains commands during the message window

Hi, I need your help once again 😛

I wanna make my messages more lively by being able to play sound effects, or flash/shake the screen at chosen moments in the message.

I explain myself : When I was on VX, I had a script which let me call common events while displaying a message with the text code \ce[x], where x was the ID of the common event.

It was really useful because I would be able to make texts like this :

3219371781_1_9_eQWyOMai.gif


See ? When Phoenix is saying "no way !" the screen flashes. I'm unable to reproduce this in MV. Or rather I couldn't find a plugin for that 🙁

Any ideas ?
you might can do the same in MV, create a common event, make a screenshake last 4 frames and erase it.
call the event before the next text.

I didn't test it, but it should work around that by than.
I dont know if there is a plugin for it, but while the shake screen is only horzontally, you might
want to include Theo's ShakeScreen to make it better, of course, you can make it common event
in a parallel, and use variable +1, wait 4 frames, variable -= 1 or set to 0 before
the next text message.
A Parallel event like ShadowDragon describes is one possibility, though that can get a little clunky because you need to make sure the timing matches your text etc. 😴

I happen to have a plugin that lets you define custom escape codes, but it requires you to write the effects with JavaScript. Link: view/download Cae_CustomEscCodes (Google Drive).

These are the general forms for invoking the shakeScreen and flashScreen methods (cf rpg_objects.js):
JavaScript:
$gameScreen.startShake(power, speed, duration);
$gameScreen.startFlash([red, green, blue, saturation], duration);
Based on that, you could try making two "Process" codes in my plugin's parameters, one for each effect:
  • Shake (3 arguments, all Integer):
    JavaScript:
    var power    = parseInt(arguments[1], 10);
    var speed    = parseInt(arguments[2], 10);
    var duration = parseInt(arguments[3], 10);
    $gameScreen.startShake(power, speed, duration);

  • Flash (5 arguments, all Integer):
    JavaScript:
    var args = [arguments[1], arguments[2], arguments[3],
                arguments[4], arguments[5]];
    args = args.map(function(a) { return parseInt(a, 10); });
    var tone = args.slice(0, 4);  // r,g,b,sat
    var duration = args[4];       // frames
    $gameScreen.startFlash(tone, duration);
...or combine them into one "Process" code with 7 arguments or something. Hope that makes sense! 😂

Edit: my plugin also has a "sound effect" example, check its help section. Common events are more tricky: I'm not sure how to implement a code to run an event mid-message like you describe, will try out some stuff and let you know if I make any helpful discoveries! 😤

Edit 2 @belatucadrus: 👋 OK this seems to work for me, but note that if you put the event calls too close together then the first event will immediately stop to make way for the second event. It's a "Process" code like the others~
  • Common Event (1 argument, an Integer):
    JavaScript:
    var ev = $dataCommonEvents[parseInt(arguments[1], 10)];
    if (ev) {
      var pt = SceneManager._scene instanceof Scene_Map ?
               $gameMap._interpreter : $gameTroop._interpreter;
      var id = pt.isOnCurrentMap() ? pt.eventId() : 0;
      pt.setupChild(ev.list, id);
    }
@caethyril what a complicate code, I check your plugin, but I dont understad any of it yet.
but it might be also helpfull in your way.

My way can get clunky while its more BEFORE the text happens, but it was only a possibilty.
if he wants the exact way, a plugin that can use to call the CE can be nice.

blabla blablabla blabla \ce[1] bla bla bla bla
blabla \ce[1] bla bla bla etc 😛

its something differents, but do it before a text message is easy, but during it, something else.
I have no idea how to do that exacly as well. I have a game that use that effect as well. but
to make the option with default part is to use automatic text, so y you cant speed up the text
and call the common event like (parallel proces) (switch CE ID)

wait 40 (frames)
shakescreen power duration
wait 20 (frames)
shakescreen power duration
code
code
code

in text box
control switch CE ID = ON
text text
text text
etc
control switch CE ID = OFF

depends when you want to trigger the event. but that is also a simple solution.
you have to use a plugin to disable the speed of the text entirely to make it work nicely
and when he is saying certain things, but you must also know and play with the settings
and caluclations to make it right (can be some time consuming).

but try caethyri way first, you might ask her (if he/she want to help) to set it up.
there might be other ways as well, but you can always improve later on when you
know the software better and better in eventing stuff 🙂
Wow, this looks amazing !

@ShadowDragon yea, I'm using your method for unskippable text events like cutscenes. But in casual dialogues it's a pain to time it, when the player can press ENTER to skip the text (I'm allowing that when it's not cutscenes)

Then I want to use @caethyril's plugin to create a custom escape code, it would help me... a LOT ^^
I'm testing this, will feedback later
@belatucadrus: hope it works out! If you need help with the setup I can try to explain things more clearly~ 🙏

@ShadowDragon: if you want to understand the plugin code, I'd suggest starting with the last couple of methods, in the "Alterations" section. You can compare the code there with the existing methods in rpg_windows.js. The plugin also uses regular expressions for matching; they can be confusing if you're unfamiliar with them.

The idea is that each list in the plugin parameters ("Convert" and "Process") gets converted into appropriate objects (regular expressions and functions), then each function is linked to its regular expression (via the method aliases in the "Alterations" section). 🙂

For the escape code stuff I've just been referring to the event command code (rpg_objects.js). 😛
@caethyril IT WOOOORKS <3 Thank you @caethyril and @ShadowDragon I shall bring life to my dialogues now 😀

EDIT: Hmm I spoke too fast. My common event is triggering twice. I don't mind my character double-punching the poor dude, but still....

1584200143489.png


1584200215475.png
EDIT: Hmm I spoke too fast. My common event is triggering twice.
Oh, are you using a word-wrap plugin, e.g. Yanfly's Message Core? Word-wrap requires the message to be written out once in advance, to decide where the linebreaks should go (because something like \ce[25] has zero width when actually displayed on-screen). 👋

I've just added a check for Yanfly's "word wrap check mode" and it seems to be working correctly for me. Same link as before, the plugin is now version 1.3: view/download Cae_CustomEscCodes (Google Drive). 😤
@caethyril I re-download to check later, but while im fairly new to javascript and learn to understand them,
I still dont know what the codes exacly does or your codes above.

I learn more from a demo to see how its inputted where and their effects in game.

(you may PM me or it get a bit off topic here)

@belatucadrus I'm happy you get it to work in the way you wanted.
I wish you good luck on your project, and if you need more help, we nice peoples see
where we can help where-ever you need us again on this forum ^^
Everything works fine now. Thank you so much 😛

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/do-certains-commands-during-the-message-window.119091/