Playing piano

Hey folks!

I have a question!

I wanna make it possible to play the piano but stop when the player presses the key to stop or go back.

But my commands don't really work well.. xD

Can you pls. help me? =)

Spoiler
D1M7omQ.jpg

Spoiler
AFODtfw.jpg
Your problem here is that your conditional branch for stopping it, is set to only happen if the piano switch isn't on, move the conditional branch for stopping the piano to directly after play bgm.
@Unislayer That's not the problem actually. What that conditional branch does is just turning off the switch, it won't stop any music from being played. Moving the control switch command there will just turn the switch off immediatly after the musc starts.

@Wasserteufel in your event you have nothing that stops your BGM. What you lack is a BGM Fadeout command (page 2 ov event commands). If you don't use that one to stop your music then it will loop.
@Unislayer That's not the problem actually. What that conditional branch does is just turning off the switch, it won't stop any busic from being played. Moving the control switch command there will just turn the switch off immediatly after the musc starts.

@Wasserteufel in your event you have nothing that stops your BGM. What you lack is a BGM Fadeout command (page 2 ov event commands). If you don't use that one to stop your music then it will loop.

Oh! Okay..

I'll try chanching that.

Thanks a lot!
You are welcome!

Just one more thing: you should start your music in the 1st page of your event. The 2nd page is set as Autorun. You don't need the engine to check that line (play BGM) every single frame.
It is an unrequired operation that you don't need (and you probably don't want). I am kinda sure that the engine still plays the music as intended but it is not how it is meant to be. When the player decides to play the piano, before turning the switch on. start your BGM, then use the 2nd page to handle the condition to stop it.


EDIT:
A much better way to do it is to create your conditional branch (the one where the player decides to start playing the piano) like this:

1 - Play BGM
2 - Display a Message like "Soft and calm music starts coming out of the piano...". Here you can even add something to tell the player that if the message window is closed the music also stops. That's entirely up to you.
3 - Fadeout BGM

This way the music automatically stops when the player closes the message window but keeps playing until that happens.
You are welcome!

Just one more thing: you should start your music in the 1st page of your event. The 2nd page is set as Autorun. You don't need the engine to check that line (play BGM) every single frame.
It is an unrequired operation that you don't need (and you probably don't want). I am kinda sure that the engine still plays the music as intended but it is not how it is meant to be. When the player decides to play the piano, before turning the switch on. start your BGM, then use the 2nd page to handle the condition to stop it.

Yes. That sounds plausibel!

I will test it.

Normaly I try to avoid autoruns or parallel processes except for cut scenes.
I edited my previous post ading a little suggestion. Try it and see if it fits your situation. In my opinion that's the best way of doing it.
I edited my previous post ading a little suggestion. Try it and see if it fits your situation. In my opinion that's the best way of doing it.

Your EDIT idea sounds awesome!

I'll just do that! 🙂

Thanks!!
2 - Display a Message like "Soft and calm music starts coming out of the piano...". Here you can even add something to tell the player that if the message window is closed the music also stops. That's entirely up to you.

Just as an aside, this method has the added bonus of being handicap accessible - for any deaf or hard of hearing players you might have!
You are welcome!

Just one more thing: you should start your music in the 1st page of your event. The 2nd page is set as Autorun. You don't need the engine to check that line (play BGM) every single frame.
It is an unrequired operation that you don't need (and you probably don't want). I am kinda sure that the engine still plays the music as intended but it is not how it is meant to be. When the player decides to play the piano, before turning the switch on. start your BGM, then use the 2nd page to handle the condition to stop it.


EDIT:
A much better way to do it is to create your conditional branch (the one where the player decides to start playing the piano) like this:

1 - Play BGM
2 - Display a Message like "Soft and calm music starts coming out of the piano...". Here you can even add something to tell the player that if the message window is closed the music also stops. That's entirely up to you.
3 - Fadeout BGM

This way the music automatically stops when the player closes the message window but keeps playing until that happens.

It works perfectly!!

Thank you!

You opend my mind about creating different conditional branches now! =)

Thanks alot!
I am glad to hear that. Good luck with your events!

If you anything else feel free to contact me whenever you want.
I am glad to hear that. Good luck with your events!

If you anything else feel free to contact me whenever you want.
Thanks! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/playing-piano.86017/