查看: 3260|回复: 2

[已经解决] 半身像脚本的问题

[复制链接]

爪子

梦石
0
星屑
1678
在线时间
882 小时
注册时间
2014-8-28
回帖
1058
发表于 2015-5-21 09:00:02 | 显示全部楼层 |阅读模式

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

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

×
https://rpg.blue/forum.php?mod=viewthread&tid=318068
使用的这个脚本,
但是立绘只能显示在左边,我想做出两个人物对话的效果。怎么可以让半身像可以在右边显示呢?
显示图片的话会在对话框的后面,看着很不舒服。
QQ图片20150521085755.png
QQ图片20150521085810.png
请求帮助。
或者可以提供↓这个网站的脚本和范例也可以。(我下载不了
http://www.rpgmakervxace.net/topic/8756-message-busts/
个人坑《凝聚的祈愿》更新日记
网瘾少女的领域-Lofter
一时骂人一时爽,一直骂人一直爽^o^
梦石
0
星屑
108
在线时间
1006 小时
注册时间
2008-11-9
回帖
1633
发表于 2015-5-21 17:05:07 | 显示全部楼层
本帖最后由 判约之轮 于 2015-5-21 18:29 编辑

使用方法:主立绘和原脚本设置相同,如果要设置在右边显示,那么就打开$right_flag开关
从立绘需要在$target_face中设置文件名,如Actor4_5,不包括后缀名

注意:如果要把第二立绘关闭,一定要调用$target_face=""把它设回空字符串

修正完毕,直接覆盖
  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. $right_flag = false
  18. $target_face = ""

  19. module LBQ
  20.   module Bust
  21.     FOLDER="Busts"
  22.     SUB1=[/【/,    "\\{\\c[6]-- "]
  23.     SUB2=[/】/,    " --\\c[0]\\}"]

  24.     TEXT_FOR_NEXT="[next]"
  25.     TEXT_FOR_END ="[end]"

  26.     INDENT=255 #半身像的缩进
  27.   end
  28. end

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



  34. class Sprite_Bust < Sprite_Base
  35.   attr_accessor   :bust_graphics
  36.   attr_accessor   :status

  37.   def initialize(vp=nil)
  38.     super(vp)
  39.     @bust_graphics=nil
  40.     @status=:nothing
  41.     @right_flag = false
  42.   end

  43.   def slide_in
  44.     @status=:sliding_in
  45.   end

  46.   def slide_out
  47.     @status=:sliding_out
  48.     if $game_temp.do_not_slide_out
  49.       @status=:slided_out
  50.       set_pos
  51.     end
  52.   end

  53.   def set_pos(slide_in=true)
  54.     if @right_flag
  55.       self.x = Graphics.width
  56.     else
  57.       self.x = -self.bitmap.width
  58.     end
  59.     self.y=Graphics.height-self.bitmap.height
  60.     unless slide_in
  61.       if @right_flag
  62.         self.x = Graphics.width - self.bitmap.width
  63.       else
  64.         self.x = 0
  65.       end
  66.     end
  67.   end

  68.   def set_right
  69.     @right_flag = true
  70.   end

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



  74.   def update
  75.     super
  76.     case @status
  77.     when :nothing
  78.       # Do Nothing
  79.     when :sliding_in
  80.       #Slide In
  81.       if @right_flag
  82.         self.x-=12
  83.       else
  84.         self.x+=12
  85.       end
  86.       if ((self.x <= (Graphics.width - self.bitmap.width)) && @right_flag)
  87.         self.x = Graphics.width - self.bitmap.width
  88.         @status=:slided_in
  89.       elsif (self.x>=0 && !@right_flag)
  90.         self.x=0
  91.         @status=:slided_in
  92.       end

  93.     when :sliding_out
  94.       if @right_flag
  95.         self.x+=12
  96.       else
  97.         self.x-=12
  98.       end
  99.       if self.x >= Graphics.width && @right_flag
  100.         self.x = Graphics.width
  101.         @status=:slided_out
  102.       elsif self.x <= -self.bitmap.width && !@right_flag
  103.         self.x=-self.bitmap.width
  104.         @status=:slided_out
  105.       end
  106.       #Slide Out
  107.     when :slided_in
  108.       #Slided in
  109.     when :slided_out
  110.       #Sliede out
  111.     end
  112.   end


  113. end


  114. class Game_Temp
  115.   attr_accessor   :bust_name
  116.   attr_accessor   :bust
  117.   attr_accessor   :tarface
  118.   attr_accessor   :have_bust
  119.   attr_accessor   :do_not_slide_out

  120.   alias lbq_bust_shot_game_message_init initialize
  121.   def initialize
  122.     lbq_bust_shot_game_message_init
  123.     @bust_name=""
  124.     @bust=nil
  125.     @have_bust=false
  126.     @do_not_slide_out=false
  127.   end




  128. end

  129. class Game_Message
  130.    #--------------------------------------------------------------------------
  131.   # ● 添加内容
  132.   #--------------------------------------------------------------------------
  133.   def add(text)
  134.     new_text=text.gsub(LBQ::Bust::SUB1[0],LBQ::Bust::SUB1[1])
  135.     new_text2=new_text.gsub(LBQ::Bust::SUB2[0],LBQ::Bust::SUB2[1])
  136.     if new_text2.include? LBQ::Bust::TEXT_FOR_NEXT
  137.       new_text2.delete!(LBQ::Bust::TEXT_FOR_NEXT)
  138.       $game_temp.do_not_slide_out=true
  139.     end

  140.     if new_text2.include? LBQ::Bust::TEXT_FOR_END
  141.       new_text2.delete!(LBQ::Bust::TEXT_FOR_END)
  142.       $game_temp.do_not_slide_out=false
  143.     end
  144.     @texts.push(new_text2)
  145.   end
  146. end


  147. class Game_Interpreter
  148.   alias lbq_bust_shot_command_101 command_101
  149.   #--------------------------------------------------------------------------
  150.   # ● 显示文字
  151.   #--------------------------------------------------------------------------
  152.   def command_101
  153.     $game_temp.bust=nil
  154.       unless @params[0].empty?
  155.         if File.exist?("Graphics/#{LBQ::Bust::FOLDER}/#{@params[0]}_#{@params[1]}.png")
  156.           $game_temp.have_bust=true
  157.         else
  158.           $game_temp.have_bust=false
  159.           $game_temp.bust_name=""
  160.         end
  161.       end

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

  165.     if $game_temp.have_bust
  166.       $game_temp.bust_name="#{@params[0]}_#{@params[1]}"
  167.       $game_temp.bust=nil
  168.       $game_temp.bust=Sprite_Bust.new
  169.       $game_temp.bust.set_graphics($game_temp.bust_name)
  170.       $game_temp.bust.z=99999
  171.       
  172.       if $target_face != ""
  173.         if File.exist?("Graphics/#{LBQ::Bust::FOLDER}/#{$target_face}.png")
  174.           $game_temp.tarface = Sprite_Bust.new
  175.           $game_temp.tarface.bitmap = Cache.busts($target_face)
  176.           $game_temp.tarface.z=99999
  177.         end
  178.       end
  179.         
  180.       unless $game_temp.do_not_slide_out
  181.         $game_temp.bust.set_right if $right_flag
  182.         $game_temp.bust.set_pos
  183.         $game_temp.bust.slide_in
  184.         if $target_face != ""
  185.           $game_temp.tarface.set_right unless $right_flag
  186.           $game_temp.tarface.set_pos
  187.           $game_temp.tarface.slide_in
  188.         end
  189.       else
  190.         $game_temp.bust.set_right if $right_flag
  191.         $game_temp.bust.set_pos(false)
  192.         $game_temp.bust.slide_in
  193.         if $target_face != ""
  194.           $game_temp.tarface.set_right unless $right_flag
  195.           $game_temp.tarface.set_pos(false)
  196.           $game_temp.tarface.slide_in
  197.         end
  198.       end
  199.     end

  200.     lbq_bust_shot_command_101
  201.     if $game_temp.have_bust
  202.         $game_temp.bust.slide_out
  203.         Fiber.yield until $game_temp.bust.status==:slided_out
  204.         if $target_face != ""
  205.           $game_temp.tarface.slide_out
  206.           Fiber.yield until $game_temp.tarface.status==:slided_out
  207.         end
  208.     end
  209.     $game_temp.have_bust=false
  210.     $game_temp.bust_name=""

  211.   end


  212.   alias lbq_bust_int_update update
  213.   def update
  214.     lbq_bust_int_update
  215.     $game_temp.bust.update unless $game_temp.bust.nil?
  216.     if $target_face != ""
  217.       $game_temp.tarface.update unless $game_temp.tarface.nil?
  218.     end
  219.   end

  220. end


  221. class Window_Message
  222.   #--------------------------------------------------------------------------
  223.   # ● 获取换行位置
  224.   #--------------------------------------------------------------------------
  225.   def new_line_x
  226.     # 如果有头像
  227.     unless $game_message.face_name.empty?
  228.       value=112
  229.       value=LBQ::Bust::INDENT unless $game_temp.bust_name.empty?
  230.     # 木有
  231.     else
  232.       value=0
  233.     end
  234.     return value
  235.   end
  236. end


  237. class Window_Message
  238.   #--------------------------------------------------------------------------
  239.   # ● 翻页处理
  240.   #--------------------------------------------------------------------------
  241.   def new_page(text, pos)
  242.     contents.clear
  243.     draw_face($game_message.face_name, $game_message.face_index, 0, 0) if $game_temp.bust_name.empty?
  244.     reset_font_settings
  245.     if $right_flag && $target_face==""
  246.       pos[:x] = 0
  247.       pos[:new_x] = 0
  248.     else
  249.       pos[:x] = LBQ::Bust::INDENT  
  250.       pos[:new_x] = LBQ::Bust::INDENT
  251.     end
  252.     pos[:y] = 0
  253.     pos[:height] = calc_line_height(text)
  254.     clear_flags
  255.   end
  256. end
复制代码

点评

好的好的  发表于 2015-5-21 19:18
事件最后一页有脚本选项啊,比如在某一句对话前后分别加上$target_face="Actor4_5"和$target_face="",那么就只有这一句对话会显示第二张立绘  发表于 2015-5-21 19:11
_(:з」∠)_哦 对了 我突然想起来 我没看懂其实。  发表于 2015-5-21 19:07
谢谢!我去试试~  发表于 2015-5-21 19:06
更新提醒,这样的绘制方式再次涨姿势  发表于 2015-5-21 18:30

评分

参与人数 2星屑 +120 梦石 +1 收起 理由
VIPArcher + 1 认可答案
莫言别离 + 120 认可答案

查看全部评分

回复

使用道具 举报

爪子

梦石
0
星屑
1678
在线时间
882 小时
注册时间
2014-8-28
回帖
1058
 楼主| 发表于 2015-5-21 19:48:18 | 显示全部楼层
然而并不行。。
QQ图片20150521194818.png
木有了。。

点评

_(:з」∠)_好复杂 不弄啦。。我还是老老实实在左边显示吧。  发表于 2015-5-21 20:27
我个人觉得估计是没有找到文件,或者变量没有成功赋值闹的  发表于 2015-5-21 20:00
然而我还是修改一下范例工程传上来好了(远目):http://pan.baidu.com/s/1c0fdI3e  发表于 2015-5-21 19:59
这是用了二号立绘的。  发表于 2015-5-21 19:57
原先的立绘无法显示?还是?  发表于 2015-5-21 19:54
个人坑《凝聚的祈愿》更新日记
网瘾少女的领域-Lofter
一时骂人一时爽,一直骂人一直爽^o^
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部