查看: 2684|回复: 1

[已经解决] 脚本报错?这标题太普遍了,于是改成taroxd脚本报错了

[复制链接]

炎

梦石
0
星屑
98
在线时间
1617 小时
注册时间
2013-8-15
回帖
4322
发表于 2014-10-8 01:16:00 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 永燃的狂炎 于 2014-10-8 09:39 编辑

[box=DarkRed]●狂炎@[/box]
@VIPArcher  结账结帖

[box=DarkRed]●狂炎的推测[/box]
自从用了换装脚本就会报错
[box=DarkRed]●狂炎报错的脚本[/box]

获取道具总数

  1. #--------------------------------------------------------------------------
  2. # ● 自动显示得失物品提示
  3. #--------------------------------------------------------------------------

  4. module Taroxd end

  5. module Taroxd::GainMessage
  6. #--------------------------------------------------------------------------
  7. # ● 常数设置
  8. #--------------------------------------------------------------------------
  9. SWITCH = 0 # 开关打开时功能开启。可以填入 0 表示始终打开。
  10. GAIN = '获得'
  11. LOSE = '失去'
  12. ITEM_FORMAT = '%s了 %s * %d' # 获得/失去了 某物品 * N
  13. GOLD_FORMAT = '%s了 %d %s' # 获得/失去了 N 金钱单位
  14. BACKGROUND = 1 # 窗口背景(0/1/2)
  15. POSITION = 1 # 显示位置(0/1/2)
  16. GAIN_GOLD_SE = 'Shop' # 获得金钱音效(不需要的话可以直接删去该行)
  17. LOSE_GOLD_SE = 'Blow2' # 失去金钱音效(不需要的话可以直接删去该行)
  18. GAIN_ITEM_SE = 'Item1' # 获得物品音效(不需要的话可以直接删去该行)
  19. LOSE_ITEM_SE = LOSE_GOLD_SE # 失去物品音效(不需要的话可以直接删去该行)
  20. #--------------------------------------------------------------------------
  21. module_function
  22. #--------------------------------------------------------------------------
  23. # ● 功能是否启用
  24. #--------------------------------------------------------------------------
  25. def enabled?
  26. SWITCH.zero? || $game_switches[SWITCH]
  27. end
  28. #--------------------------------------------------------------------------
  29. # ● 准备
  30. #--------------------------------------------------------------------------
  31. def prepare(value, item)
  32. @item = item
  33. @value = value
  34. $game_message.background = BACKGROUND
  35. $game_message.position = POSITION
  36. play_se
  37. end
  38. #--------------------------------------------------------------------------
  39. # ● 获取提示的消息
  40. #--------------------------------------------------------------------------
  41. def message
  42. prefix = @value > 0 ? GAIN : LOSE
  43. if @item
  44. sprintf(ITEM_FORMAT, prefix, @item.name, @value.abs)
  45. else
  46. sprintf(GOLD_FORMAT, prefix, @value.abs, Vocab.currency_unit)
  47. end
  48. end
  49. #--------------------------------------------------------------------------
  50. # ● 播放音效
  51. #--------------------------------------------------------------------------
  52. def play_se
  53. const = :"#{@value > 0 ? 'GAIN' : 'LOSE'}_#{@item ? 'ITEM' : 'GOLD'}_SE"
  54. se = const_defined?(const) && const_get(const)
  55. Audio.se_play('Audio/SE/' + se) if se
  56. end
  57. end

  58. class Game_Party < Game_Unit
  59. #--------------------------------------------------------------------------
  60. # ● 获取道具总数(包括装备)
  61. #--------------------------------------------------------------------------
  62. def item_number_with_equip(item)
  63. members.inject(item_number(item)) do |number, actor|
  64. number + actor.equips.count(item)
  65. end
  66. end
  67. end

  68. class Game_Interpreter
  69. alias taroxd_gain_message_command_125 command_125
  70. alias taroxd_gain_message_command_126 command_126
  71. alias taroxd_gain_message_command_127 command_127
  72. alias taroxd_gain_message_command_128 command_128
  73. #--------------------------------------------------------------------------
  74. # ● 显示提示窗口
  75. #--------------------------------------------------------------------------
  76. def show_gain_message(value, item = nil)
  77. return if !Taroxd::GainMessage.enabled? || value.zero?
  78. Taroxd::GainMessage.prepare value, item
  79. wait_for_message
  80. $game_message.add Taroxd::GainMessage.message
  81. wait_for_message
  82. end
  83. #--------------------------------------------------------------------------
  84. # ● 增减持有金钱
  85. #--------------------------------------------------------------------------
  86. def command_125
  87. last_gold = $game_party.gold
  88. taroxd_gain_message_command_125
  89. show_gain_message($game_party.gold - last_gold)
  90. end
  91. #--------------------------------------------------------------------------
  92. # ● 增减物品
  93. #--------------------------------------------------------------------------
  94. def command_126
  95. item = $data_items[@params[0]]
  96. last_num = $game_party.item_number(item)
  97. taroxd_gain_message_command_126
  98. show_gain_message($game_party.item_number(item) - last_num, item)
  99. end
  100. #--------------------------------------------------------------------------
  101. # ● 增减武器
  102. #--------------------------------------------------------------------------
  103. def command_127
  104. item = $data_weapons[@params[0]]
  105. last_num = $game_party.item_number_with_equip(item)
  106. taroxd_gain_message_command_127
  107. value = $game_party.item_number_with_equip(item) - last_num
  108. show_gain_message(value, item)
  109. end
  110. #--------------------------------------------------------------------------
  111. # ● 增减护甲
  112. #--------------------------------------------------------------------------
  113. def command_128
  114. item = $data_armors[@params[0]]
  115. last_num = $game_party.item_number_with_equip(item)
  116. taroxd_gain_message_command_128
  117. value = $game_party.item_number_with_equip(item) - last_num
  118. show_gain_message(value, item)
  119. end
  120. end
复制代码


[box=DarkRed]●狂炎使用的脚本[/box]
半身像对话框
  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=[/【/,    ""]
  21.     SUB2=[/】/,    ""]

  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
复制代码

对话显示姓名
  1. =begin
  2. ===============================================================================
  3. 对话显示姓名 By喵呜喵5
  4. ===============================================================================


  5. 【说明】


  6.   通过在对话中加入


  7.     \name[姓名]


  8.   可以在对话中显示姓名


  9. =end
  10. $m5script ||= {};raise("需要喵呜喵5基础脚本的支持") unless $m5script[:M5Base]
  11. $m5script[:M5Name20141004] = 20141004;M5script.version(20140916)
  12. module M5Name20141004
  13. #==============================================================================
  14. #  设定部分
  15. #==============================================================================


  16.   FONT = "黑体"
  17.   
  18.   # 姓名所使用的字体
  19.   
  20.   SIZE = 20
  21.   
  22.   # 姓名字体的大小
  23.   
  24.   COLOR = Color.new(0,0,0,255)
  25.   
  26.   # 姓名的颜色,四个数值分别是R、G、B以及透明度
  27.   
  28.   SET = [false,false,false,true]
  29.   
  30.   # 中括号中以逗号分隔开的单词分别设置姓名是否加粗、斜体、有阴影、加边框
  31.   # 需要的话填写true,不需要的话填写false
  32.   
  33.   OUT_COLOR = Color.new(-255, -255, -255, 0)
  34.   
  35.   # 姓名边框的颜色,四个数值分别是R、G、B以及透明度
  36.   
  37.   ALIGN =  0
  38.   
  39.   # 姓名的对齐方式,0,1,2分别是居左、居中、居右
  40.   
  41.   NAME_X = - 10
  42.   
  43.   # 姓名的X坐标,数值越大姓名位置越靠近屏幕右侧
  44.   
  45.   NAME_Y = 2
  46.   
  47.   # 姓名的Y坐标,数值越大姓名位置越靠近屏幕底部
  48.   
  49.   DISTANCE = 1
  50.   
  51.   # 对话与姓名的间距,数字越大间距越大
  52.   
  53.   BACK_Y = 0
  54.   
  55.   # 姓名背景的Y坐标,数值越大姓名位置越靠近屏幕底部
  56.   
  57.   BACK_HEIGHT = 5
  58.   
  59.   # 姓名背景的高度,数字越大高度越大


  60.   COLOR1 = Color.new(255, 255, 255, 200)
  61.   
  62.   # 姓名的背景框左边的颜色,四个数值分别是R、G、B以及透明度  
  63.   
  64.   COLOR2 = Color.new(255, 255, 255, 0)
  65.   
  66.   # 姓名的背景框右边的颜色,四个数值分别是R、G、B以及透明度  
  67.   # 不需要背景的话,两个颜色的透明度都填0就好了
  68.   
  69. #==============================================================================
  70. #  设定结束
  71. #==============================================================================
  72. end
  73. class Window_Message
  74.   alias m5_20141004_convert_escape_characters convert_escape_characters
  75.   def convert_escape_characters *arg
  76.     @m5_name = nil
  77.     result = m5_20141004_convert_escape_characters *arg
  78.     result.gsub!(/\eNAME\[(.+)\]/i) { @m5_name = $1; "" }
  79.     result
  80.   end  
  81.   alias m5_20141004_draw_face draw_face
  82.   def draw_face *arg   
  83.     if @m5_name
  84.       temp_font = contents.font.m5_return_all_setting
  85.       contents.font.name = M5Name20141004::FONT
  86.       contents.font.size = M5Name20141004::SIZE
  87.       contents.font.color = M5Name20141004::COLOR
  88.       contents.font.out_color = M5Name20141004::OUT_COLOR
  89.       
  90.       contents.font.bold = M5Name20141004::SET[0]
  91.       contents.font.italic = M5Name20141004::SET[1]
  92.       contents.font.shadow = M5Name20141004::SET[2]
  93.       contents.font.outline = M5Name20141004::SET[3]
  94.       
  95.       name_height = text_size(@m5_name).height
  96.       m5_20141004_draw_back(name_height)
  97.       draw_text([new_line_x + M5Name20141004::NAME_X,0].max,
  98.         M5Name20141004::NAME_Y,self.width - new_line_x,
  99.         name_height +[M5Name20141004::NAME_Y,0].max,@m5_name,
  100.         M5Name20141004::ALIGN)      
  101.       contents.font.m5_set_all_setting(temp_font)
  102.       @m5_name = name_height
  103.     end
  104.     m5_20141004_draw_face *arg
  105.   end
  106.   def m5_20141004_draw_back(height)
  107.     rect = Rect.new(0, M5Name20141004::BACK_Y, self.width,
  108.       height + M5Name20141004::BACK_HEIGHT)
  109.     contents.gradient_fill_rect(rect,
  110.       M5Name20141004::COLOR1, M5Name20141004::COLOR2)
  111.   end
  112.   alias m5_20141004_new_page new_page
  113.   def new_page(text, pos)
  114.     m5_20141004_new_page(text, pos)
  115.     if @m5_name
  116.       pos[:y] += @m5_name + M5Name20141004::DISTANCE
  117.     end
  118.   end  
  119. end
复制代码

