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.

Letter by Letter Message Window

Very good script its basically simple enough to avoid major problems with other scripts but it still does the trick.
Just a question, i would like my face image to show directly on the left of the message.
I mean, i wanted to add a border to the image, but the border would fit the entire messagebox height... its a bit hard to explain but im adding an example of what id like it to be. The reddish part should be the face file, the rest is the windowskin.
Thank you very much in advance, hope its possible to do this.
 
Hope this works... :p
Replace this:
Code:
      self.width, self.height = 480, 160
with this:
Code:
      self.width, self.height = 480 - (temp.message_text[/\\[Ff]ace/] ? 160 : 0), 160

This:
Code:
      self.contents = Bitmap.new(448, 128)
with this:
Code:
      self.contents = Bitmap.new(width - 32, 128)

This:
Code:
    if @text[/\\[Ff]ace/]
      # Left
      if @text.sub!(/\\[Ff]ace{(.+?)}/, '')
        @face, face_name = 1, $1
      # Right
      elsif @text.sub!(/\\[Ff]ace\[(.+?)\]/, '')
        @face, face_name = 2, $1
      end
    end
with this:
Code:
    if @text.sub!(/\\[Ff]ace\[(.+?)\]/, '')
      picture = $1
    end

This:
Code:
      self.x = 320 - self.width / 2
with this:
Code:
      self.x = 320 - (self.width - (picture ? self.height : 0)) / 2

And this:
Code:
      @picture.x = self.x + self.width - @picture.bitmap.width
      @picture.y = self.y - @picture.bitmap.height
with this:
Code:
      @picture.x = self.x - self.height
      @picture.y = self.y
 
mmm it says
"Script 'Message System' line 235: NameError occurred.

undefined local variable or method 'face' for #<Window_Message:0x14ea6b0>

I have no idea of what's happening (im not a coder. i can do some stuff with the events on rpgmaker but ruby's gibberish for me) but it refers to a line that says
"if face" under the "refresh" part... Hope this can be fixed... thank you very much again!!!
 
Delete those lines, or something similar:
Code:
    if @face
      if @fit_size
        mh = system.height
        fh = system.face_rect.height
        lines = (fh.to_f / mh.to_f).ceil if (lines * mh) < fh
        f_x = @face == 2 ? 0 : @lines_size.max + 16
        f_y = (lines * mh) <= fh ? 0 : (lines * mh - fh) / 2
        @face_width = system.face_rect.width + 8
        @start_x += @face_width if @face == 2
        indent += @face_width - 4
      else
        f_x, f_y = @face == 2 ? 16 : 336, 16
        @face_width = system.face_rect.width + 36
        @start_x += @face_width if @face == 2
      end
      f_bitmap = RPG::Cache.load_bitmap(system.path, face_name)
    end
 
Ok what I was wondering is how can I make the name box display the Name ariable for actor 1...Which it doesnt matter which actor as long as I can display the actors current name in the Name Box...

This is just so I can use Enter Hero Name Function in my games...otherwise the game just wont have that player friendly look I was going for...
 
Just change the contant (EXT), but it isn't tested... so any error, please tell me :)
Code:
class Window_NameBox
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  EXT = 4   # <- play with this value
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, text)
    dumb = Bitmap.new(160, 42)
    dumb.font.name = system.font
    size = dumb.text_size(text).width
    dumb.dispose
    @back = Window_Base.new(x, y, size + 12 + EXT * 2, 32 + EXT * 2)
    skin = system.nb_skin ? system.nb_skin : $game_system.windowskin_name
    @back.windowskin = RPG::Cache.windowskin(skin)
    viewport = Viewport.new(x + 6 + EXT, y + 5 + EXT, size, 22)
    @back.z = viewport.z = 9999
    super(viewport)
    self.bitmap = Bitmap.new(size, 22)
    bitmap.font.name = system.font
    bitmap.draw_text(0, 0, size, 22, text)
  end
end
 

HoRe

Member

Hey Slipknot,
Loved the demo, though I couldn't seem to get back down the stairs... I've been going through scripting tutorials because I'm still 98% noob to XP, but just to make sure, the script you provided replaces the script in Main.... yes?....
 
@eypeon
It's because you're using a face graphic in addition to the text. I have this problem as well
using it with my project, but found a way around it.

To get it working, make the 2nd and 3rd lines of text only about as long as the text you
typed for the first line (just the message, not the modifiers like \face). There will be less
text this way per message box, but it won't get cut off and will line up better. (You won't
have that space after the first line either if you get the lines to be close to the same length).
 

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