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.

music track display or text display that doesn't check input

Script Title:
Music track display

RMXP or RMVX:
RMXP

Detailed Description:

I need a window that is a lot like the text box used for dialog and messages, but does the following:

-Callable from an event script(like myWindow.say "text to say here")
-Shows up at the top of the screen, sliding in from the top. (Dialog is at the bottom in this game, and characters usually are in the center.)
-Displays two lines of text, like:

Song Title
Author of Song

-Slides away after a couple of seconds, on it's own.
-Does not need any player input to display.
-Does not interfere with regular text display, allowing dialog to display as normal even while this is being displayed.

Explanation of where I need to use it:

There are several emotional cutscenes in my game, with special music tracks that only play during these scenes. Most of these scenes are "hidden" or storyline A-B type setups, thus I don't want to give away the whole list of music in the credits. However, in order to give proper credit for the songs, I need to display the author and song title when I start playing the song.

Because the cutscenes are at emotional/storyline key points, I don't want to ruin the dialog by suddenly having the game announce a song in the dialog window. Instead, much like weather or screen changes work, I want to simply slide in the info, and then slide it back out, while the player can still take as long as they want reading the text the characters are saying.

It doesn't need to do anything fancy other then appear with the text required, count down on it's own independant of the dialog window, and then vanish. Ideally, I would not use a second event to trigger it's dissapearance, in order to keep from timing the song credit to the dialog if the player should be slow or fast at reading. That way, the song creator still gets the same amount of "screen time" for their name every time the scene is run.

Other Scripts I am using (in order):
I have a lot of modified scripts, but most use their own classes, and should not interfere with this. I also have a heavily modified skill damage setup(different days of the week in game make elements act different), but that probably won't have any effect on this script. Basically, try to keep it as independant as possible. I haven't modified any of the basic window code or any other default scripts, so it should be safe to reference those code if you really must.
 
Desecration":1ththcc8 said:
Hey. I did a quick search for you and found two scripts that could possibly be what your looking for, the first is A similar requset thread, with some scripts in it that do what you need. The second is Beran's iPod Script

Both links seem to connect to the same thread, which is a full blown in game media tracker. It's way overkill.

I don't really need any control over the music itself, I just want to display a small message at the top independant of the message events and player input. I guess from a coding standpoint, the data itself could be anything that would take two lines of text.

Thanks anyway, but I'd have to cut that script down to pieces and get rid of the whole "ipod" window system for it to be useful. :p
 
I'm on my laptop currently and must have mislinked the urls, sorry. I'll give it a look over tomorrow and see if I can pump out a script to show the Song Title and Composer. I'll post when I've had a look letting you know how its going.
 
Desecration":3smjq2gp said:
Well I gave it a go and couldn't work out an automated way to get the Map's BGM title, spent an hour or so looking but to no sucsess. Sorry I wasn't able to help.

Actually, I don't even need it automated. I just need to be able to pass a message to a message box and not interrupt the default dialog options. Since I am using events to play the music, I already know when I need to display the window.

Maybe I'll try explaining again. Forget the music related stuff...I think I just confused everyone.

What I need is a small display up top, capable of showing two lines of text, that then will dissapear after it's been on screen for around 60-80 frames or so. I need to be able to call it using a script event, just after I change the bg music using a regular event. I don't want it automated though, as there are many bg music changes that won't have the box show up. Last, it needs to not interrupt the player's input, so that they don't have to push a button to make it go away, and it doesn't push buttons for them either. Small and simple. :)
 
Hey again. So I think I've got what you need. Here it is;
The Window -
Code:
#==============================================================================

# ** Window_MiscBox

#------------------------------------------------------------------------------

#  This window creates the box.

#==============================================================================

 

class Window_MiscBox < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #-------------------------------------------------------------------------- 

  def initialize

    super(150, 150, 480, 480)

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #-------------------------------------------------------------------------- 

  def refresh

    self.contents.clear

    self.contents.draw_text(4, 0, 120, 320, "Text Uno")

    self.contents.draw_text(4, 0, 120, 280, "Text Duex")

  end

  end