RMVA加点系统正常向-v1.03
  1. #encoding:utf-8
  2. #=============================================================================
  3. #-----------RMVA加点系统正常向-v1.03---By:救世小树--------转载请注明出处-------
  4. #=============================================================================

  5. module Point_Tree
  6.   
  7.   POINT_KIND     = 6       #设定加点种类
  8.   LEVEL_UP_POINT = 3       #每升一级自由属性点增加数
  9.   RESET_ITEM     = 20      #洗点水编号
  10.   
  11.   STR_POINT        = ["体力","精神","力量","魔力","韧性","灵活","???"]
  12.   
  13.   #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  14.   POINT_ADD_PARAM = [[12 ,  0,   0,  0,   0,   0,   0,   0],     #体力
  15.                      [0  , 12,   0,  0,   0,   0,   0,   0],     #精神
  16.                      [0  ,  0,   5,  0,   0,   0,   0,   0],     #力量
  17.                      [0  ,  0,   0,  0,   5,   0,   0,   0],     #魔力
  18.                      [0  ,  0,   0,  3,   0,   2,   0,   1],     #韧性
  19.                      [0  ,  0,   0,  0,   0,   0,   3,   0],     #灵活
  20.                      
  21.                      [0,0,0,0,0,0,0,0]]
  22.                      #可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
  23.   
  24.   #分别对应增加       [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
  25.   POINT_ADD_XPARAM = [[0 , 0, 0, 0, 0, 0, 0, 6, 0, 0],
  26.                       [0 , 0, 0, 0, 0, 0, 0, 0, 6, 0],
  27.                       [6 , 6, 0, 0, 0, 0, 0, 0, 0, 0],
  28.                       [0 , 0, 6, 0, 0, 0, 0, 0, 0, 0],
  29.                       [0 , 0, 0, 0, 0, 0, 0, 4, 4, 0],
  30.                       [0 , 6, 0, 6, 6, 0, 0, 0, 0, 0],
  31.                      
  32.                       [0,0,0,0,0,0,0,0,0,0]]
  33.                      #这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
  34.   
  35.   #各种名称
  36.   
  37.   ADDPOINT       = "加点"     #菜单中选项
  38.   POINT_NAME     = "属性点"   #未分配点数
  39.   
  40.   XARAM_NAME     = ["物理命中","物理闪避","必杀","必杀闪避","魔法闪避","魔法反射","物理反击","HP再生","Mp再生","Tp再生"]

  41.   
  42.   def temp_all
  43.     r = 0
  44.     for i in 0 .. POINT_KIND-1
  45.       r+=$temp_point[i]
  46.     end
  47.     return r
  48.   end
  49.   
  50.   def reset(actor_id)
  51.     for i in 1..6
  52.       $game_actors[actor_id].point[0] += $game_actors[actor_id].point[i]
  53.       $game_actors[actor_id].point[i] =0
  54.     end
  55.   end
  56.   
  57. end

  58. $temp_point = []
  59. for i in 0 .. Point_Tree::POINT_KIND-1
  60.   $temp_point.push(0)
  61. end

  62. class Game_Actor < Game_Battler
  63.   include Point_Tree
  64.   attr_accessor :point
  65.   
  66.   alias setup_tre setup
  67.   def setup(actor_id)
  68.     @point = []
  69.     for i in 0 .. POINT_KIND
  70.       @point.push(0)
  71.     end
  72.     setup_tre(actor_id)
  73.   end
  74.   
  75.   
  76.   
  77.   
  78.   alias level_up_tre level_up
  79.   def level_up
  80.     level_up_tre
  81.     @hp += mhp
  82.     @mp += mmp
  83.     @point[0] += LEVEL_UP_POINT
  84.   end
  85.   

  86.   
  87.   def point_plus(param_id)
  88.     r=0
  89.     for i in 1 .. POINT_KIND
  90.       r+=@point[i]*POINT_ADD_PARAM[i-1][param_id]
  91.     end
  92.     return r
  93.   end

  94.   alias point_base_param param
  95.   
  96.   def param(param_id)
  97.     value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
  98.     value *= param_rate(param_id) * param_buff_rate(param_id)
  99.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  100.   end
  101.   def xparam(xparam_id,extra_add = 0)
  102.     xp = super(xparam_id)
  103.     for i in 0 .. POINT_KIND-1
  104.       xp+=(@point[i+1]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  105.     end
  106.     return xp
  107.   end

  108.   def item_apply(user, item)
  109.     super(user, item)
  110.     if item.id == RESET_ITEM and item.is_a?(RPG::Item)
  111.       reset(@actor_id)
  112.       self.hp = [self.hp,self.mhp].min
  113.       self.mp = [self.mp,self.mmp].min
  114.     end
  115.   end
  116.   
  117. end

  118. class Window_Point_Command < Window_Command
  119.   
  120.   include Point_Tree
  121.   #--------------------------------------------------------------------------
  122.   # ● 初始化指令选择位置(类方法)
  123.   #--------------------------------------------------------------------------
  124.   def self.init_command_position
  125.     @@last_command_symbol = nil
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 初始化对象
  129.   #--------------------------------------------------------------------------
  130.   def initialize(actor)
  131.     @status_window = nil
  132.     @actor = actor
  133.     super(0,0)
  134.     select_last
  135.   end
  136.   def actor=(actor)
  137.     return if @actor == actor
  138.     @actor = actor
  139.     refresh
  140.   end
  141.   def status_window=(status_window)
  142.     return if @status_window == status_window
  143.     @status_window = status_window
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 获取窗口的宽度
  147.   #--------------------------------------------------------------------------
  148.   def window_width
  149.     return 160
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 获取显示行数
  153.   #--------------------------------------------------------------------------
  154.   def visible_line_number
  155.     item_max
  156.   end
  157.   def get_actor_point(index)
  158.     s = @actor.point[index+1].to_s
  159.     return "("+s+")+"+$temp_point[index].to_s
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 生成指令列表
  163.   #--------------------------------------------------------------------------
  164.   def make_command_list
  165.     for i in 0 .. POINT_KIND-1
  166.       add_command(STR_POINT[i]   + get_actor_point(i)  , :point_add  ,add_enabled)
  167.     end
  168.     add_command("确认",  :point_ok)
  169.     add_command("取消",  :point_cancle)
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 按下确定键时的处理
  173.   #--------------------------------------------------------------------------
  174.   def process_ok
  175.     @@last_command_symbol = current_symbol
  176.     super
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 返回最后一个选项的位置
  180.   #--------------------------------------------------------------------------
  181.   def select_last
  182.     select_symbol(@@last_command_symbol)
  183.   end
  184.   
  185.   def add_enabled
  186.     temp_all < @actor.point[0]
  187.   end

  188.   def update_help
  189.     @help_window.set_text(self.index+1) if @help_window
  190.     @status_window.index = self.index if @status_window
  191.   end
  192. end

  193. #帮助窗口
  194. class Window_Point_Help < Window_Base
  195.   include Point_Tree
  196.   def initialize(x,y,w,h)
  197.     super(x, y, w, h)
  198.    
  199.    
  200.   end
  201.   def set_text(id)
  202.     contents.clear
  203.     if id <= POINT_KIND
  204.       text = "\\}提升一点该属性"
  205.     elsif id == POINT_KIND+1
  206.       text = "\\}确认此次加点分配"
  207.     elsif  id == POINT_KIND+2
  208.       text = "\\}取消此次加点分配"
  209.     end
  210.     draw_text_ex(8, 8, text)
  211.   end
  212. end


  213. #角色状态窗口
  214. class Window_Point_Actor < Window_Base
  215.   include Point_Tree
  216.   
  217.   
  218.   def initialize(actor)
  219.     super(160, 0, Graphics.width - 160, Graphics.height)
  220.     @actor = actor
  221.     @index = 0
  222.     refresh
  223.   end
  224.   def actor=(actor)
  225.     return if @actor == actor
  226.     @actor = actor
  227.     refresh
  228.   end
  229.   def index=(index)
  230.     return if @index == index
  231.     @index = index
  232.     refresh
  233.   end
  234.   def line_height
  235.     return 24
  236.   end
  237.   def refresh
  238.     contents.clear
  239.     contents.font.size = 24
  240.     draw_actor_name(@actor, 100, 0)
  241.     draw_actor_class(@actor, 240, 0)
  242.     draw_actor_face(@actor, 2, 0)
  243.     contents.font.size = 20
  244.     draw_actor_level(@actor, 102,  24)
  245.     draw_actor_point(100,48)
  246.     contents.font.size = 16
  247.     draw_actor_param_point(8,16 * 6)
  248.     draw_actor_xparam_point(8,16 * 14)
  249.   end
  250.   def draw_actor_point(x,y)
  251.     draw_text(x,y,200,line_height,"  未分配"+POINT_NAME + ":" + @actor.point[0].to_s)
  252.     draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
  253.   end
  254.   def draw_actor_param_point(x,y)
  255.     8.times {|i| draw_actor_param_to_s(x,y,i)}
  256.   end
  257.   def draw_actor_xparam_point(x,y)
  258.     10.times {|i| draw_actor_xparam_to_s(x,y,i)}
  259.   end
  260.   
  261.   def draw_actor_param_to_s(x,y,param_id)
  262.     a=0
  263.     for i in 0 .. POINT_KIND-1
  264.       a+=$temp_point[i]*POINT_ADD_PARAM[i][param_id]
  265.     end
  266.     s1 = Vocab::param(param_id)
  267.     s2 = @actor.param(param_id).to_s
  268.     s3 = (@actor.param(param_id)+a).to_s
  269.     if @index < POINT_KIND
  270.       if POINT_ADD_PARAM[@index][param_id]==0
  271.         s4 = ""
  272.       else
  273.         s4 = "+" + POINT_ADD_PARAM[@index][param_id].to_s
  274.       end
  275.     else
  276.       s4 = ""
  277.     end
  278.    
  279.     change_color(system_color)
  280.     draw_text(x,y+16*param_id,100,line_height,s1)
  281.     change_color(normal_color)
  282.     s2+= " →"
  283.     draw_text(x+82,y+16*param_id,120,line_height,s2,2)
  284.     change_color(system_color)
  285.     draw_text(x+150,y+16*param_id,100,line_height,s3,2)
  286.     change_color(normal_color)
  287.     contents.font.size = 14
  288.     draw_text(x+266,y+16*param_id,100,line_height,s4)
  289.     contents.font.size = 16
  290.   end
  291.   def draw_actor_xparam_to_s(x,y,xparam_id)
  292.     a=0.00
  293.     for i in 0 .. POINT_KIND-1
  294.       a+=($temp_point[i]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  295.     end
  296.     s1 = XARAM_NAME[xparam_id]
  297.     s2 = sprintf("%02.2f%%",@actor.xparam(xparam_id)*100)
  298.     s3 = sprintf("%02.2f%%",(@actor.xparam(xparam_id) + a)*100)

  299.     if @index < POINT_KIND
  300.       if POINT_ADD_XPARAM[@index][xparam_id]==0
  301.         s4=""
  302.       else
  303.         s4 = sprintf("+%02.2f%%",POINT_ADD_XPARAM[@index][xparam_id]/100.0)
  304.       end
  305.     else
  306.       s4 = ""
  307.     end
  308.    
  309.     change_color(system_color)
  310.     draw_text(x,y+16*xparam_id,100,line_height,s1)
  311.     change_color(normal_color)
  312.     s2+= " →"
  313.     draw_text(x+82,y+16*xparam_id,120,line_height,s2,2)
  314.     change_color(system_color)
  315.     draw_text(x+150,y+16*xparam_id,100,line_height,s3,2)
  316.     change_color(normal_color)
  317.     contents.font.size = 14
  318.     draw_text(x+266,y+16*xparam_id,100,line_height,s4)
  319.     contents.font.size = 16
  320.    
  321.    
  322.   end
  323. end

  324. class Scene_Point < Scene_Base
  325.   include Point_Tree
  326.   def start
  327.     super
  328.     create_background
  329.     @actor = $game_party.menu_actor
  330.     create_command_window
  331.     create_status_window
  332.     create_help_window
  333.     @command_window.activate
  334.   end
  335.   def terminate
  336.     super
  337.     dispose_background
  338.   end
  339.   def create_background
  340.     @background_sprite = Sprite.new
  341.     @background_sprite.bitmap = SceneManager.background_bitmap
  342.     @background_sprite.color.set(16, 16, 16, 128)
  343.   end
  344.   def dispose_background
  345.     @background_sprite.dispose
  346.   end
  347.   
  348.   def create_command_window
  349.     @command_window = Window_Point_Command.new(@actor)
  350.     @command_window.set_handler(:cancel,      method(:return_scene))
  351.     @command_window.set_handler(:pagedown,    method(:next_actor))
  352.     @command_window.set_handler(:pageup,      method(:prev_actor))
  353.     @command_window.set_handler(:point_add,   method(:add_point))
  354.     @command_window.set_handler(:point_ok,    method(:add_ok))
  355.     @command_window.set_handler(:point_cancle,method(:add_cancle))
  356.    
  357.   end
  358.   def return_scene
  359.     add_cancle
  360.     SceneManager.return
  361.   end
  362.   def create_status_window
  363.     @status_window = Window_Point_Actor.new(@actor)
  364.     @command_window.status_window = @status_window
  365.   end
  366.   def create_help_window
  367.     @help_window = Window_Point_Help.new(0,@command_window.height,160,Graphics.height-@command_window.height)
  368.     #(0, 216, 160, 200)
  369.     @help_window.viewport = @viewport
  370.     @command_window.help_window = @help_window
  371.   end
  372.   
  373.   def add_point
  374.     if temp_all >= @actor.point[0]
  375.       @command_window.activate
  376.       return
  377.     end
  378.     $temp_point[@command_window.index] += 1
  379.     @status_window.refresh
  380.     @command_window.refresh
  381.     @command_window.activate
  382.   end
  383.   

  384.   def add_ok
  385.     for i in 0 .. POINT_KIND-1
  386.       @actor.point[i+1] += $temp_point[i]
  387.     end
  388.     @actor.point[0]-= temp_all
  389.     add_cancle
  390.   end
  391.   
  392.   def add_cancle
  393.     for i in 0 .. POINT_KIND-1
  394.       $temp_point[i]=0
  395.     end
  396.     @status_window.refresh
  397.     @command_window.refresh
  398.     @command_window.activate
  399.   end
  400.   
  401.   
  402.   def next_actor
  403.     @actor = $game_party.menu_actor_next
  404.     on_actor_change
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ● 切换到上一个角色
  408.   #--------------------------------------------------------------------------
  409.   def prev_actor
  410.     @actor = $game_party.menu_actor_prev
  411.     on_actor_change
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 切换角色
  415.   #--------------------------------------------------------------------------
  416.   def on_actor_change
  417.     add_cancle
  418.     @status_window.actor = @actor
  419.     @command_window.actor = @actor
  420.     @command_window.activate
  421.   end
  422.   
  423. end

  424. class Window_MenuCommand < Window_Command
  425.   alias add_original_commands_old add_original_commands
  426.   def add_original_commands
  427.     add_original_commands_old
  428.     add_command(Point_Tree::ADDPOINT,    :addpoint)
  429.   end
  430. end

  431. class Scene_Menu < Scene_MenuBase
  432.   alias create_command_window_old create_command_window
  433.   def create_command_window
  434.     create_command_window_old
  435.     @command_window.set_handler(:addpoint,method(:add_point))
  436.   end
  437.   def add_point
  438.     @status_window.select_last
  439.     @status_window.activate
  440.     @status_window.set_handler(:ok,     method(:on_ok))
  441.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  442.   end
  443.   def on_ok
  444.     SceneManager.call(Scene_Point)
  445.     Window_Point_Command::init_command_position
  446.   end
  447. end



  448. class Scene_ItemBase < Scene_MenuBase
  449.   def item_usable?
  450.     if item.id == Point_Tree::RESET_ITEM and item.is_a?(RPG::Item)
  451.       return true
  452.     end
  453.     user.usable?(item) && item_effects_valid?
  454.   end
  455. end






  456. class Window_Status < Window_Selectable
  457.   include Point_Tree
  458.   alias draw_parameters_old draw_parameters
  459.   def draw_parameters(x, y)
  460.     draw_parameters_old(x,y)
  461.     draw_point(x,y)
  462.   end
  463.   def draw_point(x,y)
  464.     for i in 0..5
  465.       change_color(system_color)
  466.       
  467.       
  468.       draw_text(x+100, y+ line_height * i, 80, line_height, STR_POINT[i])
  469.       change_color(normal_color)
  470.       draw_text(x+180, y+ line_height * i, 36, line_height,@actor.point[i+1].to_s, 2)
  471.     end
  472.   end
  473.   
  474. end

  475. class Window_Base < Window
  476.   def draw_actor_param(actor, x, y, param_id)
  477.     change_color(system_color)
  478.     draw_text(x-30, y, 80, line_height, Vocab::param(param_id))
  479.     change_color(normal_color)
  480.     draw_text(x+ 50, y, 36, line_height, actor.param(param_id), 2)
  481.   end
  482. end
复制代码

简易式存档界面
  1. =begin
  2. ===============================================================================
  3.   简易式存档界面 By喵呜喵5
  4. ===============================================================================


  5. 【说明】
  6.   
  7.   给存档数目只有一个的游戏使用的简易式存档界面
  8.   
  9.   在事件中使用脚本“load”可以快速读档(适用于使用事件作为标题菜单的情况)  
  10.   
  11. =end
  12. module M5SimpleSave
  13. #==============================================================================
  14. #  设定部分
  15. #==============================================================================
  16.   
  17.   SAVE_NAME = "SAVE"
  18.   #存档的文件名
  19.   
  20.   SAVE_OPTION = "保存记录"
  21.   #存档按钮的提示文字
  22.   
  23.   CANCLE_OPTION = "回到游戏"
  24.   #取消按钮的提示文字
  25.   
  26.   SAVING_HINT = "保存中"
  27.   #存档时的提示文字
  28.   
  29.   SAVE_HINT = "记录已保存"
  30.   #存档完成时的提示文字
  31.   
  32.   SAVE_SE = "Save"
  33.   #存档完成时播放的音效
  34.   
  35.   LOAD_SE = "Load"
  36.   #读档完成时播放的音效
  37.   
  38.   LOAD_ERROR = "没有发现可以使用的存档"
  39.   #读档失败时的提示文字
  40.   
  41.   LOAD_ERROR_SE = "Buzzer1"
  42.   #读档失败时播放的音效
  43.   
  44. #==============================================================================
  45. #  设定结束
  46. #==============================================================================
  47. end
  48. class Window_Hint < Window_Base  
  49.   def initialize(x = 0,y = 90,height = 80)
  50.     super(x,y,Graphics.width, height)
  51.   end  
  52.   def write_text(text)
  53.     contents.clear
  54.     draw_text(0,0,Graphics.width,fitting_height(1),text,1)
  55.   end  
  56.   def line_height
  57.     Font.default_size
  58.   end
  59. end
  60. class Window_SimpleSave < Window_Command
  61.   def initialize
  62.     super(0, 0)
  63.     update_placement
  64.     self.openness = 0
  65.     open
  66.   end
  67.   def window_width
  68.     160   
  69.   end
  70.   def update_placement
  71.     self.x = (Graphics.width - width) / 2
  72.     self.y = (Graphics.height - height) / 2
  73.   end
  74.   def make_command_list
  75.     add_command(M5SimpleSave::SAVE_OPTION, :save)   
  76.     add_command(M5SimpleSave::CANCLE_OPTION, :cancel)
  77.   end
  78.   def alignment
  79.     return 1
  80.   end
  81. end
  82. class Scene_SimpleSave < Scene_MenuBase
  83.   def start
  84.     super
  85.     create_command_window
  86.   end
  87.   def pre_terminate
  88.     super
  89.     close_command_window
  90.   end
  91.   def create_command_window
  92.     @command_window = Window_SimpleSave.new
  93.     @command_window.set_handler(:save, method(:command_save))   
  94.     @command_window.set_handler(:cancel,   method(:return_scene))
  95.   end
  96.   def close_command_window
  97.     @command_window.close
  98.     update until @command_window.close?
  99.   end  
  100.   def command_save
  101.     DataManager.save_game(1)
  102.     hint = Window_Hint.new
  103.     Graphics.wait(10)
  104.     5.times {|i| hint.write_text(M5SimpleSave::SAVING_HINT+"."*(i+1)); Graphics.wait(20)}
  105.     Graphics.wait(40)
  106.     Audio.se_play("Audio/SE/"+M5SimpleSave::SAVE_SE)
  107.     hint.write_text(M5SimpleSave::SAVE_HINT)
  108.     Graphics.wait(10)
  109.     loop do
  110.       Input.update     
  111.       break if Input.trigger?(:C)      
  112.     end
  113.     hint.dispose   
  114.     return_scene
  115.   end  
  116. end
  117. class << DataManager
  118.   def make_filename(index)
  119.     M5SimpleSave::SAVE_NAME
  120.   end
  121.   def savefile_max
  122.     1
  123.   end
  124.   def save_file_exists?
  125.     !Dir.glob(M5SimpleSave::SAVE_NAME).empty?
  126.   end
  127. end
  128. class Scene_File
  129.   def visible_max
  130.     1
  131.   end
  132. end
  133. class Game_Interpreter
  134.   def load
  135.     if FileTest.exist?(M5SimpleSave::SAVE_NAME)
  136.       load_success
  137.     else
  138.       load_error
  139.     end
  140.   end  
  141.   def save
  142.     SceneManager.call(Scene_SimpleSave)
  143.   end
  144.   def load_success
  145.     Audio.se_play("Audio/SE/"+M5SimpleSave::LOAD_SE)
  146.     DataManager.load_game(1)
  147.     RPG::BGM.fade(1000)
  148.     RPG::BGS.fade(1000)
  149.     RPG::ME.fade(1000)
  150.     Graphics.fadeout(1000 * Graphics.frame_rate / 1000)
  151.     RPG::BGM.stop
  152.     RPG::BGS.stop
  153.     RPG::ME.stop
  154.     $game_system.on_after_load
  155.     SceneManager.goto(Scene_Map)
  156.   end
  157.   def load_error
  158.     Audio.se_play("Audio/SE/"+M5SimpleSave::LOAD_ERROR_SE)
  159.     hint = Window_Hint.new(0,Graphics.height/2 - 40)
  160.     hint.write_text(M5SimpleSave::LOAD_ERROR)
  161.     Graphics.wait(10)
  162.     loop do
  163.       Input.update
  164.       break if Input.trigger?(:C)
  165.     end
  166.     hint.dispose
  167.   end  
  168. end
  169. Scene_Save = Scene_SimpleSave
复制代码

Symbol
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Symbol
  4. #------------------------------------------------------------------------------
  5. #  。
  6. #==============================================================================
  7. $apicache = {}
  8. class Symbol
  9.   #--------------------------------------------------------------------------
  10.   # ● 轉為Win32API
  11.   #--------------------------------------------------------------------------
  12.   def to_api
  13.     $apicache[self] = Win32API.new(*self.to_s.split("|")) unless $apicache.include? self
  14.     return $apicache[self]
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 轉為Win32API並呼叫
  18.   #--------------------------------------------------------------------------
  19.   def apicall(*args)
  20.     self.to_api.call(*args)
  21.   end
  22. end
复制代码

MainWindow
  1. #encoding:utf-8
  2. # 纯脚本不使用DLL就读取窗口消息
  3. # By 晴兰 form 66RPG
  4. # 功能擴充 By AAM@_@
  5. #==============================================================================
  6. # ■ MainWindow
  7. #------------------------------------------------------------------------------
  8. #  。
  9. #==============================================================================

  10. module MainWindow
  11.   #--------------------------------------------------------------------------
  12.   # ● 部分Windows消息定义
  13.   #--------------------------------------------------------------------------
  14.   WM_CREATE                       = 0x0001
  15.   WM_DESTROY                      = 0x0002
  16.   WM_MOVE                         = 0x0003
  17.   WM_SIZE                         = 0x0005
  18.   
  19.   WM_ACTIVATE                     = 0x0006
  20.   WM_ACTIVATEAPP                  = 0x001C

  21.   WM_GETTEXT                      = 0x000D
  22.   WM_GETTEXTLENGTH                = 0x000E
  23.   WM_PAINT                        = 0x000F
  24.   WM_CLOSE                        = 0x0010
  25.   WM_QUERYENDSESSION              = 0x0011
  26.   WM_QUIT                         = 0x0012
  27.   
  28.   WM_KEYDOWN                      = 0x0100
  29.   WM_KEYUP                        = 0x0101
  30.   WM_CHAR                         = 0x0102

  31.   WM_SYSKEYDOWN                   = 0x0104
  32.   WM_SYSKEYUP                     = 0x0105
  33.   WM_SYSCHAR                      = 0x0106

  34.   WM_COMMAND                      = 0x0111
  35.   WM_SYSCOMMAND                   = 0x0112
  36.   WM_TIMER                        = 0x0113

  37.   WM_MOUSEMOVE                    = 0x0200
  38.   WM_LBUTTONDOWN                  = 0x0201
  39.   WM_LBUTTONUP                    = 0x0202
  40.   WM_LBUTTONDBLCLK                = 0x0203
  41.   WM_RBUTTONDOWN                  = 0x0204
  42.   WM_RBUTTONUP                    = 0x0205
  43.   WM_RBUTTONDBLCLK                = 0x0206
  44.   WM_MBUTTONDOWN                  = 0x0207
  45.   WM_MBUTTONUP                    = 0x0208
  46.   WM_MBUTTONDBLCLK                = 0x0209

  47.   WM_MOUSEWHEEL                   = 0x020A
  48.   
  49.   RM_F1MENU_OPEN                  = 0x0112
  50.   RM_F1MENU_CLOSE                 = 0x0125
  51.   #--------------------------------------------------------------------------
  52.   # ● 其他常量定义
  53.   #--------------------------------------------------------------------------
  54.   WA_INACTIVE                     = 0
  55.   WA_ACTIVE                       = 1
  56.   WA_CLICKACTIVE                  = 2
  57.   #--------------------------------------------------------------------------
  58.   # ●
  59.   #--------------------------------------------------------------------------
  60.   @@ShowCursor = :"user32|ShowCursor|i|l".to_api
  61.   @@handle = false # 禁用默认窗口过程
  62.   @@procs = {}
  63.   @@child_procs = {}
  64.   @@child_callback = {}
  65.   @@child_def_procs = {}
  66.   #--------------------------------------------------------------------------
  67.   # ● 窗口过程函数 ※ 该名字切勿更改
  68.   #--------------------------------------------------------------------------
  69.   def self.wnd_proc(hwnd,msg,wparam,lparam)
  70.     # 消息分歧
  71.     case msg
  72.     when WM_CREATE
  73.     when WM_MOVE
  74.     when WM_ACTIVATEAPP
  75.       if wparam == WA_INACTIVE
  76.         #SNSER.chn_pause_all
  77.         Input.lock_all_key
  78.         @@ShowCursor.call(1)
  79.       else
  80.         #SNSER.chn_resume_all
  81.         Input.unlock_all_key
  82.         @@ShowCursor.call(0)
  83.       end
  84.     when WM_LBUTTONDOWN
  85.       Input.key_down(Input::M_L)
  86.     when WM_LBUTTONUP
  87.       Input.key_up(Input::M_L)
  88.     when WM_LBUTTONDBLCLK
  89.       Input.set_dbclick(Input::M_L)
  90.     when WM_RBUTTONDOWN
  91.       Input.key_down(Input::M_R)
  92.     when WM_RBUTTONUP
  93.       Input.key_up(Input::M_R)
  94.     when WM_RBUTTONDBLCLK
  95.       Input.set_dbclick(Input::M_R)
  96.     when WM_MBUTTONDOWN
  97.       Input.key_down(Input::M_M)
  98.     when WM_MBUTTONUP
  99.       Input.key_up(Input::M_M)
  100.     when WM_MBUTTONDBLCLK
  101.       Input.set_dbclick(Input::M_M)
  102.     when WM_MOUSEWHEEL
  103.       Input.set_mouse_wheel(wparam)
  104.     when WM_MOUSEMOVE
  105.       Input.set_mouse_pos(lparam)
  106.     when WM_KEYDOWN
  107.       Input.key_down(wparam)
  108.     when WM_KEYUP
  109.       Input.key_up(wparam)
  110.     when WM_SYSKEYDOWN
  111.       Input.key_down(wparam)
  112.     when WM_SYSKEYUP
  113.       Input.key_up(wparam)
  114.     when WM_SIZE
  115.     when RM_F1MENU_OPEN
  116.       @@ShowCursor.call(1)
  117.     when RM_F1MENU_CLOSE
  118.       @@ShowCursor.call(0)
  119.     else
  120.     end
  121.     # 調用其他外插的視窗訊息
  122.     if !@@procs.empty?
  123.       @@procs.each_value do |i|
  124.         begin
  125.           i.call(hwnd,msg,wparam,lparam)
  126.         rescue
  127.         end
  128.       end
  129.     end
  130.     # 调用默认窗口过程
  131.     self.use_rm_proc(hwnd,msg,wparam,lparam)
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ●
  135.   #--------------------------------------------------------------------------
  136.   def self.add_proc(symbol, method)
  137.     @@procs[symbol] = method
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ●
  141.   #--------------------------------------------------------------------------
  142.   def self.remove_proc(symbol)
  143.     @@procs.delete(symbol)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ●
  147.   #--------------------------------------------------------------------------
  148.   def self.use_rm_proc(hwnd, msg, wp, lp)
  149.     return :"user32|CallWindowProc|iiiii|i".apicall(@@oHandle, hwnd, msg, wp, lp) if !@@handle
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ●
  153.   #--------------------------------------------------------------------------
  154.   def self.disable_rm_proc
  155.     @@handle = true
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ●
  159.   #--------------------------------------------------------------------------
  160.   def self.enable_rm_proc
  161.     @@handle = false
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ●
  165.   #--------------------------------------------------------------------------
  166.   def self.child_def_proc(symbol, hwnd, msg, wp, lp)
  167.     return :"user32|CallWindowProc|iiiii|i".apicall(@@child_def_procs[hwnd], hwnd, msg, wp, lp)
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● ??? ※ 该名字切勿更改
  171.   #--------------------------------------------------------------------------
  172.   def self.child_wnd_proc(symbol, hwnd, msg, wparam, lparam)
  173.     begin
  174.       @@child_procs[symbol].call(hwnd,msg,wparam,lparam)
  175.     rescue
  176.     end
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ●
  180.   #--------------------------------------------------------------------------
  181.   def self.disableChildWndProc(hwnd)
  182.     :"user32|SetWindowLong|iii|i".apicall(hwnd, -4, @@child_def_procs[hwnd])
  183.     @@child_def_procs.delete(hwnd)
  184.     :"msvcrt|free|i|i".apicall(@@child_callback[hwnd])
  185.     @@child_callback.delete(hwnd)
  186.     @@child_procs.delete(hwnd)
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ●
  190.   #--------------------------------------------------------------------------
  191.   def self.enableChildWndProc(hwnd, proc)
  192.     @@child_procs[hwnd] = proc
  193.    
  194.     @malloc = :"msvcrt|malloc|i|i"
  195.     @memcpy = :"msvcrt|memcpy|ipi|v"
  196.    
  197.     sprintf    = self.findProc("msvcrt", "sprintf")
  198.     rgsseval   = self.findProc("RGSS300", "RGSSGetInt")
  199.     oHandle  = :"user32|GetWindowLong|ll|l".apicall(hwnd, -4)
  200.     buf        = @malloc.apicall(1024)
  201.     fmt        = @malloc.apicall(2048)
  202.     sprintfvar = @malloc.apicall(8)
  203.     rgssevalvar= @malloc.apicall(8)
  204.     oldvar     = @malloc.apicall(8)
  205.     fmtvar     = @malloc.apicall(8)
  206.     bufvar     = @malloc.apicall(8)
  207.     defvar     = @malloc.apicall(8)
  208.    
  209.     @@child_def_procs[hwnd] = oHandle
  210.    
  211.     :"msvcrt|strcpy|pp|p".apicall(fmt, "MainWindow.child_wnd_proc(#{hwnd},%d,%d,%d,%d)")
  212.    
  213.     @memcpy.apicall(sprintfvar, [sprintf].pack("i"),   4)
  214.     @memcpy.apicall(rgssevalvar,[rgsseval].pack("i"),  4)
  215.     @memcpy.apicall(oldvar,     [@@oHandle].pack("i"), 4)
  216.     @memcpy.apicall(fmtvar,     [fmt].pack("i"),       4)
  217.     @memcpy.apicall(bufvar,     [buf].pack("i"),       4)
  218.     @memcpy.apicall(defvar,     [oHandle].pack("i"), 4)
  219.    
  220.     code = [0x55,0x89,0xe5,0xff,0x75,0x14,
  221.              0xff,0x75,0x10,0xff,0x75,0x0c,
  222.              0xff,0x75,0x08,0xff,0x35].pack('C*')
  223.     code << [fmtvar].pack('l') << [0xff, 0x35].pack('C*')
  224.     code << [bufvar].pack('l') << [0xff, 0x15].pack('C*')
  225.     code << [sprintfvar].pack("l")
  226.     code << [0xff, 0x15].pack('C*')
  227.     code << [rgssevalvar].pack("l")
  228.     code << [0x83,0xc4,0x18].pack('C*')
  229.     code << [0xc9,0xc2,0x10,0x00].pack('C*')
  230.     #0xD1, 0xE8
  231.     shellcode = @malloc.apicall(2048)
  232.     @memcpy.apicall(shellcode, code, code.size)
  233.     :"user32|SetWindowLong|iii|i".apicall(hwnd, -4, shellcode)
  234.     @@child_callback[hwnd] = shellcode
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ●
  238.   #--------------------------------------------------------------------------
  239.   def self.enable
  240.     MainWindow.instance_eval do
  241.       # 清空 enable 方法(避免重複呼叫)
  242.       def self.enable
  243.       end
  244.       # 取得 HWND
  245.       @msg = "\0" * 24
  246.       @hwnd = 0
  247.       while @hwnd == 0
  248.         :"user32|GetMessage|piii|v".apicall(@msg, 0, 0, 0)
  249.         @kmsg = @msg
  250.         :"user32|TranslateMessage|p|v".apicall(@kmsg)
  251.         :"user32|DispatchMessage|p|v".apicall(@kmsg)
  252.         @hwnd = @msg.unpack("i*")[0]
  253.       end
  254.       @hdc = :"user32|GetDC|i|i".apicall(@hwnd)
  255.       # 方法:取得HWND
  256.       def self.hwnd
  257.         return @hwnd
  258.       end
  259.       # 方法:取得HDC
  260.       def self.hdc
  261.         return @hdc
  262.       end
  263.       # 方法:取得HWNDProc
  264.       def self.findProc(l, n)
  265.         lib = :"kernel32|LoadLibrary|p|i".apicall(l)
  266.         ret = :"kernel32|GetProcAddress|ip|l".apicall(lib, n)
  267.         :"kernel32|FreeLibrary|l|v".apicall(lib)
  268.         return ret
  269.       end
  270.       # 方法:Hook HWNDProc
  271.       def self.enableWndProc
  272.         # 清空 enableWndProc 方法(避免重複呼叫)
  273.         MainWindow.instance_eval do
  274.           def self.enableWndProc
  275.           end
  276.         end
  277.         @malloc = :"msvcrt|malloc|i|i"
  278.         @memcpy = :"msvcrt|memcpy|ipi|v"
  279.         
  280.         sprintf    = self.findProc("msvcrt", "sprintf")
  281.         rgsseval   = self.findProc("RGSS300", "RGSSGetInt")
  282.         @@oHandle  = :"user32|GetWindowLong|ll|l".apicall(@hwnd, -4)
  283.         buf        = @malloc.apicall(1024)
  284.         fmt        = @malloc.apicall(2048)
  285.         sprintfvar = @malloc.apicall(8)
  286.         rgssevalvar= @malloc.apicall(8)
  287.         oldvar     = @malloc.apicall(8)
  288.         fmtvar     = @malloc.apicall(8)
  289.         bufvar     = @malloc.apicall(8)
  290.         defvar     = @malloc.apicall(8)
  291.         
  292.         :"msvcrt|strcpy|pp|p".apicall(fmt, "MainWindow.wnd_proc(%d,%d,%d,%d)")
  293.         
  294.         @memcpy.apicall(sprintfvar, [sprintf].pack("i"),   4)
  295.         @memcpy.apicall(rgssevalvar,[rgsseval].pack("i"),  4)
  296.         @memcpy.apicall(oldvar,     [@@oHandle].pack("i"), 4)
  297.         @memcpy.apicall(fmtvar,     [fmt].pack("i"),       4)
  298.         @memcpy.apicall(bufvar,     [buf].pack("i"),       4)
  299.         @memcpy.apicall(defvar,     [self.findProc("user32", "DefWindowProcA")].pack("i"), 4)
  300.         
  301.         @code = [0x55,0x89,0xe5,0xff,0x75,0x14,
  302.                  0xff,0x75,0x10,0xff,0x75,0x0c,
  303.                  0xff,0x75,0x08,0xff,0x35].pack('C*')
  304.         @code << [fmtvar].pack('l') << [0xff, 0x35].pack('C*')
  305.         @code << [bufvar].pack('l') << [0xff, 0x15].pack('C*')
  306.         @code << [sprintfvar].pack("l")
  307.         @code << [0xff, 0x15].pack('C*')
  308.         @code << [rgssevalvar].pack("l")
  309.         @code << [0x83,0xc4,0x18].pack('C*')
  310.         @code << [0xc9,0xc2,0x10,0x00].pack('C*')
  311.         #0xD1, 0xE8
  312.         @shellcode = @malloc.apicall(2048)
  313.         @memcpy.apicall(@shellcode, @code, @code.size)
  314.         :"user32|SetWindowLong|iii|i".apicall(@hwnd, -4, @shellcode)
  315.       end
  316.     end
  317.   end
  318. end


  319. MainWindow.enable
  320. MainWindow.enableWndProc
复制代码

String
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ String
  4. #------------------------------------------------------------------------------
  5. #  字符串类。可处理任意长度的字节串。 (追加编码转换的定义)
  6. #==============================================================================

  7. class String
  8.   #--------------------------------------------------------------------------
  9.   # ●
  10.   #--------------------------------------------------------------------------
  11.   CP_ACP = 0
  12.   CP_UTF8 = 65001
  13.   CP_UTF16 = 1200
  14.   #--------------------------------------------------------------------------
  15.   # ●
  16.   #--------------------------------------------------------------------------
  17.   def u2s
  18.     m2w = :"kernel32|MultiByteToWideChar|ilpipi|i".to_api
  19.     w2m = :"kernel32|WideCharToMultiByte|ilpipipp|i".to_api
  20.    
  21.     len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
  22.     buf = "\0" * (len*2)
  23.     m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)
  24.    
  25.     len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
  26.     ret = "\0" * len
  27.     w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)
  28.    
  29.     return ret
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ●
  33.   #--------------------------------------------------------------------------
  34.   def s2u
  35.     m2w = :"kernel32|MultiByteToWideChar|ilpipi|i".to_api
  36.     w2m = :"kernel32|WideCharToMultiByte|ilpipipp|i".to_api
  37.   
  38.     len = m2w.call(CP_ACP, 0, self, -1, nil, 0);
  39.     buf = "\0" * (len*2)
  40.     m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);
  41.   
  42.     len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
  43.     ret = "\0" * len
  44.     w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
  45.      
  46.     return ret
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ●
  50.   #--------------------------------------------------------------------------
  51.   def u2w
  52.     m2w = :"kernel32|MultiByteToWideChar|ilpipi|i".to_api
  53.    
  54.     len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
  55.     buf = "\0" * (len*2)
  56.     m2w.call(CP_UTF8, 0, self, -1, buf, len)
  57.    
  58.     return buf
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ●
  62.   #--------------------------------------------------------------------------
  63.   def w2u
  64.     w2m = :"kernel32|WideCharToMultiByte|ilpipipp|i".to_api
  65.    
  66.     len = w2m.call(CP_UTF8, 0, self, -1, nil, 0, nil, nil)
  67.     buf = "\0" * len
  68.     w2m.call(CP_UTF8, 0, self, -1, buf, len, nil, nil)
  69.    
  70.     return buf
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ●
  74.   #--------------------------------------------------------------------------
  75.   def s2u!
  76.     self[0, length] = s2u
  77.   end  
  78.   #--------------------------------------------------------------------------
  79.   # ●
  80.   #--------------------------------------------------------------------------
  81.   def u2s!
  82.     self[0, length] = u2s
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ●
  86.   #--------------------------------------------------------------------------
  87.   def u2w!
  88.     self[0, length] = u2u16
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ●
  92.   #--------------------------------------------------------------------------
  93.   def w2u!
  94.     self[0, length] = u162u
  95.   end
  96. end
复制代码

TextBox
  1. #==============================================================================
  2. # ■ TextBox By AAM@_@
  3. #------------------------------------------------------------------------------
  4. #  输入框的类。
  5. #==============================================================================
  6. class TextBox
  7.   #--------------------------------------------------------------------------
  8.   # ● 设置API
  9.   #--------------------------------------------------------------------------
  10.   @@CreateWindow = :"user32|CreateWindowEx|lpplllllllll|l".to_api
  11.   @@ShowWindow = :"user32|ShowWindow|ll|l".to_api
  12.   @@DestroyWindow = :"user32|DestroyWindow|l|l".to_api
  13.   @@SetWindowPos = :"user32|SetWindowPos|lllllll|l".to_api
  14.   @@GetWindowRect = :"user32|GetWindowRect|ll|l".to_api
  15.   @@GetWindowText = :"user32|GetWindowText|lpl|l".to_api
  16.   @@GetWindowTextLength = :"user32|GetWindowTextLength|l|l".to_api
  17.   @@SetWindowText = :"user32|SetWindowText|lp|l".to_api
  18.   @@UpdateWindow = :"user32|UpdateWindow|l|i".to_api
  19.   @@SetFocus = :"user32|SetFocus|l|l".to_api
  20.   @@SendMessage = :"user32|SendMessage|llll|l".to_api
  21.   @@SendMessage_Pos = :"user32|SendMessage|llpp|l".to_api
  22.   @@CreateFont = :"gdi32|CreateFont|lllllllllllllp|l".to_api
  23.   #--------------------------------------------------------------------------
  24.   # ● 定义实例变量
  25.   #--------------------------------------------------------------------------
  26.   attr_accessor :focus
  27.   attr_reader   :font_name
  28.   attr_reader   :font_size
  29.   attr_reader   :password
  30.   #--------------------------------------------------------------------------
  31.   # ●
  32.   #--------------------------------------------------------------------------
  33.   def default_font_name
  34.     return Font.default_name if Font.default_name.is_a?(String)
  35.     for i in Font.default_name
  36.       return i if Font.exist?(i)
  37.     end
  38.     return ""
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ●
  42.   #--------------------------------------------------------------------------
  43.   def font_name=(f)
  44.     @font_name = f
  45.     update_font
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ●
  49.   #--------------------------------------------------------------------------
  50.   def font_size=(s)
  51.     @font_size = s * 0.9
  52.     update_font
  53.     # Fix window height
  54.     rect = "\0" * 16
  55.     @@GetWindowRect.call(@window, rect)
  56.     rect = rect.unpack("l*")
  57.     @@SetWindowPos.call(@window, 0, rect[0], rect[1], @width, @font_size, 0)
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ●
  61.   #--------------------------------------------------------------------------
  62.   def update_font
  63.     hFont = @@CreateFont.call(@font_size,@font_size/2,0,0,0,0,0,0,0,0,0,0,0,@font_name.u2s)
  64.     @@SendMessage.call(@window, 0x30, hFont, 0) # WM_SETFONT
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 初始化
  68.   #--------------------------------------------------------------------------
  69.   def initialize(text = "", limit = 8, password = false, width = 160, direct_show = false, font_name = default_font_name, font_size = Font.default_size)
  70.     @password = password
  71.     @width = width
  72.     @direct_show = direct_show
  73.     @font_name = font_name
  74.     @font_size = font_size * 0.9
  75.     c = 0x40000000
  76.     c |= 0x00000020 if password # ES_PASSWORD
  77.     @window = @@CreateWindow.call(0, 'EDIT', text.u2s, c, 0, 0, @width, @font_size, MainWindow.hwnd, 0, 0, 0)
  78.     if @direct_show
  79.        mc = :"user32|GetWindowLong|ll|l".apicall(MainWindow.hwnd, -16) # GWL_STYLE
  80.        mc |= 0x02000000 # WS_CLIPCHILDREN
  81.        :"user32|SetWindowLong|lll|l".apicall(MainWindow.hwnd, -16, mc) # GWL_STYLE
  82.      end
  83.     @@ShowWindow.call(@window, 5) if @direct_show
  84.     @@SendMessage.call(@window, 0xC5, limit, 0) # WM_SETLIMITTEXT
  85.     update_font
  86.     MainWindow.enableChildWndProc(@window, method(:wnd_proc))
  87.     @enter_pressed = false
  88.     @focus = true
  89.     @disposed = false
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 窗口过程函数
  93.   #--------------------------------------------------------------------------
  94.   def wnd_proc(hwnd, msg, wp, lp)
  95.     if hwnd == @window and msg == MainWindow::WM_CHAR and wp == 0x0D # Enter
  96.       @enter_pressed = true
  97.     end
  98.     MainWindow.child_def_proc(@window, hwnd, msg, wp, lp)
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 释放
  102.   #--------------------------------------------------------------------------
  103.   def dispose
  104.     @disposed = true
  105.     MainWindow.disableChildWndProc(@window)
  106.     @@DestroyWindow.call(@window)
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 刷新
  110.   #--------------------------------------------------------------------------
  111.   def update
  112.     return if !@focus or @disposed
  113.     if @direct_show
  114.       @@UpdateWindow.call(@window)
  115.     else
  116.       @@SendMessage.call(@window, 0xB1, sel_spos, sel_epos)
  117.     end
  118.     @@SetFocus.call(@window)
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ●
  122.   #--------------------------------------------------------------------------
  123.   def set_pos(x, y)
  124.     @@SetWindowPos.call(@window, 0, x, y, @width, @font_size, 0)
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 获取内容
  128.   #--------------------------------------------------------------------------
  129.   def text
  130.     return if @disposed
  131.     l = @@GetWindowTextLength.call(@window) + 1
  132.     str = "\0" * l
  133.     @@GetWindowText.call(@window, str, l)
  134.     return str.s2u.strip!
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 更改内容
  138.   #--------------------------------------------------------------------------
  139.   def text=(str)
  140.     return if @disposed
  141.     @@SetWindowText.call(@window, str.u2s)
  142.     self.sel_pos = str.u2s.size - 1
  143.     str
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 获取起始光标位置
  147.   #--------------------------------------------------------------------------
  148.   def sel_spos
  149.     return if @disposed
  150.     #return @@SendMessage.call(@window, 0xB0, 0, 0) & 0xFFFF
  151.     spos = "\0" * 4
  152.     @@SendMessage_Pos.call(@window, 0xB0, spos, 0)
  153.     return spos.unpack("l")[0]
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 获取結束光标位置
  157.   #--------------------------------------------------------------------------
  158.   def sel_epos
  159.     return if @disposed
  160.     #return @@SendMessage.call(@window, 0xB0, 0, 0) >> 16
  161.     epos = "\0" * 4
  162.     @@SendMessage_Pos.call(@window, 0xB0, 0, epos)
  163.     return epos.unpack("l")[0]
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 设置光标位置
  167.   #--------------------------------------------------------------------------
  168.   def sel_spos=(i)
  169.     return if @disposed
  170.     @@SendMessage.call(@window, 0xB1, i, sel_epos)
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 设置光标位置
  174.   #--------------------------------------------------------------------------
  175.   def sel_epos=(i)
  176.     return if @disposed
  177.     @@SendMessage.call(@window, 0xB1, sel_spos, i)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 设置光标位置
  181.   #--------------------------------------------------------------------------
  182.   def sel_pos=(i)
  183.     return if @disposed
  184.     @@SendMessage.call(@window, 0xB1, i, i)
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 获取字數限制
  188.   #--------------------------------------------------------------------------
  189.   def limit
  190.     return if @disposed
  191.     return @@SendMessage.call(@window, 0xD5, 0, 0)
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 设置字數限制
  195.   #--------------------------------------------------------------------------
  196.   def limit=(i)
  197.     return if @disposed
  198.     @@SendMessage.call(@window, 0xC5, i, 0)
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 是否按下回车键(0x0D => Enter, 0x1B => ESC)
  202.   #--------------------------------------------------------------------------
  203.   def press_enter?
  204.     return !(@enter_pressed = false) if @enter_pressed
  205.     return false
  206.   end
  207. end
复制代码

Window_Help
  1. #==============================================================================
  2. # ■ Window_Help
  3. #------------------------------------------------------------------------------
  4. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  5. #==============================================================================

  6. class Window_Help < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize(line_number = 2, width = Graphics.width)
  11.     super(0, 0, width, fitting_height(line_number))
  12.   end
  13. end
