Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Improve Vehicle Music Handling

I want to make it so that:

A. The vehicle music doesn't stop playing when you change maps.
B. When you exit the vehicle, the map's auto-music plays.

Anyone know how to do this?

EDIT: I tried to do it on my own, but I keep getting this error when I try to land:

Script 'Vehicle Music Improvement' line 58: NoMethodError occurred.

undefined method ` autoplay_bgm' for nil:NilClass

Here's the script:

Code:
#==============================================================================
# ** Vehicle Music Improvement
#------------------------------------------------------------------------------
# By: MysteryMan23
# Version 1.0
# Date: 3/21/08
#
# This script makes it so that the vehicle music doesn't stop playing when you 
# change maps, and also makes it so that when you leave the vehicle, the map's 
# autoplay music plays if it has any; else, it will just play the memorized 
# music.
#
# To use: put in the materials section above Main.
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Player Transfer  Processing
  #--------------------------------------------------------------------------
  def update_transfer_player
    return unless $game_player.transfer?
    fade = (Graphics.brightness > 0)
    fadeout(30) if fade
    @spriteset.dispose              # Dispose of sprite set
    $game_player.perform_transfer   # Execute player transfer
    $game_map.autoplay if ($game_player.vehicle_type == -1)
    $game_map.update
    Graphics.wait(15)
    @spriteset = Spriteset_Map.new  # Recreate sprite set
    fadein(30) if fade
    Input.update
  end
end

class Game_Player
  #--------------------------------------------------------------------------
  # * Get Off Vehicle
  #    Assumes that the player is currently riding in a vehicle.
  #--------------------------------------------------------------------------
  def get_off_vehicle
    if in_airship?                                # Airship
      return unless airship_land_ok?(@x, @y)      # Can't land?
    else                                          # Boat/ship
      front_x = $game_map.x_with_direction(@x, @direction)
      front_y = $game_map.y_with_direction(@y, @direction)
      return unless can_walk?(front_x, front_y)   # Can't touch land?
    end
    $game_map.vehicles[@vehicle_type].get_off     # Get off processing
    if in_airship?                                # Airship
      @direction = 2                              # Face down
    else                                          # Boat/ship
      force_move_forward                          # Move one step forward
      @transparent = false                        # Remove transparency
    end
    @vehicle_getting_off = true                   # Start getting off operation
    @move_speed = 4                               # Return move speed
    @through = false                              # Passage OFF
    if @map.autoplay_bgm                          # Map has auto BGM
      game_map_autoplay                           # Autoplay
    else
      @walking_bgm.play                           # Restore walking BGM
    end
    make_encounter_count                          # Initialize encounter
  end
end

I DO plan on releasing this script later, by the way.  Could someone help me out here?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top