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

Project1

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

[RMXP发布] 彩票脚本,带不中奖的+FUKI对话框

[复制链接]

Lv1.梦旅人

矿工

梦石
0
星屑
134
在线时间
898 小时
注册时间
2012-10-5
帖子
1535
跳转到指定楼层
1
 楼主| 发表于 2013-1-28 15:36:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 876加几 于 2013-1-29 11:24 编辑

彩票:
脚本内容:
RUBY 代码复制
  1. class Person
  2.   def pple
  3.     def dice
  4. return rand(100) #随机范围
  5. end
  6. a = $game_party.gold
  7. if a >= 100   #判断所需金钱
  8. $game_party.gain_gold(-100) #金钱减少
  9. if dice == 0
  10. print "1等奖,一千万"
  11. $game_party.gain_gold(10000000) #一等奖奖励
  12. elsif dice >= 90        
  13.   print "2等奖,十万"
  14. $game_party.gain_gold(100000)#二等奖奖励
  15. elsif dice >= 80               
  16.   print "3等奖,一百"
  17.   $game_party.gain_gold(100) #三等奖奖励
  18. else  
  19.   print "没获奖"
  20.   $game_party.gain_gold(0) #没获奖情况
  21. end
  22. else
  23. print "金钱不够"  #金钱不够的场合
  24.    end
  25.  
  26. end
  27. end

呼出方式:
RUBY 代码复制
  1. alex = Person.new
  2. alex.pple

这样在游戏中就能设置彩票了。
事件
先新建一个事件(有FUKI对话框的),再设置文章显示(上或下,窗口显示)
再设置一个脚本:
RUBY 代码复制
  1. $mes_id = 0
  2. $mes_name = "(这里填事件的姓名)"

文章:卖彩票了,你买不买?
显示选择项:买,不买
[买]的场合
脚本:
RUBY 代码复制
  1. alex = Person.new
  2. alex.pple