复制代码

Window_TextBox
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_TextBox By AAM@_@
  4. #------------------------------------------------------------------------------
  5. #  显示输入框用的窗口。
  6. #==============================================================================
  7. class Window_TextBox < Window_Base
  8. #--------------------------------------------------------------------------
  9. # ● 设置缓存的类
  10. #--------------------------------------------------------------------------
  11. TextBoxMem = Struct.new(:text, :sel_spos, :sel_epos)
  12. #--------------------------------------------------------------------------
  13. # ● 定义实例变量
  14. #--------------------------------------------------------------------------
  15. attr_reader :textbox
  16. attr_reader :sel_pos
  17. #--------------------------------------------------------------------------
  18. # ● 初始化
  19. #--------------------------------------------------------------------------
  20. def initialize(x, y, width = 160, password = false)
  21. super(x, y, width, window_height)
  22. @handler = nil
  23. @textbox = TextBox.new("", 8, password, width - standard_padding * 2)
  24. @textbox.set_pos(self.x + standard_padding, self.y + standard_padding)
  25. @tbmem = TextBoxMem.new
  26. @curcor = Sprite.new
  27. @curcor.bitmap = Bitmap.new(2, line_height)
  28. @curcor.bitmap.fill_rect(@curcor.bitmap.rect, system_color)
  29. @curcor.visible = false
  30. @curcor.x = self.x + standard_padding
  31. @curcor.y = self.y + standard_padding
  32. @curcor.z = self.z + 1
  33. @selection_color = system_color.clone
  34. @selection_color.alpha = 128
  35. refresh
  36. activate
  37. end
  38. #--------------------------------------------------------------------------
  39. # ● 获取窗口的高度
  40. #--------------------------------------------------------------------------
  41. def window_height
  42. fitting_height(1)
  43. end
  44. #--------------------------------------------------------------------------
  45. # ●
  46. #--------------------------------------------------------------------------
  47. def x=(x)
  48. super
  49. @textbox.set_pos(self.x + standard_padding, self.y + standard_padding)
  50. update_cursor_pos
  51. end
  52. #--------------------------------------------------------------------------
  53. # ●
  54. #--------------------------------------------------------------------------
  55. def y=(y)
  56. super
  57. @textbox.set_pos(self.x + standard_padding, self.y + standard_padding)
  58. @curcor.y = y + standard_padding
  59. end
  60. #--------------------------------------------------------------------------
  61. # ●
  62. #--------------------------------------------------------------------------
  63. def z=(z)
  64. super
  65. @curcor.z = z + 1
  66. end
  67. #--------------------------------------------------------------------------
  68. # ●
  69. #--------------------------------------------------------------------------
  70. def viewport=(viewport)
  71. super
  72. @curcor.viewport = viewport
  73. end
  74. #--------------------------------------------------------------------------
  75. # ● 刷新
  76. #--------------------------------------------------------------------------
  77. def update
  78. super
  79. if !@textbox.focus
  80. @curcor.visible = false
  81. return
  82. end
  83. @textbox.update
  84. refresh if @textbox.sel_spos != @tbmem.sel_spos or @textbox.sel_epos != @tbmem.sel_epos or @textbox.text != @tbmem.text
  85. update_cursor
  86. process_handling
  87. end
  88. #--------------------------------------------------------------------------
  89. # ● 刷新游標
  90. #--------------------------------------------------------------------------
  91. def update_cursor
  92. @curcor.visible = !@curcor.visible if Graphics.frame_count % 30 == 0
  93. end
  94. #--------------------------------------------------------------------------
  95. # ● 刷新游標位置
  96. #--------------------------------------------------------------------------
  97. def update_cursor_pos
  98. if @tbmem.sel_spos == @textbox.sel_spos
  99. @sel_pos = @textbox.sel_epos
  100. else
  101. @sel_pos = @textbox.sel_spos
  102. end
  103. t = @textbox.text[0, @sel_pos]
  104. s = contents.text_size(t).width
  105. @curcor.x = x + standard_padding + s
  106. end
  107. #--------------------------------------------------------------------------
  108. # ● 選取繪製
  109. #--------------------------------------------------------------------------
  110. def fill_selection(spos, epos)
  111. return if spos == epos
  112. rect = contents.rect.clone
  113. t = @textbox.text[0, spos]
  114. rect.x = contents.text_size(t).width
  115. t = @textbox.text[spos, epos - spos]
  116. rect.width = contents.text_size(t).width
  117. contents.fill_rect(rect, @selection_color)
  118. end
  119. #--------------------------------------------------------------------------
  120. # ● 释放
  121. #--------------------------------------------------------------------------
  122. def dispose
  123. @textbox.dispose
  124. @curcor.bitmap.dispose
  125. @curcor.dispose
  126. super
  127. end
  128. #--------------------------------------------------------------------------
  129. # ● 内容刷新
  130. #--------------------------------------------------------------------------
  131. def refresh
  132. contents.clear
  133. fill_selection(@textbox.sel_spos, @textbox.sel_epos)
  134. change_color(normal_color)
  135. txt = @textbox.password ? ("*" * @textbox.text.size) : @textbox.text
  136. draw_text(contents.rect, txt)
  137. update_cursor_pos
  138. @tbmem.sel_spos = @textbox.sel_spos
  139. @tbmem.sel_epos = @textbox.sel_epos
  140. @tbmem.text = @textbox.text
  141. end
  142. #--------------------------------------------------------------------------
  143. # ● 设置动作对应的处理方法
  144. #--------------------------------------------------------------------------
  145. def set_ok_handler(method)
  146. @handler = method
  147. end
  148. #--------------------------------------------------------------------------
  149. # ● 调用处理方法
  150. #--------------------------------------------------------------------------
  151. def call_handler(symbol)
  152. @handler[symbol].call if handle?(symbol)
  153. end
  154. #--------------------------------------------------------------------------
  155. # ● “确定”和“取消”的处理
  156. #--------------------------------------------------------------------------
  157. def process_handling
  158. return unless open? && active
  159. return process_ok if ok_enabled? && @textbox.press_enter?
  160. end
  161. #--------------------------------------------------------------------------
  162. # ● 获取确定处理的有效状态
  163. #--------------------------------------------------------------------------
  164. def ok_enabled?
  165. return !@handler.nil?
  166. end
  167. #--------------------------------------------------------------------------
  168. # ● 按下确定键时的处理
  169. #--------------------------------------------------------------------------
  170. def process_ok
  171. Sound.play_ok
  172. Input.update
  173. deactivate
  174. call_ok_handler
  175. end
  176. #--------------------------------------------------------------------------
  177. # ● 调用“确定”的处理方法
  178. #--------------------------------------------------------------------------
  179. def call_ok_handler
  180. @handler.call if ok_enabled?
  181. end
  182. end
复制代码

Scene_Name
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Name
  4. #------------------------------------------------------------------------------
  5. #  名字输入画面
  6. #==============================================================================

  7. class Scene_Name < Scene_MenuBase
  8. #--------------------------------------------------------------------------
  9. # ● 准备
  10. #--------------------------------------------------------------------------
  11. def prepare(actor_id, max_char)
  12. @actor_id = actor_id
  13. @max_char = max_char
  14. end
  15. #--------------------------------------------------------------------------
  16. # ● 开始处理
  17. #--------------------------------------------------------------------------
  18. def start
  19. super
  20. @actor = $game_actors[@actor_id]
  21. @text_input_help = Window_Help.new(1, 480)
  22. @text_input_help.x = (Graphics.width - 480) / 2
  23. @text_input_help.y = (Graphics.height - @text_input_help.height * 2) / 2
  24. @text_input_help.set_text("命名")
  25. @text_input = Window_TextBox.new(@text_input_help.x, @text_input_help.y + @text_input_help.height, 480)
  26. @text_input.set_ok_handler(method(:on_input_ok))
  27. @text_input.textbox.limit = @max_char
  28. @text_input.textbox.text = @actor.name
  29. @text_input.textbox.sel_pos = @actor.name.size
  30. end
  31. #--------------------------------------------------------------------------
  32. # ● 输入“确定”
  33. #--------------------------------------------------------------------------
  34. def on_input_ok
  35. @actor.name = @text_input.textbox.text
  36. return_scene
  37. end
  38. end
复制代码

WhiteCabbageBase
  1. # 白菜组基础脚本 WhiteCabbageBase)v1.02 (2013/11/16)
  2. #
  3. module APIs
  4. def self.new(ts); Win32API.new(*ts.split('|')) end
  5. #-------------------------------------------------
  6. ClipCursor = new 'user32|ClipCursor|p|l'
  7. FindWindowEx = new 'user32|FindWindowEx|llpp|i'
  8. GetAsyncKeyState = new 'user32|GetAsyncKeyState|i|i'
  9. GetCursorPos = new 'user32|GetCursorPos|p|i'
  10. GetKeyState = new 'user32|GetKeyState|i|i'
  11. GetPrvPflString = new 'kernel32|GetPrivateProfileString|pppplp|l'
  12. GetSysMtr = new 'user32|GetSystemMetrics|i|i'
  13. JoyGetPosEx = new 'winmm|joyGetPosEx|lp|l'
  14. KeybdEvent = new 'user32|keybd_event|iill|v'
  15. MultiByteToWideChar = new 'kernel32|MultiByteToWideChar|ilpipi|i'
  16. WideCharToMultiByte = new 'kernel32|WideCharToMultiByte|ilpipipp|i'
  17. RtlMoveMemory_pi = new 'kernel32|RtlMoveMemory|pii|i'
  18. RtlMoveMemory_ip = new 'kernel32|RtlMoveMemory|ipi|i'
  19. ScreenToClient = new 'user32|ScreenToClient|ip|i'
  20. SetCursorPos = new 'user32|SetCursorPos|ii|l'
  21. SetFocus = new 'user32|SetFocus|l|l'
  22. SetKeyBoardState = new 'user32|SetKeyboardState|i|i'
  23. SetWindowPos = new 'user32|SetWindowPos|liiiiip|i'
  24. ShellExecuteA = new 'shell32|ShellExecuteA|pppppi|i'
  25. ShowCursor = new 'user32|ShowCursor|i|l'
  26. #-----------------------------------------------
  27. HWnd = FindWindowEx.call(0, 0, 'RGSS Player', 0)
  28. end
  29. # §
  30. # Base Class~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. class NilClass
  32. def +(v) return v end
  33. def -(v) return -v end
  34. def *(v) return 0 end
  35. def /(v) return 0 end
  36. end
  37. class Numeric
  38. def fpart; self - self.to_i end #获取小数部分
  39. def rfpart; 1 - fpart end # 1 - 小数部分
  40. def max(v); self > v ? self : v end # 取最大值
  41. def min(v); self < v ? self : v end # 取最小值
  42. def tide(r); self * (rand-0.5)*2 * r end #进行权值波动 ± v * (-r ~ r)
  43. def digits(ary=10) # 获取对应进制下的数字位数 2/8/10/16 进制
  44. dig = 0; num = self.abs.to_i; if ary == 10; until num == 0; dig += 1
  45. num /= ary; end; else ary = case ary; when 2;1; when 8;3; when 16;4 end
  46. until num == 0; dig += 1; num = num >> ary end; end; return dig
  47. end
  48. end
  49. class Array
  50. def iswap(a, b)
  51. t_ = self[a]
  52. self[a] = self[b]
  53. self[b] = t_
  54. end
  55. end
  56. class Hash
  57. def iswap(a, b)
  58. t_ = self[a]
  59. self[a] = self[b]
  60. self[b] = t_
  61. end
  62. def key_sort(rev = false)
  63. a = []; h = {}
  64. self.each {|k, v| a.push([v, k])}
  65. a.sort!
  66. rev ? a.reverse_each {|vk| h[vk[1]] = vk[0]} :
  67. a.each {|vk| h[vk[1]] = vk[0]}
  68. return h
  69. end
  70. end
  71. # ~~~~~~~~~~~~~~~~~~~~~
  72. # =====================
  73. class Font
  74. def marshal_dump; end
  75. def marshal_load(*args); end
  76. end
  77. # =====================
  78. class Bitmap
  79. include APIs
  80. #Bitmap marshal. by 柳之一(rpg.blue)
  81. # --------------------------------------
  82. def _dump(limit)
  83. data = bit_4 * width * height
  84. RtlMoveMemory_pi.call(data, address, data.length)
  85. [width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
  86. end
  87. def self._load(str)
  88. w, h, zdata = str.unpack("LLa*"); buf = new(w, h)
  89. RtlMoveMemory_ip.call(buf.address, Zlib::Inflate.inflate(zdata), w*h*4)
  90. return buf
  91. end
  92. def address
  93. buf = bit_4
  94. ad = object_id * 2 + 16
  95. RtlMoveMemory_pi.call(buf, ad, 4)
  96. ad = buf.unpack("L")[0] + 8
  97. RtlMoveMemory_pi.call(buf, ad, 4)
  98. ad = buf.unpack("L")[0] + 16
  99. RtlMoveMemory_pi.call(buf, ad, 4)
  100. buf.unpack("L")[0]
  101. end
  102. def bit_4
  103. 'ccav'
  104. end
  105. # --------------------------------------
  106. # 绘制直线
  107. def blt_wu_line(x1, y1, x2, y2, r,g,b,a=255) # 抗锯齿
  108. dx = x2 - x1
  109. dy = y2 - y1
  110. if dx.abs < dy.abs
  111. t_ = x1; x1 = y1; y1 = t_
  112. t_ = x2; x2 = y2; y2 = t_
  113. t_ = dx; dx = dy; dy = t_
  114. end
  115. if x2 < x1
  116. t_ = x1; x1 = x2; x2 = t_
  117. t_ = y1; y1 = y2; y2 = t_
  118. end
  119. set_pixel(x1, y1, Color.new(r,g,b,a))
  120. set_pixel(x2, y2, Color.new(r,g,b,a))
  121. gradient = dy.fdiv(dx)
  122. intery = y1 + gradient
  123. for x in (x1 + 1)..(x2 - 1)
  124. y1 = intery.to_i
  125. y2 = intery.ceil
  126. set_pixel(x, y1, Color.new(r,g,b, intery.rfpart * a))
  127. set_pixel(x, y2, Color.new(r,g,b, intery.fpart * a)) if y1 != y2
  128. intery = intery + gradient
  129. end
  130. end
  131. def blt_line(x0, y0, x1, y1, r,g,b,a=255) # 不抗锯
  132. c = Color.new(r,g,b,a)
  133. steep = (y1 - y0).abs > (x1 - x0).abs
  134. if steep
  135. t_ = x0; x0 = y0; y0 = t_
  136. t_ = x1; x1 = y1; y1 = t_
  137. end
  138. if x0 > x1
  139. t_ = x0; x0 = x1; x1 = t_
  140. t_ = y0; y0 = y1; y1 = t_
  141. end
  142. deltax = x1 - x0
  143. deltay = (y1 - y0).abs
  144. error = deltax / 2
  145. y = y0
  146. ystep = y0 < y1 ? 1 : -1
  147. for x in x0..x1
  148. steep ? set_pixel(y,x,c) : set_pixel(x,y,c)
  149. error = error - deltay
  150. if error < 0
  151. y = y + ystep
  152. error = error + deltax
  153. end
  154. end
  155. end
  156. # 描边 -----------------------------
  157. def blt_border(w = 1, d = 0, color = Color.new(255, 255, 255))
  158. fill_rect(d, d, width - d*2, w, color)
  159. fill_rect(d, height - d - w, width - d*2, w, color)
  160. fill_rect(d, d, w, height - d*2 - w, color)
  161. fill_rect(width - d - w, d*2, w, height - d*2 - w, color)
  162. return self
  163. end
  164. def clear_4angle_dot
  165. clear_rect(0, 0, 1, 1)
  166. clear_rect(width - 1, 0, 1, 1)
  167. clear_rect(0, height - 1, 1, 1)
  168. clear_rect(width - 1, height - 1, 1, 1)
  169. return self
  170. end
  171. # 纵向中心渐变
  172. def vert_center_gradual(c2)
  173. c1 = Color.new
  174. self.gradient_fill_rect(0, 0, width, height/2, c1, c2, true)
  175. self.gradient_fill_rect(0, height/2, width, height/2, c2, c1, true)
  176. return self
  177. end
  178. end
  179. # =======================
  180. class Sprite
  181. def center_screen_xy
  182. self.x = Graphics.width / 2
  183. self.y = Graphics.height / 2
  184. end
  185. def center_origin
  186. self.ox = (width + 1) / 2
  187. self.oy = (height + 1) / 2
  188. end
  189. def set_origin_tone
  190. self.tone = $game_map.screen.tone.inverse
  191. end
  192. def zoom(v) # 缩放精灵
  193. self.zoom_x = v
  194. self.zoom_y = v
  195. end
  196. end
  197. # =====================
  198. class Table
  199. def fill(value) # 填充Table
  200. if ysize == 1
  201. xsize.times {|i| self[i] = value}
  202. elsif zsize == 1
  203. ysize.times {|j| xsize.times {|i| self[i,j] = value}}
  204. else
  205. zsize.times {|k| ysize.times {|j| xsize.times {|i| self[i,j,k] = value}}}
  206. end
  207. return self
  208. end
  209. def amend(value)
  210. if ysize == 1
  211. xsize.times {|i| self[i] += value}
  212. elsif zsize == 1
  213. ysize.times {|j| xsize.times {|i|self[i,j] += value}}
  214. else
  215. zsize.times {|k| ysize.times {|j| xsize.times {|i| self[i,j,k] += value}}}
  216. end
  217. return self
  218. end
  219. #
  220. def self.new_by(array) #利用数组中的16进制信息创建一个Table
  221. xsize = array[0].digits(16) - 1
  222. ysize = array.size
  223. table = Table.new(xsize, ysize)
  224. ysize.times {|y|
  225. bit = array[y]
  226. xsize.times {|x|
  227. table[xsize - x - 1, y] = (bit >> x*4) & 0xf
  228. }
  229. }
  230. return table
  231. end
  232. end
  233. # =====================
  234. class Tone
  235. def inverse
  236. Tone.new(-red, -green, -blue)
  237. end
  238. end
  239. # =====================
  240. class << SceneManager
  241. def goto(scene_class, *args)
  242. @scene = scene_class.new(*args)
  243. end
  244. def call(scene_class, *args)
  245. @stack.push(@scene)
  246. @scene = scene_class.new(*args)
  247. end
  248. end
  249. #
  250. class << Input
  251. include APIs
  252. def key_press?(key)
  253. 0 != GetAsyncKeyState.call(key)
  254. end
  255. def key_on?(key)
  256. 1 == GetKeyState.call(key) & 1
  257. end
  258. def key_repeat?(key) # 该方法最好每帧只调用一次
  259. GetAsyncKeyState.call(key) & 1 == 1
  260. end
  261. #
  262. def press_shift?
  263. key_press?(0xA0) || key_press?(0xA1)
  264. end
  265. def press_ctrl?
  266. key_press?(0xA2) || key_press?(0xA3)
  267. end
  268. def press_alt?
  269. key_press?(0xA4) || key_press?(0xA5)
  270. end
  271. def refresh_all_keys
  272. 255.times {|i| key_press?(i)}
  273. end
  274. end
  275. # ============================
  276. class Window_Base
  277. def draw_escape_text_al(text, x = 0, y = 0) #绘制文字自动换行
  278. reset_font_settings
  279. pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  280. text = convert_escape_characters(text)
  281. process_characters_al(text.slice!(0, 1), text, pos) until text.empty?
  282. end
  283. def process_characters_al(c, text, pos)
  284. case c
  285. when "\r", "\n"; return
  286. when "\f"; process_new_page(text, pos)
  287. when "\e"; process_escape_character(obtain_escape_code(text), text, pos)
  288. else process_character_al(c, pos)
  289. end
  290. end
  291. def process_character_al(c, pos) #处理自动换行
  292. tw = text_size(c).width
  293. process_new_line(c, pos) if pos[:x] + tw > contents.width - pos[:new_x]
  294. draw_text(pos[:x], pos[:y], tw * 2, pos[:height], c)
  295. pos[:x] += tw
  296. end
  297. end
复制代码

Scene_Menu
  1. class Scene_Menu
  2. alias cp_20140811 command_personal
  3. def command_personal
  4. $game_party.members.size == 1 ? on_personal_ok : cp_20140811
  5. end
  6. end
复制代码

截图存档
  1. #==============================================================================
  2. # [PS0]截图存档
  3. # Window_SaveFile_Plus
  4. #------------------------------------------------------------------------------
  5. #   一种带有截图的存档,同时可以自定义存档数量。
  6. #==============================================================================
  7. # [核心脚本]
  8. # - 快速储存Bitmap的Marshal By 柳之一
  9. #------------------------------------------------------------------------------
  10. # [更新记录]
  11. # - 2012.02.16 By 各种压力的猫君
  12. # * 修正地图边缘时截图不完整的错误
  13. # - 2012.01.28 By 各种压力的猫君
  14. # * 去掉效率较差的双线性缩放算法;
  15. # * 新增存档管理功能(F5键,复制/移动/删除存档)
  16. # - 2011.12.27 By 各种压力的猫君
  17. # * 补上截图阴影;
  18. # * 新增“不缩放”截图(推荐使用,尤其是大分辨率);
  19. # * 修正选择不存在的存档时存档列表窗口卡死以及奇怪的SE;
  20. # * 新增“存档中”提示窗口、覆盖存档提示、删除存档功能(Z键,对应键盘D)
  21. # - 2011.12.26 By 各种压力的猫君
  22. # * 功能齐全的测试版
  23. # - 2011.12.16 By 各种压力的猫君
  24. # * 移植至RGSS3,遵循PS0协议;
  25. # * 丰富自定义选项,整合双线性插值算法精简版
  26. # - 2008.05.26 By 沉影不器
  27. # * 蓝本(VX新截图存档)
  28. #------------------------------------------------------------------------------
  29. # [使用方法]
  30. # - 删除原Scene_File、Window_SaveFile 并将本脚本插入到原Scene_File位置。
  31. # - 或者直接将本脚本插入到MAIN以上,并确保本脚本位于上述两个脚本以下。
  32. #==============================================================================
  33. $_PS0 = {} if $_PS0 == nil
  34. $_PS0["Window_SaveFile_Plus"] = 20120216
  35. #==============================================================================
  36. # [PS0] 通用配置模块
  37. #==============================================================================
  38. module PS0
  39. module Window_SaveFile_Plus

  40. # 最大存档数(范围正整数)
  41. MAX_SAVE = 18

  42. # 存档目录(默认值 "Saves/";根目录 "")
  43. SAVE_DIR = "Saves/"

  44. # 无存档时显示的文字
  45. NO_DATA = "无存档"

  46. # 保存时显示的信息
  47. SAVE_NOW = "存档中..."

  48. # 复制存档时的帮助文字
  49. HELP_COPY = "要复制到哪个位置?"

  50. # 移动存档时的帮助文字
  51. HELP_MOVE = "要移动到哪个位置?"

  52. # 是否显示存档中窗口(true:显示;false:不显示)
  53. # - 分辨率较大时建议显示
  54. SHOW_SAVE_NOW = false

  55. # 截图缩放使用的插值算法
  56. # - "NN" 最邻近(速度最快,质量最差,RM默认算法)
  57. # - "NZ" 不缩放(速度快,质量好,以主角为中心切边,非全屏)
  58. Zoom_Type = "NZ"

  59. # 双线性插值能获得更好的截图缩放质量,但所需时间较最邻近插值更长。
  60. # 缩略图尺寸(范围整数,单位像素)
  61. # - VA默认分辨率(544×416)推荐使用340×260
  62. # - VA最大分辨率(640×480)推荐使用425×325
  63. # - 本脚本兼容分辨率解放,窗口大小将自动计算。
  64. # 请自行计算截图分辨率,注意要确保宽高比一致,
  65. # 若使用“不缩放”模式则可以不保持一致。
  66. Thumbnail_Width = 340 # 宽度
  67. Thumbnail_Height = 260 # 高度

  68. # 缩略图位置微调(范围整数,单位像素)
  69. Thumbnail_ox = -2 # 横向
  70. Thumbnail_oy = -2-32 # 纵向

  71. # 各窗口切换时的渐变帧数
  72. TRANS_DURATION = 5

  73. end
  74. end
  75. #==============================================================================
  76. # [核心脚本] 快速储存Bitmap的Marshal By 柳之一
  77. #==============================================================================
  78. class Font
  79. def marshal_dump
  80. end
  81. def marshal_load(obj)
  82. end
  83. end
  84. class Bitmap
  85. RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  86. RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  87. def _dump(limit)
  88. data = "rgba" * width * height
  89. RtlMoveMemory_pi.call(data, address, data.length)
  90. [width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
  91. end
  92. def self._load(str)
  93. w, h, zdata = str.unpack("LLa*")
  94. b = self.new(w, h)
  95. RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  96. return b
  97. end
  98. def address
  99. buffer, ad = "rgba", object_id * 2 + 16
  100. RtlMoveMemory_pi.call(buffer, ad, 4)
  101. ad = buffer.unpack("L")[0] + 8
  102. RtlMoveMemory_pi.call(buffer, ad, 4)
  103. ad = buffer.unpack("L")[0] + 16
  104. RtlMoveMemory_pi.call(buffer, ad, 4)
  105. return buffer.unpack("L")[0]
  106. end
  107. end
  108. #==============================================================================
  109. # ■ Game_Temp
  110. #==============================================================================
  111. class Game_Temp
  112. attr_accessor :save_bitmap
  113. attr_accessor :save_snapshoot
  114. alias new_initialize initialize
  115. def initialize
  116. new_initialize
  117. @save_bitmap = Bitmap.new(1, 1)
  118. @save_snapshoot = Bitmap.new(1, 1)
  119. end
  120. end
  121. #==============================================================================
  122. # ■ SceneManager
  123. #==============================================================================
  124. module SceneManager
  125. def self.snapshot_for_save
  126. $game_temp.save_bitmap = Graphics.snap_to_bitmap
  127. unless FileTest.exist?(PS0::Window_SaveFile_Plus::SAVE_DIR)
  128. Dir.mkdir(PS0::Window_SaveFile_Plus::SAVE_DIR)
  129. end
  130. end
  131. end
  132. #==============================================================================
  133. # ■ Scene_Map
  134. #==============================================================================
  135. class Scene_Map < Scene_Base
  136. alias save_terminate terminate
  137. def terminate
  138. SceneManager.snapshot_for_save
  139. save_terminate
  140. end
  141. end
  142. #==============================================================================
  143. # ■ DataManager
  144. #==============================================================================
  145. module DataManager
  146. def self.save_file_exists?
  147. !Dir.glob(PS0::Window_SaveFile_Plus::SAVE_DIR + 'Save*.rvdata2').empty?
  148. end
  149. def self.make_filename(index)
  150. sprintf(PS0::Window_SaveFile_Plus::SAVE_DIR + "Save%02d.rvdata2", index + 1)
  151. end
  152. #--------------------------------------------------------------------------
  153. # ● セーブヘッダの作成
  154. #--------------------------------------------------------------------------
  155. def self.make_save_header
  156. d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  157. PS0::Window_SaveFile_Plus::Thumbnail_Height)
  158. case PS0::Window_SaveFile_Plus::Zoom_Type
  159. when "NN"
  160. s_rect = $game_temp.save_bitmap.rect
  161. $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  162. $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
  163. when "NZ"
  164. x = [$game_player.screen_x - d_rect.width/2, 0].max
  165. x = [x, Graphics.width - d_rect.width].min
  166. y = [$game_player.screen_y - d_rect.height/2, 0].max
  167. y = [y, Graphics.height - d_rect.height].min
  168. s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
  169. $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  170. $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
  171. end
  172. header = {}
  173. header[:characters] = $game_party.characters_for_savefile
  174. header[:playtime_s] = $game_system.playtime_s
  175. header[:snapshoot] = $game_temp.save_snapshoot
  176. header
  177. end
  178. #--------------------------------------------------------------------------
  179. # ● セーブの実行
  180. #--------------------------------------------------------------------------
  181. def self.save_game(index)
  182. saving_window = Window_Saving.new
  183. Graphics.update
  184. begin
  185. save_game_without_rescue(index)
  186. rescue
  187. delete_save_file(index)
  188. false
  189. end
  190. saving_window.dispose
  191. return true
  192. end
  193. end
  194. #==============================================================================
  195. # ■ Window_Yes_Or_No
  196. #------------------------------------------------------------------------------
  197. #  提供“是”、“否”两个选项的窗口(替换、删除存档用)
  198. #==============================================================================
  199. class Window_Yes_Or_No < Window_HorzCommand
  200. #--------------------------------------------------------------------------
  201. # ● オブジェクト初期化
  202. #--------------------------------------------------------------------------
  203. def initialize(yes, no)
  204. @yes = yes
  205. @no = no
  206. super(130, 0)
  207. self.visible = false
  208. self.active = false
  209. @index = 0
  210. end
  211. #--------------------------------------------------------------------------
  212. # ● 桁数の取得
  213. #--------------------------------------------------------------------------
  214. def col_max
  215. return 2
  216. end
  217. #--------------------------------------------------------------------------
  218. # ● コマンドリストの作成
  219. #--------------------------------------------------------------------------
  220. def make_command_list
  221. add_command(@yes, :yes)
  222. add_command(@no, :cancel)
  223. end
  224. #--------------------------------------------------------------------------
  225. # ● 決定ボタンが押されたときの処理
  226. #--------------------------------------------------------------------------
  227. def process_ok
  228. Input.update
  229. call_ok_handler
  230. end
  231. #--------------------------------------------------------------------------
  232. # ● 按下取消键时的处理
  233. #--------------------------------------------------------------------------
  234. def process_cancel
  235. Input.update
  236. call_cancel_handler
  237. end
  238. #--------------------------------------------------------------------------
  239. # ● 启用窗口
  240. #--------------------------------------------------------------------------
  241. def activate
  242. temp = self.y + self.height - Graphics.height
  243. if temp > 0
  244. self.y -= (temp + 12)
  245. end
  246. self.active = true
  247. self
  248. end
  249. end
  250. #==============================================================================
  251. # ■ Window_Saving
  252. #------------------------------------------------------------------------------
  253. #  显示保存信息的窗口
  254. #==============================================================================
  255. class Window_Saving < Window_Base
  256. #--------------------------------------------------------------------------
  257. # ● オブジェクト初期化
  258. #--------------------------------------------------------------------------
  259. def initialize
  260. w = PS0::Window_SaveFile_Plus::SAVE_NOW.length * 16 + 32
  261. x = (Graphics.width - w)/2
  262. y = (Graphics.height - fitting_height(1))/2
  263. super(x, y, w, fitting_height(1))
  264. self.visible = PS0::Window_SaveFile_Plus::SHOW_SAVE_NOW
  265. draw_text_ex(4, 0, PS0::Window_SaveFile_Plus::SAVE_NOW)
  266. end
  267. end
  268. #==============================================================================
  269. # ■ Window_SaveManagerCommand
  270. #------------------------------------------------------------------------------
  271. #  存档管理窗口
  272. #==============================================================================
  273. class Window_SaveManagerCommand < Window_Command
  274. #--------------------------------------------------------------------------
  275. # ● 初始化对象
  276. #--------------------------------------------------------------------------
  277. def initialize(*args)
  278. @copy, @move, @delete, @cancel = args[0..3]
  279. super(130, 0)
  280. self.visible = false
  281. self.active = false
  282. @index = 0
  283. end
  284. #--------------------------------------------------------------------------
  285. # ● 获取窗口的宽度
  286. #--------------------------------------------------------------------------
  287. def window_width
  288. return 100
  289. end
  290. #--------------------------------------------------------------------------
  291. # ● 获取项目数
  292. #--------------------------------------------------------------------------
  293. def item_max
  294. return 4
  295. end
  296. #--------------------------------------------------------------------------
  297. # ● 生成指令列表
  298. #--------------------------------------------------------------------------
  299. def make_command_list
  300. add_command(@copy, :copy )
  301. add_command(@move, :move )
  302. add_command(@delete, :delete)
  303. add_command(@cancel, :cancel)
  304. end
  305. #--------------------------------------------------------------------------
  306. # ● 按下确定键时的处理
  307. #--------------------------------------------------------------------------
  308. def process_ok
  309. Input.update
  310. call_ok_handler
  311. end
  312. #--------------------------------------------------------------------------
  313. # ● 启用窗口
  314. #--------------------------------------------------------------------------
  315. def activate
  316. temp = self.y + self.height - Graphics.height
  317. if temp > 0
  318. self.y -= (temp + 12)
  319. end
  320. self.active = true
  321. self
  322. end
  323. end
  324. #==============================================================================
  325. # ■ Window_FileCommand
  326. #------------------------------------------------------------------------------
  327. #  截图存档左侧的选择窗口。
  328. #==============================================================================
  329. class Window_FileCommand < Window_Command
  330. #--------------------------------------------------------------------------
  331. # ● オブジェクト初期化
  332. #--------------------------------------------------------------------------
  333. def initialize
  334. super(0, 0)
  335. end
  336. #--------------------------------------------------------------------------
  337. # ● ウィンドウ幅の取得
  338. #--------------------------------------------------------------------------
  339. def window_height
  340. return Graphics.height-fitting_height(1)
  341. end
  342. #--------------------------------------------------------------------------
  343. # ● 表示行数の取得
  344. #--------------------------------------------------------------------------
  345. def visible_line_number
  346. item_max
  347. end
  348. #--------------------------------------------------------------------------
  349. # ● コマンドリストの作成
  350. #--------------------------------------------------------------------------
  351. def make_command_list
  352. add_main_commands
  353. end
  354. #--------------------------------------------------------------------------
  355. # ● 主要コマンドをリストに追加
  356. #--------------------------------------------------------------------------
  357. def add_main_commands
  358. for i in 1..PS0::Window_SaveFile_Plus::MAX_SAVE
  359. if i < 10
  360. text = Vocab::File + " 0" + i.to_s
  361. else
  362. text = Vocab::File + " " + i.to_s
  363. end
  364. add_command(text, :file)
  365. end
  366. end
  367. #--------------------------------------------------------------------------
  368. # ● 決定ボタンが押されたときの処理
  369. #--------------------------------------------------------------------------
  370. def process_ok
  371. end
  372. end
  373. #==============================================================================
  374. # ■ Window_SaveFile
  375. #------------------------------------------------------------------------------
  376. #  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
  377. #==============================================================================
  378. class Window_SaveFile < Window_Base
  379. #--------------------------------------------------------------------------
  380. # ● オブジェクト初期化
  381. # index : セーブファイルのインデックス
  382. #--------------------------------------------------------------------------
  383. def initialize(index)
  384. super(160, 0, Graphics.width-160, Graphics.height-fitting_height(1))
  385. @file_index = index
  386. @selected = true
  387. refresh
  388. end
  389. #--------------------------------------------------------------------------
  390. # ● リフレッシュ
  391. #--------------------------------------------------------------------------
  392. def refresh
  393. contents.clear
  394. change_color(normal_color)
  395. w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
  396. h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
  397. width = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
  398. height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
  399. draw_shadow(width+5, height+5)
  400. draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
  401. self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
  402. line_height, PS0::Window_SaveFile_Plus::NO_DATA)
  403. draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  404. draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
  405. draw_snapshoot(width, height)
  406. end
  407. #--------------------------------------------------------------------------
  408. # ● パーティキャラの描画
  409. #--------------------------------------------------------------------------
  410. def draw_party_characters(x, y)
  411. header = DataManager.load_header(@file_index)
  412. return unless header
  413. header[:characters].each_with_index do |data, i|
  414. draw_character(data[0], data[1], x + i * 48, y)
  415. end
  416. end
  417. #--------------------------------------------------------------------------
  418. # ● プレイ時間の描画
  419. #--------------------------------------------------------------------------
  420. def draw_playtime(x, y, width, align)
  421. header = DataManager.load_header(@file_index)
  422. return unless header
  423. draw_text(x, y, width, line_height, header[:playtime_s], 2)
  424. end
  425. #--------------------------------------------------------------------------
  426. # ● 绘制截图
  427. #--------------------------------------------------------------------------
  428. def draw_snapshoot(x, y)
  429. header = DataManager.load_header(@file_index)
  430. return unless header
  431. bitmap = header[:snapshoot]
  432. contents.blt(x, y, bitmap, bitmap.rect)
  433. bitmap.dispose
  434. end
  435. #--------------------------------------------------------------------------
  436. # ● 绘制阴影
  437. #--------------------------------------------------------------------------
  438. def draw_shadow(x, y)
  439. header = DataManager.load_header(@file_index)
  440. return unless header
  441. contents.fill_rect(x, y, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  442. PS0::Window_SaveFile_Plus::Thumbnail_Height, Color.new(0, 0, 0))
  443. contents.blur
  444. end
  445. end
  446. #==============================================================================
  447. # ■ Scene_File
  448. #------------------------------------------------------------------------------
  449. #  セーブ画面とロード画面の共通処理を行うクラスです。
  450. #==============================================================================
  451. class Scene_File < Scene_MenuBase
  452. #--------------------------------------------------------------------------
  453. # ● 開始処理
  454. #--------------------------------------------------------------------------
  455. def start
  456. super
  457. create_help_window
  458. create_savefile_viewport
  459. create_command_window
  460. create_savefile_window
  461. create_manager_window
  462. create_replace_window
  463. create_delete_window
  464. end
  465. #--------------------------------------------------------------------------
  466. # ● 終了処理
  467. #--------------------------------------------------------------------------
  468. def terminate
  469. super
  470. @savefile_viewport.dispose
  471. @savefile_window.dispose
  472. @command_window.dispose
  473. @window_manager.dispose
  474. @window_replace.dispose
  475. @window_delete.dispose
  476. end
  477. #--------------------------------------------------------------------------
  478. # ● フレーム更新
  479. #--------------------------------------------------------------------------
  480. def update
  481. super
  482. update_savefile_selection
  483. end
  484. #--------------------------------------------------------------------------
  485. # ● 创建替换窗口
  486. #--------------------------------------------------------------------------
  487. def create_replace_window
  488. @window_replace = Window_Yes_Or_No.new("替换", "取消")
  489. @window_replace.set_handler(:yes, method(:do_replace))
  490. @window_replace.set_handler(:cancel, method(:do_cancel))
  491. end
  492. #--------------------------------------------------------------------------
  493. # ● 创建删除窗口
  494. #--------------------------------------------------------------------------
  495. def create_delete_window
  496. @window_delete = Window_Yes_Or_No.new("删除", "取消")
  497. @window_delete.set_handler(:yes, method(:do_delete))
  498. @window_delete.set_handler(:cancel, method(:do_return_manager))
  499. @window_delete.x += 40
  500. end
  501. #--------------------------------------------------------------------------
  502. # ● 创建管理窗口
  503. #--------------------------------------------------------------------------
  504. def create_manager_window
  505. @window_manager = Window_SaveManagerCommand.new("复制", "移动", "删除", "取消")
  506. @window_manager.set_handler(:copy , method(:on_copy?))
  507. @window_manager.set_handler(:move , method(:on_move?))
  508. @window_manager.set_handler(:delete, method(:on_delete?))
  509. @window_manager.set_handler(:cancel, method(:do_cancel))
  510. end
  511. #--------------------------------------------------------------------------
  512. # ● ヘルプウィンドウの作成
  513. #--------------------------------------------------------------------------
  514. def create_help_window
  515. @help_window = Window_Help.new(1)
  516. @help_window.set_text(help_window_text)
  517. end
  518. #--------------------------------------------------------------------------
  519. # ● ヘルプウィンドウのテキストを取得
  520. #--------------------------------------------------------------------------
  521. def help_window_text
  522. return ""
  523. end
  524. #--------------------------------------------------------------------------
  525. # ● セーブファイルビューポートの作成
  526. #--------------------------------------------------------------------------
  527. def create_savefile_viewport
  528. @savefile_viewport = Viewport.new
  529. @savefile_viewport.rect.y = @help_window.height
  530. @savefile_viewport.rect.height -= @help_window.height
  531. end
  532. #--------------------------------------------------------------------------
  533. # ● セーブファイルウィンドウの作成
  534. #--------------------------------------------------------------------------
  535. def create_savefile_window
  536. @savefile_window = Window_SaveFile.new(@index)
  537. @savefile_window.viewport = @savefile_viewport
  538. end
  539. #--------------------------------------------------------------------------
  540. # ● 生成存档列表窗口
  541. #--------------------------------------------------------------------------
  542. def create_command_window
  543. @command_window = Window_FileCommand.new
  544. @command_window.index = first_savefile_index
  545. @index = @command_window.index
  546. @command_window.viewport = @savefile_viewport
  547. @command_window.set_handler(:file, method(:on_savefile_ok))
  548. end
  549. #--------------------------------------------------------------------------
  550. # ● セーブファイル選択の更新
  551. #--------------------------------------------------------------------------
  552. def update_savefile_selection
  553. if @source_index != nil
  554. if Input.trigger?(:C)
  555. if @index == @source_index
  556. Sound.play_buzzer
  557. elsif FileTest.exist?(DataManager.make_filename(@index))
  558. Graphics.freeze
  559. @command_window.deactivate
  560. @window_replace.y = 72 + @index * 24
  561. @window_replace.activate
  562. @window_replace.visible = true
  563. @window_replace.refresh
  564. Sound.play_ok
  565. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  566. else
  567. return on_copy_ok
  568. end
  569. elsif Input.trigger?(:B)
  570. return do_return_manager
  571. end
  572. else
  573. if Input.trigger?(:C)
  574. if self.is_a?(Scene_Save) and FileTest.exist?(DataManager.make_filename(@index))
  575. Graphics.freeze
  576. @command_window.deactivate
  577. @window_replace.y = 72 + @index * 24
  578. @window_replace.activate
  579. @window_replace.visible = true
  580. @window_replace.refresh
  581. Sound.play_ok
  582. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  583. else
  584. return on_savefile_ok
  585. end
  586. elsif Input.trigger?(:B)
  587. return on_savefile_cancel
  588. elsif Input.trigger?(:F5)
  589. unless @window_manager.active == true or
  590. @window_delete.active == true or
  591. @window_replace.active == true
  592. return on_manager?
  593. end
  594. end
  595. end
  596. @need_refresh = true if @index != @command_window.index
  597. if @need_refresh
  598. Graphics.freeze
  599. @index = @command_window.index
  600. @savefile_window.dispose
  601. create_savefile_window
  602. @need_refresh = false
  603. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  604. end
  605. end
  606. #--------------------------------------------------------------------------
  607. # ● セーブファイル[決定]
  608. #--------------------------------------------------------------------------
  609. def on_savefile_ok
  610. end
  611. #--------------------------------------------------------------------------
  612. # ● セーブファイル[キャンセル]
  613. #--------------------------------------------------------------------------
  614. def on_savefile_cancel
  615. Sound.play_cancel
  616. return_scene
  617. end
  618. #--------------------------------------------------------------------------
  619. # ● セーブファイル[決定]
  620. #--------------------------------------------------------------------------
  621. def on_copy_ok
  622. Graphics.freeze
  623. source_name = DataManager.make_filename(@source_index)
  624. new_name = DataManager.make_filename(@index)
  625. case @source_type
  626. when "copy"
  627. # 复制存档文件(API)
  628. Win32API.new('kernel32',"CopyFileA",'ppl','').call(source_name,new_name,0)
  629. when "move"
  630. # 重命名存档
  631. File.rename(source_name, new_name)
  632. end
  633. # 返回
  634. @help_window.set_text(help_window_text)
  635. @source_index = nil
  636. do_return_savelist
  637. end
  638. #--------------------------------------------------------------------------
  639. # ● セーブファイル[复制]
  640. #--------------------------------------------------------------------------
  641. def on_copy?
  642. Graphics.freeze
  643. @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_COPY)
  644. @source_index = @index
  645. @source_type = "copy"
  646. do_return_savelist
  647. end
  648. #--------------------------------------------------------------------------
  649. # ● セーブファイル[移动]
  650. #--------------------------------------------------------------------------
  651. def on_move?
  652. Graphics.freeze
  653. @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_MOVE)
  654. @source_index = @index
  655. @source_type = "move"
  656. do_return_savelist
  657. end
  658. #--------------------------------------------------------------------------
  659. # ● セーブファイル[管理]
  660. #--------------------------------------------------------------------------
  661. def on_manager?
  662. if FileTest.exist?(DataManager.make_filename(@index))
  663. Graphics.freeze
  664. @command_window.deactivate
  665. @window_manager.y = 72 + @index * 24
  666. @window_manager.activate
  667. @window_manager.visible = true
  668. @window_manager.refresh
  669. Sound.play_ok
  670. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  671. else
  672. Sound.play_buzzer
  673. end
  674. end
  675. #--------------------------------------------------------------------------
  676. # ● セーブファイル[删除]
  677. #--------------------------------------------------------------------------
  678. def on_delete?
  679. Graphics.freeze
  680. @window_manager.deactivate
  681. @command_window.deactivate
  682. @window_delete.y = 72 + 72 + @index * 24
  683. @window_delete.activate
  684. @window_delete.visible = true
  685. @window_delete.refresh
  686. Sound.play_ok
  687. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  688. end
  689. #--------------------------------------------------------------------------
  690. # ● 删除
  691. #--------------------------------------------------------------------------
  692. def do_delete
  693. Graphics.freeze
  694. File.delete(DataManager.make_filename(@index))
  695. @window_delete.index = 0
  696. @window_manager.index = 0
  697. @window_delete.visible = false
  698. @window_manager.visible = false
  699. @window_delete.deactivate
  700. @window_manager.deactivate
  701. @command_window.activate
  702. @need_refresh = true
  703. Sound.play_save
  704. if DataManager.save_file_exists?
  705. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  706. else
  707. return_scene
  708. end
  709. end
  710. #--------------------------------------------------------------------------
  711. # ● 替换
  712. #--------------------------------------------------------------------------
  713. def do_replace
  714. Graphics.freeze
  715. if @source_index != nil
  716. return on_copy_ok
  717. else
  718. return on_savefile_ok
  719. end
  720. @window_replace.visible = false
  721. @window_replace.deactivate
  722. @need_refresh = true
  723. end
  724. #--------------------------------------------------------------------------
  725. # ● 取消
  726. #--------------------------------------------------------------------------
  727. def do_cancel
  728. Graphics.freeze
  729. Sound.play_cancel
  730. @window_delete.index = 0
  731. @window_replace.index = 0
  732. @window_manager.index = 0
  733. @window_delete.visible = false
  734. @window_replace.visible = false
  735. @window_manager.visible = false
  736. @window_delete.deactivate
  737. @window_replace.deactivate
  738. @window_manager.deactivate
  739. @command_window.activate
  740. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  741. end
  742. #--------------------------------------------------------------------------
  743. # ● 返回管理菜单
  744. #--------------------------------------------------------------------------
  745. def do_return_manager
  746. Graphics.freeze
  747. @help_window.set_text(help_window_text)
  748. @command_window.index = @source_index unless @source_index == nil
  749. @source_index = nil
  750. @source_type = nil
  751. @command_window.deactivate
  752. @window_delete.index = 0
  753. @window_replace.index = 0
  754. @window_delete.visible = false
  755. @window_replace.visible = false
  756. @window_delete.deactivate
  757. @window_replace.deactivate
  758. @window_manager.y = 72 + @index * 24
  759. @window_manager.activate
  760. @window_manager.visible = true
  761. @window_manager.refresh
  762. Sound.play_cancel
  763. Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  764. end
  765. #--------------------------------------------------------------------------
  766. # ● 返回文件列表(复制、移动 用)
  767. #--------------------------------------------------------------------------
  768. def do_return_savelist
  769. @window_manager.visible = false
  770. @window_manager.deactivate
  771. @command_window.activate
  772. @need_refresh = true
  773. Sound.play_ok
  774. end
  775. end
  776. #==============================================================================
  777. # [PS0] End of Script
  778. #==============================================================================
