BGM-problems by changing vehicles

Hi Guys,
I've tried really hard to find my own solution, but there is no way I can solve my problem on my own.

I'll try to explain:
I want to add a function to turn the ship into an airship by pressing "Q".

However, during a (common) event, the player cannot jump from one vehicle to the next.
In order to change vehicles, the player has to get out first.

And there is the problem:
The player stands on the map for a few frames before getting into the airship and the game thinks: "I have to change ship BGM to map BGM and then I have to change map BGM to airship BGM!" But I do not want that!

I want to change ship BGM directly to airship BGM. Or I need a way to jump from one vehicle to the next.

Do you know any way to solve the problem?
I would really be incredibly grateful to you!
I assume you have the press Q -> run common event part handled? If not yanfly button common event script will do that.

In the common event
gather player location info and map id saved to variables
do a fadeout
transfer to a new map
land ship (or airship) (check with conditional branch)
Make sure to be facing a specific direction for getting off the ship and getting on the ship.
after the character gets off the ship, move one square (move route) left or up or down whichever way you want.
have the airship at that spot and get on the airship.
Do the reverse for the airship to ship.
transfer back to original map with coordinates saved in variables
fade in screen

For the sound have the transfer map with no sound and do the normal airship and ship sounds.
You could also have a sound effect play in between to indicate a ship swap.

There will be a 1-2 second delay until the new music plays.
I assume you have the press Q -> run common event part handled? If not yanfly button common event script will do that.

In the common event
gather player location info and map id saved to variables
do a fadeout
transfer to a new map
land ship (or airship) (check with conditional branch)
Make sure to be facing a specific direction for getting off the ship and getting on the ship.
after the character gets off the ship, move one square (move route) left or up or down whichever way you want.
have the airship at that spot and get on the airship.
Do the reverse for the airship to ship.
transfer back to original map with coordinates saved in variables
fade in screen

For the sound have the transfer map with no sound and do the normal airship and ship sounds.
You could also have a sound effect play in between to indicate a ship swap.

There will be a 1-2 second delay until the new music plays.

Yes! That's the detail that I was missing!

I did everything as you described it but I just didn't think about doing the transfer from one vehicle to the next on a different map.
Sometimes the solution is too simple to figure out...

You are great! Thank you!!


And sorry for my bad English... =)



EDIT:
Okay, I've tried to solve the problem by teleporting the player (with the vehicle) to another map, but it doesn't seem that easy.

The new map has no sound. The box for the BGM change is ticked. Nevertheless, the BGM of the world-map is played when getting out of the vehicle.

Uff... 🙁
The new map has no sound. The box for the BGM change is ticked. Nevertheless, the BGM of the world-map is played when getting out of the vehicle.
Turns out Game_Vehcile has that in the get_off method

Perhaps us this and change the switch number to whatever number you want.
Turn the switch on will block the sound
off to restore sound. (for vehicle getting off)
Ruby:
class Game_Vehicle < Game_Character
  def get_off
    @driving = false
    @walk_anime = false
    @step_anime = false
    @direction = 4
    @walking_bgm.play if $game_switches[1] == false
  end
end
Hopefully this it the cause.
Thank's! With the new method (changing maps to switch vehicle) it still doesn't work. But I'll try to use the script without changing the map for the transfer.

This might take a while because I forgot to create a backup =/
...but today I'm not in the mood to repair it...

I'll let you know if it worked. 😉

Original thread: https://forums.rpgmakerweb.com/threads/bgm-problems-by-changing-vehicles.134284/