查看: 2774|回复: 2

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

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

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

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

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

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

  17. module LBQ
  18.   module Bust
  19.     FOLDER="Busts"
  20.     SUB1=[/【/,    "\\c[1]【 "]
  21.     SUB2=[/】/,    " 】\\c[0]"]

  22.     TEXT_FOR_NEXT="[next]"
  23.     TEXT_FOR_END ="[end]"

  24.     INDENT=255 #半身像的缩进
  25.   end
  26. end

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



  32. class Sprite_Bust < Sprite_Base
  33.   attr_accessor   :bust_graphics
  34.   attr_accessor   :status

  35.   def initialize(vp=nil)
  36.     super(vp)
  37.     @bust_graphics=nil
  38.     @status=:nothing
  39.   end

  40.   def slide_in
  41.     @status=:sliding_in
  42.   end

  43.   def slide_out
  44.     @status=:sliding_out
  45.     if $game_temp.do_not_slide_out
  46.       @status=:slided_out
  47.       set_pos
  48.     end
  49.   end




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

  53.     self.x=0 unless slide_in
  54.   end


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



  58.   def update
  59.     super
  60.     case @status
  61.     when :nothing
  62.       # Do Nothing
  63.     when :sliding_in
  64.       #Slide In
  65.       self.x+=12
  66.       if self.x>=0
  67.         self.x=0
  68.         @status=:slided_in
  69.       end

  70.     when :sliding_out
  71.       self.x-=12
  72.       if self.x<= -self.bitmap.width
  73.         self.x= -self.bitmap.width
  74.         @status=:slided_out
  75.       end
  76.       #Slide Out
  77.     when :slided_in
  78.       #Slided in
  79.     when :slided_out
  80.       #Sliede out
  81.     end

  82.   end


  83. end



  84. class Game_Temp
  85.   attr_accessor   :bust_name
  86.   attr_accessor   :bust
  87.   attr_accessor   :have_bust
  88.   attr_accessor   :do_not_slide_out

  89.   alias lbq_bust_shot_game_message_init initialize
  90.   def initialize
  91.     lbq_bust_shot_game_message_init
  92.     @bust_name=""
  93.     @bust=nil
  94.     @have_bust=false
  95.     @do_not_slide_out=false
  96.   end




  97. end

  98. class Game_Message
  99.    #--------------------------------------------------------------------------
  100.   # ● 添加内容
  101.   #--------------------------------------------------------------------------
  102.   def add(text)
  103.     new_text=text.gsub(LBQ::Bust::SUB1[0],LBQ::Bust::SUB1[1])
  104.     new_text2=new_text.gsub(LBQ::Bust::SUB2[0],LBQ::Bust::SUB2[1])
  105.     if new_text2.include? LBQ::Bust::TEXT_FOR_NEXT
  106.       new_text2.delete!(LBQ::Bust::TEXT_FOR_NEXT)
  107.       $game_temp.do_not_slide_out=true
  108.     end

  109.     if new_text2.include? LBQ::Bust::TEXT_FOR_END
  110.       new_text2.delete!(LBQ::Bust::TEXT_FOR_END)
  111.       $game_temp.do_not_slide_out=false
  112.     end
  113.     @texts.push(new_text2)
  114.   end
  115. end


  116. class Game_Interpreter
  117.   alias lbq_bust_shot_command_101 command_101
  118.   #--------------------------------------------------------------------------
  119.   # ● 显示文字
  120.   #--------------------------------------------------------------------------
  121.   def command_101
  122.     $game_temp.bust=nil
  123.       unless @params[0].empty?
  124.         if File.exist?("Graphics/#{LBQ::Bust::FOLDER}/#{@params[0]}_#{@params[1]}.png")
  125.           $game_temp.have_bust=true
  126.         else
  127.           $game_temp.have_bust=false
  128.           $game_temp.bust_name=""
  129.         end
  130.       end

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

  134.     if $game_temp.have_bust
  135.       $game_temp.bust_name="#{@params[0]}_#{@params[1]}"
  136.       $game_temp.bust=nil
  137.       $game_temp.bust=Sprite_Bust.new
  138.       $game_temp.bust.set_graphics($game_temp.bust_name)
  139.       $game_temp.bust.z=99999
  140.       unless $game_temp.do_not_slide_out
  141.         $game_temp.bust.set_pos
  142.         $game_temp.bust.slide_in
  143.       else
  144.         $game_temp.bust.set_pos(false)
  145.         $game_temp.bust.slide_in
  146.       end
  147.     end

  148.     lbq_bust_shot_command_101
  149.     if $game_temp.have_bust
  150.         $game_temp.bust.slide_out
  151.         Fiber.yield until $game_temp.bust.status==:slided_out
  152.     end
  153.     $game_temp.have_bust=false
  154.     $game_temp.bust_name=""

  155.   end


  156.   alias lbq_bust_int_update update
  157.   def update
  158.     lbq_bust_int_update
  159.     $game_temp.bust.update unless $game_temp.bust.nil?
  160.   end

  161. end


  162. class Window_Message
  163.   #--------------------------------------------------------------------------
  164.   # ● 获取换行位置
  165.   #--------------------------------------------------------------------------
  166.   def new_line_x
  167.     # 如果有头像
  168.     unless $game_message.face_name.empty?
  169.       value=112
  170.       value=LBQ::Bust::INDENT unless $game_temp.bust_name.empty?
  171.     # 木有
  172.     else
  173.       value=0
  174.     end
  175.     return value
  176.   end
  177. end


  178. class Window_Message
  179.   #--------------------------------------------------------------------------
  180.   # ● 翻页处理
  181.   #--------------------------------------------------------------------------
  182.   def new_page(text, pos)
  183.     contents.clear
  184.     draw_face($game_message.face_name, $game_message.face_index, 0, 0) if $game_temp.bust_name.empty?
  185.     reset_font_settings
  186.     pos[:x] = new_line_x
  187.     pos[:y] = 0
  188.     pos[:new_x] = new_line_x
  189.     pos[:height] = calc_line_height(text)
  190.     clear_flags
  191.   end
  192. end