复制代码

Window_ChoiceList

  1. class Window_ChoiceList

  2. def max_choice_width
  3. $game_message.choices.collect {|s| pro_ex(s) }.max
  4. end

  5. def pro_ex(str)
  6. s = convert_escape_characters(str)
  7. pos = {:x => 0, :y => -Graphics.height, :new_x => 0, :height => calc_line_height(s)}
  8. process_character(s.slice!(0, 1), s, pos) until s.empty?
  9. pos[:x]
  10. end
  11. end
复制代码

VXAce-RGSS3-26 8方向移動
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-26 8方向移動 [Ver.1.0.0] by Claimh
  3. #------------------------------------------------------------------------------
  4. # 8方向の移動が可能となります。
  5. # 斜め移動ができない時に縦or横に移動できる場合は縦or横に移動するようになります。
  6. #==============================================================================

  7. class Game_Player < Game_Character
  8. #--------------------------------------------------------------------------
  9. # ● 方向ボタン入力による移動処理
  10. #--------------------------------------------------------------------------
  11. def move_by_input
  12. return if !movable? || $game_map.interpreter.running?
  13. if [1, 3, 7, 9].include?(Input.dir8)
  14. case Input.dir8
  15. when 1; move_diagonal(4, 2)
  16. when 3; move_diagonal(6, 2)
  17. when 7; move_diagonal(4, 8)
  18. when 9; move_diagonal(6, 8)
  19. end
  20. return if @move_succeed
  21. end
  22. move_straight(Input.dir4) if Input.dir4 > 0
  23. end
  24. end


  25. class Game_CharacterBase
  26. #--------------------------------------------------------------------------
  27. # ● 斜めに移動
  28. # horz : 横方向(4 or 6)
  29. # vert : 縦方向(2 or 8)
  30. #--------------------------------------------------------------------------
  31. alias move_diagonal_8dir move_diagonal
  32. def move_diagonal(horz, vert)
  33. if !passable?(@x, @y, horz) and !passable?(@x, @y, vert)
  34. @move_succeed = false
  35. return
  36. end
  37. return move_straight(horz) if passable?(@x, @y, horz) and !passable?(@x, @y, vert)
  38. return move_straight(vert) if !passable?(@x, @y, horz) and passable?(@x, @y, vert)
  39. move_diagonal_8dir(horz, vert)
  40. end
  41. end
复制代码

战斗结束后回复
  1. =begin
  2. ===============================================================================
  3. 战斗结束后回复 By喵呜喵5
  4. ===============================================================================
  5. 【说明】

  6. 战斗后回复一定量的HP、MP
  7. 回复的数值可以参考数据库的伤害公式来写,支持以下字符:

  8. v[n] n号变量的数值
  9. hp 当前HP
  10. mp 当前mp
  11. tp 当前HP
  12. level 当前等级

  13. mhp 最大HP Maximum Hit Point
  14. mmp 最大MP Maximum Magic Point
  15. atk 物理攻击 ATtacK power
  16. def 物理防御 DEFense power
  17. mat 魔法攻击 Magic ATtack power
  18. mdf 魔法防御 Magic DeFense power
  19. agi 敏 捷 值 AGIlity
  20. luk 幸 运 值 LUcK
  21. hit 成功几率 HIT rate
  22. eva 闪避几率 EVAsion rate
  23. cri 必杀几率 CRItical rate
  24. cev 闪避必杀几率 Critical EVasion rate
  25. mev 闪避魔法几率 Magic EVasion rate
  26. mrf 反射魔法几率 Magic ReFlection rate
  27. cnt 反击几率 CouNTer attack rate
  28. hrg HP再生速度 Hp ReGeneration rate
  29. mrg MP再生速度 Mp ReGeneration rate
  30. trg TP再生速度 Tp ReGeneration rate
  31. tgr 受到攻击的几率 TarGet Rate
  32. grd 防御效果比率 GuaRD effect rate
  33. rec 恢复效果比率 RECovery effect rate
  34. pha 药理知识 PHArmacology
  35. mcr MP消费率 Mp Cost Rate
  36. tcr TP消耗率 Tp Charge Rate
  37. pdr 物理伤害加成 Physical Damage Rate
  38. mdr 魔法伤害加成 Magical Damage Rate
  39. fdr 地形伤害加成 Floor Damage Rate
  40. exr 经验获得加成 EXperience Rate


  41. 同样支持包括$game_switches在内其他所有的全局变量
  42. 如果计算公式包含多行代码或者多个判定条件,请使用“;”号分隔
  43. (不懂脚本的话无需理解上面两句话的意思)

  44. =end
  45. module M5_BattleRecover
  46. #==============================================================================
  47. # 设定部分
  48. #==============================================================================


  49. HP = "mhp*0.5 + v[1]"
  50. #这里设置HP的回复量,请不要删除引号

  51. MP = "mmp*0.5 + v[1]"
  52. #这里设置MP的回复量,请不要删除引号

  53. ALWAYS = true
  54. #设置为true的话,即使战斗没有胜利也可以恢复

  55. #==============================================================================
  56. # 设定结束
  57. #==============================================================================
  58. #==============================================================================
  59. # 脚本部分
  60. #==============================================================================
  61. end
  62. class << BattleManager
  63. alias m5_20131027_battle_end battle_end
  64. def battle_end(result)
  65. m5_20131027_battle_end(result)
  66. if (result == 0) or M5_BattleRecover::ALWAYS
  67. $game_party.m5_recovery
  68. end
  69. end
  70. end
  71. class Game_Battler < Game_BattlerBase
  72. def m5_recovery
  73. v = $game_variables
  74. self.hp += eval(M5_BattleRecover::HP).round
  75. self.mp += eval(M5_BattleRecover::MP).round
  76. end
  77. end
  78. class Game_Unit
  79. def m5_recovery
  80. members.each {|member| member.m5_recovery }
  81. end
  82. end
  83. #==============================================================================
  84. # 脚本结束
  85. #==============================================================================
复制代码

地图名显示美化
  1. =begin
  2. ===============================================================================
  3. 地图名显示美化 By喵呜喵5
  4. ===============================================================================
  5. 【说明】
  6. 修改了默认的地图名显示方式
  7. 地图名的显示支持基本的转义字符,因此可以做出类似:
  8. 地图名:“\i[4]这里是\n[1]的家”
  9. 显示效果:【图标4】这里是艾里克的家
  10. 这样的效果
  11. 使用脚本需要将地图名的背景命名为“mapname”放在Graphics\System下

  12. =end
  13. $m5script = {} if $m5script.nil?
  14. $m5script["M5MapName"] = true
  15. module M5MapName
  16. #==============================================================================
  17. # 设定部分
  18. #==============================================================================
  19. DEAFUT = 3

  20. #在这里设置地图名的显示模式
  21. #1:不显示地图名,2:长时间显示地图名,3:一段时间显示地图名

  22. TIME = 120
  23. #这里设置地图名显示模式为一段时间时,地图名停留的时间

  24. OPTION = 1

  25. #在这里设置控制地图名的变量ID
  26. #当变量的值分别为1、2、3时地图名显示模式将切换到对应的模式

  27. FADE = 40
  28. #这里设置地图名进入的时间

  29. FONT = ["黑体"]
  30. #地图名所使用的字体

  31. SIZE = 20
  32. #地图名字体的大小

  33. COLOR = Color.new(0,0,0, 210)
  34. #地图名的颜色,四个数值分别是R、G、B以及透明度

  35. BOLD = false
  36. #地图名是否加粗

  37. ITALIC = false
  38. #地图名是否斜体

  39. SHADOW = false
  40. #地图名是否有阴影

  41. OUT = false
  42. #地图名是否加边框

  43. OUT_COLOR = Color.new(255, 255, 255, 100)
  44. #地图名边框的颜色,四个数值分别是R、G、B以及透明度

  45. X = 87
  46. #这里调整地图名的X坐标

  47. Y = 12
  48. #这里调整地图名的Y坐标

  49. #==============================================================================
  50. # 设定结束
  51. #==============================================================================
  52. end
  53. class Window_MapName
  54. def self.show_start
  55. @@map_name_showing = true
  56. end
  57. def self.show_end
  58. @@map_name_showing = false
  59. end
  60. def initialize
  61. super(Graphics.width, M5MapName::Y, Graphics.width,Graphics.height)
  62. self.opacity = self.contents_opacity = 0
  63. creat_map_background
  64. @state = :S1
  65. update_mode
  66. @showing = true
  67. update_haveshow? if !@@map_name_showing
  68. end

  69. def creat_map_background
  70. @background = Sprite.new
  71. @background.bitmap = Cache.system("Mapname")
  72. @background.opacity = 0
  73. @background.z = self.z - 1
  74. end

  75. def update_haveshow?
  76. case @mode
  77. when 2
  78. get_content
  79. @background.opacity = self.contents_opacity = 255
  80. self.x = M5MapName::X
  81. else
  82. @background.opacity = self.contents_opacity = 0
  83. end
  84. @showing = false
  85. end

  86. def update
  87. super
  88. update_mode
  89. if @showing
  90. update_open if need_update?
  91. update_disappear if @mode == 1
  92. end
  93. end

  94. def need_update?
  95. @mode != 1 && $game_map.display_name != ""
  96. end

  97. def update_mode
  98. mode = $game_variables[M5MapName::OPTION].to_i
  99. mode = mode.between?(1,3)? mode : M5MapName::DEAFUT
  100. if @mode != mode
  101. @mode = mode
  102. @showing = true
  103. @state = :S1
  104. end
  105. end

  106. def update_disappear
  107. @background.opacity -= (255/M5MapName::FADE)*2
  108. self.contents_opacity -= (255/M5MapName::FADE)*2
  109. if @background.opacity <= 0
  110. @showing = false
  111. self.x = Graphics.width
  112. end
  113. end

  114. def get_content
  115. contents.clear
  116. contents.font.name = M5MapName::FONT
  117. contents.font.size = M5MapName::SIZE
  118. contents.font.bold = M5MapName::BOLD
  119. contents.font.italic = M5MapName::ITALIC
  120. contents.font.outline = M5MapName::OUT
  121. contents.font.shadow = M5MapName::SHADOW
  122. contents.font.color = M5MapName::COLOR
  123. contents.font.out_color = M5MapName::OUT_COLOR
  124. draw_text_ex(0,0, $game_map.display_name)
  125. end

  126. def update_open
  127. case @state
  128. when :S1
  129. get_content
  130. @background.opacity += 255/M5MapName::FADE
  131. @state = :S2 if @background.opacity > 170
  132. when :S2
  133. @background.opacity += 255/M5MapName::FADE
  134. self.contents_opacity += 255/M5MapName::FADE
  135. self.x = [self.x - Graphics.width/M5MapName::FADE,M5MapName::X].max
  136. if self.x == M5MapName::X and @background.opacity == 255 and \
  137. self.contents_opacity == 255
  138. case @mode
  139. when 2
  140. @showing = false
  141. when 3
  142. @times = M5MapName::TIME
  143. @state = :S3
  144. end
  145. end
  146. when :S3
  147. @times -= 1
  148. @state = :S4 if @times < 0
  149. when :S4
  150. @background.opacity -= (255/M5MapName::FADE)/2
  151. self.contents_opacity -= 255/M5MapName::FADE
  152. self.x = [self.x + Graphics.width/M5MapName::FADE , Graphics.width].min
  153. @state = :S5 if self.x == Graphics.width
  154. when :S5
  155. @background.opacity -= 255/M5MapName::FADE
  156. if @background.opacity <= 0
  157. @state = :S1
  158. @showing = false
  159. end
  160. end
  161. end
  162. def close
  163. @showing = false
  164. self.contents_opacity = @background.opacity = 0
  165. self
  166. end
  167. def open
  168. @state = :S1
  169. self.x = Graphics.width
  170. Window_MapName::show_start
  171. @showing = true
  172. self
  173. end
  174. def dispose
  175. super
  176. @background.dispose
  177. end
  178. end
  179. class Scene_Map
  180. alias m5_20131130_update_scene update_scene
  181. def update_scene
  182. m5_20131130_update_scene
  183. Window_MapName::show_end if scene_changing?
  184. end
  185. end
  186. class << DataManager
  187. alias m5_20131130_setup_new_game setup_new_game
  188. def setup_new_game
  189. m5_20131130_setup_new_game
  190. Window_MapName::show_start
  191. end
  192. alias m5_20131130_load_game load_game
  193. def load_game(index)
  194. Window_MapName::show_start
  195. m5_20131130_load_game(index)
  196. end
  197. end
