设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1868|回复: 10
打印 上一主题 下一主题

[已经解决] 誰知道這腳本怎麼用?

[复制链接]

Lv2.观梦者

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
帖子
117
跳转到指定楼层
1
发表于 2016-12-1 19:16:59 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2016-12-1 19:26 编辑

誰知道這腳本怎麼用嗎?
腳本素材來源:http://pastebin.com/YAZUHmER
完全看不懂-_-||||
RUBY 代码复制
  1. module Lune_Message
  2. #=======================================================
  3. # Lune Message System
  4. # Author: Raizen
  5. # Compatible with: RMVXAce
  6. # The script allows message boxes above and below the
  7. # character, with automatic size making a more interatvice
  8. # message system between characters.
  9.  
  10.  
  11.  
  12. # Instructions
  13.  
  14. # To use the message just call the show message
  15. # either with a face or not.
  16.  
  17. # before showing the message configure the character that
  18. # will receive the message box.
  19. # Also configure if it is below or above the character.
  20.  
  21. # It is also possible to toggle between the new message system
  22. # and the old message system
  23.  
  24. # To configure the message system just do the following.
  25.  
  26. # Call Script:Lune_Message.config(p, id)
  27.  
  28. # Being p the position of the message box.
  29. # 1 = above the character
  30. # 0 = below the character
  31. # 2 = old message system
  32.  
  33. # To deactivate this script just
  34. # Call Script this way
  35. # Call Script:Lune_Message.config(2, 0)
  36. # Put a 1 frame wait before changing between the message systems,
  37. # to give the system the time to reconfigure all the positions back to
  38. # the old system, or from the old to the new system.
  39.  
  40. # ID is the event ID, being the ID 0 it is the Hero.
  41. # The windows size is configured automatically, being that you
  42. # will need to choose the length of the font to ajust better to the
  43. # message box. (In pixels)
  44.  
  45. Espacamento = 11
  46.  
  47. # Size of the characters that you are using, an estimate to calculate
  48. # the Boxes position.
  49.  
  50. Tamanho = 48
  51.  
  52. # Name of the picture file that will put a cursor above the character
  53. # which is talking.
  54. # In case you do not need any picture files put the constant this way.
  55. # Imagem = ""
  56. # The image needs to be in the file Graphics/System inside your project.
  57. Imagem = "arrow"
  58. # Height of the arrow image, for position displacement.
  59. Alt = 10
  60. # Movement of the arrow, 0 to deactivate.
  61. Mov = 0
  62. # ========================================================================
  63. # Here starts the script.
  64. # ========================================================================
  65.  
  66. def self.config(p, id)
  67. posicao(p)
  68. identificacao(id)
  69. end
  70.  
  71. def self.posicao(p = nil)
  72. @p = p unless p == nil
  73. return @p
  74. end
  75.  
  76. def self.identificacao(id = nil)
  77. @id = id unless id == nil
  78. return @id
  79. end
  80. end
  81.  
  82. #==============================================================================
  83. # ** Janela auxiliar
  84. #==============================================================================
  85. class Lune_Window_Message < Window_Base
  86. include Lune_Message
  87.   def initialize(x, y, window_width, window_height)
  88.     super(x, y, window_width, window_height)
  89.     self.z = 199
  90.     self.openness = 0
  91.     @get_sprite = true
  92.     @sprite_arrow = Sprite.new
  93.     @sprite_arrow.bitmap = Cache.system(Imagem)
  94.     if Lune_Message.identificacao == 0
  95.       @lune_x = $game_player.screen_x
  96.       @lune_y = $game_player.screen_y
  97.       else
  98.       @lune_x = $game_map.events[Lune_Message.identificacao].screen_x
  99.       @lune_y = $game_map.events[Lune_Message.identificacao].screen_y
  100.     end
  101.     @sprite_arrow.x = @lune_x - 8
  102.     @sprite_arrow.y = @lune_y - Lune_Message::Tamanho
  103.   end
  104.   def refresh
  105.   if @get_sprite == true
  106.   @sprite_arrow.y += Lune_Message::Mov
  107.   @get_sprite = false
  108.   else
  109.   @sprite_arrow.y -= Lune_Message::Mov
  110.   @get_sprite = true
  111.   end
  112.   end
  113.   def openlune
  114.     self.openness += 40
  115.     self.openness <= 254 ? (return false) : (return true)
  116.   end
  117.   def closelune
  118.     @sprite_arrow.opacity = 0 unless Imagem.nil?
  119.     self.openness -= 40
  120.     self.openness >= 1 ? (return false) : (return true)
  121.   end
  122.   def dispose
  123.   @sprite_arrow.dispose
  124.   super
  125.   end
  126. end
  127.  
  128.  
  129. class Game_Message
  130. # Retorna o valor da quantidade de linhas
  131.    def get_lune_lines
  132.      @lune_text_size = 0
  133.      @texts.inject("") {|r, text| @lune_text_size += 1}
  134.      return @lune_text_size
  135.    end
  136. # Retorna o valor do tamanho do texto.
  137.   def get_lune_length
  138.      @lune_length_size = 0
  139.      @biggest = 0
  140.      @texts.inject("") {|r, text|
  141.      if text.size > @lune_length_size
  142.       @lune_length_size = text.size
  143.       @biggest = text.dup
  144.       @biggest.delete! "\."
  145.       @biggest.delete! "\!"
  146.       @biggest.delete! "\c["
  147.       @biggest.delete! "]"
  148.       @biggest.delete! "["
  149.       p @biggest
  150.       end
  151.      }
  152.      return @biggest
  153.    end
  154. end
  155.  
  156. #==============================================================================
  157. # ** Window_Message
  158. #------------------------------------------------------------------------------
  159. #  Esta janela de mensagem é usada para exibir textos.
  160. #==============================================================================
  161.   #--------------------------------------------------------------------------
  162.   # * Aquisição da largura da janela
  163.   #--------------------------------------------------------------------------
  164. class Window_Message < Window_Base
  165. # aliasing
  166. alias lune_message_update update  
  167. alias lune_process_all_text process_all_text
  168. alias lune_message_dispose dispose
  169. alias lune_input_choice input_choice
  170.   def initialize
  171.     super(0, 0, Graphics.width, fitting_height(4))
  172.     self.z = 200
  173.     self.openness = 0
  174.     create_all_windows
  175.     create_back_bitmap
  176.     create_back_sprite
  177.     clear_instance_variables
  178.  
  179.   end
  180.   def window_width
  181.     text_size($game_message.get_lune_length).width + Lune_Message::Espacamento
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # * Aquisição da altura da janela
  185.   #--------------------------------------------------------------------------
  186.   def window_height
  187.     fitting_height($game_message.get_lune_lines)
  188.   end
  189.   def update(*args)
  190.     lune_message_update(*args)
  191.     unless Lune_Message.posicao == 2
  192.     @lune_message.refresh if @lune_message and Graphics.frame_count % 25 == 1
  193.     self.opacity = 0
  194.     end
  195.   end
  196.   def fiber_main
  197.     $game_message.visible = true
  198.     update_background
  199.     lune_update_placement if Lune_Message.posicao == 2
  200.     loop do
  201.       if Lune_Message.posicao == 2
  202.       lune_process_all_text if $game_message.has_text?
  203.       else
  204.       process_all_text if $game_message.has_text?
  205.       end
  206.       process_input
  207.       $game_message.clear
  208.       @gold_window.close
  209.       Fiber.yield
  210.       break unless text_continue?
  211.     end
  212.     @lune_message.opacity = 0 unless @lune_message == nil and Lune_Message.posicao == 2
  213.     close_and_wait
  214.     $game_message.visible = false
  215.     @fiber = nil
  216.   end
  217.   def lune_update_placement
  218.     @position = $game_message.position
  219.     self.y = @position * (Graphics.height - height) / 2
  220.     self.x = 0
  221.     @gold_window.y = y > 0 ? 0 : Graphics.height - @gold_window.height
  222.   end
  223.   def update_placement
  224.     @gold_window.y = y > 0 ? 0 : Graphics.height - @gold_window.height
  225.     unless Lune_Message.identificacao.nil?
  226.       self.x = @lune_x - window_width / 2
  227.       self.x -= (self.x + window_width - Graphics.width) if self.x + window_width >= Graphics.width
  228.       self.x -= new_line_x
  229.       self.x = [self.x,0].max   
  230.       self.y = @lune_y
  231.       self.y -= window_height + Lune_Message::Tamanho if Lune_Message.posicao == 1
  232.       self.y = [self.y,0].max
  233.       self.y -= (self.y + window_height - Graphics.height) if self.y + window_height >= Graphics.height
  234.     end
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # * Execução de todos texto
  238.   #--------------------------------------------------------------------------
  239.   def process_all_text
  240.     if Lune_Message.identificacao == 0
  241.       @lune_x = $game_player.screen_x
  242.       @lune_y = $game_player.screen_y
  243.       else
  244.       @lune_x = $game_map.events[Lune_Message.identificacao].screen_x
  245.       @lune_y = $game_map.events[Lune_Message.identificacao].screen_y
  246.     end
  247.     @lune_message.dispose unless @lune_message.nil?
  248.     w = @lune_x - window_width / 2
  249.     h = @lune_y
  250.     $game_message.face_name.empty? ? (w = [w,0].max) : (w = [w,112].max)
  251.     h -= window_height + Lune_Message::Tamanho if Lune_Message.posicao == 1
  252.     h = [h,0].max
  253.     w -= (w + window_width - Graphics.width) if w + window_width >= Graphics.width
  254.     h -= (h + window_height - Graphics.height) if h + window_height >= Graphics.height
  255.     @lune_message = Lune_Window_Message.new(w, h, window_width, window_height)
  256.     @lune_face = Window_Base.new(w - 104, h + 8, 104, 104) unless $game_message.face_name.empty?
  257.     update_placement
  258.     text = convert_escape_characters($game_message.all_text)
  259.     pos = {}
  260.     new_page(text, pos)
  261.     open_and_wait
  262.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  263.   end
  264.     #--------------------------------------------------------------------------
  265.   # * Abertura da janela e espeta até abertura total
  266.   #--------------------------------------------------------------------------
  267.   def open_and_wait
  268.     unless Lune_Message.posicao == 2
  269.     @lune_message.openlune
  270.     Fiber.yield until @lune_message.openlune
  271.     open
  272.   else
  273.     open
  274.     Fiber.yield until open?
  275.   end
  276.   end
  277.     #--------------------------------------------------------------------------
  278.   # * Fechamento da janela e espeta até fechamento total
  279.   #--------------------------------------------------------------------------
  280.   def close_and_wait
  281.     close
  282.     Fiber.yield until all_close?
  283.     @lune_message.closelune if @lune_message
  284.     Fiber.yield until @lune_message.closelune unless Lune_Message.posicao == 2
  285.   end
  286.     #--------------------------------------------------------------------------
  287.   # * Execução de espera de entrada
  288.   #--------------------------------------------------------------------------
  289.   def input_pause
  290.     self.pause = true if Lune_Message.posicao == 2
  291.     wait(10)
  292.     Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C)
  293.     Input.update
  294.     @lune_face.dispose unless @lune_face.nil?
  295.     self.pause = false
  296.   end
  297.   def dispose
  298.     @lune_message.dispose if @lune_message
  299.     Lune_Message.config(2,0)
  300.     lune_message_dispose
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # * Execução de entrada de escolhas
  304.   #--------------------------------------------------------------------------
  305.   def input_choice
  306.     lune_input_choice
  307.     @lune_face.dispose unless @lune_face.nil?
  308.   end
  309. end