[不买]的场合
(这里不用设置事件)
FUKI对话框就选这个脚本:
RUBY 代码复制
  1. #
  2. #    呼出对话框 ver. 1.31 By パラ犬(日)
  3. #  来自 [url]http://rpg.para.s3p.net/[/url]
  4. #
  5. #  汉化修改 66RPG bbschat(2006.1.5)
  6. #    来自 [url]http://www.66RPG.com/[/url]
  7. #
  8. #    ●准备工作-窗口Skin
  9. #
  10. #    首先,确认自己使用的对话框窗口Skin,(数据库-系统-窗口外观图形)
  11. #    然后根据该窗口Skin制作对话框尾部使用的两个箭头图形
  12. #    尾部箭头图形命名方式:“窗口skin名-top”,“窗口skin名-under”
  13. #    将该图形文件存放在“Graphics/Windowskins”文件夹下。
  14. #
  15. #    本演示游戏内置2套窗口和箭头图形,
  16. #    一套是游戏默认的“001-Blue01”,一套是定制的“fk”
  17. #    玩家可以根据自己的需要参照样本定制自己的呼出对话框窗口Skin。
  18. #
  19. #    ●呼出对话框使用方法
  20. #
  21. #    在事件命令行使用[脚本]将事件ID代入[$mes_id]
  22. #    该事件就可以使用呼出对话框了。
  23. #   (举例:$mes_id=4)
  24. #
  25. #    ID 代入 -1 表示玩家,代入 0 表示事件自身。
  26. #    代入 nil 或者 "" 则返回成通常的信息窗口。
  27. #    对话框的表示位置可以通过事件的“更改文章选项”来设定(上、中、下)。
  28. #    表示位置为“中央”的话,不管事件位置在哪里,对话框都将显示在画面中央。
  29. #
  30. #    ●角色名字窗口的使用文字的方法
  31. #
  32. #    在事件命令行使用[脚本]将文字列代入[$mes_name]
  33. #    对话框就会显示角色名字窗口
  34. #   (举例:$mes_name="阿尔西斯")
  35. #    代入 nil 或者 "" 则不显示角色名字窗口。
  36. #
  37. #    以上两个机能是独立的,所以可以单独使用
  38. #
  39. #   $mes_id=(ID) + $mes_name="名字"  :呼出对话框显示 + 角色名字窗口
  40. #   $mes_id=(ID) + $mes_name=""      :呼出对话框显示(没有角色名字)
  41. #   $mes_id=nil  + $mes_name="名字"  :默认信息窗口 + 角色名字窗口
  42. #   $mes_id=nil  + $mes_name=""      :默认信息窗口(没有角色名字)
  43. #
  44. #    ●角色名字窗口使用角色图片的方法(汉化特别追加功能,原脚本只能使用文字)
  45. #   
  46. #    如果能在对应文件夹中找到文件名和角色名字相同的图片,   
  47. #    则角色名字窗口显示角色头像图片,角色图片最好能包括角色的名字。
  48. #    默认头像图片保存目录为“Graphics/Heads/”,玩家可自行修改。
  49. #
  50. #    如果不想使用角色名字直接作为头像文件名。
  51. #    可以使用下面在 Game_Temp 类里增加的namebmp属性。
  52. #    重新设定角色名字与文件名的对应关系。
  53. #
  54. #    ●信息表示速度的变更方法
  55. #
  56. #    在事件命令行使用[脚本]将数值代入[$mes_speed]
  57. #    速度为 0 即瞬间显示全部信息,数字越大,信息表示速度越慢。
  58. #   (举例:$mes_speed=1)
  59. #
  60. #    ●其他设置
  61. #
  62. #    请参照下面的注释
  63. #==============================================================================
  64.  
  65. module FUKI
  66.  
  67.   # 头像图片保存目录的设定
  68.   HEAD_PIC_DIR = "Graphics/Heads/"
  69.  
  70.   # 是否显示尾部图标
  71.   TAIL_SHOW = true
  72.  
  73.   # Skin的设定
  74.   # 使用数据库默认窗口Skin情况下这里使用[""]
  75.   FUKI_SKIN_NAME = "001-Blue01"   # 呼出对话框用Skin
  76.   NAME_SKIN_NAME = "001-Blue01"   # 角色名字窗口用Skin
  77.  
  78.   # 字体大小
  79.   MES_FONT_SIZE = 22    # 呼出对话框
  80.   NAME_FONT_SIZE = 14   # 角色名字窗口
  81.  
  82.   # 字体颜色
  83.   #(设定为 Color.new(0, 0, 0, 0) 表示使用普通文字色)
  84.   FUKI_COLOR = Color.new(255, 255, 255, 255)  # 呼出对话框
  85.   NAME_COLOR = Color.new(255, 255, 255, 255)  # 角色名字窗口
  86.  
  87.   # 窗口透明度
  88.   # 如修改窗口透明度请同时修改尾部箭头图形内部的透明度
  89.   FUKI_OPACITY = 255    # 呼出对话框
  90.   MES_OPACITY = 255     # 默认信息窗口
  91.   NAME_OPACITY = 255    # 角色名字窗口
  92.  
  93.   # 角色名字窗口的相对位置
  94.   NAME_SHIFT_X = 0      # 横坐标
  95.   NAME_SHIFT_Y = 16     # 纵坐标
  96.  
  97.   # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  98.   # 自动改变位置( true / false )
  99.   # 设置成 true 可能出现箭头图标颠倒的问题 <- bbschat
  100.   POS_FIX = false
  101.  
  102.   # 在画面最边缘表示时的稍微挪动
  103.   # 使用圆形Skin的角和方框的角重合的情况下为 true
  104.   CORNER_SHIFT = false
  105.   SHIFT_PIXEL = 4   # true 时挪动的象素
  106.  
  107.   # 角色高度尺寸
  108.   CHARACTOR_HEIGHT = 48
  109.   # 呼出对话框的相对位置(纵坐标)
  110.   POP_SHIFT_TOP = 0         # 表示位置为上的时候
  111.   POP_SHIFT_UNDER = 0       # 表示位置为下的时候
  112.  
  113.   # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  114.   # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  115.   MES_SPEED = 1
  116.  
  117. end
  118.  
  119. #==============================================================================
  120. # 方便用户同时设置2个常用参数而使用的函数
  121. #==============================================================================
  122. def chat(id = 0,name = "")
  123.   $mes_id = id
  124.   $mes_name = name
  125. end
  126.  
  127. #==============================================================================
  128. # □ Game_Temp
  129. #==============================================================================
  130.  
  131. class Game_Temp
  132.   attr_accessor  :namebmp              #保存头像图片的Hash表
  133.   alias initialize_fuki initialize
  134.   def initialize
  135.     initialize_fuki
  136.     # 如果不想使用角色名字直接作为头像文件名
  137.     # 可在这里重新设定角色名字与文件名的对应关系
  138.     @namebmp ={ }
  139.   end
  140. end
  141.  
  142. #==============================================================================
  143. # □ Window_FukiMessage
  144. #==============================================================================
  145.  
  146. class Window_FukiMessage < Window_Selectable
  147.  
  148.   #--------------------------------------------------------------------------
  149.   # ● 初始化状态
  150.   #--------------------------------------------------------------------------
  151.   def initialize
  152.     super(80, 304, 480, 160)
  153.     self.contents = Bitmap.new(width - 32, height - 32)
  154.     self.visible = false
  155.     self.z = 9998
  156.     @fade_in = false
  157.     @fade_out = false
  158.     @contents_showing = false
  159.     @cursor_width = 0
  160.     self.active = false
  161.     self.index = -1
  162.     [url=home.php?mod=space&uid=133944]@w[/url] = 0
  163.     @h = 0
  164.     [url=home.php?mod=space&uid=36110]@Wait[/url] = 0
  165.     @dx = 0
  166.     @dy = 0
  167.     $mes_speed = FUKI::MES_SPEED
  168.   end
  169.  
  170.   #--------------------------------------------------------------------------
  171.   # ○ 决定窗口尺寸并生成窗口
  172.   #--------------------------------------------------------------------------
  173.   def refresh_create
  174.     self.contents.clear
  175.     self.contents.font.color = normal_color
  176.     self.contents.font.size = FUKI::MES_FONT_SIZE
  177.     # 取得窗口尺寸
  178.     get_windowsize
  179.     w = [url=home.php?mod=space&uid=133944]@w[/url] + 32 + 8
  180.     h = @h * (self.contents.font.size + 10) + 26
  181.     # 生成呼出窗口
  182.     set_fukidasi(self.x, self.y, w, h)
  183.     # 生成角色名字窗口
  184.     set_namewindow
  185.     # 初始化信息表示使用的变量
  186.     @dx = @dy = 0
  187.     @cursor_width = 0
  188.     @contents_drawing = true
  189.     # 瞬间表示的情况下
  190.     if $mes_speed == 0
  191.       # 循环信息描绘处理
  192.       while $game_temp.message_text != ""
  193.         draw_massage
  194.       end
  195.       draw_opt_text
  196.       @contents_showing_end = true
  197.       @contents_drawing = false
  198.     else
  199.       # 一个一个描绘文字
  200.       refresh_drawtext
  201.     end
  202.   end
  203.  
  204.   #--------------------------------------------------------------------------
  205.   # ○ 一个一个描绘文字
  206.   #--------------------------------------------------------------------------
  207.   def refresh_drawtext
  208.     if $game_temp.message_text != nil
  209.       if [url=home.php?mod=space&uid=36110]@Wait[/url] > 0
  210.         [url=home.php?mod=space&uid=36110]@Wait[/url] -= 1
  211.       elsif [url=home.php?mod=space&uid=36110]@Wait[/url] == 0
  212.         # 描绘处理
  213.         draw_massage
  214.         [url=home.php?mod=space&uid=36110]@Wait[/url] = $mes_speed
  215.       end
  216.     end
  217.     # 描绘结束
  218.     if $game_temp.message_text == ""
  219.       draw_opt_text
  220.       @contents_showing_end = true
  221.       @contents_drawing = false
  222.     end
  223.   end
  224.  
  225.   #--------------------------------------------------------------------------
  226.   # ○ 取得窗口尺寸
  227.   #--------------------------------------------------------------------------
  228.   def get_windowsize
  229.     x = y = 0
  230.     @h = [url=home.php?mod=space&uid=133944]@w[/url] = 0
  231.     @cursor_width = 0
  232.     # 有选择项的话,处理字的缩进
  233.     if $game_temp.choice_start == 0
  234.       x = 16
  235.     end
  236.     # 有等待显示的文字的情况下
  237.     if $game_temp.message_text != nil
  238.     text = $game_temp.message_text.clone
  239.       # 限制文字处理
  240.       begin
  241.         last_text = text.clone
  242.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  243.       end until text == last_text
  244.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  245.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  246.       end
  247.       # 为了方便、将 "\\\\" 变换为 "\000"
  248.       text.gsub!(/\\\\/) { "\000" }
  249.       # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  250.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  251.       text.gsub!(/\\[Gg]/) { "\002" }
  252.       # c 获取 1 个字 (如果不能取得文字就循环)
  253.       while ((c = text.slice!(/./m)) != nil)
  254.         # \\ 的情况下
  255.         if c == "\000"
  256.           # 还原为本来的文字
  257.           c = "\\"
  258.         end
  259.         # \C[n] 或者 \G 的情况下
  260.         if c == "\001" or c == "\002"
  261.           # 下面的文字
  262.           next
  263.         end
  264.         # 另起一行文字的情况下
  265.         if c == "\n"
  266.           # y 累加 1
  267.           y += 1
  268.           # 取得纵横尺寸
  269.           @h = y
  270.           [url=home.php?mod=space&uid=133944]@w[/url] = x > [url=home.php?mod=space&uid=133944]@w[/url] ? x : @w
  271.           if y >= $game_temp.choice_start
  272.             [url=home.php?mod=space&uid=133944]@w[/url] = x + 8 > @w ? x + 8 : @w
  273.           end
  274.           x = 0
  275.           # 移动到选择项的下一行
  276.           if y >= $game_temp.choice_start
  277.             x = 8
  278.           end
  279.           # 下面的文字
  280.           next
  281.         end
  282.         # x 为要描绘文字的宽度加法运算
  283.         x += self.contents.text_size(c).width
  284.       end
  285.     end
  286.     # 输入数值的情况
  287.     if $game_temp.num_input_variable_id > 0
  288.       digits_max = $game_temp.num_input_digits_max
  289.       number = $game_variables[$game_temp.num_input_variable_id]
  290.       @h += 1
  291.       x = digits_max * self.contents.font.size + 16
  292.       @w = x > @w ? x : @w
  293.     end
  294.   end
  295.  
  296.   #--------------------------------------------------------------------------
  297.   # ○ 描绘信息处理
  298.   #--------------------------------------------------------------------------
  299.   def draw_massage
  300.     # 有等待显示的文字的情况下
  301.     if $game_temp.message_text != nil
  302.       text = $game_temp.message_text
  303.       # 限制文字处理
  304.       begin
  305.         last_text = text.clone
  306.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  307.       end until text == last_text
  308.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  309.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  310.       end
  311.       # 为了方便、将 "\\\\" 变换为 "\000"
  312.       text.gsub!(/\\\\/) { "\000" }
  313.       # "\\C" 变为 "\001"、"\\G" 变为 "\002"
  314.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  315.       text.gsub!(/\\[Gg]/) { "\002" }
  316.       # c 获取 1 个字
  317.       if ((c = text.slice!(/./m)) != nil)
  318.         # 选择项的情况
  319.         if @dy >= $game_temp.choice_start
  320.           # 处理字的缩进
  321.           @dx = 8
  322.           # 描绘文字
  323.           self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  324.           # x 为要描绘文字宽度的加法运算
  325.           @dx += self.contents.text_size(c).width
  326.           # 循环
  327.           while ((c = text.slice!(/./m)) != "\n")
  328.             # 描绘文字
  329.             self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  330.             # x 为要描绘文字宽度的加法运算
  331.             @dx += self.contents.text_size(c).width
  332.           end
  333.           if c == "\n"
  334.             # 更新光标宽度
  335.             @cursor_width = [@cursor_width, @dx].max
  336.             # dy 累加 1
  337.             @dy += 1
  338.             @dx = 0
  339.           end
  340.           return
  341.         end
  342.         # \\ 的情况下
  343.         if c == "\000"
  344.           # 还原为本来的文字
  345.           c = "\\"
  346.         end
  347.         #\C[n] 的情况下
  348.         if c == "\001"
  349.           # 更改文字色
  350.           text.sub!(/\[([0-9]+)\]/, "")
  351.           color = $1.to_i
  352.           if color >= 0 and color <= 7
  353.             self.contents.font.color = text_color(color)
  354.           end
  355.         end
  356.         # \G 的情况下
  357.         if c == "\002"
  358.           # 生成金钱窗口
  359.           if @gold_window == nil
  360.             @gold_window = Window_Gold.new
  361.             @gold_window.x = 560 - @gold_window.width
  362.             if $game_temp.in_battle
  363.               @gold_window.y = 192
  364.             else
  365.               @gold_window.y = self.y >= 128 ? 32 : 384
  366.             end
  367.             @gold_window.opacity = self.opacity
  368.             @gold_window.back_opacity = self.back_opacity
  369.           end
  370.         end
  371.         # 另起一行文字的情况下
  372.         if c == "\n"
  373.           # dy 累加 1
  374.           @dy += 1
  375.           @dx = 0
  376.         end
  377.         # 描绘文字
  378.         self.contents.font.size = FUKI::MES_FONT_SIZE
  379.         font_size = self.contents.font.size
  380.         self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  381.         # dx 为要描绘文字的宽度加法运算
  382.         @dx += self.contents.text_size(c).width
  383.       end
  384.     end
  385.   end
  386.  
  387.   #--------------------------------------------------------------------------
  388.   # ○ 选择项和输入数值的情况下
  389.   #--------------------------------------------------------------------------
  390.   def draw_opt_text
  391.     # 选择项的情况下
  392.     if $game_temp.choice_max > 0
  393.       @item_max = $game_temp.choice_max
  394.       self.active = true
  395.       self.index = 0
  396.     end
  397.     # 输入数值的情况下
  398.     if $game_temp.num_input_variable_id > 0
  399.       digits_max = $game_temp.num_input_digits_max
  400.       number = $game_variables[$game_temp.num_input_variable_id]
  401.       @input_number_window = Window_InputNumber.new(digits_max)
  402.       @input_number_window.number = number
  403.       @input_number_window.x = self.x + 8
  404.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  405.     end
  406.   end
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # ○ 设置呼出对话框
  410.   #--------------------------------------------------------------------------
  411.   def set_fukidasi(x, y, width, height)
  412.     # $mes_id 为空的时候,不显示呼出对话框
  413.     if $mes_id == nil or $mes_id == ""
  414.       del_fukidasi
  415.       reset_window
  416.     else
  417.       # 不显示暂停标志
  418.       self.pause = false
  419.       # 取得对话框位置
  420.       pos = get_fuki_pos(width, height)
  421.       x = pos[0]
  422.       y = pos[1]
  423.       skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  424.       # 生成呼出对话框
  425.       self.windowskin = RPG::Cache.windowskin(skin)
  426.       self.x = x
  427.       self.y = y
  428.       self.height = height
  429.       self.width = width
  430.       self.contents.dispose
  431.       self.contents = Bitmap.new(width - 32, height - 32)
  432.       self.back_opacity = FUKI::FUKI_OPACITY
  433.       self.contents.clear
  434.       self.contents.font.color = normal_color
  435.       self.contents.font.size = FUKI::MES_FONT_SIZE
  436.       # 描绘尾部图标
  437.       if $game_system.message_frame == 0
  438.         # 取得位置
  439.         tale_pos = get_tale_pos
  440.         @tale = Sprite.new
  441.         # 是否显示尾部图标 <- bbschat
  442.         if FUKI::TAIL_SHOW == true
  443.           case @message_position
  444.             when 0  # 上
  445.               @tale.bitmap = RPG::Cache.windowskin(skin + "-top")
  446.               @tale.x = tale_pos[0]
  447.               @tale.y = tale_pos[1]
  448.               @tale.z = self.z + 1
  449.             when 1  # 中
  450.               @tale.dispose
  451.               @tale = nil
  452.             when 2  # 下
  453.               @tale.bitmap = RPG::Cache.windowskin(skin + "-under")
  454.               @tale.x = tale_pos[0]
  455.               @tale.y = tale_pos[1]
  456.               @tale.z = self.z + 1
  457.           end
  458.         end
  459.       end
  460.     end
  461.   end
  462.  
  463.   #--------------------------------------------------------------------------
  464.   # ○ 计算呼出对话框的位置
  465.   #--------------------------------------------------------------------------
  466.   def get_fuki_pos(width, height)
  467.  
  468.     # 取得角色
  469.     @character = get_character($mes_id)
  470.     if @character == nil
  471.       # 角色不存在的情况下使用默认信息框
  472.       del_fukidasi
  473.       reset_window
  474.       return
  475.     end
  476.     # 处理坐标
  477.     x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  478.     # 为尽量显示在画面内而移动横坐标
  479.     if x + width > 640
  480.       x = 640 - width
  481.     elsif x < 0
  482.       x = 0
  483.     end
  484.     # 决定窗口位置
  485.     case $game_system.message_position
  486.       when 0  # 上
  487.         y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  488.       when 1  # 中
  489.         y = (480 - height) / 2
  490.         x = (640 - width) / 2
  491.       when 2  # 下
  492.         y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  493.     end
  494.     # 纪录文章显示位置
  495.     @message_position = $game_system.message_position
  496.     # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  497.     if FUKI::POS_FIX
  498.       case @message_position
  499.         when 0  # 上
  500.           if y <= 0
  501.             @message_position = 2
  502.             y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  503.           end
  504.         when 2  # 下
  505.           if y + height >= 480
  506.             p "上"
  507.             @message_position = 0
  508.             y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  509.           end
  510.       end
  511.     end
  512.     return [x,y]
  513.  
  514.   end
  515.  
  516.   #--------------------------------------------------------------------------
  517.   # ○ 计算尾部图标的位置
  518.   #--------------------------------------------------------------------------
  519.   def get_tale_pos
  520.     case @message_position
  521.       when 0  # 上
  522.         # 处理坐标
  523.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  524.         # 画面边缘的话则移动位置
  525.         if FUKI::CORNER_SHIFT
  526.           if x == 0
  527.             x = FUKI::SHIFT_PIXEL
  528.           elsif x == 640 - 32
  529.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  530.           end
  531.         end
  532.         y = self.y + self.height - 16
  533.       when 1  # 中
  534.         x = nil
  535.         y = nil
  536.       when 2  # 下
  537.         # 处理坐标
  538.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  539.         # 画面边缘的话则移动位置
  540.         if FUKI::CORNER_SHIFT
  541.           if x == 0
  542.             x = FUKI::SHIFT_PIXEL
  543.           elsif @tale.x == 640 - 32
  544.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  545.           end
  546.         end
  547.         y = self.y - 16
  548.     end
  549.     return [x,y]
  550.   end
  551.  
  552.   #--------------------------------------------------------------------------
  553.   # ○ 计算名字窗口的位置
  554.   #--------------------------------------------------------------------------
  555.   def get_name_pos
  556.     case @face_pic_txt
  557.       when 0  # 文字
  558.         x = self.x + FUKI::NAME_SHIFT_X
  559.         y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  560.       when 1  # 图片
  561.         if self.x >= @pic_width + 5
  562.           # 默认头像显示在对话框左边
  563.           x = self.x-@pic_width-5
  564.         else
  565.           # 对话框左边放不下时头像显示在右边
  566.           x = self.x + self.width
  567.         end
  568.         y = self.y+self.height/2 - (@pic_height + 5)/2
  569.       end
  570.  
  571.     return [x,y]
  572.   end
  573.  
  574.   #--------------------------------------------------------------------------
  575.   # ○ 设置角色名字窗口
  576.   #--------------------------------------------------------------------------
  577.   def set_namewindow
  578.  
  579.     # $mes_name为空时不显示角色名字窗口
  580.     if $mes_name == nil or $mes_name == ""
  581.       return
  582.     else
  583.       # 设定变量
  584.       mes_name = $mes_name
  585.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  586.  
  587.       #判断名称是否有对应的图片"Graphics/heads/" +
  588.       if $game_temp.namebmp[mes_name] == nil then
  589.         sFile = "Graphics/heads/" + mes_name + ".png"
  590.       else
  591.         sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"
  592.       end
  593.  
  594.       if FileTest.exist?(sFile) == true then
  595.  
  596.         @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  597.  
  598.         # 生成头像
  599.         bmp = Bitmap.new(sFile)
  600.         @pic_width = bmp.width
  601.         @pic_height = bmp.height
  602.  
  603.         if self.x >= @pic_width + 5
  604.           # 默认头像显示在对话框左边
  605.           name_x = self.x-@pic_width-5
  606.         else
  607.           # 对话框左边放不下时头像显示在右边
  608.           name_x = self.x + self.width
  609.         end
  610.         name_y = self.y+self.height/2 - (@pic_height + 5)/2
  611.  
  612.         # 生成角色头像窗口
  613.         @name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  614.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  615.         @name_win.back_opacity =0     
  616.         @name_win.z = self.z + 1
  617.  
  618.         @name_contents = Sprite.new
  619.         @name_contents.x = name_x + 2
  620.         @name_contents.y = name_y + 2
  621.         @name_contents.bitmap = bmp
  622.         #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  623.  
  624.       else
  625.  
  626.         @face_pic_txt = 0                       #名字窗口使用文字<- bbschat
  627.  
  628.         # 生成名字
  629.         name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  630.         name_height = FUKI::NAME_FONT_SIZE
  631.         name_x = self.x + FUKI::NAME_SHIFT_X
  632.         name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
  633.  
  634.         # 生成角色名字窗口(只有边框)
  635.         @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  636.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  637.         @name_win.back_opacity = FUKI::NAME_OPACITY
  638.         @name_win.z = self.z + 1
  639.  
  640.         # 为了使空白比Windows类限定的更小使用双重结构
  641.         @name_contents = Sprite.new
  642.         @name_contents.x = name_x + 12
  643.         @name_contents.y = name_y + 8
  644.         @name_contents.bitmap = Bitmap.new(name_width, name_height)
  645.         @name_contents.z = @name_win.z + 2
  646.  
  647.         # 设定文字色
  648.         nil_color = Color.new(0,0,0,0)
  649.         if FUKI::NAME_COLOR != nil_color
  650.           @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  651.         else
  652.           @name_contents.bitmap.font.color = normal_color
  653.         end
  654.         @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  655.         # 调整窗口尺寸
  656.         rect = @name_contents.bitmap.text_size(mes_name)
  657.         @name_win.width = rect.width + 32
  658.         # 描画名字
  659.         @name_contents.bitmap.draw_text(rect, mes_name)
  660.       end
  661.     end
  662.  
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # ○ 释放呼出对话框和角色名字窗口
  667.   #--------------------------------------------------------------------------
  668.   def del_fukidasi
  669.     if @tale != nil
  670.       @tale.dispose
  671.       @tale = nil
  672.     end
  673.     if @name_win != nil
  674.       @name_win.dispose
  675.       @name_win = nil
  676.       @name_contents.dispose
  677.       @name_contents = nil
  678.     end
  679.     self.opacity = 0
  680.     self.x = 80
  681.     self.width = 480
  682.     self.height = 160
  683.     self.contents.dispose
  684.     self.contents = Bitmap.new(width - 32, height - 32)
  685.     self.pause = true
  686.   end
  687.  
  688.   #--------------------------------------------------------------------------
  689.   # ○ 取得角色
  690.   #     parameter : 参数
  691.   #--------------------------------------------------------------------------
  692.   def get_character(parameter)
  693.     # 参数分歧
  694.     case parameter
  695.     when -1  # 玩家
  696.       return $game_player
  697.     when 0   # 该事件
  698.       events = $game_map.events
  699.       return events == nil ? nil : events[$active_event_id]
  700.     else     # 特定事件
  701.       events = $game_map.events
  702.       return events == nil ? nil : events[parameter]
  703.     end
  704.   end
  705.  
  706.   #--------------------------------------------------------------------------
  707.   # ● 设定窗口位置和不透明度
  708.   #--------------------------------------------------------------------------
  709.   def reset_window
  710.     if $game_temp.in_battle
  711.       self.y = 16
  712.     else
  713.       case $game_system.message_position
  714.       when 0  # 上
  715.         self.y = 16
  716.       when 1  # 中
  717.         self.y = 160
  718.       when 2  # 下
  719.         self.y = 304
  720.       end
  721.     end
  722.     if $game_system.message_frame == 0
  723.       self.opacity = 255
  724.     else
  725.       self.opacity = 0
  726.     end
  727.     self.back_opacity = FUKI::MES_OPACITY
  728.   end
  729.  
  730.   #--------------------------------------------------------------------------
  731.   # ● 刷新画面
  732.   #--------------------------------------------------------------------------
  733.   def update
  734.     super
  735.     # 呼出模式下跟随事件移动
  736.     if @tale != nil
  737.       pos = get_fuki_pos(self.width, self.height)
  738.       self.x = pos[0]
  739.       self.y = pos[1]
  740.  
  741.       tale_pos = get_tale_pos
  742.       @tale.x = tale_pos[0]
  743.       @tale.y = tale_pos[1]
  744.  
  745.       if @name_win != nil
  746.         name_pos = get_name_pos
  747.         @name_win.x = name_pos[0]
  748.         @name_win.y = name_pos[1]
  749.         case @face_pic_txt
  750.           when 0  # 文字
  751.             @name_contents.x = @name_win.x + 12
  752.             @name_contents.y = @name_win.y + 8
  753.           when 1  # 图片
  754.             @name_contents.x = @name_win.x + 2
  755.             @name_contents.y = @name_win.y + 2
  756.           end
  757.       end
  758.     end
  759.  
  760.     # 渐变的情况下
  761.     if @fade_in
  762.       self.contents_opacity += 24
  763.       if @name_win != nil
  764.         @name_win.opacity += 24
  765.       end
  766.       if @tale != nil
  767.         @tale.opacity += 24
  768.       end
  769.       if @input_number_window != nil
  770.         @input_number_window.contents_opacity += 24
  771.       end
  772.       if self.contents_opacity == 255
  773.         @fade_in = false
  774.       end
  775.       return
  776.     end
  777.     # 显示信息中的情况下
  778.     if @contents_drawing
  779.       refresh_drawtext
  780.       return
  781.     end
  782.     # 输入数值的情况下
  783.     if @input_number_window != nil
  784.       @input_number_window.update
  785.       # 确定
  786.       if Input.trigger?(Input::C)
  787.         $game_system.se_play($data_system.decision_se)
  788.         $game_variables[$game_temp.num_input_variable_id] =
  789.           @input_number_window.number
  790.         $game_map.need_refresh = true
  791.         # 释放输入数值窗口
  792.         @input_number_window.dispose
  793.         @input_number_window = nil
  794.         terminate_message
  795.       end
  796.       return
  797.     end
  798.     # 显示信息结束的情况下
  799.     if @contents_showing_end
  800.       # 不是显示选择项且不是呼出对话模式则显示暂停标志
  801.       if $game_temp.choice_max == 0 and @tale == nil
  802.         self.pause = true
  803.       else
  804.         self.pause = false
  805.       end
  806.       # 取消
  807.       if Input.trigger?(Input::B)
  808.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  809.           $game_system.se_play($data_system.cancel_se)
  810.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  811.           terminate_message
  812.         end
  813.       end
  814.       # 确定
  815.       if Input.trigger?(Input::C)
  816.         if $game_temp.choice_max > 0
  817.           $game_system.se_play($data_system.decision_se)
  818.           $game_temp.choice_proc.call(self.index)
  819.         end
  820.         terminate_message
  821.         # 释放呼出窗口
  822.         del_fukidasi
  823.       end
  824.       return
  825.     end
  826.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  827.     if @fade_out == false and $game_temp.message_text != nil
  828.       @contents_showing = true
  829.       $game_temp.message_window_showing = true
  830.       reset_window
  831.       refresh_create
  832.       if @name_win != nil
  833.         @name_win.opacity = 0
  834.       end
  835.       if @tale != nil
  836.         @tale.opacity = 0
  837.       end
  838.       Graphics.frame_reset
  839.       self.visible = true
  840.       self.contents_opacity = 0
  841.       if @input_number_window != nil
  842.         @input_number_window.contents_opacity = 0
  843.       end
  844.       @fade_in = true
  845.       return
  846.     end
  847.     # 没有可以显示的信息、但是窗口为可见的情况下
  848.     if self.visible
  849.       @fade_out = true
  850.       self.opacity -= 48
  851.       if @name_win != nil
  852.         @name_win.opacity -= 48
  853.       end
  854.       if @tale != nil
  855.         @tale.opacity -= 48
  856.       end
  857.       if self.opacity == 0
  858.         self.visible = false
  859.         @fade_out = false
  860.         $game_temp.message_window_showing = false
  861.         del_fukidasi
  862.       end
  863.       return
  864.     end
  865.   end
  866.  
  867.   #--------------------------------------------------------------------------
  868.   # ● 释放
  869.   #--------------------------------------------------------------------------
  870.   def dispose
  871.     terminate_message
  872.     $game_temp.message_window_showing = false
  873.     if @input_number_window != nil
  874.       @input_number_window.dispose
  875.     end
  876.     super
  877.   end
  878.  
  879.   #--------------------------------------------------------------------------
  880.   # ● 信息结束处理
  881.   #--------------------------------------------------------------------------
  882.   def terminate_message
  883.     self.active = false
  884.     self.pause = false
  885.     self.index = -1
  886.     self.contents.clear
  887.     # 清除显示中标志
  888.     @contents_showing = false
  889.     @contents_showing_end = false
  890.     # 呼叫信息调用
  891.     if $game_temp.message_proc != nil
  892.       $game_temp.message_proc.call
  893.     end
  894.     # 清除文章、选择项、输入数值的相关变量
  895.     $game_temp.message_text = nil
  896.     $game_temp.message_proc = nil
  897.     $game_temp.choice_start = 99
  898.     $game_temp.choice_max = 0
  899.     $game_temp.choice_cancel_type = 0
  900.     $game_temp.choice_proc = nil
  901.     $game_temp.num_input_start = 99
  902.     $game_temp.num_input_variable_id = 0
  903.     $game_temp.num_input_digits_max = 0
  904.     # 释放金钱窗口
  905.     if @gold_window != nil
  906.       @gold_window.dispose
  907.       @gold_window = nil
  908.     end
  909.   end
  910.  
  911.   #--------------------------------------------------------------------------
  912.   # ● 刷新光标矩形
  913.   #--------------------------------------------------------------------------
  914.   def update_cursor_rect
  915.     if @index >= 0
  916.       n = $game_temp.choice_start + @index
  917.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  918.     else
  919.       self.cursor_rect.empty
  920.     end
  921.   end
  922.   #--------------------------------------------------------------------------
  923.   # ● 取得普通文字色
  924.   #--------------------------------------------------------------------------
  925.   def normal_color
  926.     nil_color = Color.new(0,0,0,0)
  927.     if FUKI::FUKI_COLOR != nil_color
  928.       color = FUKI::FUKI_COLOR
  929.     else
  930.       color = super
  931.     end
  932.     return color
  933.   end
  934. end
  935.  
  936. #==============================================================================
  937. # ■ Interpreter
  938. #==============================================================================
  939.  
  940. class Interpreter
  941.   #--------------------------------------------------------------------------
  942.   # ● 设置事件
  943.   #     event_id : 事件 ID
  944.   #--------------------------------------------------------------------------
  945.   alias setup_fuki setup
  946.   def setup(list, event_id)
  947.     setup_fuki(list, event_id)
  948.     # 如果不是战斗中
  949.     if !($game_temp.in_battle)
  950.       # 记录事件 ID
  951.       $active_event_id = event_id
  952.     end
  953.   end
  954. end
  955.  
  956. #==============================================================================
  957. # ■ Scene_Map
  958. #==============================================================================
  959.  
  960. class Scene_Map
  961.   #--------------------------------------------------------------------------
  962.   # ● 主处理
  963.   #--------------------------------------------------------------------------
  964.   def main
  965.     # 生成活动块
  966.     @spriteset = Spriteset_Map.new
  967.     # 生成信息窗口
  968.     @message_window = Window_FukiMessage.new
  969.     # 执行过渡
  970.     Graphics.transition
  971.     # 主循环
  972.     loop do
  973.       # 刷新游戏画面
  974.       Graphics.update
  975.       # 刷新输入信息
  976.       Input.update
  977.       # 刷新画面
  978.       update
  979.       # 如果画面切换的话就中断循环
  980.       if $scene != self
  981.         break
  982.       end
  983.     end
  984.     # 准备过渡
  985.     Graphics.freeze
  986.     # 释放活动块
  987.     @spriteset.dispose
  988.     # 释放信息窗口
  989.     @message_window.dispose
  990.     # 标题画面切换中的情况下
  991.     if $scene.is_a?(Scene_Title)
  992.       # 淡入淡出画面
  993.       Graphics.transition
  994.       Graphics.freeze
  995.     end
  996.   end
  997. end
  998.  
  999. #==============================================================================
  1000. # ■ Window_InputNumber
  1001. #==============================================================================
  1002.  
  1003. class Window_InputNumber < Window_Base
  1004.   #--------------------------------------------------------------------------
  1005.   # ● 初始化对像
  1006.   #     digits_max : 位数
  1007.   #--------------------------------------------------------------------------
  1008.   def initialize(digits_max)
  1009.     @digits_max = digits_max
  1010.     [url=home.php?mod=space&uid=27178]@Number[/url] = 0
  1011.     # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  1012.     dummy_bitmap = Bitmap.new(32, 32)
  1013.     dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  1014.     @cursor_width = dummy_bitmap.text_size("0").width + 8
  1015.     dummy_bitmap.dispose
  1016.     super(0, 0, @cursor_width * @digits_max + 32, 64)
  1017.     self.contents = Bitmap.new(width - 32, height - 32)
  1018.     self.contents.font.size = FUKI::MES_FONT_SIZE
  1019.     self.z += 9999
  1020.     self.opacity = 0
  1021.     @index = 0
  1022.     refresh
  1023.     update_cursor_rect
  1024.   end
  1025. end