复制代码

战斗回合数显示
  1. =begin
  2. ===============================================================================
  3. 战斗回合数显示 By喵呜喵5
  4. ===============================================================================


  5. 【说明】


  6. 在战斗界面显示当前的回合数

  7. =end
  8. $m5script = {} if $m5script.nil?

  9. $m5script["M5Round"] = true

  10. module M5Round
  11. #==============================================================================
  12. # 设定部分
  13. #==============================================================================

  14. X = 450
  15. #设置窗口的X坐标

  16. Y = 269
  17. #设置窗口的Y坐标

  18. BACK = "Battle"
  19. #设置窗口的背景图片,不需要则填入 "" 。背景图片素材放到 Graphics\System 目录下

  20. BACK_X = 416
  21. #设置背景图片的X坐标

  22. BACK_Y = 266
  23. #设置背景图片的Y坐标

  24. #==============================================================================
  25. # 脚本部分
  26. #==============================================================================
  27. end
  28. class Window_Round_Picture < Window_Base
  29. def initialize(filename,x=0,y=0)
  30. super(x, y, Graphics.width, Graphics.height)
  31. self.opacity = 0
  32. self.arrows_visible = false
  33. load_picture(filename)
  34. self.z -= 10
  35. end
  36. def standard_padding
  37. return 0
  38. end
  39. def load_picture(filename)
  40. bitmap = Cache.system(filename)
  41. rect = Rect.new(0,0,bitmap.width, bitmap.height)
  42. contents.blt(0, 0, bitmap, rect)
  43. bitmap.dispose
  44. end
  45. end
  46. class Window_Round < Window_Base
  47. def initialize
  48. super(M5Round::X, M5Round::Y, Graphics.width,Graphics.height)
  49. self.opacity = 0
  50. creat_background
  51. end
  52. def standard_padding
  53. return 0
  54. end
  55. def creat_background
  56. @background = Window_Round_Picture.new(M5Round::BACK,\
  57. M5Round::BACK_X,M5Round::BACK_Y) if M5Round::BACK
  58. end
  59. def set_text(text)
  60. if text != @text
  61. @text = text
  62. refresh
  63. end
  64. end
  65. def dispose
  66. super
  67. @background.dispose if @background
  68. end
  69. def clear
  70. set_text("")
  71. end
  72. def refresh
  73. contents.clear
  74. draw_text( 0, 0, Graphics.width, contents.font.size, @text,0)
  75. end
  76. end
  77. class Scene_Battle < Scene_Base
  78. alias m5_20130121_create_all_windows create_all_windows
  79. def create_all_windows
  80. m5_20130121_create_all_windows
  81. creat_round_window
  82. end
  83. def creat_round_window
  84. @round_window = Window_Round.new
  85. @round_window.set_text(round_text)
  86. end
  87. def round_text
  88. "第" + ($game_troop.turn_count + 1).to_s + "回合"
  89. end
  90. alias m5_20130121_turn_end turn_end
  91. def turn_end
  92. m5_20130121_turn_end
  93. @round_window.set_text(round_text)
  94. end
  95. end
复制代码

升级时满血满蓝
  1. #--------------------------------------------------------------------------
  2. # ● 升级时满血满蓝 require Taroxd基础设置
  3. #--------------------------------------------------------------------------
  4. Game_Actor.send(:def_after, :level_up, :recover_all)

复制代码

Taroxd基础设置
  1. #--------------------------------------------------------------------------
  2. # ● require Taroxd基础设置
  3. #--------------------------------------------------------------------------

  4. module Keyboard
  5. #--------------------------------------------------------------------------
  6. BUTTON_L = 0x01 # left mouse button
  7. BUTTON_R = 0x02 # right mouse button
  8. BUTTON_M = 0x04 # middle mouse button
  9. BUTTON_4 = 0x05 # 4th mouse button
  10. BUTTON_5 = 0x06 # 5th mouse button
  11. #--------------------------------------------------------------------------
  12. BACK = 0x08 # BACKSPACE key
  13. TAB = 0x09 # TAB key
  14. ENTER = 0x0D # ENTER key
  15. SHIFT = 0x10 # SHIFT key
  16. CTLR = 0x11 # CTLR key
  17. ALT = 0x12 # ALT key
  18. PAUSE = 0x13 # PAUSE key
  19. CAPS = 0x14 # CAPS LOCK key
  20. ESC = 0x1B # ESC key
  21. SPACE = 0x20 # SPACEBAR
  22. PRIOR = 0x21 # PAGE UP key
  23. NEXT = 0x22 # PAGE DOWN key
  24. const_set :END, 0x23 # END key
  25. HOME = 0x24 # HOME key
  26. LEFT = 0x25 # LEFT ARROW key
  27. UP = 0x26 # UP ARROW key
  28. RIGHT = 0x27 # RIGHT ARROW key
  29. DOWN = 0x28 # DOWN ARROW key
  30. SELECT = 0x29 # SELECT key
  31. PRINT = 0x2A # PRINT key
  32. BB = 0x2B # SELECT key
  33. SNAPSHOT = 0x2C # PRINT SCREEN key
  34. INSERT = 0x2D # INS key
  35. DELETE = 0x2E # DEL key
  36. #--------------------------------------------------------------------------
  37. NUM0 = 0x30 # 0 key
  38. NUM1 = 0x31 # 1 key
  39. NUM2 = 0x32 # 2 key
  40. NUM3 = 0x33 # 3 key
  41. NUM4 = 0x34 # 4 key
  42. NUM5 = 0x35 # 5 key
  43. NUM6 = 0x36 # 6 key
  44. NUM7 = 0x37 # 7 key
  45. NUM8 = 0x38 # 8 key
  46. NUM9 = 0x39 # 9 key
  47. A = 0x41 # A key
  48. B = 0x42 # B key
  49. C = 0x43 # C key
  50. D = 0x44 # D key
  51. E = 0x45 # E key
  52. F = 0x46 # F key
  53. G = 0x47 # G key
  54. H = 0x48 # H key
  55. I = 0x49 # I key
  56. J = 0x4A # J key
  57. K = 0x4B # K key
  58. L = 0x4C # L key
  59. M = 0x4D # M key
  60. N = 0x4E # N key
  61. O = 0x4F # O key
  62. P = 0x50 # P key
  63. Q = 0x51 # Q key
  64. R = 0x52 # R key
  65. S = 0x53 # S key
  66. T = 0x54 # T key
  67. U = 0x55 # U key
  68. V = 0x56 # V key
  69. W = 0x57 # W key
  70. X = 0x58 # X key
  71. Y = 0x59 # Y key
  72. Z = 0x5A # Z key
  73. #--------------------------------------------------------------------------
  74. LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
  75. RWIN = 0x5C # Right Windows key (Natural keyboard)
  76. APPS = 0x5D # Applications key (Natural keyboard)
  77. #--------------------------------------------------------------------------
  78. NUMPAD0 = 0x60 # Numeric keypad 0 key
  79. NUMPAD1 = 0x61 # Numeric keypad 1 key
  80. NUMPAD2 = 0x62 # Numeric keypad 2 key
  81. NUMPAD3 = 0x63 # Numeric keypad 3 key
  82. NUMPAD4 = 0x64 # Numeric keypad 4 key
  83. NUMPAD5 = 0x65 # Numeric keypad 5 key
  84. NUMPAD6 = 0x66 # Numeric keypad 6 key
  85. NUMPAD7 = 0x67 # Numeric keypad 7 key
  86. NUMPAD8 = 0x68 # Numeric keypad 8 key
  87. NUMPAD9 = 0x69 # Numeric keypad 9 key
  88. MULTIPLY = 0x6A # Multiply key (*)
  89. ADD = 0x6B # Add key (+)
  90. SEPARATOR = 0x6C # Separator key
  91. SUBTRACT = 0x6D # Subtract key (-)
  92. DECIMAL = 0x6E # Decimal key
  93. DIVIDE = 0x6F # Divide key (/)
  94. #--------------------------------------------------------------------------
  95. F1 = 0x70 # F1 key
  96. F2 = 0x71 # F2 key
  97. F3 = 0x72 # F3 key
  98. F4 = 0x73 # F4 key
  99. F5 = 0x74 # F5 key
  100. F6 = 0x75 # F6 key
  101. F7 = 0x76 # F7 key
  102. F8 = 0x77 # F8 key
  103. F9 = 0x78 # F9 key
  104. F10 = 0x79 # F10 key
  105. F11 = 0x7A # F11 key
  106. F12 = 0x7B # F12 key
  107. #--------------------------------------------------------------------------
  108. NUMLOCK = 0x90 # NUM LOCK key
  109. SCROLL = 0x91 # SCROLL LOCK key
  110. #--------------------------------------------------------------------------
  111. LSHIFT = 0xA0 # Left SHIFT key
  112. RSHIFT = 0xA1 # Right SHIFT key
  113. LCONTROL = 0xA2 # Left CONTROL key
  114. RCONTROL = 0xA3 # Right CONTROL key
  115. L_ALT = 0xA4 # Left ALT key
  116. R_ALT = 0xA5 # Right ALT key
  117. #--------------------------------------------------------------------------
  118. SEP = 0xBC # , key
  119. DASH = 0xBD # - key
  120. DOTT = 0xBE # . Key
  121. #--------------------------------------------------------------------------
  122. STATES = {}
  123. API = Win32API.new("user32", "GetAsyncKeyState", ['I'], 'I')
  124. module_function
  125. #------------------------------------------------------------------------
  126. # ● 更新输入
  127. #------------------------------------------------------------------------
  128. def update
  129. STATES.each_key do |key|
  130. STATES[key] = press?(key) ? STATES[key] + 1 : 0
  131. end
  132. end
  133. #------------------------------------------------------------------------
  134. # ● 清除输入过的按键
  135. #------------------------------------------------------------------------
  136. def clear
  137. STATES.clear
  138. end
  139. #------------------------------------------------------------------------
  140. # ● 按键是否在按下的状态
  141. #------------------------------------------------------------------------
  142. def press?(key)
  143. API.call(key) < 0
  144. end
  145. #------------------------------------------------------------------------
  146. # ● 按键是否刚被按下
  147. #------------------------------------------------------------------------
  148. def trigger?(key)
  149. (STATES[key] ||= 0) == 1
  150. end
  151. #------------------------------------------------------------------------
  152. # ● 按键是否按住不放
  153. #------------------------------------------------------------------------
  154. def repeat?(key)
  155. times = STATES[key] ||= 0
  156. times == 1 || times > 23 && times % 6 == 0
  157. end
  158. end


  159. class Scene_Base
  160. #------------------------------------------------------------------------
  161. # ● 开始后处理
  162. #------------------------------------------------------------------------
  163. def_before :post_start, Keyboard.method(:clear)
  164. end
  165. #------------------------------------------------------------------------
  166. # ● 更新输入
  167. #------------------------------------------------------------------------
  168. Input.singleton_def_after :update, Keyboard.method(:update)
复制代码

无限图层显示系统 Unlimited Layers Display System
  1. #----------------------------------------------------------------------------
  2. # ● 无限图层显示系统 Unlimited Layers Display System By Taroxd
  3. #----------------------------------------------------------------------------
  4. #
  5. # 使用方法:导入此脚本后,在地图上备注
  6. #
  7. # <pic=filename>
  8. # x: X坐标(可选,默认为 0)
  9. # y: Y坐标(可选,默认为 0)
  10. # z: Z坐标(可选,默认为 10,可以设置为 -100 来当作远景图使用)
  11. # speed_x: 图片横向移动的速度。(可选,默认为 0。正右负左)
  12. # speed_y: 图片纵向移动的速度。(可选,默认为 0。正下负上)
  13. # zoom: 放大倍率(可选,默认为 1)
  14. # zoom_x: 横向放大倍率(可选,默认为 zoom)
  15. # zoom_y: 纵向放大倍率(可选,默认为 zoom)
  16. # opacity: 不透明度(可选,默认为 255)
  17. # blend_type: 合成方式(可选,默认为 0)(0:正常、1:加法、2:减法)
  18. # scroll: 跟随地图卷动的速度(可选,默认为 1)
  19. # scroll_x: 跟随地图横向卷动的速度(可选,默认为 scroll)
  20. # scroll_y:跟随地图纵向卷动的速度(可选,默认为 scroll)
  21. # loop: true(可选,循环。true 可改为任意字符串)
  22. # switch: 开关 ID(可选,当对应开关打开时才会显示)
  23. # </pic>
  24. #
  25. # 其中 filename 是图片文件名(无需扩展名),放入 parallaxes 文件夹内
  26. #
  27. # 可以在同一张地图上显示多张图片。
  28. #
  29. #----------------------------------------------------------------------------
  30. # z 坐标详解:【-100】远景图
  31. # 【0】最低图块层、在普通角色下方
  32. # 【100】与普通角色相同
  33. # 【200】在普通角色上方
  34. #----------------------------------------------------------------------------
  35. # 更新记录:
  36. # 2014.07.10 Ver1.01: 修正了 zoom、zoom_y 会报错的问题
  37. # 2014.07.11 Ver1.02: 修正了切换图块组之后失效的问题
  38. # 2014.08.14 Ver1.1: 增加了 speed_x, speed_y 的设置
  39. # 2014.08.16 Ver1.2: fix 设定更改为 scroll
  40. # 2014.08.29 Ver1.21: 修正了坐标误差
  41. # 2014.09.19 Ver1.22: 修正了远景图与图层使用相同文件时报错的问题
  42. #----------------------------------------------------------------------------

  43. module Taroxd end

  44. class Taroxd::ULDS
  45. PIC_PATH = 'Graphics/Parallaxes/' # 图片文件的路径
  46. DEFAULT_Z = 10 # 默认的 z 值
  47. #--------------------------------------------------------------------------
  48. # ● 初始化
  49. #--------------------------------------------------------------------------
  50. def initialize(name, hash, viewport = nil)
  51. @holder = (hash.key?('loop') ? Plane : Sprite).new(viewport)
  52. @holder.bitmap = Bitmap.new(PIC_PATH + name)
  53. @x = hash.key?('x') ? hash['x'].to_f : 0.0
  54. @y = hash.key?('y') ? hash['y'].to_f : 0.0
  55. @speed_x = hash.key?('speed_x') ? hash['speed_x'].to_f : 0.0
  56. @speed_y = hash.key?('speed_y') ? hash['speed_y'].to_f : 0.0
  57. @holder.z = hash.key?('z') ? hash['z'].to_i : DEFAULT_Z
  58. zoom = hash['zoom']
  59. zoom_x = hash['zoom_x'] || zoom
  60. zoom_y = hash['zoom_y'] || zoom
  61. scroll = hash.key?('scroll') ? hash['scroll'].to_f : 1.0
  62. @scroll_x = hash.key?('scroll_x') ? hash['scroll_x'].to_f : scroll
  63. @scroll_y = hash.key?('scroll_y') ? hash['scroll_y'].to_f : scroll
  64. @scroll_x *= 32
  65. @scroll_y *= 32
  66. @holder.zoom_x = zoom_x.to_f if zoom_x
  67. @holder.zoom_y = zoom_y.to_f if zoom_y
  68. @holder.opacity = hash['opacity'].to_i if hash.key?('opacity')
  69. @holder.blend_type = hash['blend_type'].to_i if hash.key?('blend_type')
  70. @switch = hash.key?('switch') && hash['switch'].to_i
  71. @frame = 0
  72. update
  73. end
  74. #--------------------------------------------------------------------------
  75. # ● 更新
  76. #--------------------------------------------------------------------------
  77. def update
  78. @holder.visible = $game_switches[@switch] if @switch
  79. @holder.ox = $game_map.display_x * @scroll_x - @x - @speed_x * @frame
  80. @holder.oy = $game_map.display_y * @scroll_y - @y - @speed_y * @frame
  81. @frame += 1
  82. end
  83. #--------------------------------------------------------------------------
  84. # ● 释放
  85. #--------------------------------------------------------------------------
  86. def dispose
  87. @holder.bitmap.dispose
  88. @holder.dispose
  89. end
  90. end

  91. class Game_Map
  92. #--------------------------------------------------------------------------
  93. # ● 获取地图的图片设置
  94. #--------------------------------------------------------------------------
  95. def picture_settings
  96. @map.note.scan(/<pic=(.+?)>(.*?)<\/pic>/mi)
  97. end
  98. end

  99. class Spriteset_Map
  100. #--------------------------------------------------------------------------
  101. # ● 创建图片
  102. #--------------------------------------------------------------------------
  103. def create_ulds
  104. @ulds = $game_map.picture_settings.map do |(name, settings)|
  105. hash = Hash[settings.scan(/(\S+)\s*:\s*(\S+)/)]
  106. Taroxd::ULDS.new(name, hash, @viewport1)
  107. end
  108. @ulds_map_id = $game_map.map_id
  109. end
  110. #--------------------------------------------------------------------------
  111. # ● 刷新图片
  112. #--------------------------------------------------------------------------
  113. def refresh_ulds
  114. dispose_ulds
  115. create_ulds
  116. end
  117. #--------------------------------------------------------------------------
  118. # ● 更新图片
  119. #--------------------------------------------------------------------------
  120. def update_ulds
  121. refresh_ulds if @ulds_map_id != $game_map.map_id
  122. @ulds.each(&:update)
  123. end
  124. #--------------------------------------------------------------------------
  125. # ● 释放图片
  126. #--------------------------------------------------------------------------
  127. def dispose_ulds
  128. @ulds.each(&:dispose)
  129. end
  130. #--------------------------------------------------------------------------
  131. # ● 导入
  132. #--------------------------------------------------------------------------
  133. %w(create update dispose).each do |name|
  134. sym = :"#{name}_parallax"
  135. hook = :"#{name}_ulds"
  136. old = instance_method sym
  137. define_method sym do
  138. send hook
  139. old.bind(self).call
  140. end
  141. end
  142. end
复制代码