复制代码


这个是喵呜喵5的显示名字脚本
  1. =begin
  2. ===============================================================================
  3.   对话显示姓名 By喵呜喵5
  4. ===============================================================================

  5. 【说明】

  6.   通过在对话开头加入

  7.     \name[姓名]

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

  11. =end
  12. $m5script ||= {};$m5script[:M5Name20141004] = 20150627
  13. module M5Name20141004
  14. #==============================================================================
  15. #  设定部分
  16. #==============================================================================

  17.   FONT = ["黑体"]

  18.   # 姓名所使用的字体

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

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

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

  30.   SET = [false,false,false,true]

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

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

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

  35.   ALIGN =  0

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

  37.   NAME_X = 0

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

  39.   NAME_Y = 3

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

  41.   DISTANCE = 10

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

  43.   BACK_Y = 0

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

  45.   BACK_HEIGHT = 6

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

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

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

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

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

  52. #==============================================================================
  53. #  设定结束
  54. #==============================================================================
  55. end
  56. class Window_Message
  57.   alias m5_20141004_convert_escape_characters convert_escape_characters
  58.   def convert_escape_characters *arg
  59.     @m5_name_20150304 = nil
  60.     result = m5_20141004_convert_escape_characters *arg
  61.     result.gsub!(/\eNAME\[(.+?)\]/i) { @m5_name_20150304 = $1; "" }
  62.     result
  63.   end
  64.   alias m5_20141004_draw_face draw_face
  65.   def draw_face *arg
  66.     if @m5_name_20150304
  67.       set = M5Name20141004      
  68.       
  69.       temp = Bitmap.new(self.width, self.height)
  70.       temp.font.name = set::FONT
  71.       temp.font.size = set::SIZE
  72.       temp.font.color = set::COLOR
  73.       temp.font.out_color = set::OUT_COLOR
  74.       temp.font.bold = set::SET[0]
  75.       temp.font.italic = set::SET[1]
  76.       temp.font.shadow = set::SET[2]
  77.       temp.font.outline = set::SET[3]
  78.       
  79.       @m5_name_20150304 = sprintf(set::VOCAB, @m5_name_20150304)
  80.       name_height = temp.text_size(@m5_name_20150304).height      
  81.       temp.draw_text(0, 0, temp.width - new_line_x, name_height,
  82.         @m5_name_20150304, set::ALIGN)
  83.       contents.gradient_fill_rect(0, set::BACK_Y,
  84.         self.width, name_height + set::BACK_HEIGHT, set::COLOR1, set::COLOR2)
  85.       contents.blt(new_line_x + set::NAME_X, set::NAME_Y, temp, temp.rect)
  86.       
  87.       temp.dispose
  88.       @m5_name_20150304 = name_height
  89.     end
  90.     m5_20141004_draw_face *arg
  91.   end
  92.   alias m5_20141004_new_page new_page
  93.   def new_page(text, pos)
  94.     m5_20141004_new_page(text, pos)
  95.     if @m5_name_20150304
  96.       pos[:y] += @m5_name_20150304 + M5Name20141004::DISTANCE
  97.       @m5_name_20150304 = nil
  98.     end
  99.   end
  100. end
复制代码

冲突提示: QQ截图20170807130332.png QQ截图20170807130355.png

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 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.

在本版发帖返回顶部