Message EX

24 de setembro de 2013

Message EX é um script para o RPG Maker XP desenvolvido por XRXS que ativa novas funcionalidades relativas as mensagens em um projeto/game desenvolvido nesta ferramenta.

A instalação do script é simples, só precisando de adicionar o módulo Modulo XRXS (vem no minigame para download), os comentários estão em português (que ensinam para que servem cada função nova para personalizar e modificar as mensagens) e é de simples instalação. Para tal, basta instalar o código abaixo, em cima do Main:

#################################################################
########################## XRXS #################################
#################################################################
=begin
                        MODULO XRXS
Scripts necessários para rodar alguns scripts do site XRXS.

L4  - built 122410 - Window Selectable
L5  - built 091221 - Elemment %
L6  - built 092308 - Elemment Set
L7  - built ?????? - Window Command
L10 - built ?????? - Window Selectable
L13 - built ?????? - Map Name
L14 - built 122012 - Sprite and Picture
                                                  (05/01/06)
=end

module XRXS_Cursor2
  def initialize(x, y, w, h)
    super(x, y, w, h)
    @xrxsc2_window = Window_Selectable.new(self.x, self.y, self.width, self.height)
    @xrxsc2_window.opacity = 0
    @xrxsc2_window.active = false
    @xrxsc2_window.index = -1
  end
  def index2
    return @xrxsc2_window.index
  end
  def index2=(index)
    @xrxsc2_window.index = index
    if index == -1
      @xrxsc2_window.cursor_rect.empty
    else
      @xrxsc2_window.x = self.x
      @xrxsc2_window.y = self.y
      @xrxsc2_window.cursor_rect = self.cursor_rect
    end
  end
  def top_row=(row)
    super
    pre_oy = @xrxsc2_window.oy
    @xrxsc2_window.oy = self.oy
    @xrxsc2_window.cursor_rect.y -= self.oy - pre_oy
  end
  def dispose
    @xrxsc2_window.dispose
    super
  end
  def x=(n)
    super
    @xrxsc2_window.x = self.x unless @xrxsc2_window.nil?
  end
  def y=(n)
    super
    @xrxsc2_window.y = self.y unless @xrxsc2_window.nil?
  end
  def visible=(b)
    @xrxsc2_window.visible = b
    super
  end
end
######
# L5 #
######
module XRXS
  def XRXS.element_check(set, element_name)
    returnar = [false, 0, 0, []]
    return returnar if !set.is_a?(Array) or set.size == 0 or element_name == ""
    for i in set
      if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
        returnar[0] = true
        if $2 == nil
          returnar[1] += $1.to_i
          returnar[3].push($1.to_i)
        else
          returnar[2] += $1.to_i
        end
      end
    end
    return returnar
  end
  def XRXS.element_include?(set, element_name)
    return element_check(set, element_name)[0]
  end
  def XRXS.element_amount(set, element_name)
    return element_check(set, element_name)[1]
  end
  def XRXS.element_percent(set, element_name)
    return element_check(set, element_name)[2]
  end
  def XRXS.element_numbers(set, element_name)
    return element_check(set, element_name)[3]
  end
end
######
# L6 #
######
class Game_Battler
  def skill_element_set(skill)
    return skill.nil? ? [] : skill.element_set
  end
  def equip_element_set
    return self.element_set + self.guard_element_set
  end
  def guard_element_set
    return []
  end
end
class Game_Actor < Game_Battler
  def guard_element_set
    set = []
    for id in self.armor_ids
      next if id.nil?
      armor = $data_armors[id]
      set += (armor != nil ? armor.guard_element_set : [])
    end
    return set
  end
  def weapon_ids
    unless self.is_a?(Game_Actor)
      return []
    end
    ids    = @weapon_ids != nil ? @weapon_ids : []
    ids[0] = @weapon_id
    return ids
  end
  def armor_ids
    unless self.is_a?(Game_Actor)
      return []
    end
    ids    = @armor_ids != nil ? @armor_ids : []
    ids[0] = @armor1_id
    ids[1] = @armor2_id
    ids[2] = @armor3_id
    ids[3] = @armor4_id
    return ids
  end
  def equipments
    equipments = []
    self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
    self.armor_ids.each {|id| equipments.push($data_armors[id])}
    return equipments
  end
  def equiping?(item)
    case item
    when RPG::Weapon
      return self.weapon_ids.include?(item.id)
    when RPG::Armor
      return self.armor_ids.include?(item.id)
    else
      return false
    end   
  end
end
######
# L7 #
######
module XRXS_Window_Command
  def add_command(command)
    @disabled = [] if @disabled.nil?
    if @commands.size != @disabled.size
      for i in 0...@commands.size
        @disabled[i] = false
      end
    end
    @commands.push(command)
    @disabled.push(false)
    @item_max = @commands.size
    self.y -= 32
    self.height += 32
    self.contents.dispose
    self.contents = nil
    self.contents = Bitmap.new(self.width - 32, @item_max * 32)
    refresh
    for i in 0...@commands.size
      if @disabled[i]
        disable_item(i)
      end
    end
  end
  def disable_item(index)
    @disabled = [] if @disabled.nil?
    @disabled[index] = true
    draw_item(index, disabled_color)
  end
  def enable_item(index)
    @disabled = [] if @disabled.nil?
    @disabled[index] = false
    draw_item(index, normal_color)
  end