下一次发代码请使用<>代码框功能 —— VIPArcher 留

评分

参与人数 1星屑 +50 收起 理由
RaidenInfinity + 50 结帖

查看全部评分

別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~

Lv3.寻梦者

梦石
0
星屑
3372
在线时间
1123 小时
注册时间
2015-12-24
帖子
246
2
发表于 2016-12-2 12:51:00 | 只看该作者
本帖最后由 翠靈月 于 2016-12-2 14:50 编辑

看不懂可以先丢估狗翻译看看啊...
事件中调用脚本指令
Lune_Message.config(p, id)
p填入0或1或2
 1 = 讯息在角色行走图上方
 0 = 讯息在角色行走图下方
 2 = 变回默认显示

id填入1以上为事件ID,0为玩家

调用Lune_Message.config(2, 0)
为变回默认显示,记得在脚本指令之后讯息之前插入一个等待1帧的指令


这里有影片示范
https://www.youtube.com/watch?v=FnRkMn0Hi4o

点评

雖然有點麻煩,還是能請你做個範檔嗎?  发表于 2016-12-7 17:10
雖然有點麻煩,還是能請你做個範檔嗎?  发表于 2016-12-7 17:09
就是她沒說如果是自動的事件,她沒教到怎麼指定玩家或是人物1號或2號  发表于 2016-12-7 17:04
請詳細描述你的問題,或者附圖  发表于 2016-12-2 23:33
即使看了也不行= = 位置完全不對,而且她也沒說兩個人怎麼用  发表于 2016-12-2 20:37
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3372
在线时间
1123 小时
注册时间
2015-12-24
帖子
246
3
发表于 2016-12-8 00:42:02 | 只看该作者
翠靈月 发表于 2016-12-2 12:51
看不懂可以先丢估狗翻译看看啊...
事件中调用脚本指令
Lune_Message.config(p, id)

顺带一提
使用这脚本的话每句话后面最好多打个全形空格

Project6.rar

1.42 MB, 下载次数: 67

点评

我知道問題出在哪了,感謝!  发表于 2016-12-9 18:46

评分

参与人数 1星屑 +250 梦石 +1 收起 理由
RaidenInfinity + 250 + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
帖子
117
4
 楼主| 发表于 2016-12-19 17:05:10 | 只看该作者
翠靈月 发表于 2016-12-8 00:42
顺带一提
使用这脚本的话每句话后面最好多打个全形空格

我試著複製你的範檔的腳本
我套用後,用顯示文字(還沒用到Lune_Message.config)
↓結果變成了這樣↓求解答


1.png (6.64 KB, 下载次数: 22)

1.png

点评

啊,我知道怎回事了  发表于 2016-12-19 17:06
別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-15 08:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表