Galv’s Message Background V.1.3

Demo – Version 1.3 >

#------------------------------------------------------------------------------#
#  Galv's Message Background
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 1.3
#------------------------------------------------------------------------------#
#  2013-04-01 - version 1.2 - added option to disable script in battle
#  2013-02-10 - version 1.1 - dim and transparent settings work with image now
#  2012-12-02 - version 1.0 - release
#------------------------------------------------------------------------------#
#  This script displays an image file for a message background instead of using
#  the windowskin. If you are using Galv's Message Busts put this script ABOVE.
#
#  This image background will not stretch to fit, that's not it's purpose.
#  I encourage you to make your own message background images, the ones in the
#  demo are just quick examples!
#------------------------------------------------------------------------------#
#  INSTRUCTIONS:
#  Put in script list below Materials and above Main.
#
#  Read the instructions
#------------------------------------------------------------------------------#
#  SCRIPT CALL
#------------------------------------------------------------------------------#
#
#  msgbg("ImageName", y_offset)     # To change message background during game
#                                   # "ImageName" is the new file name to use
#                                   # y_offset is the new IMAGE_Y for that bg
#  EXAMPLE
#  msgbg("MsgImage", -98)
#
#------------------------------------------------------------------------------#

($imported ||= {})["Galvs_Message_Background"] = true
module Galv_Msgbg

#------------------------------------------------------------------------------#
#  SCRIPT SETTINGS
#------------------------------------------------------------------------------#

  # DEFAULT MESSAGE #

  MESSAGE_IMAGE = "MsgImage"   # Name of image in /Graphics/System to use for
                               # the message background.

  IMAGE_Y = -98                # Y offset of image

  DISABLE_SWITCH = 1   # Turn swith ON to disable image background

  DISABLE_IN_BATTLE = true  # Disable this script when in battle.

#------------------------------------------------------------------------------#
#  END SCRIPT SETTINGS
#------------------------------------------------------------------------------#

end

class Window_Message < Window_Base
  alias galv_msgbg_window_create_back_bitmap create_back_bitmap
  def create_back_bitmap
    @bg ||= Sprite.new
    if !$game_message.message_bg.nil?
      @bg.bitmap = Cache.system($game_message.message_bg)
      @current_bg = $game_message.message_bg
    end
    @bg.z = z - 1
    @bg.opacity = 0
    galv_msgbg_window_create_back_bitmap
  end

  alias galv_msgbg_window_dispose dispose
  def dispose
    galv_msgbg_window_dispose
    dispose_msgbg if !@bg.nil?
  end

  def dispose_msgbg
    @bg.dispose
    @bg.bitmap.dispose
  end

  alias galv_msgbg_window_update_back_sprite update_back_sprite
  def update_back_sprite
    if !$game_switches[Galv_Msgbg::DISABLE_SWITCH] && !$game_temp.msg_off
      update_msgbg if openness > 0
      @bg.opacity = 0 if openness == 0
    else
      galv_msgbg_window_update_back_sprite
      @bg.opacity = 0
    end
    @bg.update
    @back_sprite.update
  end

  def update_msgbg
    if $game_message.message_bg != @current_bg
      if !$game_message.message_bg.nil?
        @bg.bitmap = Cache.system($game_message.message_bg)
        @current_bg = $game_message.message_bg
      end
    end
    @bg.y = self.y + $game_message.message_bg_y
    case @background
    when 0; @bg.opacity = openness
    when 1; @bg.opacity = openness * 0.5
    when 2; @bg.opacity = 0
    end
    @back_sprite.visible = false
    self.opacity = 0
  end

end # Window_Message < Window_Base

class Game_Message
  attr_accessor :message_bg
  attr_accessor :message_bg_y

  alias galv_msgbg_message_initialize initialize
  def initialize
    galv_msgbg_message_initialize
    @message_bg = Galv_Msgbg::MESSAGE_IMAGE
    @message_bg_y = Galv_Msgbg::IMAGE_Y
  end
end # Game_Message

class Game_Temp
  attr_accessor :msg_off
end # Game_Temp

