Project1

标题: 如何使用这个脚本? [打印本页]

作者: 674998887    时间: 2013-7-28 03:44
标题: 如何使用这个脚本?
http://rpg.blue/thread-224133-1-1.html
这里的脚本无法复制,如何使用?
作者: 八月桑    时间: 2013-7-28 11:40

  1. class RPG::BaseItem
  2.   def load
  3.     return if self.is_a?(RPG::Skill)
  4.     self.note.split(/[\r\n]+/).each { |line|
  5.       if line =~ /\[(?:load|负重|負重) (\w+)\]/
  6.         return $1.nil? ? 0 : $1.to_i
  7.       end}
  8.     return 0
  9.   end
  10. end
  11. class Scene_Item < Scene_ItemBase
  12.   alias load_start start
  13.   alias load_terminate terminate
  14.   alias load_update update
  15.   def start
  16.     load_start
  17.     @load_window = Window_Base.new(392, 0, 152, 56)
  18.     @load_window.viewport = @viewport
  19.   end
  20.   def terminate
  21.     @load_window.dispose
  22.     load_terminate
  23.   end
  24.   def update
  25.     @load_window.update
  26.     if @temp_load != $game_party.current_load
  27.       @load_window.contents.clear
  28.       @load_window.contents.draw_text(0, 0, 120, 24, "负重:#{$game_party.current_load}/#{$game_party.total_load}")
  29.       @temp_load = $game_party.current_load
  30.     end
  31.     if Input.trigger?(Input::X)
  32.       @item = @item_window.item
  33.       $game_party.lose_item(@item, 1)
  34.       @item_window.refresh
  35.     end
  36.     load_update
  37.   end
  38. end
  39. class Scene_Shop < Scene_MenuBase
  40.   alias load_start start
  41.   alias load_terminate terminate
  42.   alias load_update update
  43.   def start
  44.     load_start
  45.     @load_window = Window_Base.new(392, 0, 152, 56)
  46.     @load_window.viewport = @viewport
  47.   end
  48.   def terminate
  49.     @load_window.dispose
  50.     load_terminate
  51.   end
  52.   def update
  53.     @load_window.update
  54.     if @temp_load != $game_party.current_load
  55.       @load_window.contents.clear
  56.       @load_window.contents.draw_text(0, 0, 120, 24, "负重:#{$game_party.current_load}/#{$game_party.total_load}")
  57.       @temp_load = $game_party.current_load
  58.     end
  59.     load_update
  60.   end
  61. end
  62. class Game_Party < Game_Unit
  63.   attr_reader :current_load
  64.   alias load_initialize initialize
  65.   alias load_gain_item gain_item
  66.   def initialize
  67.     load_initialize
  68.     @current_load = 0
  69.   end
  70.   # 获取队伍最大负重
  71.   def total_load
  72.     party_load = 0
  73.     #members.size.times do |i|
  74.     for i in 0...members.size
  75.       actor = members[i]
  76.       party_load += actor.load
  77.     end
  78.     return party_load
  79.   end
  80.   def gain_item(item, n, include_equip = false)
  81.     return if item.nil?
  82.     if ((item.load * n) + @current_load) > total_load
  83.       $game_message.texts.push("靠!负重都不足了,你妹的怎么还不赶快清空物品!")
  84.       $game_message.visible = true
  85.       return
  86.     else
  87.       @current_load += item.load * n
  88.     end
  89.     load_gain_item(item, n, include_equip)
  90.   end
  91. end
  92. class Game_Actor < Game_Battler
  93.   # 获取队员负重
  94.   def load
  95.     return (mhp + mmp) * [url=home.php?mod=space&uid=22147]@level[/url] / agi
  96.   end
  97. end
  98. class Game_Interpreter
  99.   alias load_command_126 command_126
  100.   alias load_command_127 command_127
  101.   alias load_command_128 command_128
  102.   def command_126
  103.     n = operate_value(@params[1], @params[2], @params[3])
  104.     return command_115 if check_load(@params[0], 0, n)
  105.     load_command_126
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 增減武器
  109.   #--------------------------------------------------------------------------
  110.   def command_127
  111.     n = operate_value(@params[1], @params[2], @params[3])
  112.     return command_115 if check_load(@params[0], 1, n)
  113.     load_command_127
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 增減防具
  117.   #--------------------------------------------------------------------------
  118.   def command_128
  119.     n = operate_value(@params[1], @params[2], @params[3])
  120.     return command_115 if check_load(@params[0], 2, n)
  121.     load_command_128
  122.   end
  123.   def check_load(item_id, type, n)
  124.     case type
  125.     when 0; item = $data_items[item_id]
  126.     when 1; item = $data_weapons[item_id]
  127.     when 2; item = $data_armors[item_id]
  128.     end
  129.     if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  130.       $game_message.texts.push("靠!负重都不足了,你妹的怎么还不赶快清空物品!")
  131.       $game_message.visible = true
  132.       return true
  133.     end
  134.     return false
  135.   end
  136. end
复制代码
这个可以复制了吧↑
作者: a0936459772    时间: 2013-7-28 12:23
本帖最后由 a0936459772 于 2013-7-28 12:26 编辑

代码的右上角...

作者: 200928326    时间: 2013-7-29 06:33
可以复制啊=-=,方法应当和VX的原版一模一样,原帖有贴出VX原版地址哦= =




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1