The Scene -
Code:
#==============================================================================

# ** Scene_MiscBox

#------------------------------------------------------------------------------

#  This window displays the Misc. Box.

#==============================================================================

 

class Scene_MiscBox  

  #--------------------------------------------------------------------------

  # * Main Processing

  #--------------------------------------------------------------------------

  def main

    @wait_time = 50

    @spriteset = Spriteset_Map.new

    # Make zoom instruction window

    @misc_window = Window_MiscBox.new

    @misc_window.x = 15

    @misc_window.y = 12

    # Graphics Transition

    Graphics.transition

    loop do

      Graphics.update

      Input.update

      # Update Method

      update

      if $scene != self

        break

      end

    end

    @misc_window.dispose

  end

end

  #--------------------------------------------------------------------------

  # * Update

  #--------------------------------------------------------------------------    

      def update

       if @wait_time > 0

      @wait_time -= 1

      return

    end

    @misc_window.update

    # Switch to map screen

    $scene = Scene_Map.new

    end

I apologize for the sloppy coding, it should do the job though. To call it use this;
Code:
$scene = Scene_MiscBox.new
 
Desecration,

While that works (if you move the 'end' to the right place in Scene_MiscBox), it freezes the display while the message is showing.
Rather than start a new scene, you should just add the window to Scene_Map. Also you hard coded the text, so it can't be called with different text. (for each song).

DarkGriffon,

Try this out...

It adds the window to Scene_Map (off the screen). Then slides the window onto the screen when there is text available.
It also pulls the text from 2 global variables, so each time you use it you can have different text.

Code:
 

#==============================================================================

# ** Window_MiscBox

#------------------------------------------------------------------------------

#  This window creates the box offscreen. When you set the text,

#  it automatically slides into place, pauses, then slides off.

#  To set the pause, edit the # of frames in line 46.

#

#  To call from an event script&#058;

#

#  $winmisc_text1 = "text one"

#  $winmisc_text2 = "text two"

#==============================================================================

 

class Window_MiscBox < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    super(200, -96, 240, 96)

    @text1 = ""

    @text2 = ""

    @timer = 0

    self.contents = Bitmap.new(width - 32, height - 32)

    self.opacity = 127

    self.back_opacity = 192

    self.contents_opacity = 192

  end

  #--------------------------------------------------------------------------

  # * refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    self.contents.draw_text(4, 0, 200, 32, @text1, 1)

    self.contents.draw_text(4, 32, 200, 32, @text2, 1)

  end

  #--------------------------------------------------------------------------

  # * update

  #--------------------------------------------------------------------------

  def update

    if @text1 != $winmisc_text1 or @text2 != $winmisc_text2

      @text1 = $winmisc_text1

      @text2 = $winmisc_text2

      ################################

      # Set how long the window stays

      ################################

      @timer = 100

      refresh

    end

    if @timer > 16 and self.y < 0

      self.y += 6

    end

    if @timer <= 16 and @timer > 0

      self.y -= 6

    end

    if @timer > 0

      @timer -= 1

    end

    if @timer == 0

      @text1 = ""

      $winmisc_text1 = ""

      @text2 = ""

      $winmisc_text2 = ""

    end

  end

end

 

#==============================================================================

# ** Scene_Map

#------------------------------------------------------------------------------

#  Create the Window, and update it

#==============================================================================

class Scene_Map

  alias winmisc_main main

  alias winmisc_update update

  def main

    $winmisc_text1 = ""

    $winmisc_text2 = ""

    @win_misc = Window_MiscBox.new

    winmisc_main

    @win_misc.dispose

  end

  def update

    winmisc_update

    @win_misc.update

  end

end

 

To call it, just set
$winmisc_text1 = "text one"
$winmisc_text2 = "text two"

To change the wait time, adjust the '100' frames on line 46

Be Well
 
Ahh right, I never realised it would freeze the screen. As for the hardcoded text I didn't think about making it any other way, my bad. Thanks for the tips Brew. Glad you solved your issue Darkgriffin.
 

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