class Scene_Battle < Scene_Base
  alias galv_msgbg_sb_start start
  def start
    $game_temp.msg_off = true if Galv_Msgbg::DISABLE_IN_BATTLE
    galv_msgbg_sb_start
  end

  alias galv_msgbg_sb_terminate terminate
  def terminate
    $game_temp.msg_off = nil
    galv_msgbg_sb_terminate
  end
end # Scene_Battle < Scene_Base

class Game_Interpreter
  def msgbg(image,y_offset)
    $game_message.message_bg = image
    $game_message.message_bg_y = y_offset
  end
end # Game_Interpreter
Advertisements

55 thoughts on “Galv’s Message Background V.1.3

  1. junior Molina says:

    I have some problems in battles and other scripts: (

    I do not speak English, so I don’t quite understand, but I translate with Google :)

    • Galv says:

      I added a setting at the top of the script ‘DISABLE_IN_BATTLE’.
      If that setting is true then it will use default message windows in battles. Copy the script from this page again (not the demo, I have not updated it).

  2. junior Molina says:

    Thanks friend! :)

    Saludos desde Colombia!

  3. junior Molina says:

    Sorry to bother you, I found this error, I have activated the option “DISABLE_IN_BATTLE ‘. I get this:

    appears when I give ” run”

    Thanks

  4. OceanShark says:

    Is there a way to make the picture (Show Picture) appear over the message box, I’ve been trying to tweak things but nothing seems to work, I’m a total noob at scripting.
    Long story short; Is there a way to change the priority of the message box image?

    • Galv says:

      Look for where it says: @bg.z = z – 1
      change it to @bg.z = z + 1
      That will make the image appear above the text if that’s what you meant. Else you can try other values.

      • OceanShark says:

        Thank you very much, it worked!
        Great script by the way and good luck with Pirate Rush, I can’t wait for it to be finished, It took me a long while to beat the Plant boss.

  5. Moe says:

    My custom message background appears above the displayed text.

    • Galv says:

      What you need to do now is check to see if a script is conflicting. Also try putting this script below any other message scripts you are using to see if it fixes the issue

  6. Gyu says:

    can you make a way to add the name of the npc? only put an customizable text and customizable coodinates to where the text will appear

    • Galv says:

      No, sorry. This script just does background image – there are plenty of message scripts that add allow name functionality.

      • Gyu says:

        can i change the background priority? i found an script that add name but the background appear in front of the name

      • Galv says:

        Look in the script for where it says:
        @bg.z = z – 1
        and try changing that to something lower. Depends how the other script works if that will work or not.

  7. Gyu says:

    worked, thanks galv youre awesome

  8. Goken says:

    Sorry for bothering you, I’m pretty new at scripts and I changed the MESSAGE_IMAGE = “Black” and when I engage in any text events the game crashes and I get: http://g15.picoodle.com/ltd/img15/5/8/5/vytong/f_12c3_832_u9tgl.png

  9. Someone says:

    So.. do I make the window the same size as project or what?

  10. Need help says:

    The scrolltext doesn’t work

  11. Need help says:

    okay message background is not the problem but double message is the problem

  12. Need help says:

    Okay, thanks for the quick help and scripts.

  13. Kevin says:

    I seem to be having a problem with the script. When I add this script into my game I get the following error message upon starting up my game:

    Script ‘Game_Switches’ line 19: TypeError occurred
    can’t convert true into Integer

    I used the older version in the demo and it worked perfectly fine, but the newest version does not work. Any ideas?

    • Galv says:

      Hmm, in your settings do you have
      DISABLE_SWITCH = 1

      Or the number 1 could be any number that refers to an in-game switch you use Control Switches to turn on and off. I think you might have put true there instead of a number?

      • Kevin says:

        Seems to of been my own mistake. I was treating the disable switch like your Busts script and getting rid of the number if I did not want it to be disabled by a switch. Not sure why it works in one, but not the other. Anyways I thank you for taking the time to look at my comment. :)

      • Galv says:

        Actually the switch settings work the same way for both scripts. They must be numbers. Make the switch setting 0 if you don’t want to use it.

        One has another setting unrelated to switches which is true or false, though. Different setting type that required a true or false rather than number.

  14. Fung Kai Hei says:

    if i combine the script you written on the message background and the bust.
    The bust will disappear when message background working. i don’t know why.

  15. PBXD says:

    Hello there, I have the following error:

    Script ‘Galv’s Message Background’ line 104: TypeError occurred.
    nil can’t be coerced into Fixnum

    anyone knows how to fix it???

  16. cweorthst says:

    Hi Galv

    I tried to change the background image for books and, when I use the call script you wrote in the script, it doesn’t work. I put “msgbg(“MsgImage2″, -98)” and when I press Z, there is still the same background, the default one. How could I fix this?

    Thank you.

  17. Justin L says:

    I don’t know how to do any scripting and I feel confused. Do I copy and paste EVERYTHING here, or just select parts? Also, what does image_y mean?

    • Galv says:

      As with any script you might try, copy the whole thing and put it below materials and above main in your script list.

      IMAGE_Y = -98 # Y offset of image

      the y value is the position of the image on the screen vertically. A good way to learn is to play around to see what it does.

  18. Davis Kro says:

    Thank you for this script, Galv, but I’ve unfortunately also come across a problem.

    When I activate a message box, the window skin appears first and then whatever background I’ve set in the script for the message box will appear for half a second after.

    Your script is the only one I have in my game aside from the default ones.

  19. sapiboong says:

    If I use bigger resolution (640×480), the placement of message background become messed up… The bottom part of message background gets cut off, and if I change the Y offset, the text also changes position… Can you help?

    • Galv says:

      The text should not change position if you change the IMAGE_Y setting (or use the y offset in the script call). It should only affect the position of the background image.

  20. Hi Galv, sorry to bother you, but i’ve got a weird issue with this script. When i use this combined with Killozapit – Cache Back (Found on the menu’s one) my image goes trasparent. Like this: http://puu.sh/kcuNv/6a51f0f735.jpg
    I think the script clean the image, and since i don’t get how it works, here i am. Do you know what the problem could be?

  21. Wisteria Rosewood says:

    Greetings Galv , pardom me if it has been already asked but I noticed that this script wasn’t compatible with “Yanfly Engine Ace – Ace Message System v1.05” .
    Isn’t there any possible way to make it work ?
    If not , then nevermind , I shall be at least grateful for your amazing scripts .
    Have a good day !

    • Galv says:

      Try placing the plugins in a different order. For example, this plugin after Yanfly’s script.

      Not all functionality will be compatible but most should be.

  22. Kieran says:

    Hi Galv. I am very new to scripts, so I apologize if I’m being very nooby :P I put this scipt into the editor, changed the appropriate line to use my custom image but when I start the game is get this error;

    Script ‘Galv’s Message Background’ line 61: NameError occurred

    undefined method ‘create_back_bitmap’ for class ‘Window_Message’

    Any idea how to fix it? Thanks for the help.

    Kieran.

  23. Kieran Devine says:

    Ah, I must have skip it haha. Thanks anyway. I figured out a way around by exported the default images and editing it in photoshop.

    Sorry for the waste of time :p

    Thanks.

    Kiearn.

  24. spooky says:

    I tried using this script, but I was having issues that I just couldn’t seem to get around, so I tried downloading the demo. I opened it, and sure enough, it worked.

    I figured I’d try exporting the image you used for the example, uploading it into my own little test-game’s resource manager, and then just copy and paste the entire script without changing anything.
    … For some reason, I got the same error as I did before. Specifically with line 104, which someone else had an issue with, it seems.
    I placed the script below materials and above main, on a brand new, blank page. I also have your message bust system, and I actually tried placing it both above and below it, just in case I misunderstood which one was supposed to go on top. I have no other existing scripts. What the hell am doing wrong? I am in fact using Ace, by the way.

    • Galv says:

      Unfortunately with not enough info, I don’t know what you are doing wrong without having the project to examine. The only thing I can do is offer a checklist that you can try to error trap:
      https://galvs-scripts.com/errors-using-scripts/
      These are checks I would do to work out the issue. Particularly start a new game and check for script conflicts (which I just re-read you didn’t have any other scripts).

      The demo download on this page used an old version, I have updated it now to use the most recent version that you could also copy from this page.

      • spooky says:

        Thank you so much for the reply.

        Despite the fact that pretty much all I had done to my other project was import one walksprite, import one autotile, and a window to be used for other things like menus, the completely clean project did work out. Clearly something must be conflicting with it, then- but I haven’t the slightest clue what that could be.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s