NamePop
  1. #==============================================================================
  2. # ★ RGSS3_ネームポップ Ver1.1
  3. #==============================================================================
  4. =begin
  5. 作者:tomoaky
  6. webサイト:ひきも記 ([url=http://hikimoki.sakura.ne.jp/]http://hikimoki.sakura.ne.jp/[/url])
  7. イベント名かイベント実行内容の先頭に『注釈』コマンドで
  8. <namepop 文字列>
  9. と記述してください。
  10. イベントキャラクターの頭上に文字列が表示されます。
  11. イベント名で指定した場合はイベント全ページに適用されますが、
  12. 優先度は注釈コマンドの方が高くなっています。
  13. 文字を消したい場合は <np none> としてください。
  14. 2011.12.16  Ver1.1
  15.   ・フォントの縁取り不透明度を設定項目に追加
  16. 2011.12.15  Ver1.0
  17.   公開
  18. =end
  19. #==============================================================================
  20. # □ 設定項目
  21. #==============================================================================
  22. module TMNPOP
  23.   FONT_SIZE = 14          # 字体大小
  24.   FONT_OUT_ALPHA = 255    # 字体轮廓透明度
  25. end
  26. #==============================================================================
  27. # ■ Game_Character
  28. #==============================================================================
  29. class Game_Character
  30.   #--------------------------------------------------------------------------
  31.   # ● 公開インスタンス変数
  32.   #--------------------------------------------------------------------------
  33.   attr_accessor :namepop                  # ポップアップテキスト
  34.   attr_accessor :namecolor
  35.   #--------------------------------------------------------------------------
  36. end
  37. #==============================================================================
  38. # ■ Game_Event
  39. #==============================================================================
  40. class Game_Event < Game_Character
  41.   #--------------------------------------------------------------------------
  42.   # ● イベントページの設定をセットアップ
  43.   #--------------------------------------------------------------------------
  44.   alias tmnpop_game_event_setup_page_settings setup_page_settings
  45.   def setup_page_settings
  46.     tmnpop_game_event_setup_page_settings
  47.     if @list
  48.       @namepop = $1 if /<np\s*(\S+?)>/i =~ @event.name
  49.       @namecolor = $1.to_i if /\\C\[(\d+?)\]/i =~ @event.name
  50.       @namecolor = 0 if @namecolor == nil ||
  51.       @namecolor < 0 || @namecolor >= 32
  52.       @list.each do |list|
  53.         if list.code == 108 || list.code == 408
  54.           @namepop = $1 if /<np\s*(\S+?)>/i =~ list.parameters[0]
  55.           @namecolor = $1.to_i if /\\C\[(\d+?)\]/i =~ list.parameters[0]
  56.         else
  57.           break
  58.         end
  59.       end
  60.     end
  61.   end
  62. end
  63. #==============================================================================
  64. # ■ Sprite_Character
  65. #==============================================================================
  66. class Sprite_Character < Sprite_Base
  67.   #--------------------------------------------------------------------------
  68.   # ● 解放
  69.   #--------------------------------------------------------------------------
  70.   alias tmnpop_sprite_character_dispose dispose
  71.   def dispose
  72.     dispose_namepop
  73.     tmnpop_sprite_character_dispose
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● フレーム更新
  77.   #--------------------------------------------------------------------------
  78.   alias tmnpop_sprite_character_update update
  79.   def update
  80.     tmnpop_sprite_character_update
  81.     update_namepop
  82.     if @character.namepop != @namepop
  83.       @namepop = @character.namepop
  84.       @namecolor = @character.namecolor
  85.       start_namepop
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ○ namepopの開始
  90.   #--------------------------------------------------------------------------
  91.   def start_namepop
  92.     dispose_namepop
  93.     return if @namepop == "none" || @namepop == nil
  94.     @namepop_sprite = ::Sprite.new(viewport)
  95.     h = TMNPOP::FONT_SIZE + 4
  96.     @color_board = Window_Base.new(0,0,0,0)
  97.     @color_board.visible = false
  98.     @namepop_sprite.bitmap = Bitmap.new(h * 10, h)
  99.     @namepop_sprite.bitmap.font.size = TMNPOP::FONT_SIZE
  100.     @namepop_sprite.bitmap.font.out_color.alpha = TMNPOP::FONT_OUT_ALPHA
  101.     @namepop_sprite.bitmap.font.color = @color_board.text_color(@namecolor)
  102.     @namepop_sprite.bitmap.draw_text(0, 0, h * 10, h, @namepop, 1)
  103.     @namepop_sprite.ox = h * 5
  104.     @namepop_sprite.oy = h
  105.     update_namepop
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ○ namepopの更新
  109.   #--------------------------------------------------------------------------
  110.   def update_namepop
  111.     if @namepop_sprite
  112.       @namepop_sprite.x = x
  113.       @namepop_sprite.y = y - height
  114.       @namepop_sprite.z = z + 200
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ○ namepopの解放
  119.   #--------------------------------------------------------------------------
  120.   def dispose_namepop
  121.     if @namepop_sprite
  122.       @namepop_sprite.bitmap.dispose
  123.       @namepop_sprite.dispose
  124.       @color_board.dispose
  125.       @namepop_sprite = nil
  126.     end
  127.   end
  128. end
复制代码

薄雾年代记标题脚本
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ 薄雾年代记标题脚本
  4. #------------------------------------------------------------------------------
  5. #  薄雾年代记的标题脚本
  6. #==============================================================================


  7. #==============================================================================
  8. # 介绍:
  9. # 这个不完全是薄雾的标题脚本,但是是那个的普适版,作者:LBQ,请自由使用,转载
  10. #==============================================================================




  11. # 设置模块
  12. module LBQ
  13. module MC_Title

  14. #logo还有选项的淡入速度,数字越大淡出淡入越快
  15. FADE_SPEED=4


  16. #黑暗层的淡入淡出速度,数字越大淡出淡入越快。第一项是进入场景,第二项是退出
  17. MASK_FADE=[5,3]



  18. #背景滑动速度,默认是[2,1],即为每两帧横向滑动一个单位。
  19. SHIFT_SPEED=[2,1]

  20. #图像设置
  21. GRAPHICS=['Choice','spark','logo','background']

  22. #生成一个新的闪光点的间隔时间
  23. TIME_SPARK=0

  24. #分辨率设定
  25. RESOLUTION=[544,416]

  26. #储存文件的文件夹名称,位于Graphics文件夹下面
  27. FOLDER="MC_Title"

  28. #离开界面的时候的BGM淡出速度,单位毫秒
  29. BGM_FADE=1600

  30. #3个层的Z坐标设定。
  31. Z_SETTINGS=[1,2,3]

  32. #闪光的生命周期。(半衰期,总共生命周期)←装X的设定
  33. LIFE_CYCLE=[300,500]
  34. end
  35. end


  36. #Cache加强
  37. module Cache
  38. include LBQ::MC_Title
  39. #--------------------------------------------------------------------------
  40. # ● 标题
  41. #--------------------------------------------------------------------------
  42. def self.mc_title(filename)
  43. load_bitmap("Graphics/#{FOLDER}/", filename)
  44. end
  45. end


  46. #==============================================================================
  47. # ■ LBQ Spark
  48. #------------------------------------------------------------------------------
  49. #  闪光的精灵类
  50. #==============================================================================
  51. class Sprite_lbqSpark < Sprite_Base
  52. include LBQ::MC_Title
  53. def initialize(viewport=nil)
  54. @timer=0
  55. super(viewport)
  56. self.bitmap=Cache.mc_title(GRAPHICS[1])
  57. @opacity_speed=10
  58. @zoom_change=0
  59. set_rand_stats

  60. end


  61. def update
  62. super
  63. @timer+=1
  64. calc_speed
  65. self.x += @x_speed
  66. self.y += @y_speed
  67. if @timer<=LIFE_CYCLE[0]
  68. self.opacity += @opacity_speed
  69. else
  70. self.opacity -= @opacity_speed*2
  71. end

  72. self.angle += @angle_speed
  73. self.zoom_x += @zoom_change
  74. self.zoom_y += @zoom_change
  75. self.visible=false if @timer>=LIFE_CYCLE[1]

  76. end
  77. def calc_speed
  78. end
  79. def set_rand_stats
  80. @x_speed=(rand(4)-2)*0.8
  81. @y_speed=(rand(4)-2)*0.8
  82. @x_speed+=rand(2)-1 if @x_speed==0
  83. @y_speed+=rand(2)-1 if @y_speed==0
  84. @opacity_speed=2
  85. @angle_speed=rand(3)-3
  86. self.opacity = 1
  87. self.angle = rand(360)

  88. rand_num=rand(9)
  89. case rand_num
  90. when 0
  91. self.x,self.y=0,0
  92. when 1
  93. self.x,self.y=RESOLUTION[0],RESOLUTION[1]
  94. when 2
  95. self.x,self.y=RESOLUTION[0],0
  96. when 3
  97. self.x,self.y=0,RESOLUTION[1]
  98. when 4
  99. self.x,self.y=RESOLUTION[0]/2,0
  100. when 5
  101. self.x,self.y=RESOLUTION[0]/2,RESOLUTION[1]
  102. when 6
  103. self.x,self.y=0,208
  104. when 7
  105. self.x,self.y=RESOLUTION[0],RESOLUTION[1]/2
  106. when 8
  107. self.x,self.y=RESOLUTION[0]/2 ,RESOLUTION[1]/2
  108. end



  109. self.zoom_x=(rand(100) + 100) / 100.0
  110. self.zoom_y = self.zoom_x
  111. self.blend_type=1
  112. end
  113. def get_rand_pos
  114. pos=[]
  115. case rand(4)
  116. when 0
  117. pos[0]=0
  118. when 1
  119. pos[0]=200
  120. when 2
  121. pos[0]=300
  122. when 3
  123. pos[0]=500
  124. when 4
  125. pos[0]=100
  126. end

  127. case rand(4)
  128. when 0
  129. pos[1]=0
  130. when 1
  131. pos[1]=200
  132. when 2
  133. pos[1]=300
  134. when 3
  135. pos[1]=500
  136. when 4
  137. pos[1]=100
  138. end
  139. return pos
  140. end

  141. end


  142. #==============================================================================
  143. # ■ MC Choice
  144. #------------------------------------------------------------------------------
  145. #  可爱的选项~
  146. #==============================================================================
  147. # 选项用精灵类
  148. class Sprite_MCchoice < Sprite_Base
  149. include LBQ::MC_Title
  150. #设置
  151. MAX_INDEX=3
  152. MIN_INDEX=1
  153. #初始化
  154. def initialize(viewport=nil)
  155. super(viewport)

  156. #光标Index
  157. if DataManager.save_file_exists?
  158. @index=2
  159. else
  160. @index=1
  161. end


  162. #动态阶段
  163. @stage=1
  164. end


  165. #更新方法
  166. def update
  167. #super
  168. super

  169. #基础的动态设定
  170. case @stage
  171. when 1

  172. #更新选项
  173. update_cursor

  174. #再次强化不透明度
  175. self.opacity=0

  176. #之后转成第二步
  177. @stage+=1

  178. when 2
  179. #变得透明
  180. self.opacity+=FADE_SPEED
  181. #如果已经变完了
  182. if self.opacity>=255
  183. #进入第三步
  184. @stage+=1
  185. end
  186. when 3
  187. #好的,于是咱来进行光标更新
  188. if Input.trigger?(:UP)
  189. Sound.play_cursor
  190. if @index==MIN_INDEX
  191. @index=MAX_INDEX
  192. else
  193. @index-=1
  194. end
  195. #输入完毕之后再更新
  196. update_cursor

  197. elsif Input.trigger?(:DOWN)
  198. Sound.play_cursor
  199. if @index==MAX_INDEX
  200. #强化条件
  201. @index=MIN_INDEX

  202. else
  203. @index+=1
  204. end
  205. #输入完毕之后再更新
  206. update_cursor
  207. end

  208. end
  209. end

  210. #index外置接口
  211. def index
  212. @index
  213. end

  214. #更新光标
  215. def update_cursor
  216. #设置当前bitmap名字
  217. bitmap_name="#{GRAPHICS[0]}#{@index}"
  218. self.bitmap=Cache.mc_title(bitmap_name)
  219. end
  220. #设置当前index
  221. def set_index(index)
  222. @index=index
  223. end

  224. end




  225. #==============================================================================
  226. # ■ Scene_Title
  227. #------------------------------------------------------------------------------
  228. #  标题类
  229. #==============================================================================
  230. # Scene类
  231. class Scene_Title < Scene_Base
  232. include LBQ::MC_Title
  233. def start
  234. super
  235. @timer=0


  236. #抄袭原版的=-=
  237. SceneManager.clear
  238. Graphics.freeze

  239. #创建显示端口
  240. create_viewports

  241. #创建背景
  242. create_background

  243. #创建精灵类
  244. create_sprites

  245. #播放标题音乐
  246. play_title_music

  247. #动态阶段
  248. @stage=0
  249. end

  250. #创建各种显示端口
  251. def create_viewports
  252. #背景
  253. #RESOLUTION[0],RESOLUTION[1]
  254. @bg_vp=Viewport.new(0,0,RESOLUTION[0],RESOLUTION[1])

  255. #选项
  256. @choice_vp=Viewport.new(0,0,RESOLUTION[0],RESOLUTION[1])
  257. @choice_vp.z=Z_SETTINGS[0]

  258. @mask_vp=Viewport.new(0,0,RESOLUTION[0],RESOLUTION[1])
  259. @mask_vp.z=Z_SETTINGS[2]
  260. end


  261. #创建背景
  262. def create_background
  263. #滚动的背景
  264. @bg_sprite=Plane.new(@bg_vp)

  265. #设置背景图像
  266. @bg_sprite.bitmap=Cache.mc_title(GRAPHICS[3])
  267. end

  268. #更新
  269. def update
  270. super

  271. #计时器+
  272. @timer+=1

  273. #滚动
  274. @bg_sprite.ox+=SHIFT_SPEED[1] if @timer%SHIFT_SPEED[0]==0

  275. case @stage
  276. when 0
  277. @mask_sprite.opacity-=MASK_FADE[0]
  278. if @mask_sprite.opacity<=0
  279. @stage=1
  280. end

  281. when 1
  282. #淡入阶段
  283. @logo_sprite.opacity+=FADE_SPEED
  284. if @logo_sprite.opacity>=255
  285. @stage=2
  286. end
  287. #更新选项
  288. @choice_sprite.update
  289. when 2
  290. @choice_sprite.update
  291. #如果确定了
  292. if Input.trigger?(:C)
  293. Sound.play_ok
  294. case @choice_sprite.index
  295. when 1
  296. @stage=3
  297. when 2
  298. @stage=4
  299. when 3
  300. @stage=5
  301. end
  302. end
  303. when 3
  304. Audio.bgm_fade(BGM_FADE)
  305. @mask_sprite.opacity+=MASK_FADE[1]
  306. if @mask_sprite.opacity>=255
  307. command_new_game
  308. end
  309. when 4
  310. command_continue
  311. when 5
  312. Audio.bgm_fade(BGM_FADE)
  313. @mask_sprite.opacity+=MASK_FADE[1]
  314. if @mask_sprite.opacity>=255
  315. exit
  316. end
  317. end

  318. end
  319. #--------------------------------------------------------------------------
  320. # ● 指令“继续游戏”
  321. #--------------------------------------------------------------------------
  322. def command_continue
  323. SceneManager.call(Scene_Load)
  324. end
  325. #--------------------------------------------------------------------------
  326. # ● 结束处理
  327. #--------------------------------------------------------------------------
  328. def terminate
  329. super
  330. SceneManager.snapshot_for_background
  331. @logo_sprite.dispose
  332. @choice_sprite.dispose
  333. @bg_sprite.dispose
  334. @bg_vp.dispose
  335. @choice_vp.dispose
  336. end
  337. #--------------------------------------------------------------------------
  338. # ● 指令“开始游戏”
  339. #--------------------------------------------------------------------------
  340. def command_new_game
  341. DataManager.setup_new_game
  342. $game_map.autoplay
  343. SceneManager.goto(Scene_Map)
  344. end
  345. def create_sprites
  346. @logo_sprite=Sprite_Base.new(@choice_vp)
  347. @logo_sprite.bitmap=Cache.mc_title(GRAPHICS[2])
  348. @logo_sprite.opacity=0

  349. @choice_sprite=Sprite_Base.new(@choice_vp)

  350. @choice_sprite=Sprite_MCchoice.new(@choice_vp)
  351. @choice_sprite.opacity=0

  352. @mask_sprite=Sprite.new(@mask_vp)
  353. @mask_sprite.bitmap=Bitmap.new(RESOLUTION[0],RESOLUTION[1])
  354. @mask_sprite.bitmap.fill_rect(0,0,RESOLUTION[0],RESOLUTION[1],Color.new(0,0,0))
  355. end

  356. def play_title_music
  357. $data_system.title_bgm.play
  358. RPG::BGS.stop
  359. RPG::ME.stop
  360. end

  361. end
复制代码

标题菜单补丁
  1. #LBQ标题菜单补丁——修复了进入第一个地图没有淡入的问题
  2. class Scene_Title
  3. #--------------------------------------------------------------------------
  4. # ● 指令“开始游戏”
  5. #--------------------------------------------------------------------------
  6. alias lbq_bugfix_title_newgame command_new_game
  7. def command_new_game
  8. fadeout_all
  9. lbq_bugfix_title_newgame
  10. end
  11. end

复制代码

Yanfly Engine Ace - System Options v1.00
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - System Options v1.00
  4. # -- Last Updated: 2012.01.01
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-SystemOptions"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.01 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script replaces the "Game End" option in the Main Menu with a "System"
  20. # menu where the player can adjust various settings in the game. Of them, the
  21. # player can change the window colour, the volume for BGM, BGS, SFX, set
  22. # automatic dashing, message text to display instantly, and speed up battles by
  23. # hiding battle animations.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. # -----------------------------------------------------------------------------
  32. # Script Calls - These commands are used with script calls.
  33. # -----------------------------------------------------------------------------
  34. # $game_system.volume_change(:bgm, x)
  35. # $game_system.volume_change(:bgs, x)
  36. # $game_system.volume_change(:sfx, x)
  37. # Unlike the previous Yanfly Engines, this version does not bind volume to a
  38. # variable. Use the script call to change the bgm, bgs, or sfx sound rate by
  39. # x increment. Use a negative value to lower the volume.
  40. #
  41. # $game_system.set_autodash(true)
  42. # $game_system.set_autodash(false)
  43. # Turns autodash on (true) or off (false).
  44. #
  45. # $game_system.set_instantmsg(true)
  46. # $game_system.set_instantmsg(false)
  47. # Turns instant messages on (true) or off (false).
  48. #
  49. # $game_system.set_animations(true)
  50. # $game_system.set_animations(false)
  51. # Turns battle animations on (true) or off (false).
  52. #
  53. #==============================================================================
  54. # ▼ Compatibility
  55. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  56. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  57. # it will run with RPG Maker VX without adjusting.
  58. #
  59. #==============================================================================

  60. module YEA
  61. module SYSTEM

  62. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  63. # - General Setting -
  64. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65. # These are the general settings that govern the System settings. This will
  66. # change the "Game End" vocab, and disable or enable autodash, instant
  67. # messages, or animations by default.
  68. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69. COMMAND_NAME = "系统" # Command name used to replace Game End.
  70. DEFAULT_AUTODASH = true # Enable automatic dashing by default?
  71. DEFAULT_INSTANTMSG = false # Enable instant message text by default?
  72. DEFAULT_ANIMATIONS = true # Enable battle animations by default?

  73. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  74. # - Command Settings -
  75. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  76. # These settings adjust the commands shown in the command list. Add, remove
  77. # or rearrange the commands as you see fit. Here's a list of which commands
  78. # do what:
  79. #
  80. # -------------------------------------------------------------------------
  81. # :command Description
  82. # -------------------------------------------------------------------------
  83. # :blank Inserts an empty blank space.
  84. #
  85. # :window_red Changes the red tone for all windows.
  86. # :window_grn Changes the green tone for all windows.
  87. # :window_blu Changes the blue tone for all windows.
  88. #
  89. # :volume_bgm Changes the BGM volume used.
  90. # :volume_bgs Changes the BGS volume used.
  91. # :volume_sfx Changes the SFX volume used.
  92. #
  93. # :autodash Sets the player to automatically dash.
  94. # :instantmsg Sets message text to appear instantly.
  95. # :animations Enables battle animations or disables them.
  96. #
  97. # :to_title Returns to the title screen.
  98. # :shutdown Shuts down the game.
  99. #
  100. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  101. COMMANDS =[
  102. :window_red, # Changes the red tone for all windows.
  103. :window_grn, # Changes the green tone for all windows.
  104. :window_blu, # Changes the blue tone for all windows.
  105. :volume_bgm, # Changes the BGM volume used.
  106. :volume_bgs, # Changes the BGS volume used.
  107. :volume_sfx, # Changes the SFX volume used.
  108. :blank,
  109. :autodash, # Sets the player to automatically dash.
  110. :instantmsg, # Sets message text to appear instantly.
  111. :animations, # Enables battle animations or disables them.
  112. # :switch_1, # Custom Switch 1. Adjust settings below.
  113. # :switch_2, # Custom Switch 2. Adjust settings below.
  114. # :variable_1, # Custom Variable 1. Adjust settings below.
  115. # :variable_2, # Custom Variable 2. Adjust settings below.
  116. :blank,
  117. :to_title, # Returns to the title screen.
  118. :shutdown, # Shuts down the game.
  119. ] # Do not remove this.

  120. #--------------------------------------------------------------------------
  121. # - Custom Switches -
  122. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  123. # If you want your game to have system options other than just the ones
  124. # listed above, you can insert custom switches here to produce such an
  125. # effect. Adjust the settings here as you see fit.
  126. #--------------------------------------------------------------------------
  127. CUSTOM_SWITCHES ={
  128. # -------------------------------------------------------------------------
  129. # :switch => [Switch, Name, Off Text, On Text,
  130. # Help Window Description
  131. # ], # Do not remove this.
  132. # -------------------------------------------------------------------------
  133. :switch_1 => [ 1, "Custom Switch 1", "OFF", "ON",
  134. "Help description used for custom switch 1."
  135. ],
  136. # -------------------------------------------------------------------------
  137. :switch_2 => [ 2, "Custom Switch 2", "OFF", "ON",
  138. "Help description used for custom switch 2."
  139. ],
  140. # -------------------------------------------------------------------------
  141. } # Do not remove this.

  142. #--------------------------------------------------------------------------
  143. # - Custom Variables -
  144. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  145. # If you want your game to have system options other than just the ones
  146. # listed above, you can insert custom variables here to produce such an
  147. # effect. Adjust the settings here as you see fit.
  148. #--------------------------------------------------------------------------
  149. CUSTOM_VARIABLES ={
  150. # -------------------------------------------------------------------------
  151. # :variable => [Switch, Name, Colour1, Colour2, Min, Max,
  152. # Help Window Description
  153. # ], # Do not remove this.
  154. # -------------------------------------------------------------------------
  155. :variable_1 => [ 1, "Custom Variable 1", 9, 1, -100, 100,
  156. "Help description used for custom variable 1."
  157. ],
  158. # -------------------------------------------------------------------------
  159. :variable_2 => [ 2, "Custom Variable 2", 10, 2, -10, 10,
  160. "Help description used for custom variable 2."
  161. ],
  162. # -------------------------------------------------------------------------
  163. } # Do not remove this.

  164. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  165. # - Vocab Settings -
  166. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  167. # This hash adjusts the vocab used for both the commands and the help
  168. # description that appears above the command window. Note that for the
  169. # command help descriptions, you may use text codes. Use \n to linebreak.
  170. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  171. COMMAND_VOCAB ={
  172. # -------------------------------------------------------------------------
  173. # :command => [Command Name, Option1, Option2
  174. # Help Window Description,
  175. # ], # Do not remove this.
  176. # -------------------------------------------------------------------------
  177. :blank => ["", "None", "None",
  178. ""
  179. ], # Do not remove this.
  180. # -------------------------------------------------------------------------
  181. :window_red => ["窗口红色", "None", "None",
  182. "改变红色色调的Window。\n" +
  183. "按住SHIFT键,用10来改变增量。"
  184. ], # Do not remove this.
  185. # -------------------------------------------------------------------------
  186. :window_grn => ["窗口绿色", "None", "None",
  187. "改变绿色色调的Window。\n" +
  188. "按住SHIFT键,用10来改变增量。"
  189. ], # Do not remove this.
  190. # -------------------------------------------------------------------------
  191. :window_blu => ["窗口蓝色", "None", "None",
  192. "改变蓝色色调的Window。\n" +
  193. "按住SHIFT键,用10来改变增量。"
  194. ], # Do not remove this.
  195. # -------------------------------------------------------------------------
  196. :volume_bgm => ["背景音乐量", 12, 4, # Options 1 & 2 are Gauge Colours.
  197. "更改用于背景音乐的音量。\n" +
  198. "按住SHIFT键,用10来改变增量。"
  199. ], # Do not remove this.
  200. # -------------------------------------------------------------------------
  201. :volume_bgs => ["背景声音量", 13, 5, # Options 1 & 2 are Gauge Colours.
  202. "改变用于背景声音的音量。\n" +
  203. "按住SHIFT键,用10来改变增量。"
  204. ], # Do not remove this.
  205. # -------------------------------------------------------------------------
  206. :volume_sfx => ["音效的声量", 14, 6, # Options 1 & 2 are Gauge Colours.
  207. "改变用于音效的音量。\n" +
  208. "按住SHIFT键,用10来改变增量。"
  209. ], # Do not remove this.
  210. # -------------------------------------------------------------------------
  211. :autodash => ["主角移动速度", "走", "跑",
  212. "自动跑不必用运行按钮。"
  213. ], # Do not remove this.
  214. # -------------------------------------------------------------------------
  215. :instantmsg => ["显示文字速度", "普通", "快速",
  216. "设置消息文字出现一个接一个或瞬间。"
  217. ], # Do not remove this.
  218. # -------------------------------------------------------------------------
  219. :animations => ["战斗速度", "隐藏", "展现",
  220. "在战斗中,加快战斗隐藏的动画?"
  221. ], # Do not remove this.
  222. # -------------------------------------------------------------------------
  223. :to_title => ["返回标题页面", "None", "None",
  224. "返回标题页面"
  225. ], # Do not remove this.
  226. # -------------------------------------------------------------------------
  227. :shutdown => ["退出游戏", "None", "None",
  228. "退出此游戏"
  229. ], # Do not remove this.
  230. # -------------------------------------------------------------------------
  231. } # Do not remove this.

  232. end # SYSTEM
  233. end # YEA

  234. #==============================================================================
  235. # ▼ Editting anything past this point may potentially result in causing
  236. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  237. # halitosis so edit at your own risk.
  238. #==============================================================================

  239. #==============================================================================
  240. # ■ Vocab
  241. #==============================================================================

  242. module Vocab

  243. #--------------------------------------------------------------------------
  244. # overwrite method: self.game_end
  245. #--------------------------------------------------------------------------
  246. def self.game_end
  247. return YEA::SYSTEM::COMMAND_NAME
  248. end

  249. end # Vocab

  250. #==============================================================================
  251. # ■ RPG::BGM
  252. #==============================================================================

  253. class RPG::BGM < RPG::AudioFile

  254. #--------------------------------------------------------------------------
  255. # overwrite method: play
  256. #--------------------------------------------------------------------------
  257. def play(pos = 0)
  258. if @name.empty?
  259. Audio.bgm_stop
  260. @@last = RPG::BGM.new
  261. else
  262. volume = @volume
  263. volume *= $game_system.volume(:bgm) * 0.01 unless $game_system.nil?
  264. Audio.bgm_play('Audio/BGM/' + @name, volume, @pitch, pos)
  265. @@last = self.clone
  266. end
  267. end

  268. end # RPG::BGM

  269. #==============================================================================
  270. # ■ RPG::ME
  271. #==============================================================================

  272. class RPG::ME < RPG::AudioFile

  273. #--------------------------------------------------------------------------
  274. # overwrite method: play
  275. #--------------------------------------------------------------------------
  276. def play
  277. if @name.empty?
  278. Audio.me_stop
  279. else
  280. volume = @volume
  281. volume *= $game_system.volume(:bgm) * 0.01 unless $game_system.nil?
  282. Audio.me_play('Audio/ME/' + @name, volume, @pitch)
  283. end
  284. end

  285. end # RPG::ME

  286. #==============================================================================
  287. # ■ RPG::BGS
  288. #==============================================================================

  289. class RPG::BGS < RPG::AudioFile

  290. #--------------------------------------------------------------------------
  291. # overwrite method: play
  292. #--------------------------------------------------------------------------
  293. def play(pos = 0)
  294. if @name.empty?
  295. Audio.bgs_stop
  296. @@last = RPG::BGS.new
  297. else
  298. volume = @volume
  299. volume *= $game_system.volume(:bgs) * 0.01 unless $game_system.nil?
  300. Audio.bgs_play('Audio/BGS/' + @name, volume, @pitch, pos)
  301. @@last = self.clone
  302. end
  303. end

  304. end # RPG::BGS

  305. #==============================================================================
  306. # ■ RPG::SE
  307. #==============================================================================

  308. class RPG::SE < RPG::AudioFile

  309. #--------------------------------------------------------------------------
  310. # overwrite method: play
  311. #--------------------------------------------------------------------------
  312. def play
  313. unless @name.empty?
  314. volume = @volume
  315. volume *= $game_system.volume(:sfx) * 0.01 unless $game_system.nil?
  316. Audio.se_play('Audio/SE/' + @name, volume, @pitch)
  317. end
  318. end

  319. end # RPG::SE

  320. #==============================================================================
  321. # ■ Game_System
  322. #==============================================================================

  323. class Game_System

  324. #--------------------------------------------------------------------------
  325. # alias method: initialize
  326. #--------------------------------------------------------------------------
  327. alias game_system_initialize_so initialize
  328. def initialize
  329. game_system_initialize_so
  330. init_volume_control
  331. init_autodash
  332. init_instantmsg
  333. init_animations
  334. end

  335. #--------------------------------------------------------------------------
  336. # new method: init_volume_control
  337. #--------------------------------------------------------------------------
  338. def init_volume_control
  339. @volume = {}
  340. @volume[:bgm] = 100
  341. @volume[:bgs] = 100
  342. @volume[:sfx] = 100
  343. end

  344. #--------------------------------------------------------------------------
  345. # new method: volume
  346. #--------------------------------------------------------------------------
  347. def volume(type)
  348. init_volume_control if @volume.nil?
  349. return [[@volume[type], 0].max, 100].min
  350. end

  351. #--------------------------------------------------------------------------
  352. # new method: volume_change
  353. #--------------------------------------------------------------------------
  354. def volume_change(type, increment)
  355. init_volume_control if @volume.nil?
  356. @volume[type] += increment
  357. @volume[type] = [[@volume[type], 0].max, 100].min
  358. end

  359. #--------------------------------------------------------------------------
  360. # new method: init_autodash
  361. #--------------------------------------------------------------------------
  362. def init_autodash
  363. @autodash = YEA::SYSTEM::DEFAULT_AUTODASH
  364. end

  365. #--------------------------------------------------------------------------
  366. # new method: autodash?
  367. #--------------------------------------------------------------------------
  368. def autodash?
  369. init_autodash if @autodash.nil?
  370. return @autodash
  371. end

  372. #--------------------------------------------------------------------------
  373. # new method: set_autodash
  374. #--------------------------------------------------------------------------
  375. def set_autodash(value)
  376. @autodash = value
  377. end

  378. #--------------------------------------------------------------------------
  379. # new method: init_instantmsg
  380. #--------------------------------------------------------------------------
  381. def init_instantmsg
  382. @instantmsg = YEA::SYSTEM::DEFAULT_INSTANTMSG
  383. end

  384. #--------------------------------------------------------------------------
  385. # new method: instantmsg?
  386. #--------------------------------------------------------------------------
  387. def instantmsg?
  388. init_instantmsg if @instantmsg.nil?
  389. return @instantmsg
  390. end

  391. #--------------------------------------------------------------------------
  392. # new method: set_instantmsg
  393. #--------------------------------------------------------------------------
  394. def set_instantmsg(value)
  395. @instantmsg = value
  396. end

  397. #--------------------------------------------------------------------------
  398. # new method: init_animations
  399. #--------------------------------------------------------------------------
  400. def init_animations
  401. @animations = YEA::SYSTEM::DEFAULT_ANIMATIONS
  402. end

  403. #--------------------------------------------------------------------------
  404. # new method: animations?
  405. #--------------------------------------------------------------------------
  406. def animations?
  407. init_animations if @animations.nil?
  408. return @animations
  409. end

  410. #--------------------------------------------------------------------------
  411. # new method: set_animations
  412. #--------------------------------------------------------------------------
  413. def set_animations(value)
  414. @animations = value
  415. end

  416. end # Game_System

  417. #==============================================================================
  418. # ■ Game_Player
  419. #==============================================================================

  420. class Game_Player < Game_Character

  421. #--------------------------------------------------------------------------
  422. # alias method: dash?
  423. #--------------------------------------------------------------------------
  424. alias game_player_dash_so dash?
  425. def dash?
  426. if $game_system.autodash?
  427. return false if @move_route_forcing
  428. return false if $game_map.disable_dash?
  429. return false if vehicle
  430. return !Input.press?(:A)
  431. else
  432. return game_player_dash_so
  433. end
  434. end

  435. end # Game_Player

  436. #==============================================================================
  437. # ■ Scene_Battle
  438. #==============================================================================

  439. class Scene_Battle < Scene_Base

  440. #--------------------------------------------------------------------------
  441. # alias method: show_fast?
  442. #--------------------------------------------------------------------------
  443. alias scene_battle_show_fast_so show_fast?
  444. def show_fast?
  445. return true unless $game_system.animations?
  446. return scene_battle_show_fast_so
  447. end

  448. #--------------------------------------------------------------------------
  449. # alias method: show_normal_animation
  450. #--------------------------------------------------------------------------
  451. alias scene_battle_show_normal_animation_so show_normal_animation
  452. def show_normal_animation(targets, animation_id, mirror = false)
  453. return unless $game_system.animations?
  454. scene_battle_show_normal_animation_so(targets, animation_id, mirror)
  455. end

  456. end # Scene_Battle

  457. #==============================================================================
  458. # ■ Window_Message
  459. #==============================================================================

  460. class Window_Message < Window_Base

  461. #--------------------------------------------------------------------------
  462. # alias method: clear_flags
  463. #--------------------------------------------------------------------------
  464. alias window_message_clear_flags_so clear_flags
  465. def clear_flags
  466. window_message_clear_flags_so
  467. @show_fast = true if $game_system.instantmsg?
  468. end

  469. end # Window_Message

  470. #==============================================================================
  471. # ■ Window_SystemOptions
  472. #==============================================================================

  473. class Window_SystemOptions < Window_Command

  474. #--------------------------------------------------------------------------
  475. # initialize
  476. #--------------------------------------------------------------------------
  477. def initialize(help_window)
  478. @help_window = help_window
  479. super(0, @help_window.height)
  480. refresh
  481. end

  482. #--------------------------------------------------------------------------
  483. # window_width
  484. #--------------------------------------------------------------------------
  485. def window_width; return Graphics.width; end

  486. #--------------------------------------------------------------------------
  487. # window_height
  488. #--------------------------------------------------------------------------
  489. def window_height; return Graphics.height - @help_window.height; end

  490. #--------------------------------------------------------------------------
  491. # update_help
  492. #--------------------------------------------------------------------------
  493. def update_help
  494. if current_symbol == :custom_switch || current_symbol == :custom_variable
  495. text = @help_descriptions[current_ext]
  496. else
  497. text = @help_descriptions[current_symbol]
  498. end
  499. text = "" if text.nil?
  500. @help_window.set_text(text)
  501. end

  502. #--------------------------------------------------------------------------
  503. # ok_enabled?
  504. #--------------------------------------------------------------------------
  505. def ok_enabled?
  506. return true if [:to_title, :shutdown].include?(current_symbol)
  507. return false
  508. end

  509. #--------------------------------------------------------------------------
  510. # make_command_list
  511. #--------------------------------------------------------------------------
  512. def make_command_list
  513. @help_descriptions = {}
  514. for command in YEA::SYSTEM::COMMANDS
  515. case command
  516. when :blank
  517. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  518. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  519. when :window_red, :window_grn, :window_blu
  520. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  521. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  522. when :volume_bgm, :volume_bgs, :volume_sfx
  523. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  524. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  525. when :autodash, :instantmsg, :animations
  526. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  527. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  528. when :to_title, :shutdown
  529. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  530. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  531. else
  532. process_custom_switch(command)
  533. process_custom_variable(command)
  534. end
  535. end
  536. end

  537. #--------------------------------------------------------------------------
  538. # process_custom_switch
  539. #--------------------------------------------------------------------------
  540. def process_custom_switch(command)
  541. return unless YEA::SYSTEM::CUSTOM_SWITCHES.include?(command)
  542. name = YEA::SYSTEM::CUSTOM_SWITCHES[command][1]
  543. add_command(name, :custom_switch, true, command)
  544. @help_descriptions[command] = YEA::SYSTEM::CUSTOM_SWITCHES[command][4]
  545. end

  546. #--------------------------------------------------------------------------
  547. # process_custom_variable
  548. #--------------------------------------------------------------------------
  549. def process_custom_variable(command)
  550. return unless YEA::SYSTEM::CUSTOM_VARIABLES.include?(command)
  551. name = YEA::SYSTEM::CUSTOM_VARIABLES[command][1]
  552. add_command(name, :custom_variable, true, command)
  553. @help_descriptions[command] = YEA::SYSTEM::CUSTOM_VARIABLES[command][6]
  554. end

  555. #--------------------------------------------------------------------------
  556. # draw_item
  557. #--------------------------------------------------------------------------
  558. def draw_item(index)
  559. reset_font_settings
  560. rect = item_rect(index)
  561. contents.clear_rect(rect)
  562. case @list[index][:symbol]
  563. when :window_red, :window_grn, :window_blu
  564. draw_window_tone(rect, index, @list[index][:symbol])
  565. when :volume_bgm, :volume_bgs, :volume_sfx
  566. draw_volume(rect, index, @list[index][:symbol])
  567. when :autodash, :instantmsg, :animations
  568. draw_toggle(rect, index, @list[index][:symbol])
  569. when :to_title, :shutdown
  570. draw_text(item_rect_for_text(index), command_name(index), 1)
  571. when :custom_switch
  572. draw_custom_switch(rect, index, @list[index][:ext])
  573. when :custom_variable
  574. draw_custom_variable(rect, index, @list[index][:ext])
  575. end
  576. end

  577. #--------------------------------------------------------------------------
  578. # draw_window_tone
  579. #--------------------------------------------------------------------------
  580. def draw_window_tone(rect, index, symbol)
  581. name = @list[index][:name]
  582. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  583. #---
  584. dx = contents.width / 2
  585. tone = $game_system.window_tone
  586. case symbol
  587. when :window_red
  588. rate = (tone.red + 255.0) / 510.0
  589. colour1 = Color.new(128, 0, 0)
  590. colour2 = Color.new(255, 0, 0)
  591. value = tone.red.to_i
  592. when :window_grn
  593. rate = (tone.green + 255.0) / 510.0
  594. colour1 = Color.new(0, 128, 0)
  595. colour2 = Color.new(0, 255, 0)
  596. value = tone.green.to_i
  597. when :window_blu
  598. rate = (tone.blue + 255.0) / 510.0
  599. colour1 = Color.new(0, 0, 128)
  600. colour2 = Color.new(0, 0, 255)
  601. value = tone.blue.to_i
  602. end
  603. draw_gauge(dx, rect.y, contents.width - dx - 48, rate, colour1, colour2)
  604. draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
  605. end

  606. #--------------------------------------------------------------------------
  607. # draw_volume
  608. #--------------------------------------------------------------------------
  609. def draw_volume(rect, index, symbol)
  610. name = @list[index][:name]
  611. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  612. #---
  613. dx = contents.width / 2
  614. case symbol
  615. when :volume_bgm
  616. rate = $game_system.volume(:bgm)
  617. when :volume_bgs
  618. rate = $game_system.volume(:bgs)
  619. when :volume_sfx
  620. rate = $game_system.volume(:sfx)
  621. end
  622. colour1 = text_color(YEA::SYSTEM::COMMAND_VOCAB[symbol][1])
  623. colour2 = text_color(YEA::SYSTEM::COMMAND_VOCAB[symbol][2])
  624. value = sprintf("%d%%", rate)
  625. rate *= 0.01
  626. draw_gauge(dx, rect.y, contents.width - dx - 48, rate, colour1, colour2)
  627. draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
  628. end

  629. #--------------------------------------------------------------------------
  630. # draw_toggle
  631. #--------------------------------------------------------------------------
  632. def draw_toggle(rect, index, symbol)
  633. name = @list[index][:name]
  634. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  635. #---
  636. dx = contents.width / 2
  637. case symbol
  638. when :autodash
  639. enabled = $game_system.autodash?
  640. when :instantmsg
  641. enabled = $game_system.instantmsg?
  642. when :animations
  643. enabled = $game_system.animations?
  644. end
  645. dx = contents.width/2
  646. change_color(normal_color, !enabled)
  647. option1 = YEA::SYSTEM::COMMAND_VOCAB[symbol][1]
  648. draw_text(dx, rect.y, contents.width/4, line_height, option1, 1)
  649. dx += contents.width/4
  650. change_color(normal_color, enabled)
  651. option2 = YEA::SYSTEM::COMMAND_VOCAB[symbol][2]
  652. draw_text(dx, rect.y, contents.width/4, line_height, option2, 1)
  653. end

  654. #--------------------------------------------------------------------------
  655. # cursor_right
  656. #--------------------------------------------------------------------------
  657. def draw_custom_switch(rect, index, ext)
  658. name = @list[index][:name]
  659. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  660. #---
  661. dx = contents.width / 2
  662. enabled = $game_switches[YEA::SYSTEM::CUSTOM_SWITCHES[ext][0]]
  663. dx = contents.width/2
  664. change_color(normal_color, !enabled)
  665. option1 = YEA::SYSTEM::CUSTOM_SWITCHES[ext][2]
  666. draw_text(dx, rect.y, contents.width/4, line_height, option1, 1)
  667. dx += contents.width/4
  668. change_color(normal_color, enabled)
  669. option2 = YEA::SYSTEM::CUSTOM_SWITCHES[ext][3]
  670. draw_text(dx, rect.y, contents.width/4, line_height, option2, 1)
  671. end

  672. #--------------------------------------------------------------------------
  673. # draw_custom_variable
  674. #--------------------------------------------------------------------------
  675. def draw_custom_variable(rect, index, ext)
  676. name = @list[index][:name]
  677. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  678. #---
  679. dx = contents.width / 2
  680. value = $game_variables[YEA::SYSTEM::CUSTOM_VARIABLES[ext][0]]
  681. colour1 = text_color(YEA::SYSTEM::CUSTOM_VARIABLES[ext][2])
  682. colour2 = text_color(YEA::SYSTEM::CUSTOM_VARIABLES[ext][3])
  683. minimum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][4]
  684. maximum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][5]
  685. rate = (value - minimum).to_f / [(maximum - minimum).to_f, 0.01].max
  686. dx = contents.width/2
  687. draw_gauge(dx, rect.y, contents.width - dx - 48, rate, colour1, colour2)
  688. draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
  689. end

  690. #--------------------------------------------------------------------------
  691. # cursor_right
  692. #--------------------------------------------------------------------------
  693. def cursor_right(wrap = false)
  694. cursor_change(:right)
  695. super(wrap)
  696. end

  697. #--------------------------------------------------------------------------
  698. # cursor_left
  699. #--------------------------------------------------------------------------
  700. def cursor_left(wrap = false)
  701. cursor_change(:left)
  702. super(wrap)
  703. end

  704. #--------------------------------------------------------------------------
  705. # cursor_change
  706. #--------------------------------------------------------------------------
  707. def cursor_change(direction)
  708. case current_symbol
  709. when :window_red, :window_blu, :window_grn
  710. change_window_tone(direction)
  711. when :volume_bgm, :volume_bgs, :volume_sfx
  712. change_volume(direction)
  713. when :autodash, :instantmsg, :animations
  714. change_toggle(direction)
  715. when :custom_switch
  716. change_custom_switch(direction)
  717. when :custom_variable
  718. change_custom_variables(direction)
  719. end
  720. end

  721. #--------------------------------------------------------------------------
  722. # change_window_tone
  723. #--------------------------------------------------------------------------
  724. def change_window_tone(direction)
  725. Sound.play_cursor
  726. value = direction == :left ? -1 : 1
  727. value *= 10 if Input.press?(:A)
  728. tone = $game_system.window_tone.clone
  729. case current_symbol
  730. when :window_red; tone.red += value
  731. when :window_grn; tone.green += value
  732. when :window_blu; tone.blue += value
  733. end
  734. $game_system.window_tone = tone
  735. draw_item(index)
  736. end

  737. #--------------------------------------------------------------------------
  738. # change_window_tone
  739. #--------------------------------------------------------------------------
  740. def change_volume(direction)
  741. Sound.play_cursor
  742. value = direction == :left ? -1 : 1
  743. value *= 10 if Input.press?(:A)
  744. case current_symbol
  745. when :volume_bgm
  746. $game_system.volume_change(:bgm, value)
  747. RPG::BGM::last.play
  748. when :volume_bgs
  749. $game_system.volume_change(:bgs, value)
  750. RPG::BGS::last.play
  751. when :volume_sfx
  752. $game_system.volume_change(:sfx, value)
  753. end
  754. draw_item(index)
  755. end

  756. #--------------------------------------------------------------------------
  757. # change_toggle
  758. #--------------------------------------------------------------------------
  759. def change_toggle(direction)
  760. value = direction == :left ? false : true
  761. case current_symbol
  762. when :autodash
  763. current_case = $game_system.autodash?
  764. $game_system.set_autodash(value)
  765. when :instantmsg
  766. current_case = $game_system.instantmsg?
  767. $game_system.set_instantmsg(value)
  768. when :animations
  769. current_case = $game_system.animations?
  770. $game_system.set_animations(value)
  771. end
  772. Sound.play_cursor if value != current_case
  773. draw_item(index)
  774. end

  775. #--------------------------------------------------------------------------
  776. # change_custom_switch
  777. #--------------------------------------------------------------------------
  778. def change_custom_switch(direction)
  779. value = direction == :left ? false : true
  780. ext = current_ext
  781. current_case = $game_switches[YEA::SYSTEM::CUSTOM_SWITCHES[ext][0]]
  782. $game_switches[YEA::SYSTEM::CUSTOM_SWITCHES[ext][0]] = value
  783. Sound.play_cursor if value != current_case
  784. draw_item(index)
  785. end

  786. #--------------------------------------------------------------------------
  787. # change_custom_variables
  788. #--------------------------------------------------------------------------
  789. def change_custom_variables(direction)
  790. Sound.play_cursor
  791. value = direction == :left ? -1 : 1
  792. value *= 10 if Input.press?(:A)
  793. ext = current_ext
  794. var = YEA::SYSTEM::CUSTOM_VARIABLES[ext][0]
  795. minimum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][4]
  796. maximum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][5]
  797. $game_variables[var] += value
  798. $game_variables[var] = [[$game_variables[var], minimum].max, maximum].min
  799. draw_item(index)
  800. end

  801. end # Window_SystemOptions

  802. #==============================================================================
  803. # ■ Scene_Menu
  804. #==============================================================================

  805. class Scene_Menu < Scene_MenuBase

  806. #--------------------------------------------------------------------------
  807. # overwrite method: command_game_end
  808. #--------------------------------------------------------------------------
  809. def command_game_end
  810. SceneManager.call(Scene_System)
  811. end

  812. end # Scene_Menu

  813. #==============================================================================
  814. # ■ Scene_System
  815. #==============================================================================

  816. class Scene_System < Scene_MenuBase

  817. #--------------------------------------------------------------------------
  818. # start
  819. #--------------------------------------------------------------------------
  820. def start
  821. super
  822. create_help_window
  823. create_command_window
  824. end

  825. #--------------------------------------------------------------------------
  826. # create_command_window
  827. #--------------------------------------------------------------------------
  828. def create_command_window
  829. @command_window = Window_SystemOptions.new(@help_window)
  830. @command_window.set_handler(:cancel, method(:return_scene))
  831. @command_window.set_handler(:to_title, method(:command_to_title))
  832. @command_window.set_handler(:shutdown, method(:command_shutdown))
  833. end

  834. #--------------------------------------------------------------------------
  835. # command_to_title
  836. #--------------------------------------------------------------------------
  837. def command_to_title
  838. fadeout_all
  839. SceneManager.goto(Scene_Title)
  840. end

  841. #--------------------------------------------------------------------------
  842. # command_shutdown
  843. #--------------------------------------------------------------------------
  844. def command_shutdown
  845. fadeout_all
  846. SceneManager.exit
  847. end

  848. end # Scene_System

  849. #==============================================================================
  850. #
  851. # ▼ End of File
  852. #
  853. #==============================================================================