end
class Window_Command < Window_Selectable
  include XRXS_Window_Command
  def disable_item(index)
    super
  end
end
#######
# L1s0 #
#######
module Module_SelectableEX
  def line_height
    return 32
  end
  attr_accessor :align
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @item_max = 1
    @column_max = 1
    @index = -1
    @align = 0
  end
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, self.line_height * index, self.contents.width - 8, self.line_height)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], self.align)
  end
  def top_row
    return self.oy / self.line_height
  end
  def top_row=(row)
    super
    self.oy = self.oy/32 * self.line_height
  end
  def page_row_max
    return (self.height - 32) / self.line_height
  end
  def update_cursor_rect
    super
    unless @index < 0
      y = (self.cursor_rect.y + self.oy) * self.line_height/32 - self.oy
      self.cursor_rect.set(0, y, self.cursor_rect.width, self.line_height)
    end
  end
end
class Window_Command < Window_Selectable
  include Module_SelectableEX
  def line_height
    return 32
  end
  def initialize(width, commands)
    super(0, 0, width, commands.size * self.line_height + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * self.line_height)
    refresh
    self.index = 0
  end
  def draw_item(index, color)
    super
  end
end
#######
# L13 #
#######
class Game_Map
  def name
    $data_mapinfos = load_data("Data/MapInfos.rxdata") if $data_mapinfos.nil?
    $data_mapinfos[@map_id].name
  end
end
#######
# L14 #
#######
class Bitmap
  def draw_hemming_text(x, y, w, h, text, align = 0)
    original_color = self.font.color.dup
    self.font.color = Color.new(0,0,0,255)
    self.draw_text(x  , y  , w, h, text, align)
    self.draw_text(x  , y+2, w, h, text, align)
    self.draw_text(x+2, y+2, w, h, text, align)
    self.draw_text(x+2, y  , w, h, text, align)
    self.font.color = original_color
    self.draw_text(x+1, y+1, w, h, text, align)
  end
end
module RPG_FileTest
  def RPG_FileTest.character_exist?(filename)
    return RPG::Cache.character(filename, 0) rescue return false
  end
  def RPG_FileTest.picture_exist?(filename)
    return RPG::Cache.picture(filename) rescue return false
  end
  def RPG_FileTest.battler_exist?(filename)
    return RPG::Cache.battler(filename, 0) rescue return false
  end
end
class Sprite_Number < Sprite
  attr_reader  :w
  def initialize(font = Font.new)
    super()
    self.bitmap = Bitmap.new(1,1)
    self.bitmap.font = font
    max = s = 0
    for i in 0..9
      s = self.bitmap.text_size(i.to_s).width
      max = s if max < s
    end
    @w = max + 2
    @h = font.size + 2
    self.bitmap.dispose
    self.bitmap = Bitmap.new(@w, @h * 10)
    self.bitmap.font = font
    (0..9).each {|n| self.bitmap.draw_hemming_text(0, @h * n, @w, @h, n.to_s) }
    self.src_rect.height /= 10
  end
  def number=(n)
    self.src_rect.y = n * @h
  end
  def n=(n)
    self.number = n
  end
end
class Spriteset_Numbers
  attr_reader  :x
  attr_reader  :y
  attr_reader  :z
  attr_reader  :visible
  def initialize(font = Font.new)
    @font = font
    @numbers = []
    @x = 0
    @y = 0
    @z = 0
    @visible = true
  end
  def number=(n)
    @numbers.each{|number| number.n = 10 }
    d = (n == 0 ? 0 : Math.log10(n).to_i)
    for i in 0..d
      @numbers[i] = Sprite_Number.new(@font) if @numbers[i] == nil
      @numbers[i].n = n % 10
      @numbers[i].visible = true
      n /= 10
    end
    self.x = self.x
    self.y = self.y
    self.z = self.z
  end
  def n=(n)
    self.number=(n)
  end
  def x=(n)
    @x = n
    for i in 0...@numbers.size
      @numbers[i].x = n
      n -= @numbers[i].w
    end
  end
  def y=(n)
    @y = n
    @numbers.each{|sprite| sprite.y = @y }
  end
  def z=(n)
    @z = n
    @numbers.each{|sprite| sprite.z = @z }
  end
  def visible=(b)
    @visible = b
    @numbers.each{|sprite| sprite.visible = b }
  end
  def dispose
    @numbers.each{|sprite| sprite.dispose }
  end
end

Download e ficha técnica

  • Download (clique com o botão esquerdo do mouse ou toque no link).
  • Desenvolvedor, publisher e/ou distribuidor: XRXS
  • SO: Windows 98/98SE/Me/2000/XP/Vista/7
  • Tamanho: 1,21MB
  • Licença: Grátis
  • Categoria: Programação XP
  • Tag: RPG Maker XP
  • Adicionado por: LichKing
  • Acessos: 55

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!