使用FUKI对话框:
脚本:
RUBY 代码复制
  1. $mes_id = #这里填事件ID,0代表本事件,-1代表玩家,使用时把此注释删除,换成事件号。
  2. $mes_name = ""#这里填姓名,用时把注释删除,换成姓名。

文章=对话内容

附:有了这个FUKI对话框脚本后不要弄”装备耐久度“这个脚本,弄了就没了这个FUKI对话框。  
呃,发糖贴好冷清呀!

Lv1.梦旅人

梦石
0
星屑
110
在线时间
85 小时
注册时间
2010-8-19
帖子
137
2
发表于 2013-3-30 19:17:05 | 只看该作者
LZ这脚本抄袭的@懒De说  
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
110
在线时间
85 小时
注册时间
2010-8-19
帖子
137
3
发表于 2013-3-30 19:19:30 | 只看该作者

点评

但我在那个脚本上新添了不中奖的几句脚本呀!  发表于 2013-3-30 21:07
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33069
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

4
发表于 2013-3-30 19:51:59 | 只看该作者
六翼恶魔 发表于 2013-3-30 19:19
原帖:http://rpg.blue/forum.php?mod=viewthread&tid=236092
比你早半年呢

只能说,,,,无语了~~~~~~,

顶起来一下,让大家都看看。

点评

呵呵!  发表于 2013-3-31 15:37
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv2.观梦者

故九江太守

梦石
0
星屑
554
在线时间
2159 小时
注册时间
2012-12-5
帖子
4463
5
发表于 2013-5-20 23:12:31 | 只看该作者
但我在那个脚本上新添了不中奖的几句脚本呀!


冒死顶起来让大家贱笑
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 12:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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