复制代码

Taroxd基础设置


  1. #--------------------------------------------------------------------------
  2. # ● require Taroxd基础设置
  3. #--------------------------------------------------------------------------
  4. class Game_System
  5. #--------------------------------------------------------------------------
  6. # ● 是否关闭显示消息
  7. #--------------------------------------------------------------------------
  8. attr_accessor :gain_message_disabled
  9. def_after(:initialize) { @gain_message_disabled = false }
  10. end

  11. class Game_Interpreter
  12. #--------------------------------------------------------------------------
  13. # ● 打开显示消息
  14. #--------------------------------------------------------------------------
  15. def gain_message_on
  16. $game_system.gain_message_disabled = false
  17. end
  18. #--------------------------------------------------------------------------
  19. # ● 关闭显示消息
  20. #--------------------------------------------------------------------------
  21. def gain_message_off
  22. $game_system.gain_message_disabled = true
  23. end
  24. #--------------------------------------------------------------------------
  25. # ● 显示提示窗口
  26. #--------------------------------------------------------------------------
  27. def show_gain_message(item, value)
  28. return if $game_system.gain_message_disabled || value == 0
  29. message =
  30. if item
  31. "#{value > 0 ? '获得' : '失去'}了 #{item.name} * #{value}"
  32. else
  33. "#{value > 0 ? '获得' : '失去'}了 #{value} #{Vocab.currency_unit}"
  34. end
  35. wait_for_message
  36. $game_message.add(message)
  37. wait_for_message
  38. end
  39. #--------------------------------------------------------------------------
  40. # ● 增减持有金钱
  41. #--------------------------------------------------------------------------
  42. def_after :command_125 do
  43. value = operate_value(@params[0], @params[1], @params[2])
  44. show_gain_message(nil, value)
  45. end
  46. #--------------------------------------------------------------------------
  47. # ● 增减物品
  48. #--------------------------------------------------------------------------
  49. def_after :command_126 do
  50. value = operate_value(@params[1], @params[2], @params[3])
  51. show_gain_message($data_items[@params[0]], value)
  52. end
  53. #--------------------------------------------------------------------------
  54. # ● 增减武器
  55. #--------------------------------------------------------------------------
  56. def_after :command_127 do
  57. value = operate_value(@params[1], @params[2], @params[3])
  58. show_gain_message($data_weapons[@params[0]], value)
  59. end
  60. #--------------------------------------------------------------------------
  61. # ● 增减护甲
  62. #--------------------------------------------------------------------------
  63. def_after :command_128 do
  64. value = operate_value(@params[1], @params[2], @params[3])
  65. show_gain_message($data_armors[@params[0]], value)
  66. end
  67. end
复制代码

Syvkal's Menu Bars VXAce
  1. #==============================================================================
  2. # ** Syvkal's Menu Bars VXAce
  3. #------------------------------------------------------------------------------
  4. # by Syvkal
  5. # Version 1.2
  6. # 19-03-12
  7. #------------------------------------------------------------------------------
  8. # * Original available at:
  9. # www.rpgmakervxace.net & forums.rpgmakerweb.com
  10. # Please do not redistribute this script
  11. #------------------------------------------------------------------------------
  12. # * Terms of Use
  13. # Available for use in commercial games provided that I get a free copy :P
  14. # Email me: syvkal@hotmail.co.uk
  15. # Please do not redistribute this script
  16. #==============================================================================
  17. #
  18. # - INTRODUCTION -
  19. #
  20. # This system implements a series of Plug 'N' Play Menu Bars/Gauges
  21. # The Bars (and some of the colour schemes) were inspired CogWheel,
  22. # but all coding was done by me
  23. #
  24. #------------------------------------------------------------------------------
  25. #
  26. # - USAGE -
  27. #
  28. # This system will work as soon as you put it in the Script Editor
  29. # You can edit the script from the Configuration System
  30. #
  31. # --- Custom Gauges -----------------------------------
  32. #
  33. # I have designed the script so you can easily (with minimal scripting
  34. # knowledge) add you own custom gauges for any attribute you want
  35. #
  36. # To draw a gauge use:
  37. # draw_syvkal_gauge(x, y, width, rate, color1, color2, slant)
  38. #
  39. # rate : Percentage of your custom attribute max (full at 1.0)
  40. # color1 : left side gradient color
  41. # color2 : right side gradient color
  42. # style : gauge draw style (explained in the Configuration System)
  43. #
  44. # --- Auto Generate Color ---------------------------
  45. #
  46. # Additionally, I have added an extra function to make it easy to
  47. # create your own colours that change as the gauge decreases
  48. #
  49. # To generate a custom colour use:
  50. # auto_color(color1, color2, r)
  51. #
  52. # r : Percentage of your custom attribute max (full at 1.0)
  53. # color1 : Colour you want for when the gauge is full
  54. # color2 : Colour you want for when the gauge is nearly empty
  55. #
  56. # This generates a SINGLE colour that changes with the gauge
  57. # Each gauge requires two colours so it has a gradient
  58. #
  59. # --- Ring Bars -------------------------------------
  60. #
  61. # Ring Bars have been removed for now, I didn't like how they looked
  62. # Testing has shown RGSS3 is more capable of the kind of ring bars I
  63. # wanted to make, but I want to perfect them first
  64. #
  65. #==============================================================================

  66. #===================================================#
  67. # ** M I N O R C O N F I G U R A T I O N ** #
  68. #===================================================#

  69. #--------------------------------------------------------------------------
  70. # * Parameter Gauge Max
  71. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  72. # Minor addition allowing you to choose a max for the parameter gauges
  73. # Best set just above your actor's highest stat (to allow for buffs)
  74. # Excludes HP, MP, TP
  75. # (This does not affect your actor's stats, but simply makes the gauges
  76. # fill up quicker and look more appealing)
  77. #--------------------------------------------------------------------------
  78. P_MAX = 400 # Parameter Gauge Max
  79. #-------------------------------------------------------------------------#
  80. # ** Full Configuration system further down ** #
  81. #-------------------------------------------------------------------------#

  82. #==============================================================================
  83. # ** Window_Base
  84. #------------------------------------------------------------------------------
  85. # Replaces various 'Draw' functions to add each gauge.
  86. #==============================================================================
  87. class Window_Base < Window

  88. #===================================================#
  89. # ** C O N F I G U R A T I O N S Y S T E M ** #
  90. #===================================================#

  91. #--------------------------------------------------------------------------
  92. # * Gauge Draw Styles
  93. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  94. # Use different bracket types to 'draw' the style of each bar
  95. # Available bracket types:
  96. # ( ) < > | / \
  97. # Simply mix and match for achieve your desired effect
  98. #
  99. # To use the default rectangular gauges, use | or simply leave blank
  100. # eg. '| |' or ''
  101. # Any invalid symbol will result in the default | as well
  102. #
  103. # - - W A R N I N G - -
  104. #
  105. # When using the following bracket:
  106. # \
  107. # Ensure it is followed a space (eg. '| \ ') or itself (eg. '| \\')
  108. # If the rest of the text below turns purple, you've done it wrong
  109. #--------------------------------------------------------------------------
  110. HPSTYLE = '| |' # Style of the HP Gauge
  111. MPSTYLE = '| |' # Style of the MP Gauge
  112. TPSTYLE = '/ /' # Style of the TP Gauge
  113. PARSTYLE = '( )' # Style of the Parameter Gauges
  114. #--------------------------------------------------------------------------
  115. # * Additional Gauge Preferences
  116. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  117. # Simple adjustments to aesthetics
  118. # Advised to use SLANTDSIZE if you have used / or \ in multiple bars
  119. #--------------------------------------------------------------------------
  120. THICKCURVED = false # Slightly thicken curved bars?
  121. SLANTDSIZE = true # Shorten slanted bars?
  122. #--------------------------------------------------------------------------
  123. # * Gauge Border Colors
  124. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  125. # Control the colours of the gauge borders
  126. #--------------------------------------------------------------------------
  127. COLOR1 = Color.new(0, 0, 0, 192) # Outer Border
  128. COLOR2 = Color.new(255, 255, 192, 192) # Inner Border
  129. #--------------------------------------------------------------------------
  130. # * Empty Cauge Filler Colors
  131. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  132. # Control the colours of the empty gauge filler
  133. #--------------------------------------------------------------------------
  134. COLOR3 = Color.new(0, 0, 0, 12) # Half of Inner Shading
  135. COLOR4 = Color.new(64, 0, 0, 92) # Half of Inner Shading
  136. #--------------------------------------------------------------------------
  137. # * Paramater Gauge Colors
  138. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  139. # Control the colours of various parameters such as ATK, DEF, etc.
  140. # (HP, MP, TP are in the 'Complex Configuration' section)
  141. #--------------------------------------------------------------------------
  142. def param_gauge_color1(param_id)
  143. case param_id
  144. when 2
  145. text_color(20) # ATK Gauge Color1
  146. when 3
  147. text_color(14) # DEF Gauge Color1
  148. when 4
  149. text_color(30) # MAT Gauge Color1
  150. when 5
  151. text_color(13) # MDF Gauge Color1
  152. when 6
  153. text_color(28) # AGI Gauge Color1
  154. when 7
  155. text_color(19) # LUK Gauge Color1
  156. end
  157. end
  158. def param_gauge_color2(param_id)
  159. case param_id
  160. when 2
  161. text_color(21) # ATK Gauge Color1
  162. when 3
  163. text_color(6) # DEF Gauge Color1
  164. when 4
  165. text_color(31) # MAT Gauge Color1
  166. when 5
  167. text_color(5) # MDF Gauge Color1
  168. when 6
  169. text_color(29) # AGI Gauge Color1
  170. when 7
  171. text_color(7) # LUK Gauge Color1
  172. end
  173. end

  174. #===================================================#
  175. # ** C O M P L E X C O N F I G U R A T I O N ** #
  176. #===================================================#

  177. #--------------------------------------------------------------------------
  178. # * HP Gauge Colors
  179. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  180. # Control the colours of the HP gauge
  181. # (Edit only if you know what you're doing)
  182. #--------------------------------------------------------------------------
  183. def hp_gauge_color1 # HP Guage Color1
  184. return Color.new(80 - 24 * @rate, 80 * @rate, 14 * @rate, 192)
  185. end
  186. def hp_gauge_color2 # HP Guage Color2
  187. return Color.new(240 - 72 * @rate, 240 * @rate, 62 * @rate, 192)
  188. end
  189. #--------------------------------------------------------------------------
  190. # * MP Gauge Colors
  191. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  192. # Control the colours of the MP gauge
  193. # (Edit only if you know what you're doing)
  194. #--------------------------------------------------------------------------
  195. def mp_gauge_color1 # MP Guage Color1
  196. return Color.new(14 * @rate, 80 - 24 * @rate, 80 * @rate, 192)
  197. end
  198. def mp_gauge_color2 # MP Guage Color2
  199. return Color.new(62 * @rate, 240 - 72 * @rate, 240 * @rate, 192)
  200. end
  201. #--------------------------------------------------------------------------
  202. # * TP Gauge Colors
  203. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  204. # Control the colours of the TP gauge
  205. # (Edit only if you know what you're doing)
  206. #--------------------------------------------------------------------------
  207. def tp_gauge_color1 # TP Gauge Color1
  208. return auto_color(Color.new(192,0,0,192), Color.new(255,110,0,192))
  209. end
  210. def tp_gauge_color2 # TP Gauge Color2
  211. return auto_color(Color.new(255,165,0,192), Color.new(255,220,0,192))
  212. end

  213. #===================================================#
  214. # ** E N D C O N F I G U R A T I O N ** #
  215. #===================================================#

  216. #--------------------------------------------------------------------------
  217. # * Public Instance Variables
  218. #--------------------------------------------------------------------------
  219. attr_accessor :rate # Rate for Colour calculations
  220. #--------------------------------------------------------------------------
  221. # * Alias Listings
  222. #--------------------------------------------------------------------------
  223. alias draw_actor_param_original draw_actor_param
  224. alias initialize_original initialize
  225. #--------------------------------------------------------------------------
  226. # * Object Initialization
  227. #--------------------------------------------------------------------------
  228. def initialize(x, y, width, height)
  229. @rate = 1.0
  230. initialize_original(x, y, width, height)
  231. end
  232. #--------------------------------------------------------------------------
  233. # * Draw HP
  234. #--------------------------------------------------------------------------
  235. def draw_actor_hp(actor, x, y, width = 124)
  236. @rate = [actor.hp_rate, 1.0].min
  237. draw_syvkal_gauge(x, y, width, @rate, hp_gauge_color1, hp_gauge_color2, HPSTYLE)
  238. change_color(system_color)
  239. draw_text(x, y, 30, line_height, Vocab::hp_a)
  240. draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  241. hp_color(actor), normal_color)
  242. end
  243. #--------------------------------------------------------------------------
  244. # * Draw MP
  245. #--------------------------------------------------------------------------
  246. def draw_actor_mp(actor, x, y, width = 124)
  247. @rate = [actor.mp_rate, 1.0].min
  248. draw_syvkal_gauge(x, y, width, @rate, mp_gauge_color1, mp_gauge_color2, MPSTYLE)
  249. change_color(system_color)
  250. draw_text(x, y, 30, line_height, Vocab::mp_a)
  251. draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  252. mp_color(actor), normal_color)
  253. end
  254. #--------------------------------------------------------------------------
  255. # * Draw TP
  256. #--------------------------------------------------------------------------
  257. def draw_actor_tp(actor, x, y, width = 124)
  258. @rate = [actor.tp_rate, 1.0].min
  259. draw_syvkal_gauge(x, y, width, @rate, tp_gauge_color1, tp_gauge_color2, TPSTYLE)
  260. change_color(system_color)
  261. draw_text(x, y, 30, line_height, Vocab::tp_a)
  262. change_color(tp_color(actor))
  263. draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
  264. end
  265. #--------------------------------------------------------------------------
  266. # * Draw Parameters
  267. # actor : actor
  268. # x : draw spot x-coordinate
  269. # y : draw spot y-coordinate
  270. # type : Type of parameters (0-3)
  271. #--------------------------------------------------------------------------
  272. def draw_actor_param(actor, x, y, param_id, width = 80)
  273. draw_syvkal_gauge(x, y, width, actor.params_rate(param_id), param_gauge_color1(param_id), param_gauge_color2(param_id), PARSTYLE)
  274. draw_actor_param_original(actor, x, y, param_id)
  275. end
  276. #--------------------------------------------------------------------------
  277. # * Auto Generate Color
  278. # color1 : initial color
  279. # color2 : ending color
  280. # r : rate (full at 1.0) 1 -> color1, 0 -> color2
  281. #--------------------------------------------------------------------------
  282. def auto_color(color1, color2, r = @rate)
  283. a_color = Color.new
  284. a_color.red = (1-r)*color2.red + r*color1.red
  285. a_color.green = (1-r)*color2.green + r*color1.green
  286. a_color.blue = (1-r)*color2.blue + r*color1.blue
  287. a_color.alpha = (1-r)*color2.alpha + r*color1.alpha
  288. return a_color
  289. end
  290. #--------------------------------------------------------------------------
  291. # * Draw Syvkal Style Gauge
  292. # rate : Rate (full at 1.0)
  293. # color1 : Left side color
  294. # color2 : Right side color
  295. # style : gauge draw style
  296. #--------------------------------------------------------------------------
  297. def draw_syvkal_gauge(x, y, width, rate, color1, color2, style = '')
  298. fill_w = (width * rate).to_i
  299. gauge_y = y + line_height - 8
  300. h = 6
  301. style.slice!(/\s*/); style = style.split(/\s*/)
  302. if style.empty? or (style[0] == '|' && style[1] == '|')
  303. contents.fill_rect(x-2, gauge_y-2, width+4, 10, COLOR1)
  304. contents.fill_rect(x-1, gauge_y-1, width+2, 8, COLOR2)
  305. contents.gradient_fill_rect(x, gauge_y, width, 6, COLOR3, COLOR4)
  306. contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
  307. else
  308. adj1 = style_adj_string(style[0]); adj2 = style_adj_string(style[1], true)
  309. h += 4
  310. for i in 0...h
  311. a1 = eval(adj1[0]); a2 = eval(adj2[0])
  312. a3 = adj1[2]; a4 = adj2[4].nil? ? adj2[2] : adj2[4]
  313. contents.fill_rect(x-a3 +a1, gauge_y-2 + i, width+(a3+a4) - a1 - a2, 1, COLOR1)
  314. end
  315. h -= 2
  316. for i in 0...h
  317. a1 = eval(adj1[0]); a2 = eval(adj2[0])
  318. a3 = adj1[1]; a4 = adj2[3].nil? ? adj2[1] : adj2[3]
  319. contents.fill_rect(x-a3 +a1, gauge_y-1 + i, width+(a3+a4) - a1 - a2, 1, COLOR2)
  320. end
  321. h -= 2
  322. for i in 0...h
  323. a1 = eval(adj1[0]); a2 = eval(adj2[0])
  324. contents.gradient_fill_rect(x +a1, gauge_y +i, width - a1 - a2, 1, COLOR3, COLOR4)
  325. end
  326. for i in 0...h
  327. a1 = eval(adj1[0]); a2 = eval(adj2[0])
  328. contents.gradient_fill_rect(x +a1, gauge_y +i, fill_w - a1 - a2, 1, color1, color2)
  329. end
  330. end
  331. end
  332. #--------------------------------------------------------------------------
  333. # * Get Style Specific Adjustment Array
  334. # sym : edge style '(', ')', '<', '>', '|', '/' or '\'
  335. # edge : end of the gauge?
  336. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  337. # Returns an array containing the following:
  338. # * a formular string to be evaluated
  339. # * adjustments to x and width values for Outer and Inner Borders
  340. #--------------------------------------------------------------------------
  341. def style_adj_string(sym, edge = false)
  342. case sym
  343. when '/'
  344. SLANTDSIZE ? [(edge ? 'i+2' : '(h+1) - i'), 3, 5] :
  345. [(edge ? 'i' : '(h-1) - i'), 3, 5]
  346. when '\\'
  347. SLANTDSIZE ? [(edge ? '(h+1) - i' : 'i+2'), 3, 5] :
  348. [(edge ? '(h-1) - i' : 'i'), 3, 5]
  349. when '<'
  350. [(edge ? '(h/2)-((h/2) - i).abs' : '((h/2) - i).abs'), 2, 3]
  351. when '>'
  352. [(edge ? '((h/2) - i).abs' : '(h/2)-((h/2) - i).abs'), 2, 3]
  353. when '('
  354. [(edge ? '((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i' :
  355. '(h-6) - ((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i'),
  356. THICKCURVED ? 3 : 2, THICKCURVED ? 5 : 4, 3, 5]
  357. when ')'
  358. [(edge ? '(h-3) - ((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i' :
  359. '((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i'),
  360. 3, 5, THICKCURVED ? 3 : 2, THICKCURVED ? 5 : 4]
  361. else # eg. | or invalid sym
  362. ['0', 1, 2]
  363. end
  364. end
  365. #--------------------------------------------------------------------------
  366. # * Draw Gauge
  367. #--------------------------------------------------------------------------
  368. def draw_gauge(x, y, width, rate, color1, color2, style = '')
  369. r = [rate, 1.0].min
  370. draw_syvkal_gauge(x, y, width, r, color1, color2, style)
  371. end
  372. end

  373. #==============================================================================
  374. # ** Game_BattlerBase
  375. #------------------------------------------------------------------------------
  376. # Added specialised 'params_rate' function.
  377. #==============================================================================

  378. class Game_BattlerBase
  379. #--------------------------------------------------------------------------
  380. # * Get Percentage of Paramaters
  381. #--------------------------------------------------------------------------
  382. def params_rate(param_id)
  383. return [param(param_id).to_f / P_MAX, 1.0].min
  384. end
  385. end

  386. #==============================================================================
  387. # ** Script Import
  388. #==============================================================================

  389. $imported = {} if $imported == nil
  390. $imported["Syvkal's Menu Bars"] = true
复制代码

