New RPG Maker
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.


Forum traitant du logiciel RPG Maker tout en français ! Entraide, tutos, scripts, ressources, hébergement de vos projets RPG Maker 2000, 2003, XP et VX. Venez les présenter !
 
AccueilDernières imagesRechercherS'enregistrerConnexion
Le Deal du moment :
Boutique Nike : -25% dès 50€ sur TOUT le ...
Voir le deal

 

 [VX]Fenêtre nom du perso dans les messages

Aller en bas 
AuteurMessage
Naqqah
Administrateur
Administrateur
Naqqah


Masculin Nombre de messages : 844
Age : 28
Localisation : Parti manger un ours
Date d'inscription : 22/02/2009

[VX]Fenêtre nom du perso dans les messages Empty
MessageSujet: [VX]Fenêtre nom du perso dans les messages   [VX]Fenêtre nom du perso dans les messages EmptySam 13 Fév - 12:48

Auteur : Woratana

Fonction : Permet de mettre le nom du personnage (l'évènement) au dessus d'un message affiché à l'écran.

Image(s) : [VX]Fenêtre nom du perso dans les messages Message_name

Installation : Ouvrez l'éditeur de script ( F11 ). Créez en un nouveau au dessus de "Main" et collez le code ci-dessous.

Utilisation :
Mettez dans votre message :

\na[nom]

où "nom" est le nom du personnage. Par exemple :

\na[Samarium]

Code :

Code:
#==============================================================================
# ? [VX] ? Neo-Face System Advance {Version 3.1} + Name Box ?
#------------------------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Special Thanks: Mako, Rabu, Yatzumo
#------------------------------------------------------------------------------
# Released on: 20/02/2008
#
# +[Features in NFS Advance (a.k.a. Neo Face System 3)]+
#
# ? For Both Face Systems
# ? 2 Show Face Effects! You can use them together~
# ? [New!] Move Effect << Move Face from outside the screen to inside
# ? Fade Effect << Fade in Face Picture
#
# ? Easier to change face side! Just type \side[side you want] in message box
# (This change will change side for all the next messages until you change face side again)
# (You can still change by call script: $game_message.side = side you want)
#----------------------------------------------------------------------
# ? FACE SIDE [a.k.a. Face Mode :)]
# ? \side[-1] << Switch to NORMAL Face System show in RIGHT SIDE
# ? \side[0] << Switch to NORMAL Face System show in LEFT SIDE
# ? \side[1] << Switch to NEO-FACE System show in LEFT SIDE
# ? \side[2] << Switch to NEO-FACE System show in RIGHT SIDE
#---------------------------------------------------------------------
#
# ? For Neo Face System
# ? Auto arrange Face Position (You can use any size of face file!)
# ? Choose to use 1 or 8 face(s) per file
#
# ? For Normal Face System
# ? Show face in right side!
#
# ? For Name Box
# ? Edit your name box easily~
# ? Change color of name text in game by call script
# $game_message.color = [Red,Green,Blue]
# ? Add text after name, e.g. add ":" after name >>result>> "name:"
# ? Move name box to right side when showing face in right side
# ? Change name text's font/size, and can  make it bold and/or has outline
#
# ? Call Name box by type this in message box:
# \na[name you want] << e.g. \na[Worale]
#
# ? If you don't want to type same name every time, use this way:
# \nn[name you want] << e.g. \nn[Worale]
# This will show the name box repeatly unless you have \na[name] in that window,
# and it will show until you type \nn[] to clear the repeat name.
#
#-----------------------------------------------------------------------------
#==============================================================================

class Window_Base
  #---------------------------------
  # [START] SETUP SCRIPT PART
  #-------------------------------
 
  #------------------------------------------------
  # ** NEO-FACE / NORMAL FACE SYSTEM SETUP
  #----------------------------------------------
  DEFAULT_SIDE = 0 # Default Face Side when game start~
 
  FACE_X_PLUS = 0 # Move Face Horizontally (Left: -, Right: +)
  FACE_Y_PLUS = -112 # Move Face Vertically (Up: -, Down: +)
  TEXT_X_PLUS = 0 # Move Text Horizontally
  CHOICE_INPUT_X_PLUS = 10
  # Move Choices Text and Input Number Text Horizontally
 
  MOVE_TEXT = true#true # (true/false)
  # Move text to right side of face, when showing face in left side.
 
  #-------------------------------
  # ** NEO FACE SYSTEM
  #----------------------------
  EightFaces_File = false
  # For NeoFace System: Use 8 Faces per file (or) 1 Face per file (true/false)
 
  #-------------------------------------
  # **SHOW FACE EFFECT
  # * For both Face Systems *
  #----------------------------------
  FADE_EFFECT = true # Turn on/off fade effect (true/false)
  FADE_SPEED = 20 # Speed up face's fade effect by increase this number
 
  MOVE_EFFECT = true # Turn on/off "move in" effect (true/false)
  MOVE_SPEED = 10 # Speed up face's "move in" effect by increase this number
 
  #------------------------------------
  # ** NAME BOX / NAME TEXT SETUP
  #----------------------------------
  NAMEBOX_SKIN = "Window" # Windowskin of Name Box (In folder 'Graphics/System')
  NAMEBOX_OPACITY = 255 # Name Box Opacity (Lowest 0 - 255 Highest)
  NAMEBOX_BACK_OPACITY = 180 # Name Box Background Opacity
 
  NAMEBOX_X_PLUS = 115#20 # Move Name Box & Text Horizontally (both faces system)
  NAMEBOX_X_PLUS_NF = 140 # Addtional Name Box X only for NeoFace Name Box
  # When using NeoFace, X Plus will calculate by: NAMEBOX_X_PLUS + NAMEBOX_X_PLUS_NF
  NAMEBOX_Y_PLUS = 0 # Move Name Box & Text Vertically
 
  NAMEBOX_TEXT_LENGTH_PER_LETTER = 10 # Length of Text Per Letter (in pixel)
  NAMEBOX_TEXT_FONT = "UmePlus Gothic" # Name Text Font's Name
  NAMEBOX_TEXT_SIZE = 22 # Name Text Font's Size
  NAMEBOX_TEXT_HEIGHT_PLUS = 2 # Increase Name Text Height (For Big Size Text)

  NAMEBOX_TEXT_BOLD = false # Make Text in Name Box Bold
  NAMEBOX_TEXT_OUTLINE = false # Make Black Outline around Text (Good with Opacity = 0)
  NAMEBOX_TEXT_DEFAULT_COLOR = [173,216,230]#[255,255,255] # [Red,Green,Blue]: Name Text Color (RGB)
  # You can easily find color code for RGB (RedGreenBlue) color in Google :)
  # You are allow to change color in game by call script:
  # $game_message.color = [Red,Green,Blue]
 
  NAMEBOX_TEXT_AFTER_NAME = ":" # Add Text after Name, leave "" to disable.
 
  NAMEBOX_BOX_WIDTH_PLUS = 6 # Increase Name Box Width
  NAMEBOX_BOX_HEIGHT_PLUS = 7 # Increase Name Box Height
 
  MOVE_NAMEBOX = true
  # (true/false) Move Text Box to Right Side if showing Face in Right side.
 
  #---------------------------------
  # [END] SETUP SCRIPT PART
  #-------------------------------
end
  $worale = {} if $worale == nil
  $worale["NeoFace"] = true
#==============================================================================
# Window_Message
#------------------------------------------------------------------------------
#==============================================================================
class Window_Message
    alias msg_ini initialize
 
    #------------------------------------
    # EDITED FROM ORIGINAL METHODS
    #----------------------------------
    def initialize
      msg_ini
      @face = Sprite.new
      @face.z = self.z + 5
      @nametxt = Sprite.new
      @nametxt.z = self.z + 15
      @namebox = nil
      @ori_x = 0
      @name_text = nil
    end
 
    alias msg_conspecha convert_special_characters
    def convert_special_characters
    clear_namebox if @namebox != nil
    msg_conspecha
   
    # CHECK FOR CALL NAME BOX/ CALL REPEAT NAME BOX/ CHANGE SIDE
    @text.scan(/\\na\[(.*?)\]/)
    if $1.to_s != ""
      @name_text = $1.to_s
      @text.sub!(/\\na\[(.*?)\]/) {}
    end
 
    @text.gsub!(/\\nn\[(.*?)\]/) do
      $game_message._name = $1.to_s
      a = ""
    end
 
    @text.scan(/\\side\[([-,0-9]+)\]/)
    if $1.to_s != ""
      $game_message.side = $1.to_i
      @text.sub!(/\\side\[([-,0-9]+)\]/) {}
    end
 
    @name_text = $game_message._name if @name_text == nil and $game_message._name != ""
    end
 
    def new_page
    contents.clear
    if @face.bitmap != nil
    @face.bitmap.dispose
    end
    if $game_message.face_name.empty?
    @contents_x = TEXT_X_PLUS
    else
      name = $game_message.face_name
      index = $game_message.face_index
      # CALL DRAW FACE METHOD
      draw_face2(name, self.x, self.y, index)
      # CHECK FOR MOVE EFFECT
      if MOVE_EFFECT == true
        @ori_x = @face.x
        if $game_message.side == 0 or $game_message.side == 1
          @face.x = 0 - @face.width
        else
          @face.x = 416 + @face.width
        end
      end
      @contents_x = get_x_face
    end
    @contents_y = 0
    @line_count = 0
    @show_fast = false
    @line_show_fast = false
    @pause_skip = false
    contents.font.color = text_color(0)
  end

  def start_message
    @text = ""
    for i in 0...$game_message.texts.size
      @text += "" if i >= $game_message.choice_start
      @text += $game_message.texts[i].clone + "\x00"
    end
    @item_max = $game_message.choice_max
    convert_special_characters
    reset_window
    new_page
  end
 
  def new_line
    if $game_message.face_name.empty? or MOVE_TEXT == false
      @contents_x = TEXT_X_PLUS
    else
      @contents_x = get_x_face
    end
    @contents_x += CHOICE_INPUT_X_PLUS if $game_message.choice_max > 0
    @contents_y += WLH
    @line_count += 1
    @line_show_fast = false
  end
 
  def update
    super
    if @name_text != nil
      draw_name(@name_text,self.x,self.y)
    end
    update_gold_window
    update_number_input_window
    update_back_sprite
    update_show_fast
    if @face.bitmap != nil
      # UPDATE FADE IN EFFECT
      if @face.opacity < 255
        @face.opacity += FADE_SPEED
      end
      # UPDATE MOVE IN EFFECT
      if MOVE_EFFECT == true and @ori_x != @face.x
        if (@ori_x > @face.x and @face.x + MOVE_SPEED < @ori_x) or (@ori_x < @face.x and @face.x - MOVE_SPEED > @ori_x)
          @face.x += MOVE_SPEED if @ori_x > @face.x
          @face.x -= MOVE_SPEED if @ori_x < @face.x
        else
          @face.x = @ori_x
        end
      end
    end
    unless @opening or @closing
      if @wait_count > 0
        @wait_count -= 1
      elsif self.pause
        input_pause
      elsif self.active
        input_choice
      elsif @number_input_window.visible
        input_number
      elsif @text != nil
        update_message
      elsif continue?
        start_message
        open
        $game_message.visible = true
      else
        close
        if @face.bitmap != nil
        @face.bitmap.dispose
        end
        clear_namebox if @namebox != nil
        $game_message.visible = @closing
      end
    end
  end
 
    def start_number_input
    digits_max = $game_message.num_input_digits_max
    number = $game_variables[$game_message.num_input_variable_id]
    @number_input_window.digits_max = digits_max
    @number_input_window.number = number
    if $game_message.face_name.empty? or MOVE_TEXT == false
      @number_input_window.x = x - 23
    else
      case $game_message.side
      when 0
        @number_input_window.x = (x + 112) - 23
      when 1
        @number_input_window.x = (x + text_x) - 23
      when 2
        @number_input_window.x = x - 23
      when -1
        @number_input_window.x = x - 23
      end
    end
    @number_input_window.x += CHOICE_INPUT_X_PLUS
    @number_input_window.y = y + @contents_y
    @number_input_window.active = true
    @number_input_window.visible = true
    @number_input_window.update
  end
 
  def update_cursor
    if @index >= 0
      if $game_message.face_name.empty?
      x = TEXT_X_PLUS
      else
      x = get_x_face
      end
      y = ($game_message.choice_start + @index) * WLH
      # CHANGE WIDTH OF CURSOR FOR CHOICE SELECT
      if $game_message.face_name.empty? or MOVE_TEXT == false
        facesize = x
      else
        facesize = get_x_face
        facesize += @face.width if $game_message.side == 2
        facesize += @face.width + 16 if $game_message.side == -1
      end
      self.cursor_rect.set(x, y, contents.width - facesize, WLH)
    else
      self.cursor_rect.empty
    end
  end
  #--------------------------------
  # ADDITIONAL METHODS
  #------------------------------
  # RETURN Text X-Coordinate, DEPENDS ON FACE SIDE
  def get_x_face
  if MOVE_TEXT == true
    case $game_message.side
    when 0
      return 112 + TEXT_X_PLUS
    when 1
      return text_x
    when 2
      return TEXT_X_PLUS
    else
      return TEXT_X_PLUS
    end
  else
    return TEXT_X_PLUS
  end
  end

  # RETURN Text X-Coordinate for Face Side = 1
  def text_x
    return @face.width + TEXT_X_PLUS
  end
 
  # Clear Name Box & Name Text
  def clear_namebox
    @nametxt.bitmap.dispose
    @namebox.dispose
    @namebox = nil
    @name_text = nil
  end
 
  #--------------------------------------
  # DRAW FACE [Both Systems] METHOD
  #------------------------------------
  def draw_face2(face_name, x, y, index = 0)
  if $game_message.side == 0 or $game_message.side == -1 or EightFaces_File == true
    # USE 8 FACES PER FILE
    bitmap = Cache.face(face_name)
    rect = Rect.new(0,0,0,0)
    rect.width = (bitmap.width / 4)
    rect.height = (bitmap.height / 2)
    rect.x = index % 4 * rect.width
    rect.y = index / 4 * rect.height
    @face.bitmap = Bitmap.new(rect.width,rect.height)
    @face.bitmap.blt(0,0,bitmap,rect)
    bitmap.dispose
  else
    # USE 1 FACES PER FILE
    @face.bitmap = Cache.face(face_name)
  end
  # SET X/Y OF FACE DEPENDS ON FACE SIDE
  if $game_message.side == 1
    @face.mirror = false
    @face.x = x + 6
    @face.y = y - (@face.height - 123)
  elsif $game_message.side == 2
    @face.mirror = true
    @face.x = x + (538 - @face.width)
    @face.y = y - (@face.height - 123)
  elsif $game_message.side == 0
    @face.mirror = false
    @face.x = x + 16
    @face.y = y + 16
  elsif $game_message.side == -1
    @face.mirror = true
    @face.x = self.contents.width - @face.width + 16
    @face.y = y + 16
  end
    @face.x += FACE_X_PLUS
    @face.y += FACE_Y_PLUS
    @face.opacity = 0 if FADE_EFFECT == true
  end
 
  #--------------------------------------
  # DRAW NAME BOX METHOD
  #-----------------------------------
  def draw_name(name,x,y)
    name = name + NAMEBOX_TEXT_AFTER_NAME
    namesize = calculate_name_size(name)
    @nametxt.bitmap = Bitmap.new(16 + (namesize * NAMEBOX_TEXT_LENGTH_PER_LETTER), 24 + NAMEBOX_TEXT_HEIGHT_PLUS)
    @nametxt.x = x + 8 + NAMEBOX_X_PLUS
    @nametxt.x += NAMEBOX_X_PLUS_NF if $game_message.side == 1 or $game_message.side == 2
    @nametxt.y = y - 20 + NAMEBOX_Y_PLUS
    @nametxt.x = 544 - @nametxt.x - @nametxt.width if MOVE_NAMEBOX == true and ($game_message.side == 2 or $game_message.side == -1)
    @namebox = Window.new
    @namebox.windowskin = Cache.system(NAMEBOX_SKIN)
    @namebox.z = self.z + 10
    @namebox.opacity = NAMEBOX_OPACITY
    @namebox.back_opacity = NAMEBOX_BACK_OPACITY
    @namebox.openness = 255
    @namebox.x = @nametxt.x - NAMEBOX_BOX_WIDTH_PLUS
    @namebox.y = @nametxt.y - NAMEBOX_BOX_HEIGHT_PLUS
    @namebox.width = @nametxt.bitmap.width + (NAMEBOX_BOX_WIDTH_PLUS * 2)
    @namebox.height = @nametxt.bitmap.height + (NAMEBOX_BOX_HEIGHT_PLUS * 2)
    @nametxt.bitmap.font.name = NAMEBOX_TEXT_FONT
    @nametxt.bitmap.font.size = NAMEBOX_TEXT_SIZE
    @nametxt.bitmap.font.bold = NAMEBOX_TEXT_BOLD
    if NAMEBOX_TEXT_OUTLINE == true
      # MAKE TEXT OUTLINE
      @nametxt.bitmap.font.color = Color.new(0,0,0)
      @nametxt.bitmap.draw_text(0,2,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
      @nametxt.bitmap.draw_text(0,0,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
      @nametxt.bitmap.draw_text(2,0,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
      @nametxt.bitmap.draw_text(2,2,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
    end
    @nametxt.bitmap.font.color = Color.new($game_message.color[0],$game_message.color[1],$game_message.color[2])
    @nametxt.bitmap.draw_text(1,1,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
    @name_text = nil
  end
 
  # CALCULATE REAL TEXT LENGTH (for Other Languages, e.g. Japanese)
  def calculate_name_size(name = "")
    name = name.scan(/./)
    return name.size
  end
 
end # Window_Message

#==============================================================================
# Game_Message: + store variables
#------------------------------------------------------------------------------
#==============================================================================
class Game_Message
  attr_accessor :side, :color, :_name
  alias wor_neoface_old_ini initialize
  def initialize
    @side = Window_Base::DEFAULT_SIDE
    @_name = ""
    @color = Window_Base::NAMEBOX_TEXT_DEFAULT_COLOR
    wor_neoface_old_ini
  end
end

#==============================================================================
# END Neo-Face System
# by Woratana (woratana@hotmail)
#=====================

Merci à RPG Creative
Revenir en haut Aller en bas
 
[VX]Fenêtre nom du perso dans les messages
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» [RMVX] Event dans BDD dans groupes
» [VX]Perso face border
» [RMXP]Script TVA dans les magasins

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
New RPG Maker :: Making :: Ressources :: Grand livre des ressources :: Partage de scripts :: Systèmes-
Sauter vers: