查看: 2728|回复: 2

[已经解决] 喵呜喵5的显示名字脚本和半身像对话框脚本冲突

[复制链接]
梦石
5
星屑
1843
在线时间
340 小时
注册时间
2014-4-1
回帖
211
发表于 2017-8-7 13:03:01 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 funxlww 于 2017-8-7 13:05 编辑

这个是图书馆的半身像脚本[pre lang="ruby"]#encoding:utf-8
#==============================================================================
# ■ 半身像对话框 by LBQ
#------------------------------------------------------------------------------
#  一个简单的半身像对话框罢了= =
#------------------------------------------------------------------------------
# ■ 用法一览
#     1:如何将半身像应用到游戏中?
#       ——如果想要把一个脸图替换成半身像,则需要找到这个脸图的编号,比如说拉尔
#           夫,就是Actor1的编号0,之后去在Graphics/Busts这个文件夹里面拷贝一个
#           叫做Actor1_0的图像,这个图像会被当做半身像替换原有图像。
#==============================================================================
# 2013.8.25 => 修复存档不能Bug (感谢小刀
#==============================================================================
$imported ||= {}
$imported[:LBQ_Bust]=true

module LBQ
  module Bust
    FOLDER="Busts"
    SUB1=[/【/,    "\\c[1]【 "]
    SUB2=[/】/,    " 】\\c[0]"]

    TEXT_FOR_NEXT="[next]"
    TEXT_FOR_END ="[end]"

    INDENT=255 #半身像的缩进
  end
end

module Cache
  def self.busts(filename)
    load_bitmap("Graphics/#{LBQ::Bust::FOLDER}/", filename)
  end
end



class Sprite_Bust < Sprite_Base
  attr_accessor   :bust_graphics
  attr_accessor   :status

  def initialize(vp=nil)
    super(vp)
    @bust_graphics=nil
    @status=:nothing
  end

  def slide_in
    @status=:sliding_in
  end

  def slide_out
    @status=:sliding_out
    if $game_temp.do_not_slide_out
      @status=:slided_out
      set_pos
    end
  end




  def set_pos(slide_in=true)
    self.x=0 - self.bitmap.width
    self.y=Graphics.height-self.bitmap.height

    self.x=0 unless slide_in
  end


  def set_graphics(bust_graphics)
    self.bitmap=Cache.busts(bust_graphics)
  end



  def update
    super
    case @status
    when :nothing
      # Do Nothing
    when :sliding_in
      #Slide In
      self.x+=12
      if self.x>=0
        self.x=0
        @status=:slided_in
      end

    when :sliding_out
      self.x-=12
      if self.x<= -self.bitmap.width
        self.x= -self.bitmap.width
        @status=:slided_out
      end
      #Slide Out
    when :slided_in
      #Slided in
    when :slided_out
      #Sliede out
    end

  end


end



class Game_Temp
  attr_accessor   :bust_name
  attr_accessor   :bust
  attr_accessor   :have_bust
  attr_accessor   :do_not_slide_out

  alias lbq_bust_shot_game_message_init initialize
  def initialize
    lbq_bust_shot_game_message_init
    @bust_name=""
    @bust=nil
    @have_bust=false
    @do_not_slide_out=false
  end




end

class Game_Message
   #--------------------------------------------------------------------------
  # ● 添加内容
  #--------------------------------------------------------------------------
  def add(text)
    new_text=text.gsub(LBQ::Bust::SUB1[0],LBQ::Bust::SUB1[1])
    new_text2=new_text.gsub(LBQ::Bust::SUB2[0],LBQ::Bust::SUB2[1])
    if new_text2.include? LBQ::Bust::TEXT_FOR_NEXT
      new_text2.delete!(LBQ::Bust::TEXT_FOR_NEXT)
      $game_temp.do_not_slide_out=true
    end

    if new_text2.include? LBQ::Bust::TEXT_FOR_END
      new_text2.delete!(LBQ::Bust::TEXT_FOR_END)
      $game_temp.do_not_slide_out=false
    end
    @texts.push(new_text2)
  end
end


class Game_Interpreter
  alias lbq_bust_shot_command_101 command_101
  #--------------------------------------------------------------------------
  # ● 显示文字
  #--------------------------------------------------------------------------
  def command_101
    $game_temp.bust=nil
      unless @params[0].empty?
        if File.exist?("Graphics/#{LBQ::Bust::FOLDER}/#{@params[0]}_#{@params[1]}.png")
          $game_temp.have_bust=true
        else
          $game_temp.have_bust=false
          $game_temp.bust_name=""
        end
      end

    unless @params[3] == 2
      $game_temp.have_bust=false
    end

    if $game_temp.have_bust
      $game_temp.bust_name="#{@params[0]}_#{@params[1]}"
      $game_temp.bust=nil
      $game_temp.bust=Sprite_Bust.new
      $game_temp.bust.set_graphics($game_temp.bust_name)
      $game_temp.bust.z=99999
      unless $game_temp.do_not_slide_out
        $game_temp.bust.set_pos
        $game_temp.bust.slide_in
      else
        $game_temp.bust.set_pos(false)
        $game_temp.bust.slide_in
      end
    end

    lbq_bust_shot_command_101
    if $game_temp.have_bust
        $game_temp.bust.slide_out
        Fiber.yield until $game_temp.bust.status==:slided_out
    end
    $game_temp.have_bust=false
    $game_temp.bust_name=""

  end


  alias lbq_bust_int_update update
  def update
    lbq_bust_int_update
    $game_temp.bust.update unless $game_temp.bust.nil?
  end

end


class Window_Message
  #--------------------------------------------------------------------------
  # ● 获取换行位置
  #--------------------------------------------------------------------------
  def new_line_x
    # 如果有头像
    unless $game_message.face_name.empty?
      value=112
      value=LBQ::Bust::INDENT unless $game_temp.bust_name.empty?
    # 木有
    else
      value=0
    end
    return value
  end
end


class Window_Message
  #--------------------------------------------------------------------------
  # ● 翻页处理
  #--------------------------------------------------------------------------
  def new_page(text, pos)
    contents.clear
    draw_face($game_message.face_name, $game_message.face_index, 0, 0) if $game_temp.bust_name.empty?
    reset_font_settings
    pos[:x] = new_line_x
    pos[:y] = 0
    pos[:new_x] = new_line_x
    pos[:height] = calc_line_height(text)
    clear_flags
  end
end[/pre]

这个是喵呜喵5的显示名字脚本[pre lang="ruby"]=begin
===============================================================================
  对话显示姓名 By喵呜喵5
===============================================================================

【说明】

  通过在对话开头加入

    \name[姓名]

  可以在对话中显示姓名
  
  ( \name[姓名] 的后面不需要换行,另外,请注意对话框高度太小时系统会强制翻页)

=end
$m5script ||= {};$m5script[:M5Name20141004] = 20150627
module M5Name20141004
#==============================================================================
#  设定部分
#==============================================================================

  FONT = ["黑体"]

  # 姓名所使用的字体

  SIZE = 18
  
  # 姓名字体的大小
  
  VOCAB = "【%s】:"
  
  # 姓名的显示方式,%s 表示姓名的文字,
  # 例如,默认的设置下,“\name[埃里克]”将在游戏中显示为“【埃里克】:”
  # 不需要的话,直接填写一个 %s 就好

  COLOR = Color.new(0,0,0,255)

  # 姓名的颜色,四个数值分别是R、G、B以及透明度

  SET = [false,false,false,true]

  # 中括号中以逗号分隔开的单词分别设置姓名是否加粗、斜体、有阴影、加边框
  # 需要的话填写true,不需要的话填写false

  OUT_COLOR = Color.new(255, 255, 255, 0)

  # 姓名边框的颜色,四个数值分别是R、G、B以及透明度

  ALIGN =  0

  # 姓名的对齐方式,0,1,2分别是居左、居中、居右

  NAME_X = 0

  # 姓名的X坐标,数值越大姓名位置越靠近屏幕右侧

  NAME_Y = 3

  # 姓名的Y坐标,数值越大姓名位置越靠近屏幕底部

  DISTANCE = 10

  # 对话与姓名的间距,数字越大间距越大

  BACK_Y = 0

  # 姓名背景的Y坐标,数值越大姓名位置越靠近屏幕底部

  BACK_HEIGHT = 6

  # 姓名背景的高度,数字越大高度越大

  COLOR1 = Color.new(255, 255, 255, 200)

  # 姓名的背景框左边的颜色,四个数值分别是R、G、B以及透明度

  COLOR2 = Color.new(255, 255, 255, 0)

  # 姓名的背景框右边的颜色,四个数值分别是R、G、B以及透明度
  # 不需要背景的话,两个颜色的透明度都填0就好了

#==============================================================================
#  设定结束
#==============================================================================
end
class Window_Message
  alias m5_20141004_convert_escape_characters convert_escape_characters
  def convert_escape_characters *arg
    @m5_name_20150304 = nil
    result = m5_20141004_convert_escape_characters *arg
    result.gsub!(/\eNAME\[(.+?)\]/i) { @m5_name_20150304 = $1; "" }
    result
  end
  alias m5_20141004_draw_face draw_face
  def draw_face *arg
    if @m5_name_20150304
      set = M5Name20141004      
      
      temp = Bitmap.new(self.width, self.height)
      temp.font.name = set::FONT
      temp.font.size = set::SIZE
      temp.font.color = set::COLOR
      temp.font.out_color = set::OUT_COLOR
      temp.font.bold = set::SET[0]
      temp.font.italic = set::SET[1]
      temp.font.shadow = set::SET[2]
      temp.font.outline = set::SET[3]
      
      @m5_name_20150304 = sprintf(set::VOCAB, @m5_name_20150304)
      name_height = temp.text_size(@m5_name_20150304).height      
      temp.draw_text(0, 0, temp.width - new_line_x, name_height,
        @m5_name_20150304, set::ALIGN)
      contents.gradient_fill_rect(0, set::BACK_Y,
        self.width, name_height + set::BACK_HEIGHT, set::COLOR1, set::COLOR2)
      contents.blt(new_line_x + set::NAME_X, set::NAME_Y, temp, temp.rect)
      
      temp.dispose
      @m5_name_20150304 = name_height
    end
    m5_20141004_draw_face *arg
  end
  alias m5_20141004_new_page new_page
  def new_page(text, pos)
    m5_20141004_new_page(text, pos)
    if @m5_name_20150304
      pos[:y] += @m5_name_20150304 + M5Name20141004::DISTANCE
      @m5_name_20150304 = nil
    end
  end
end[/pre]
冲突提示: QQ截图20170807130332.png QQ截图20170807130355.png

梦石
1
星屑
23236
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 2017-8-7 13:58:14 | 显示全部楼层
更新了脚本,你看看是否还有问题
https://rpg.blue/home.php?mod=sp ... o=blog&id=11733

点评

可用!谢谢  发表于 2017-8-7 14:36
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部