获取道具总数

  1. #--------------------------------------------------------------------------
  2. # ● 自动显示得失物品提示
  3. #--------------------------------------------------------------------------

  4. module Taroxd end

  5. module Taroxd::GainMessage
  6. #--------------------------------------------------------------------------
  7. # ● 常数设置
  8. #--------------------------------------------------------------------------
  9. SWITCH = 0 # 开关打开时功能开启。可以填入 0 表示始终打开。
  10. GAIN = '获得'
  11. LOSE = '失去'
  12. ITEM_FORMAT = '%s了 %s * %d' # 获得/失去了 某物品 * N
  13. GOLD_FORMAT = '%s了 %d %s' # 获得/失去了 N 金钱单位
  14. BACKGROUND = 1 # 窗口背景(0/1/2)
  15. POSITION = 1 # 显示位置(0/1/2)
  16. GAIN_GOLD_SE = 'Shop' # 获得金钱音效(不需要的话可以直接删去该行)
  17. LOSE_GOLD_SE = 'Blow2' # 失去金钱音效(不需要的话可以直接删去该行)
  18. GAIN_ITEM_SE = 'Item1' # 获得物品音效(不需要的话可以直接删去该行)
  19. LOSE_ITEM_SE = LOSE_GOLD_SE # 失去物品音效(不需要的话可以直接删去该行)
  20. #--------------------------------------------------------------------------
  21. module_function
  22. #--------------------------------------------------------------------------
  23. # ● 功能是否启用
  24. #--------------------------------------------------------------------------
  25. def enabled?
  26. SWITCH.zero? || $game_switches[SWITCH]
  27. end
  28. #--------------------------------------------------------------------------
  29. # ● 准备
  30. #--------------------------------------------------------------------------
  31. def prepare(value, item)
  32. @item = item
  33. @value = value
  34. $game_message.background = BACKGROUND
  35. $game_message.position = POSITION
  36. play_se
  37. end
  38. #--------------------------------------------------------------------------
  39. # ● 获取提示的消息
  40. #--------------------------------------------------------------------------
  41. def message
  42. prefix = @value > 0 ? GAIN : LOSE
  43. if @item
  44. sprintf(ITEM_FORMAT, prefix, @item.name, @value.abs)
  45. else
  46. sprintf(GOLD_FORMAT, prefix, @value.abs, Vocab.currency_unit)
  47. end
  48. end
  49. #--------------------------------------------------------------------------
  50. # ● 播放音效
  51. #--------------------------------------------------------------------------
  52. def play_se
  53. const = :"#{@value > 0 ? 'GAIN' : 'LOSE'}_#{@item ? 'ITEM' : 'GOLD'}_SE"
  54. se = const_defined?(const) && const_get(const)
  55. Audio.se_play('Audio/SE/' + se) if se
  56. end
  57. end

  58. class Game_Party < Game_Unit
  59. #--------------------------------------------------------------------------
  60. # ● 获取道具总数(包括装备)
  61. #--------------------------------------------------------------------------
  62. def item_number_with_equip(item)
  63. members.inject(item_number(item)) do |number, actor|
  64. number + actor.equips.count(item)
  65. end
  66. end
  67. end

  68. class Game_Interpreter
  69. alias taroxd_gain_message_command_125 command_125
  70. alias taroxd_gain_message_command_126 command_126
  71. alias taroxd_gain_message_command_127 command_127
  72. alias taroxd_gain_message_command_128 command_128
  73. #--------------------------------------------------------------------------
  74. # ● 显示提示窗口
  75. #--------------------------------------------------------------------------
  76. def show_gain_message(value, item = nil)
  77. return if !Taroxd::GainMessage.enabled? || value.zero?
  78. Taroxd::GainMessage.prepare value, item
  79. wait_for_message
  80. $game_message.add Taroxd::GainMessage.message
  81. wait_for_message
  82. end
  83. #--------------------------------------------------------------------------
  84. # ● 增减持有金钱
  85. #--------------------------------------------------------------------------
  86. def command_125
  87. last_gold = $game_party.gold
  88. taroxd_gain_message_command_125
  89. show_gain_message($game_party.gold - last_gold)
  90. end
  91. #--------------------------------------------------------------------------
  92. # ● 增减物品
  93. #--------------------------------------------------------------------------
  94. def command_126
  95. item = $data_items[@params[0]]
  96. last_num = $game_party.item_number(item)
  97. taroxd_gain_message_command_126
  98. show_gain_message($game_party.item_number(item) - last_num, item)
  99. end
  100. #--------------------------------------------------------------------------
  101. # ● 增减武器
  102. #--------------------------------------------------------------------------
  103. def command_127
  104. item = $data_weapons[@params[0]]
  105. last_num = $game_party.item_number_with_equip(item)
  106. taroxd_gain_message_command_127
  107. value = $game_party.item_number_with_equip(item) - last_num
  108. show_gain_message(value, item)
  109. end
  110. #--------------------------------------------------------------------------
  111. # ● 增减护甲
  112. #--------------------------------------------------------------------------
  113. def command_128
  114. item = $data_armors[@params[0]]
  115. last_num = $game_party.item_number_with_equip(item)
  116. taroxd_gain_message_command_128
  117. value = $game_party.item_number_with_equip(item) - last_num
  118. show_gain_message(value, item)
  119. end
  120. end
复制代码

Ring Menu
  1. #==============================================================================
  2. # **
  3. #------------------------------------------------------------------------------
  4. # by Syvkal
  5. # Version 1.2
  6. # 03-04-12
  7. #------------------------------------------------------------------------------
  8. # * Original available at:
  9. # www.rpgmakervxace.net & forums.rpgmakerweb.com
  10. # Please do not redistribute this script
  11. #------------------------------------------------------------------------------
  12. # * Terms of Use
  13. # Available for use in commercial games provided that I get a free copy :P
  14. # Email me: syvkal@hotmail.co.uk
  15. # Please do not redistribute this script
  16. #==============================================================================
  17. #
  18. # - INTRODUCTION -
  19. #
  20. # This system implements a Plug 'N' Play Ring Menu
  21. # Movement based off XRXS, Dubealex & Hypershadow180's original XP Ring Menu,
  22. # which was devised through some simple, but clever trigonometry
  23. #
  24. #------------------------------------------------------------------------------
  25. #
  26. # - USAGE -
  27. #
  28. # Any additional scenes that are added to the menu require an icon
  29. # Place them in the pictures folder, they are advised to be 48x48 pixels
  30. #
  31. # The name of the icons must be of the form:
  32. # [Command Name] Icon
  33. #
  34. # For example 'Items Icon.png' or 'Equipment Icon.png'
  35. #
  36. # If you are unsure what it needs to be called, wait for the error message,
  37. # then call it the name of the file it can not find
  38. #
  39. #------------------------------------------------------------------------------
  40. #
  41. # - COMPATIBILITY -
  42. #
  43. # Additional scenes should be automatically added assuming thier creators
  44. # utilise the 'add_original_commands' feature in Window_MenuCommand
  45. #
  46. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  47. #
  48. # This script redefines the following methods:
  49. # * create_status_window (Scene_Menu)
  50. # * on_formation_ok (Scene_Menu)
  51. # * on_formation_cancel (Scene_Menu)
  52. # * draw_character (Window_Base)
  53. #
  54. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  55. #
  56. # This script Aliases the following methods:
  57. # * add_save_command (Window_MenuCommand)
  58. # * start (Scene_Menu)
  59. # * create_command_window (Scene_Menu)
  60. # * command_personal (Scene_Menu)
  61. # * command_formation (Scene_Menu)
  62. # * on_personal_cancel (Scene_Menu)
  63. #
  64. #==============================================================================

  65. #===================================================#
  66. # ** C O N F I G U R A T I O N S Y S T E M ** #
  67. #===================================================#

  68. #--------------------------------------------------------------------------
  69. # * Startup Frames
  70. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  71. # Amount of frames for the Startup Animation
  72. #--------------------------------------------------------------------------
  73. STARTUP_FRAMES = 20
  74. #--------------------------------------------------------------------------
  75. # * Movement Frames
  76. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  77. # Amount of frames for Movement Animation
  78. #--------------------------------------------------------------------------
  79. MOVING_FRAMES = 15
  80. #--------------------------------------------------------------------------
  81. # * Menu Ring Radius
  82. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  83. # Radius of the Menu Ring
  84. #--------------------------------------------------------------------------
  85. RING_R = 75
  86. #--------------------------------------------------------------------------
  87. # * Show Disabled Options
  88. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  89. # Set to false to exclude disabled options for the menu
  90. #--------------------------------------------------------------------------
  91. DISABLED_SHOW = false
  92. #--------------------------------------------------------------------------
  93. # * Disabled Icon
  94. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  95. # The icon displayed over disabled options
  96. # (only used when DISABLED_SHOW = true)
  97. #--------------------------------------------------------------------------
  98. ICON_DISABLE = Cache::picture('DisableIcon')
  99. #--------------------------------------------------------------------------
  100. # * Skip Single Actor Select
  101. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  102. # Set to true to skip the actor selection if there's only one party member
  103. #--------------------------------------------------------------------------
  104. ACTOR_SKIP = true
  105. #--------------------------------------------------------------------------
  106. # * Load Command Vocab
  107. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  108. # Text displayed for the loading option
  109. #--------------------------------------------------------------------------
  110. Vocab::Load = "Load"

  111. #===================================================#
  112. # ** E N D C O N F I G U R A T I O N ** #
  113. #===================================================#

  114. #==============================================================================
  115. # ** Ring_Menu Module
  116. #------------------------------------------------------------------------------
  117. # Module designed to rewrite methods defined in the desired Superclass.
  118. #==============================================================================

  119. module Ring_Menu
  120. #--------------------------------------------------------------------------
  121. # * Object Initialization
  122. #--------------------------------------------------------------------------
  123. def initialize(*args)
  124. super(*args)
  125. @cx = contents.width / 2; @cy = contents.height / 2
  126. self.opacity = 0
  127. @startup = STARTUP_FRAMES
  128. @icons = []
  129. @mode = :start
  130. @steps = @startup
  131. end
  132. #--------------------------------------------------------------------------
  133. # * Update Cursor
  134. #--------------------------------------------------------------------------
  135. def update_cursor
  136. end
  137. #--------------------------------------------------------------------------
  138. # * Determines if is moving
  139. #--------------------------------------------------------------------------
  140. def animation?
  141. return @mode != :wait
  142. end
  143. #--------------------------------------------------------------------------
  144. # * Move Cursor Down
  145. #--------------------------------------------------------------------------
  146. def cursor_down(wrap)
  147. cursor_right(wrap)
  148. end
  149. #--------------------------------------------------------------------------
  150. # * Move Cursor Up
  151. #--------------------------------------------------------------------------
  152. def cursor_up(wrap)
  153. cursor_left(wrap)
  154. end
  155. #--------------------------------------------------------------------------
  156. # * Move Cursor Right
  157. #--------------------------------------------------------------------------
  158. def cursor_right(wrap)
  159. unless animation?
  160. select((index + 1) % item_max)
  161. @mode = :mover
  162. @steps = MOVING_FRAMES
  163. Sound.play_cursor
  164. end
  165. end
  166. #--------------------------------------------------------------------------
  167. # * Move Cursor Left
  168. #--------------------------------------------------------------------------
  169. def cursor_left(wrap)
  170. unless animation?
  171. select((index - 1 + item_max) % item_max)
  172. @mode = :movel
  173. @steps = MOVING_FRAMES
  174. Sound.play_cursor
  175. end
  176. end
  177. #--------------------------------------------------------------------------
  178. # * Frame Update
  179. #--------------------------------------------------------------------------
  180. def update
  181. super
  182. refresh if animation?
  183. end
  184. #--------------------------------------------------------------------------
  185. # * Refresh
  186. #--------------------------------------------------------------------------
  187. def refresh
  188. self.contents.clear
  189. case @mode
  190. when :start
  191. refresh_start
  192. when :wait
  193. refresh_wait
  194. when :mover
  195. refresh_move(1)
  196. when :movel
  197. refresh_move(0)
  198. end
  199. end
  200. #--------------------------------------------------------------------------
  201. # * Refresh Start Period
  202. #--------------------------------------------------------------------------
  203. def refresh_start
  204. d1 = 2.0 * Math::PI / item_max
  205. d2 = 1.0 * Math::PI / @startup
  206. r = RING_R - 1.0 * RING_R * @steps / @startup
  207. for i in 0...item_max
  208. d = d1 * i + d2 * @steps
  209. x = @cx + ( r * Math.sin( d ) ).to_i
  210. y = @cy - ( r * Math.cos( d ) ).to_i
  211. draw_item(x, y, i)
  212. end
  213. @steps -= 1
  214. if @steps < 0
  215. @mode = :wait
  216. end
  217. end
  218. #--------------------------------------------------------------------------
  219. # * Refresh Wait Period
  220. #--------------------------------------------------------------------------
  221. def refresh_wait
  222. d = 2.0 * Math::PI / item_max
  223. for i in 0...item_max
  224. j = i - index
  225. x = @cx + ( RING_R * Math.sin( d * j) ).to_i
  226. y = @cy - ( RING_R * Math.cos( d * j) ).to_i
  227. draw_item(x, y, i)
  228. end
  229. end
  230. #--------------------------------------------------------------------------
  231. # * Refresh Movement Period
  232. #--------------------------------------------------------------------------
  233. def refresh_move( mode )
  234. d1 = 2.0 * Math::PI / item_max
  235. d2 = d1 / MOVING_FRAMES
  236. d2 *= -1 unless mode != 0
  237. for i in 0...item_max
  238. j = i - index
  239. d = d1 * j + d2 * @steps
  240. x = @cx + ( RING_R * Math.sin( d ) ).to_i
  241. y = @cy - ( RING_R * Math.cos( d ) ).to_i
  242. draw_item(x, y, i)
  243. end
  244. @steps -= 1
  245. if @steps < 0
  246. @mode = :wait
  247. end
  248. end
  249. end

  250. #==============================================================================
  251. # ** Window_MenuCommand
  252. #------------------------------------------------------------------------------
  253. # Converted into a Ring Menu.
  254. #==============================================================================

  255. class Window_MenuCommand < Window_Command
  256. #--------------------------------------------------------------------------
  257. # * Includes The Ring_Menu Module
  258. #--------------------------------------------------------------------------
  259. include Ring_Menu
  260. #--------------------------------------------------------------------------
  261. # * Alias Listings
  262. #--------------------------------------------------------------------------
  263. alias add_save_command_ring_menu_original add_save_command
  264. #--------------------------------------------------------------------------
  265. # * Object Initialization
  266. #--------------------------------------------------------------------------
  267. def initialize
  268. super(0, 0)
  269. unless DISABLED_SHOW
  270. @list.delete_if {|i| !i[:enabled]}
  271. end
  272. for i in 0...item_max
  273. @icons.push(Cache::picture(command_name(i) + ' Icon'))
  274. end
  275. if @@last_command_symbol != nil
  276. index = @list.index(@@last_command_symbol)
  277. @mode = :wait
  278. end
  279. select_last
  280. refresh
  281. end
  282. #--------------------------------------------------------------------------
  283. # * Refresh
  284. #--------------------------------------------------------------------------
  285. def refresh
  286. super
  287. rect = Rect.new(0, 196, self.contents.width, line_height)
  288. draw_text(rect, command_name(index), 1)
  289. end
  290. #--------------------------------------------------------------------------
  291. # * Get Window Width
  292. #--------------------------------------------------------------------------
  293. def window_width
  294. return 544
  295. end
  296. #--------------------------------------------------------------------------
  297. # * Get Window Height
  298. #--------------------------------------------------------------------------
  299. def window_height
  300. return 416
  301. end
  302. #--------------------------------------------------------------------------
  303. # * Add Load to Command List
  304. #--------------------------------------------------------------------------
  305. def add_save_command
  306. add_save_command_ring_menu_original
  307. add_command(Vocab::Load, :load)
  308. end
  309. #--------------------------------------------------------------------------
  310. # * Draw Item
  311. # x : draw spot x-coordinate
  312. # y : draw spot y-coordinate
  313. # i : item number
  314. #--------------------------------------------------------------------------
  315. def draw_item(x, y, i)
  316. rect = Rect.new(0, 0, @icons[i].width, @icons[i].height)
  317. if i == index
  318. self.contents.blt(x - rect.width/2, y - rect.height/2, @icons[i], rect )
  319. unless command_enabled?(index)
  320. self.contents.blt(x - rect.width/2, y - rect.height/2, ICON_DISABLE, rect )
  321. end
  322. else
  323. self.contents.blt(x - rect.width/2, y - rect.height/2, @icons[i], rect, 128 )
  324. end
  325. end
  326. end

  327. #==============================================================================
  328. # ** Window_RingStatus
  329. #------------------------------------------------------------------------------
  330. # Ring Menu for selection of Party Members
  331. #==============================================================================

  332. class Window_RingStatus < Window_Selectable
  333. #--------------------------------------------------------------------------
  334. # * Includes The Ring_Menu Module
  335. #--------------------------------------------------------------------------
  336. include Ring_Menu
  337. #--------------------------------------------------------------------------
  338. # * Public Instance Variables
  339. #--------------------------------------------------------------------------
  340. attr_accessor :pending_index # Pending position (for formation)
  341. attr_accessor :pending # Pending
  342. #--------------------------------------------------------------------------
  343. # * Object Initialization
  344. #--------------------------------------------------------------------------
  345. def initialize
  346. super(0, 0, 544, 416)
  347. self.hide
  348. @mode = :wait
  349. @pending_index = -1
  350. @pending = false
  351. refresh
  352. end
  353. #--------------------------------------------------------------------------
  354. # * Refresh
  355. #--------------------------------------------------------------------------
  356. def refresh
  357. super
  358. rect = Rect.new(0, 196, self.contents.width, line_height)
  359. draw_text(rect, $game_party.members[index].name, 1)
  360. end
  361. #--------------------------------------------------------------------------
  362. # * Get Number of Items
  363. #--------------------------------------------------------------------------
  364. def item_max
  365. $game_party.members.size
  366. end
  367. #--------------------------------------------------------------------------
  368. # * Refresh Movement Period
  369. #--------------------------------------------------------------------------
  370. def refresh_move( mode )
  371. unless pending_index >= 0
  372. super
  373. else
  374. d = 2.0 * Math::PI / item_max
  375. for i in 0...item_max
  376. j = i - pending_index
  377. x = @cx + ( RING_R * Math.sin( d * j) ).to_i
  378. y = @cy - ( RING_R * Math.cos( d * j) ).to_i
  379. draw_item(x, y, i)
  380. end
  381. @mode = :wait
  382. end
  383. end
  384. #--------------------------------------------------------------------------
  385. # * Draw Item
  386. # x : draw spot x-coordinate
  387. # y : draw spot y-coordinate
  388. # index : item number
  389. #--------------------------------------------------------------------------
  390. def draw_item(x, y, i)
  391. if i == index && !(@pending && @pending_index < 0)
  392. draw_character($game_party.members[i].character_name,
  393. $game_party.members[i].character_index , x, y, true, true)
  394. else
  395. draw_character($game_party.members[i].character_name,
  396. $game_party.members[i].character_index , x, y, false, true)
  397. end
  398. end
  399. #--------------------------------------------------------------------------
  400. # * Processing When OK Button Is Pressed
  401. #--------------------------------------------------------------------------
  402. def process_ok
  403. super
  404. $game_party.menu_actor = $game_party.members[index] unless pending
  405. end
  406. #--------------------------------------------------------------------------
  407. # * Restore Previous Selection Position
  408. #--------------------------------------------------------------------------
  409. def select_last
  410. select($game_party.members.index($game_party.menu_actor) || 0)
  411. refresh
  412. end
  413. end

  414. #==============================================================================
  415. # ** Scene_Menu
  416. #==============================================================================

  417. class Scene_Menu < Scene_MenuBase
  418. #--------------------------------------------------------------------------
  419. # * Alias Listings
  420. #--------------------------------------------------------------------------
  421. alias start_ring_original start
  422. alias create_command_window_ring_menu_original create_command_window
  423. alias command_personal_ring_original command_personal
  424. alias command_formation_ring_original command_formation
  425. alias on_personal_cancel_ring_original on_personal_cancel
  426. #--------------------------------------------------------------------------
  427. # * Start Processing
  428. #--------------------------------------------------------------------------
  429. def start
  430. start_ring_original
  431. create_location_window
  432. end
  433. #--------------------------------------------------------------------------
  434. # * Create Location Window
  435. #--------------------------------------------------------------------------
  436. def create_location_window
  437. @location_window = Window_location.new(0, 0)
  438. end
  439. #--------------------------------------------------------------------------
  440. # * Create Command Window
  441. #--------------------------------------------------------------------------
  442. def create_command_window
  443. create_command_window_ring_menu_original
  444. @command_window.set_handler(:load, method(:command_load))
  445. end
  446. #--------------------------------------------------------------------------
  447. # * Create Status Window
  448. #--------------------------------------------------------------------------
  449. def create_status_window
  450. @status_window = Window_RingStatus.new
  451. end
  452. #--------------------------------------------------------------------------
  453. # * [Skill], [Equipment] and [Status] Commands
  454. #--------------------------------------------------------------------------
  455. def command_personal
  456. if $game_party.members.size < 2 && ACTOR_SKIP
  457. on_personal_ok
  458. else
  459. @command_window.hide
  460. @status_window.show
  461. command_personal_ring_original
  462. end
  463. end
  464. #--------------------------------------------------------------------------
  465. # * [Formation] Command
  466. #--------------------------------------------------------------------------
  467. def command_formation
  468. @status_window.pending = true
  469. @command_window.hide
  470. command_formation_ring_original
  471. @status_window.index = 0
  472. @status_window.refresh
  473. @status_window.show
  474. end
  475. #--------------------------------------------------------------------------
  476. # * [Load] Command
  477. #--------------------------------------------------------------------------
  478. def command_load
  479. SceneManager.call(Scene_Load)
  480. end
  481. #--------------------------------------------------------------------------
  482. # * [Cancel] Personal Command
  483. #--------------------------------------------------------------------------
  484. def on_personal_cancel
  485. @status_window.hide
  486. on_personal_cancel_ring_original
  487. @status_window.deactivate
  488. @command_window.show
  489. end
  490. #--------------------------------------------------------------------------
  491. # * Formation [OK]
  492. #--------------------------------------------------------------------------
  493. def on_formation_ok
  494. if @status_window.pending_index >= 0
  495. $game_party.swap_order(@status_window.index,
  496. @status_window.pending_index)
  497. @status_window.index = @status_window.pending_index
  498. @status_window.pending_index = -1
  499. else
  500. @status_window.pending_index = @status_window.index
  501. end
  502. @status_window.refresh
  503. @status_window.activate
  504. end
  505. #--------------------------------------------------------------------------
  506. # * Formation [Cancel]
  507. #--------------------------------------------------------------------------
  508. def on_formation_cancel
  509. if @status_window.pending_index >= 0
  510. @status_window.index = @status_window.pending_index
  511. @status_window.pending_index = -1
  512. @status_window.activate
  513. @status_window.refresh
  514. else
  515. @status_window.pending = false
  516. @status_window.hide
  517. @status_window.select_last
  518. @status_window.deactivate
  519. @command_window.show
  520. @command_window.activate
  521. end
  522. end
  523. end

  524. #==============================================================================
  525. # ** Window_Base
  526. #------------------------------------------------------------------------------
  527. # Edited to allow disabled character icons and y centring
  528. #==============================================================================

  529. class Window_Base < Window
  530. #--------------------------------------------------------------------------
  531. # * Draw Character Graphic
  532. #--------------------------------------------------------------------------
  533. def draw_character(character_name, character_index, x, y, enabled = true, centred = false)
  534. return if character_name == nil
  535. bitmap = Cache.character(character_name)
  536. sign = character_name[/^[\!\$]./]
  537. if sign && sign.include?('$')
  538. cw = bitmap.width / 3
  539. ch = bitmap.height / 4
  540. else
  541. cw = bitmap.width / 12
  542. ch = bitmap.height / 8
  543. end
  544. n = character_index
  545. src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  546. self.contents.blt(x - cw / 2, centred ? y - ch/2 : y - ch, bitmap, src_rect,
  547. enabled ? 255 : 128)
  548. end
  549. end

  550. #==============================================================================
  551. # ** Window_Location
  552. #------------------------------------------------------------------------------
  553. # This class shows the current map name.
  554. #==============================================================================

  555. class Window_location < Window_Base
  556. #--------------------------------------------------------------------------
  557. # * Object Initialization
  558. #--------------------------------------------------------------------------
  559. def initialize(x, y)
  560. super(x, y, 160, (line_height*2) + 32)
  561. refresh
  562. end
  563. #--------------------------------------------------------------------------
  564. # * Refresh
  565. #--------------------------------------------------------------------------
  566. def refresh
  567. contents.clear
  568. @map = load_data(sprintf("Data/Map%03d.rvdata2", $game_map.map_id))
  569. change_color(system_color)
  570. draw_text(4, 0, 128, line_height, "所在地 :")
  571. change_color(normal_color)
  572. draw_text(0, line_height, 128, line_height, @map.display_name, 1)
  573. end
  574. end
复制代码

深水游泳池
  1. =begin
  2. ===============================================================================
  3. 深水游泳池 By喵呜喵5
  4. ===============================================================================
  5. 【说明】
  6. 通过本脚本可以定义流体属性图块遮挡玩家行走图的大小及被遮挡部分的透明度

  7. =end
  8. module M5Pool
  9. #==============================================================================
  10. # 设定部分
  11. #==============================================================================
  12. HEI = 20

  13. #这里设置遮挡部分的大小


  14. OPA = 20

  15. #这里设置被遮挡部分的透明度


  16. #==============================================================================
  17. # 设定结束
  18. #==============================================================================
  19. end
  20. #==============================================================================
  21. # 脚本部分
  22. #==============================================================================
  23. class Game_CharacterBase
  24. attr_reader :bush_opacity
  25. def update_bush_depth
  26. if normal_priority? && !object_character? && bush? && !jumping?
  27. if !moving?
  28. @bush_depth = M5Pool::HEI
  29. @bush_opacity = M5Pool::OPA
  30. end
  31. else
  32. @bush_depth = 0
  33. end
  34. end
  35. end
  36. class Sprite_Character < Sprite_Base
  37. alias m5_update_other update_other
  38. def update_other
  39. m5_update_other
  40. self.bush_opacity = @character.bush_opacity if @character.bush_opacity
  41. end
  42. end
复制代码

装备变更行走图
  1. =begin

  2. 装备变更行走图 Ace 版 v1.0

  3. ( XP 版作者:亿万星辰 )

  4. 素材请使用 png 格式的去底图片

  5. 装备样式行走图放在 Graphics\DisplayEquips 文件夹内
  6. 装备的备注里填写 <display 图片名>,装备上以后在行走图上绘制对应的装备样式

  7. 可以双持的装备还需要另一个左手持武器的图片
  8. 在原图片的图片名后加“_dual”显示左手拿这个武器的效果
  9. 如果没有这个图片则不显示

  10. =end

  11. #-
  12. class Sprite_Player < Sprite_Character

  13. EquipDisplayPriority = {
  14. #各个朝向对应的显示优先级,靠后的显示在最前 人物朝向
  15. 0 => [:body, :armor, :helmet, :weapon, :shield], #下
  16. 1 => [:weapon, :body, :armor, :helmet, :shield], #左
  17. 2 => [:shield, :body, :armor, :helmet, :weapon], #右
  18. 3 => [:body, :weapon, :shield, :armor, :helmet] #上
  19. }

  20. def graphic_changed?
  21. super || equip_changed?
  22. end
  23. def equip_changed?
  24. @character.actor && @character.actor.equip_changed
  25. end
  26. #
  27. def set_character_bitmap
  28. super
  29. setup_bitmap_display_equips
  30. end
  31. #
  32. def setup_bitmap_display_equips
  33. w = @cw * 3
  34. h = @ch * 4
  35. i = @character.character_index
  36. # 创建临时位图
  37. orig_bitmap = Bitmap.new(w, h)
  38. orig_bitmap.blt( 0, 0, self.bitmap, Rect.new(i%4*w, i/4*h, w, h) )
  39. self.bitmap = Bitmap.new(w, h)
  40. # 绘制装备
  41. bitmap_draw_equips(orig_bitmap) if @character.actor
  42. #~ if @character == $game_player
  43. #~ $sprite = Sprite.new
  44. #~ $sprite.bitmap = bitmap
  45. #~ end
  46. orig_bitmap.dispose
  47. end

  48. #
  49. def bitmap_draw_equips(orig_bitmap)
  50. @character.actor.equip_changed = false
  51. # 创建装备临时位图
  52. temp_equip_bitmaps = []
  53. @character.actor.equips.each_with_index {|equip, index|
  54. img_name = equip ? equip.display_equip_part : nil
  55. temp_equip_bitmaps.push(
  56. equip_bitmap(img_name, index == 1 && equip.class == RPG::Weapon)
  57. )
  58. }
  59. dual_wield = @character.actor.dual_wield?
  60. # 逐层绘制装备
  61. btmp_rect = Rect.new(0, 0, @cw*3, @ch)
  62. 4.times {|i|
  63. btmp_rect.y = @ch * i
  64. EquipDisplayPriority[i].each {|part|
  65. btmp = equip_part_bitmap(part, temp_equip_bitmaps, orig_bitmap)
  66. bitmap.blt( 0, btmp_rect.y, btmp, btmp_rect ) if btmp
  67. }
  68. }
  69. # 释放临时位图
  70. temp_equip_bitmaps.each {|bitmap| bitmap.dispose if bitmap}
  71. end
  72. #
  73. def equip_part_bitmap( part, temp_equip_bitmaps, orig_bitmap )
  74. case part
  75. when :body; orig_bitmap
  76. when :weapon; temp_equip_bitmaps[0]
  77. when :shield; temp_equip_bitmaps[1]
  78. when :armor; temp_equip_bitmaps[2]
  79. when :helmet; temp_equip_bitmaps[3]
  80. end
  81. end
  82. def equip_bitmap(img_name, dual_weapon)
  83. if img_name
  84. img_file = "Graphics/DisplayEquips/#{img_name}"
  85. if dual_weapon
  86. img_dual = img_file + "_dual.png"
  87. File.exist?(img_dual) ? Bitmap.new(img_dual) : nil
  88. else
  89. Bitmap.new(img_file)
  90. end
  91. else
  92. nil
  93. end
  94. end
  95. #
  96. def update_src_rect
  97. pattern = @character.pattern < 3 ? @character.pattern : 1
  98. sx = pattern * @cw
  99. sy = (@character.direction - 2) / 2 * @ch
  100. self.src_rect.set(sx, sy, @cw, @ch)
  101. end
  102. #

  103. def dispose
  104. bitmap.dispose
  105. super
  106. end
  107. end


  108. module RPG
  109. class Weapon
  110. def display_equip_part
  111. @note =~ /<display.(\S+)>/
  112. return $1
  113. end
  114. end
  115. class Armor
  116. def display_equip_part
  117. @note =~ /<display.(\S+)>/
  118. return $1
  119. end
  120. end
  121. end

  122. #-
  123. class Game_Actor
  124. attr_accessor\
  125. :equip_changed

  126. alias_method :display_equip_change_equip, :change_equip
  127. def change_equip(slot_id, item)
  128. display_equip_change_equip(slot_id, item)
  129. @equip_changed = true
  130. end
  131. end

  132. class Game_Character

  133. end


  134. #-
  135. class Spriteset_Map
  136. def create_characters # 覆盖
  137. @character_sprites = []
  138. $game_map.events.values.each do |event|
  139. @character_sprites.push(Sprite_Character.new(@viewport1, event))
  140. end
  141. $game_map.vehicles.each do |vehicle|
  142. @character_sprites.push(Sprite_Character.new(@viewport1, vehicle))
  143. end
  144. $game_player.followers.reverse_each do |follower|
  145. @character_sprites.push(Sprite_Player.new(@viewport1, follower))
  146. end
  147. @character_sprites.push(Sprite_Player.new(@viewport1, $game_player))
  148. @map_id = $game_map.map_id
  149. end
  150. end
复制代码


神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦

炎

梦石
0
星屑
98
在线时间
1617 小时
注册时间
2013-8-15
回帖
4322
 楼主| 发表于 2014-10-8 09:37:09 | 显示全部楼层
@VIPArcher  结账结帖
神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部