查看: 2757|回复: 7

[已经解决] 求助,帮忙增添新的菜单选项

[复制链接]
梦石
0
星屑
219
在线时间
47 小时
注册时间
2009-7-5
回帖
55
发表于 2015-8-26 21:10:57 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 sixapple 于 2015-8-26 21:22 编辑

我知道要在Scene_Menu里添加,但是,我后面添加的加点、换人脚本里,也有Scene_Menu部分,算是直接覆盖了前面的。
我是想把叶子的详尽任务显示界面,添加到菜单当中,并且与升级加点,换队伍顺序这两个脚本并存。
自己尝试弄了一下,菜单里倒是显示出选项了,但一点开就报错。

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

30岁了,也要继续创造梦想啊。
梦石
0
星屑
219
在线时间
47 小时
注册时间
2009-7-5
回帖
55
 楼主| 发表于 2015-8-26 21:14:15 | 显示全部楼层
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. class Scene_Save
  5.   #--------------------------------------------------------------------------
  6.   # ● 写入存档数据
  7.   #     file : 写入用文件对像 (已经打开)
  8.   #--------------------------------------------------------------------------
  9.   def write_save_data(file)
  10.     # 生成描绘存档文件用的角色图形
  11.     characters = []
  12.     for i in 0...[$game_party.actors.size,4].min
  13.       actor = $game_party.actors[i]
  14.       characters.push([actor.character_name, actor.character_hue])
  15.     end
  16.     # 写入描绘存档文件用的角色数据
  17.     Marshal.dump(characters, file)
  18.     # 写入测量游戏时间用画面计数
  19.     Marshal.dump(Graphics.frame_count, file)
  20.     # 增加 1 次存档次数
  21.     $game_system.save_count += 1
  22.     # 保存魔法编号
  23.     # (将编辑器保存的值以随机值替换)
  24.     $game_system.magic_number = $data_system.magic_number
  25.     # 写入各种游戏对像
  26.     Marshal.dump($game_system, file)
  27.     Marshal.dump($game_switches, file)
  28.     Marshal.dump($game_variables, file)
  29.     Marshal.dump($game_self_switches, file)
  30.     Marshal.dump($game_screen, file)
  31.     Marshal.dump($game_actors, file)
  32.     Marshal.dump($game_party, file)
  33.     Marshal.dump($game_troop, file)
  34.     Marshal.dump($game_map, file)
  35.     Marshal.dump($game_player, file)
  36.   end
  37. end

  38. class Scene_Battle
  39.   #--------------------------------------------------------------------------
  40.   # ● 设置物品或特技对像方的战斗者
  41.   #     scope : 特技或者是物品的范围
  42.   #--------------------------------------------------------------------------
  43.   def set_target_battlers(scope)
  44.     # 行动方的战斗者是敌人的情况下
  45.     if @active_battler.is_a?(Game_Enemy)
  46.       # 效果范围分支
  47.       case scope
  48.       when 1  # 敌单体
  49.         index = @active_battler.current_action.target_index
  50.         @target_battlers.push($game_party.smooth_target_actor(index))
  51.       when 2  # 敌全体
  52.         for actor in 0...[$game_party.actors.size,4].min
  53.           if $game_party.actors[actor].exist?
  54.             @target_battlers.push($game_party.actors[actor])
  55.           end
  56.         end
  57.       when 3  # 我方单体
  58.         index = @active_battler.current_action.target_index
  59.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  60.       when 4  # 我方全体
  61.         for enemy in $game_troop.enemies
  62.           if enemy.exist?
  63.             @target_battlers.push(enemy)
  64.           end
  65.         end
  66.       when 5  # 我方单体 (HP 0)
  67.         index = @active_battler.current_action.target_index
  68.         enemy = $game_troop.enemies[index]
  69.         if enemy != nil and enemy.hp0?
  70.           @target_battlers.push(enemy)
  71.         end
  72.       when 6  # 我方全体 (HP 0)
  73.         for enemy in $game_troop.enemies
  74.           if enemy != nil and enemy.hp0?
  75.             @target_battlers.push(enemy)
  76.           end
  77.         end
  78.       when 7  # 使用者
  79.         @target_battlers.push(@active_battler)
  80.       end
  81.     end
  82.     # 行动方的战斗者是角色的情况下
  83.     if @active_battler.is_a?(Game_Actor)
  84.       # 效果范围分支
  85.       case scope
  86.       when 1  # 敌单体
  87.         index = @active_battler.current_action.target_index
  88.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  89.       when 2  # 敌全体
  90.         for enemy in $game_troop.enemies
  91.           if enemy.exist?
  92.             @target_battlers.push(enemy)
  93.           end
  94.         end
  95.       when 3  # 我方单体
  96.         index = @active_battler.current_action.target_index
  97.         @target_battlers.push($game_party.smooth_target_actor(index))
  98.       when 4  # 我方全体
  99.         for actor in 0...[$game_party.actors.size,4].min
  100.           if $game_party.actors[actor].exist?
  101.             @target_battlers.push($game_party.actors[actor])
  102.           end
  103.         end
  104.       when 5  # 我方单体 (HP 0)
  105.         index = @active_battler.current_action.target_index
  106.         actor = $game_party.actors[index]
  107.         if actor != nil and actor.hp0?
  108.           @target_battlers.push(actor)
  109.         end
  110.       when 6  # 我方全体 (HP 0)
  111.         for actor in 0...[$game_party.actors.size,4].min
  112.           if $game_party.actors[actor] != nil and $game_party.actors[actor].hp0?
  113.             @target_battlers.push($game_party.actors[actor])
  114.           end
  115.         end
  116.       when 7  # 使用者
  117.         @target_battlers.push(@active_battler)
  118.       end
  119.     end
  120.   end  
  121.   #--------------------------------------------------------------------------
  122.   # ● 生成行动循序
  123.   #--------------------------------------------------------------------------
  124.   def make_action_orders
  125.     # 初始化序列 @action_battlers
  126.     @action_battlers = []
  127.     # 添加敌人到 @action_battlers 序列
  128.     for enemy in $game_troop.enemies
  129.       @action_battlers.push(enemy)
  130.     end
  131.     # 添加角色到 @action_battlers 序列
  132.     for actor in 0...[$game_party.actors.size,4].min
  133.       @action_battlers.push($game_party.actors[actor])
  134.     end
  135.     # 确定全体的行动速度
  136.     for battler in @action_battlers
  137.       battler.make_action_speed
  138.     end
  139.     # 按照行动速度从大到小排列
  140.     @action_battlers.sort! {|a,b|
  141.       b.current_action.speed - a.current_action.speed }
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 开始结束战斗回合
  145.   #--------------------------------------------------------------------------
  146.   def start_phase5
  147.     # 转移到回合 5
  148.     @phase = 5
  149.         if $game_switches[79] == true
  150.   $game_variables[100] += 1
  151.   end
  152.     # 演奏战斗结束 ME
  153.     $game_system.me_play($game_system.battle_end_me)
  154.     # 还原为战斗开始前的 BGM
  155.     $game_system.bgm_play($game_temp.map_bgm)
  156.     # 初始化 EXP、金钱、宝物
  157.     exp = 0
  158.     gold = 0
  159.     treasures = []
  160.     # 循环
  161.     for enemy in $game_troop.enemies
  162.       # 敌人不是隐藏状态的情况下
  163.       unless enemy.hidden
  164.         # 获得 EXP、增加金钱
  165.         exp += enemy.exp
  166.         gold += enemy.gold
  167.         # 出现宝物判定
  168.         if rand(100) < enemy.treasure_prob
  169.           if enemy.item_id > 0
  170.             treasures.push($data_items[enemy.item_id])
  171.           end
  172.           if enemy.weapon_id > 0
  173.             treasures.push($data_weapons[enemy.weapon_id])
  174.           end
  175.           if enemy.armor_id > 0
  176.             treasures.push($data_armors[enemy.armor_id])
  177.           end
  178.         end
  179.       end
  180.     end
  181.     # 限制宝物数为 6 个
  182.     treasures = treasures[0..5]
  183.     # 获得 EXP
  184.     for i in 0...[$game_party.actors.size,4].min
  185.       actor = $game_party.actors[i]
  186.       if actor.cant_get_exp? == false
  187.         last_level = actor.level
  188.         actor.exp += exp
  189.         if actor.level > last_level
  190.           @status_window.level_up(i)
  191.         end
  192.       end
  193.     end
  194.     # 获得金钱
  195.     $game_party.gain_gold(gold)
  196.     # 获得宝物
  197.     for item in treasures
  198.       case item
  199.       when RPG::Item
  200.         $game_party.gain_item(item.id, 1)
  201.       when RPG::Weapon
  202.         $game_party.gain_weapon(item.id, 1)
  203.       when RPG::Armor
  204.         $game_party.gain_armor(item.id, 1)
  205.       end
  206.     end
  207.     # 生成战斗结果窗口
  208.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  209.     # 设置等待计数
  210.     @phase5_wait_count = 100
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 转到输入下一个角色的命令
  214.   #--------------------------------------------------------------------------
  215.   def phase3_next_actor
  216.     # 循环
  217.     begin
  218.       # 角色的明灭效果 OFF
  219.       if @active_battler != nil
  220.         @active_battler.blink = false
  221.       end
  222.       # 最后的角色的情况
  223.       if @actor_index == [$game_party.actors.size-1,3].min
  224.         # 开始主回合
  225.         start_phase4
  226.         return
  227.       end
  228.       # 推进角色索引
  229.       @actor_index += 1
  230.       @active_battler = $game_party.actors[@actor_index]
  231.       @active_battler.blink = true
  232.     # 如果角色是在无法接受指令的状态就再试
  233.     end until @active_battler.inputable?
  234.     # 设置角色的命令窗口
  235.     phase3_setup_command_window
  236.   end
  237. end

  238. class Arrow_Actor < Arrow_Base  
  239.   #--------------------------------------------------------------------------
  240.   # ● 刷新画面
  241.   #--------------------------------------------------------------------------
  242.   def update
  243.     super
  244.     # 光标右
  245.     if Input.repeat?(Input::RIGHT)
  246.       $game_system.se_play($data_system.cursor_se)
  247.       @index += 1
  248.       @index %= [$game_party.actors.size,4].min
  249.     end
  250.     # 光标左
  251.     if Input.repeat?(Input::LEFT)
  252.       $game_system.se_play($data_system.cursor_se)
  253.       @index += $game_party.actors.size - 1
  254.       @index %= [$game_party.actors.size,4].min
  255.     end
  256.     # 设置活动块坐标
  257.     if self.actor != nil
  258.       self.x = self.actor.screen_x
  259.       self.y = self.actor.screen_y
  260.     end
  261.   end
  262. end

  263. #==============================================================================
  264. # ■ Window_Target
  265. #------------------------------------------------------------------------------
  266. #  物品画面与特技画面的、使用对像角色选择窗口。
  267. #==============================================================================

  268. class Window_Target < Window_Selectable
  269. #--------------------------------------------------------------------------
  270. # ● 初始化对像
  271. #--------------------------------------------------------------------------
  272. def initialize
  273.    super(0, 0, 336, 480)
  274.    self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
  275.    self.z += 10
  276.    @item_max = $game_party.actors.size
  277.    @top_row = 0
  278.    refresh
  279. end
  280. #--------------------------------------------------------------------------
  281. # ● 刷新
  282. #--------------------------------------------------------------------------
  283. def refresh
  284.    self.contents.clear
  285.    for i in 0...$game_party.actors.size
  286.      x = 4
  287.      y = i * 112
  288.      actor = $game_party.actors[i]
  289.      draw_actor_name(actor, x, y)
  290.      draw_actor_class(actor, x + 144, y)
  291.      draw_actor_level(actor, x + 8, y + 32)
  292.      draw_actor_state(actor, x + 8, y + 64)
  293.      draw_actor_hp(actor, x + 152, y + 32)
  294.      draw_actor_sp(actor, x + 152, y + 64)
  295.    end
  296. end  
  297. #--------------------------------------------------------------------------
  298. # ● 刷新光标矩形
  299. #--------------------------------------------------------------------------
  300. def update_cursor_rect   
  301.    # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
  302.    if @index <= -2
  303.      self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
  304.    elsif @index == -1
  305.      self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
  306.    else
  307.      tpy = @index * 112 - self.oy
  308.      self.cursor_rect.set(0, tpy, self.width - 32, 96)
  309.      if @index < @top_row
  310.        @top_row = @index
  311.        self.oy = @top_row *112
  312.      end
  313.      if @index > @top_row+3
  314.        @top_row = @index-3
  315.        self.oy = @top_row *112
  316.      end
  317.    end   
  318. end
  319. end
  320. #==============================================================================
  321. # ■ Window_MenuStatus
  322. #------------------------------------------------------------------------------
  323. #  显示菜单画面和同伴状态的窗口。
  324. #==============================================================================

  325. class Window_MenuStatus < Window_Selectable
  326.   #--------------------------------------------------------------------------
  327.   # ● 初始化目标
  328.   #--------------------------------------------------------------------------
  329.   def initialize
  330.     super(0, 0, 480, 480)
  331.     self.contents = Bitmap.new(width - 32,  $game_party.actors.size*112)
  332.     refresh
  333.     @top_row = 0
  334.     self.active = false
  335.     self.index = -1
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 刷新
  339.   #--------------------------------------------------------------------------
  340.   def refresh
  341.     self.contents.clear
  342.     @item_max = $game_party.actors.size
  343.     for i in 0...$game_party.actors.size
  344.       x = 64
  345.       y = i * 112
  346.       if i <=3
  347.         self.contents.font.color = Color.new(255,255,0,255)
  348.         self.contents.draw_text(x,y,340,32,"[出战]",2)
  349.         self.contents.font.color = normal_color
  350.       else
  351.         self.contents.font.color = Color.new(128,128,128,255)
  352.         self.contents.draw_text(x,y,340,32,"[待机]",2)
  353.         self.contents.font.color = normal_color
  354.       end      
  355.       actor = $game_party.actors[i]
  356.       draw_actor_graphic(actor, x - 40, y + 80)
  357.       draw_actor_name(actor, x, y)
  358.       draw_actor_class(actor, x + 144, y)
  359.       draw_actor_level(actor, x, y + 32)
  360.       draw_actor_state(actor, x + 90, y + 32)
  361.       draw_actor_exp(actor, x, y + 64)
  362.       draw_actor_hp(actor, x + 236, y + 32)
  363.       draw_actor_sp(actor, x + 236, y + 64)
  364.     end
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● 刷新光标矩形
  368.   #--------------------------------------------------------------------------
  369.   def update_cursor_rect
  370.     if @index < 0
  371.       self.cursor_rect.empty
  372.     else
  373.       tpy = @index * 112 - self.oy
  374.       self.cursor_rect.set(0, tpy, self.width - 32, 96)
  375.       if @index < @top_row
  376.         @top_row = @index
  377.         self.oy = @top_row *112
  378.       end
  379.       if @index > @top_row+3
  380.         @top_row = @index-3
  381.         self.oy = @top_row *112
  382.       end
  383.     end
  384.   end
  385. end

  386. class Game_Party
  387.   #--------------------------------------------------------------------------
  388.   # ● 全灭判定
  389.   #--------------------------------------------------------------------------
  390.   def all_dead?
  391.     # 同伴人数为 0 的情况下
  392.     if $game_party.actors.size == 0
  393.       return false
  394.     end
  395.     # 同伴中无人 HP 在 0 以上
  396.     for i in 0..3
  397.       if @actors[i] != nil and@actors[i].hp >0
  398.         return false
  399.       end
  400.     end
  401.     # 全灭
  402.     return true
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 加入同伴
  406.   #     actor_id : 角色 ID
  407.   #--------------------------------------------------------------------------
  408.   def add_actor(actor_id)
  409.     # 获取角色
  410.     actor = $game_actors[actor_id]
  411.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  412.     if not @actors.include?(actor)
  413.       # 添加角色
  414.       @actors.push(actor)
  415.       # 还原主角
  416.       $game_player.refresh
  417.     end
  418.   end
  419. end

  420. #==============================================================================
  421. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  422. #==============================================================================


  423. class Scene_Menu
  424. # --------------------------------
  425.   def initialize(menu_index = 0)
  426.     @menu_index = menu_index
  427.     @changer = 0
  428.     @where = 0
  429.     @checker = 0
  430.   end
  431. # --------------------------------
  432.   def main
  433.     s1 = $data_system.words.item
  434.     s2 = $data_system.words.skill
  435.     s3 = $data_system.words.equip
  436.     s4 = "状态"
  437.     s5 = "储存进度"
  438.     s6 = "离开游戏"
  439.     s7 = "调整队伍"
  440.     s8 = "升级加点"
  441.     s9 = "剧情任务"
  442.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
  443.     @command_window.index = @menu_index
  444.     if $game_party.actors.size == 0
  445.       @command_window.disable_item(0)
  446.       @command_window.disable_item(1)
  447.       @command_window.disable_item(2)
  448.       @command_window.disable_item(3)
  449.     end
  450.     if $game_system.save_disabled
  451.       @command_window.disable_item(4)
  452.     end
  453.     if $game_party.actors.size == 1
  454.       @command_window.disable_item(6)
  455.     end
  456.     @playtime_window = Window_PlayTime.new
  457.     @playtime_window.x = 0
  458.     @playtime_window.y = 320
  459.     @gold_window = Window_Gold.new
  460.     @gold_window.x = 0
  461.     @gold_window.y = 416
  462.     @status_window = Window_MenuStatus.new
  463.     @status_window.x = 160
  464.     @status_window.y = 0
  465.     Graphics.transition
  466.     loop do
  467.       Graphics.update
  468.       Input.update
  469.       update
  470.       if $scene != self
  471.         break
  472.       end
  473.     end
  474.     Graphics.freeze
  475.     @command_window.dispose
  476.     @playtime_window.dispose
  477.     @gold_window.dispose
  478.     @status_window.dispose
  479.   end
  480. # --------------------------------
  481.   def update
  482.     @command_window.update
  483.     @playtime_window.update
  484.     @gold_window.update
  485.     @status_window.update
  486.     if @command_window.active
  487.       update_command
  488.       return
  489.     end
  490.     if @status_window.active
  491.       update_status
  492.       return
  493.     end
  494.   end
  495. # --------------------------------
  496.   def update_command
  497.     if Input.trigger?(Input::B)
  498.       $game_system.se_play($data_system.cancel_se)
  499.       $scene = Scene_Map.new
  500.       return
  501.     end
  502.     if Input.trigger?(Input::C)
  503.       if $game_party.actors.size == 0 and @command_window.index < 4
  504.         $game_system.se_play($data_system.buzzer_se)
  505.         return
  506.       end
  507.       if $game_party.actors.size == 1 and @command_window.index ==6
  508.         $game_system.se_play($data_system.buzzer_se)
  509.         return
  510.       end
  511.       case @command_window.index
  512.       when 0
  513.         $game_system.se_play($data_system.decision_se)
  514.         $scene = Scene_Item.new
  515.       when 1
  516.         $game_system.se_play($data_system.decision_se)
  517.         @command_window.active = false
  518.         @status_window.active = true
  519.         @status_window.index = 0
  520.       when 2
  521.         $game_system.se_play($data_system.decision_se)
  522.         @command_window.active = false
  523.         @status_window.active = true
  524.         @status_window.index = 0
  525.       when 3
  526.         $game_system.se_play($data_system.decision_se)
  527.         @command_window.active = false
  528.         @status_window.active = true
  529.         @status_window.index = 0
  530.       when 4
  531.         if $game_system.save_disabled
  532.           $game_system.se_play($data_system.buzzer_se)
  533.           return
  534.         end
  535.         $game_system.se_play($data_system.decision_se)
  536.         $scene = Scene_Save.new
  537.       when 5
  538.         $game_system.se_play($data_system.decision_se)
  539.         $scene = Scene_End.new
  540.       when 6
  541.         $game_system.se_play($data_system.decision_se)
  542.         @checker = 0
  543.         @command_window.active = false
  544.         @status_window.active = true
  545.         @status_window.index = 0
  546.       when 7
  547.         $game_system.se_play($data_system.decision_se)
  548.         @command_window.active = false
  549.         @status_window.active = true
  550.         @status_window.index = 0
  551.       when 8
  552.         $game_system.se_play($data_system.decision_se)
  553.         @command_window.active = false
  554.         @status_window.active = true
  555.         @status_window.index = 0
  556.       when 9
  557.         $scene = Scene_Mission.new
  558.       end
  559.       return
  560.     end
  561.   end
  562. # --------------------------------
  563.   def update_status
  564.     if Input.trigger?(Input::B)
  565.       $game_system.se_play($data_system.cancel_se)
  566.       @command_window.active = true
  567.       @status_window.active = false
  568.       @status_window.index = -1
  569.       return
  570.     end
  571.     if Input.trigger?(Input::C)
  572.       case @command_window.index
  573.       when 1
  574.         if $game_party.actors[@status_window.index].restriction >= 2
  575.           $game_system.se_play($data_system.buzzer_se)
  576.           return
  577.         end
  578.         $game_system.se_play($data_system.decision_se)
  579.         $scene = Scene_Skill.new(@status_window.index)
  580.       when 2
  581.         $game_system.se_play($data_system.decision_se)
  582.         $scene = Scene_Equip.new(@status_window.index)
  583.       when 3
  584.         $game_system.se_play($data_system.decision_se)
  585.         $scene = Scene_Status.new(@status_window.index)
  586.       when 6
  587.         $game_system.se_play($data_system.decision_se)
  588.         if @checker == 0
  589.           @changer = $game_party.actors[@status_window.index]
  590.           @where = @status_window.index
  591.           @checker = 1
  592.         else
  593.           $game_party.actors[@where] = $game_party.actors[@status_window.index]
  594.           $game_party.actors[@status_window.index] = @changer
  595.           @checker = 0
  596.           @status_window.refresh
  597.         end
  598.       when 7
  599.         $game_system.se_play($data_system.decision_se)
  600.         $scene = Scene_Lvup.new(@status_window.index)
  601.       when 8
  602.         $game_system.se_play($data_system.decision_se)
  603.         $scene = Scene_Charactor.new(@status_window.index)
  604.       when 9
  605.         $scene = Scene_Mission.new
  606.       end
  607.       return
  608.     end
  609.   end
  610. end



  611.     #插件(升级加点,换队伍顺序,人物介绍,动态行走图)

  612. #==============================================================================
  613. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  614. #==============================================================================


  615. # 作者: 柳柳
  616. #
  617. # 说明:这是功能我再比较早期的时候发布在幻森,不过那时候比较笨,方法很糟糕
  618. #       这次是拿上就可以用的。
  619. #
  620. # 感谢:Claimh的脚本使我想起这个功能重做了一遍,本想直接用他的,不过他的算法过分
  621. #       冗余了,没好意思用。
  622. #==============================================================================
  623. # 使用方法:默认情况下把静态图变为了走步图。如果想自行修改,提供功能如下:
  624. #
  625. # 角色走步图:draw_walk_actor_graphic
  626. # 角色转向图:draw_turn_actor_graphic
  627. #
  628. # 回复原有静态角色图:删除100行以后的内容。修改下面这个变量可以更改行走速度
  629. #==============================================================================

  630. WALK_REFRESH_FRAME_SPEED = 15  # 刷新的速度,越大越慢,你可以改为3左右试试看

  631. #==============================================================================
  632. # Window_Base
  633. #==============================================================================
  634. class Window_Base < Window
  635.   #--------------------------------------------------------------------------
  636.   # 初始化方法
  637.   #--------------------------------------------------------------------------
  638.   alias initialize_walk initialize
  639.   def initialize(x, y, width, height)
  640.     initialize_walk(x, y, width, height)
  641.     @start_walk = false
  642.     @turn_index = 0
  643.     @turn_phase = 0
  644.   end
  645.   #--------------------------------------------------------------------------
  646.   # ★  角色行走图
  647.   #     actor : 角色
  648.   #     x     : 描绘的 X 坐标
  649.   #     y     : 描绘的 Y 坐标
  650.   #--------------------------------------------------------------------------
  651.   def draw_walk_actor_graphic(actor, x, y)
  652.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  653.     cw = bitmap.width / 4
  654.     ch = bitmap.height / 4
  655.     @start_turn = true
  656.     case @turn_phase
  657.     when 0
  658.       x_x = 0
  659.     when 1
  660.       x_x = cw
  661.     when 2
  662.       x_x = cw * 2
  663.     when 3
  664.       x_x = cw * 3
  665.     end
  666.     src_rect = Rect.new(x_x, 0, cw, ch)
  667.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ★  角色转向图
  671.   #     actor : 角色
  672.   #     x     : 描绘的 X 坐标
  673.   #     y     : 描绘的 Y 坐标
  674.   #--------------------------------------------------------------------------
  675.   def draw_turn_actor_graphic(actor, x, y)
  676.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  677.     cw = bitmap.width / 4
  678.     ch = bitmap.height / 4
  679.     @start_turn = true
  680.     case @turn_phase
  681.     when 0
  682.       x_x = 0
  683.     when 1
  684.       x_x = ch
  685.     when 2
  686.       x_x = ch * 3
  687.     when 3
  688.       x_x = ch * 2
  689.     end
  690.     src_rect = Rect.new(0, x_x, cw, ch)
  691.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   #  更新(可别使用刷新,玩命耗费内存= =)
  695.   #--------------------------------------------------------------------------
  696.   alias walk_update update
  697.   def update
  698.     walk_update
  699.     if @start_turn == true
  700.       @turn_index += 1
  701.       if @turn_index == WALK_REFRESH_FRAME_SPEED
  702.         refresh
  703.         @turn_index = 0
  704.         @turn_phase = (@turn_phase+1)%4
  705.       end
  706.     end
  707.   end  
  708. end

  709. #==============================================================================
  710. # Window_Base
  711. #==============================================================================
  712. class Window_Base < Window
  713.   #--------------------------------------------------------------------------
  714.   # 把原有静态图改为动态走步图
  715.   #--------------------------------------------------------------------------
  716.   def draw_actor_graphic(actor, x, y)
  717.     draw_walk_actor_graphic(actor, x, y)
  718.   end
  719. end

  720. #==============================================================================
  721. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  722. #==============================================================================

  723. #==============================================================================
  724. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  725. #==============================================================================


  726. # 脚本使用设定:

  727. LEVEL_UP_POINT = 3  # 每升一级所增加的点数
  728. LEVEL_UP_VARIABLE = 200  # 储存角色点数的变量编号与角色id编号的差值
  729.                          # 默认情况 = 200,
  730.                          # 则是数据库里1号角色的加点数存于101号变量
  731.                          # 3号角色的加点数存于103号变量。
  732.                          # 你可以直接操作变量赠与角色可分配点数

  733. # 每增加一次点数,各项能力值的变化:357-410行
  734.                         
  735. # 使用方法介绍:

  736. # 本脚本不会取代原升级功能 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  737. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  738. # 1-99级全部等于一个相同数值就行了。

  739. # 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
  740. # 默认都是0号

  741. # 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
  742. # 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new

  743. # 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG

  744. #==============================================================================
  745. # ■ Window_Command
  746. #------------------------------------------------------------------------------
  747. #  一般的命令选择行窗口。(追加定义)
  748. #==============================================================================
  749. class Window_Command < Window_Selectable
  750.   #--------------------------------------------------------------------------
  751.   # ● 项目有效化
  752.   #     index : 项目编号
  753.   #--------------------------------------------------------------------------
  754.   def able_item(index)
  755.     draw_item(index, normal_color)
  756.   end
  757. end
  758. #==============================================================================
  759. # ■ Game_Actor
  760. #------------------------------------------------------------------------------
  761. #  处理角色的类。(再定义)
  762. #==============================================================================
  763. class Game_Actor < Game_Battler
  764.   #--------------------------------------------------------------------------
  765.   # ● 更改 EXP
  766.   #     exp : 新的 EXP
  767.   #--------------------------------------------------------------------------
  768.   def exp=(exp)
  769.     @exp = [[exp, 9999999].min, 0].max
  770.     # 升级
  771.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  772.       @level += 1
  773.       # 增加4点可自由分配的点数
  774.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  775.       # 学会特技
  776.       for j in $data_classes[@class_id].learnings
  777.         if j.level == @level
  778.           learn_skill(j.skill_id)
  779.         end
  780.       end
  781.     end
  782.     # 降级
  783.     while @exp < @exp_list[@level]
  784.       @level -= 1
  785.     end
  786.     # 修正当前的 HP 与 SP 超过最大值
  787.     @hp = [@hp, self.maxhp].min
  788.     @sp = [@sp, self.maxsp].min
  789.   end
  790. end
  791. #==============================================================================
  792. # ■ Window_Base
  793. #------------------------------------------------------------------------------
  794. #  游戏中全部窗口的超级类(追加定义)
  795. #==============================================================================
  796. class Window_Base < Window
  797.   #--------------------------------------------------------------------------
  798.   # ● 描绘 HP
  799.   #     actor : 角色
  800.   #     x     : 描画目标 X 坐标
  801.   #     y     : 描画目标 Y 坐标
  802.   #     width : 描画目标的宽
  803.   #--------------------------------------------------------------------------
  804.   def draw_actor_hp_lvup(actor, x, y)
  805.     self.contents.font.color = system_color
  806.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.hp)
  807.     if $temp_hp == 0
  808.       self.contents.font.color = normal_color
  809.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
  810.     else
  811.       maxhp = actor.maxhp + $temp_hp
  812.       self.contents.font.color = Color.new(255, 128, 128, 255)
  813.       self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  814.       self.contents.font.color = normal_color      
  815.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  816.       if $temp_hp >=0
  817.         self.contents.font.color = Color.new(255, 128, 128, 255)
  818.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  819.       else
  820.         self.contents.font.color = Color.new(255,255,0,255)
  821.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  822.       end
  823.       self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
  824.       self.contents.font.color = normal_color
  825.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  826.     end
  827.   end
  828.   #--------------------------------------------------------------------------
  829.   # ● 描绘 SP
  830.   #     actor : 角色
  831.   #     x     : 描画目标 X 坐标
  832.   #     y     : 描画目标 Y 坐标
  833.   #     width : 描画目标的宽
  834.   #--------------------------------------------------------------------------
  835.   def draw_actor_sp_lvup(actor, x, y)
  836.     self.contents.font.color = system_color
  837.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
  838.     if $temp_sp == 0
  839.       self.contents.font.color = normal_color
  840.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
  841.     else
  842.       maxsp = actor.maxsp + $temp_sp
  843.       self.contents.font.color = Color.new(255, 128, 128, 255)
  844.       self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  845.       self.contents.font.color = normal_color      
  846.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  847.       if $temp_sp >=0
  848.         self.contents.font.color = Color.new(255, 128, 128, 255)
  849.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  850.       else
  851.         self.contents.font.color = Color.new(255,255,0,255)
  852.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  853.       end
  854.       self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
  855.       self.contents.font.color = normal_color
  856.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  857.     end
  858.   end
  859.   #--------------------------------------------------------------------------
  860.   # ● 描绘能力值
  861.   #     actor : 角色
  862.   #     x     : 描画目标 X 坐标
  863.   #     y     : 描画目标 Y 坐标
  864.   #     type  : 能力值种类 (0~4)
  865.   #--------------------------------------------------------------------------
  866.   def draw_actor_lvup(actor, x, y, type)   
  867.     # 定义数字颜色
  868.     lvup = normal_color
  869.     upcolor = Color.new(255, 128, 128, 255)
  870.     self.contents.font.color = normal_color   
  871.     case type
  872.     when 0
  873.       parameter_name = $data_system.words.str
  874.       parameter_value = actor.str
  875.       parameter_value_temp = parameter_value + $temp_str
  876.       if $temp_str != 0
  877.         lvup = upcolor
  878.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  879.         if $temp_str >= 0
  880.           self.contents.font.color = lvup
  881.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  882.         else
  883.           self.contents.font.color = Color.new(255,255,0,255)
  884.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  885.         end        
  886.         self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
  887.         self.contents.font.color = normal_color
  888.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  889.       end
  890.     when 1
  891.       parameter_name = $data_system.words.dex
  892.       parameter_value = actor.dex
  893.       parameter_value_temp = parameter_value + $temp_dex
  894.       if $temp_dex != 0
  895.         lvup = upcolor
  896.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  897.         if $temp_dex >= 0
  898.           self.contents.font.color = lvup
  899.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  900.         else
  901.           self.contents.font.color = Color.new(255,255,0,255)
  902.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  903.         end        
  904.         self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
  905.         self.contents.font.color = normal_color
  906.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  907.       end
  908.     when 2
  909.       parameter_name = $data_system.words.agi
  910.       parameter_value = actor.agi
  911.       parameter_value_temp = parameter_value + $temp_agi
  912.       if $temp_agi != 0
  913.         lvup = upcolor
  914.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  915.         if $temp_agi >= 0
  916.           self.contents.font.color = lvup
  917.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  918.         else
  919.           self.contents.font.color = Color.new(255,255,0,255)
  920.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  921.         end        
  922.         self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  923.         self.contents.font.color = normal_color
  924.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  925.       end
  926.     when 3
  927.       parameter_name = $data_system.words.int
  928.       parameter_value = actor.int
  929.       parameter_value_temp = parameter_value + $temp_int
  930.       if $temp_int != 0
  931.         lvup = upcolor
  932.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  933.         if $temp_int >= 0
  934.           self.contents.font.color = lvup
  935.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  936.         else
  937.           self.contents.font.color = Color.new(255,255,0,255)
  938.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  939.         end        
  940.         self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
  941.         self.contents.font.color = normal_color
  942.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  943.       end
  944.     when 4
  945.       parameter_name = "剩余点数"
  946.       parameter_value = $point
  947.       if $point != 0
  948.         lvup = upcolor
  949.       end
  950.     end   
  951.     self.contents.font.color = system_color
  952.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  953.     self.contents.font.color = normal_color
  954.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
  955.     if type != 4
  956.       self.contents.draw_text(x + 150, y, 36, 32, "→")
  957.     end  
  958.     self.contents.font.color = lvup
  959.     self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
  960.     self.contents.font.color = normal_color        
  961.   end
  962. end
  963. #==============================================================================
  964. # ■ Window_lvup
  965. #------------------------------------------------------------------------------
  966. #  显示升级状态窗口。
  967. #==============================================================================
  968. class Window_Lvup < Window_Base
  969.   #--------------------------------------------------------------------------
  970.   # ● 初始化对像
  971.   #     actor : 角色
  972.   #--------------------------------------------------------------------------
  973.   def initialize(actor)
  974.     super(0, 0, 512, 320)
  975.     self.contents = Bitmap.new(width - 32, height - 32)
  976.     @actor = actor
  977.     refresh
  978.   end  
  979.   #--------------------------------------------------------------------------
  980.   # ● 刷新
  981.   #--------------------------------------------------------------------------
  982.   def refresh
  983.     self.contents.clear
  984.     draw_actor_graphic(@actor, 40, 112)
  985.     draw_actor_name(@actor, 4, 0)
  986.     draw_actor_class(@actor, 4 + 144, 0)
  987.     draw_actor_level(@actor, 96, 32)
  988.     draw_actor_state(@actor, 96, 64)   
  989.     draw_actor_hp_lvup(@actor, 96+128, 32)
  990.     draw_actor_sp_lvup(@actor, 96+128, 64)
  991.     draw_actor_lvup(@actor, 96, 128, 0)
  992.     draw_actor_lvup(@actor, 96, 160, 1)
  993.     draw_actor_lvup(@actor, 96, 192, 2)
  994.     draw_actor_lvup(@actor, 96, 224, 3)
  995.     draw_actor_lvup(@actor, 96, 256, 4)
  996.   end
  997. end
  998. #==============================================================================
  999. # ■ Window_Help
  1000. #------------------------------------------------------------------------------
  1001. #  特技及物品的说明、角色的状态显示的窗口。
  1002. #==============================================================================
  1003. class Window_Lvup_Help < Window_Base
  1004.   #--------------------------------------------------------------------------
  1005.   # ● 初始化对像
  1006.   #--------------------------------------------------------------------------
  1007.   def initialize
  1008.     super(0, 320, 640, 160)
  1009.     self.contents = Bitmap.new(width - 32, height - 32)
  1010.     @test = "" #——这个东西用来检测,节约内存专用
  1011.   end  
  1012.   #--------------------------------------------------------------------------
  1013.   # ● 设置文本
  1014.   #--------------------------------------------------------------------------
  1015.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  1016.     if @test != text1
  1017.       @test = text1
  1018.     else
  1019.       return
  1020.     end   
  1021.     self.contents.clear
  1022.     self.contents.font.color = normal_color
  1023.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  1024.     if text2 != nil
  1025.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  1026.     end
  1027.     self.contents.font.size -= 4
  1028.     if text3 != nil
  1029.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  1030.     end
  1031.     if text4 != nil
  1032.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  1033.     end
  1034.     self.contents.font.size += 4
  1035.   end
  1036. end
  1037. #==============================================================================
  1038. # ■ Scene_lvup
  1039. #------------------------------------------------------------------------------
  1040. #  处理升级画面的类。
  1041. #==============================================================================
  1042. class Scene_Lvup
  1043.   #--------------------------------------------------------------------------
  1044.   # ● 初始化对像
  1045.   #     actor_index : 角色索引
  1046.   #     menu_index : 选项起始位置
  1047.   #--------------------------------------------------------------------------
  1048.   def initialize(actor_index = 0 , menu_index = 0)
  1049.     @actor_index = actor_index
  1050.     @menu_index = menu_index
  1051.   end
  1052.   #--------------------------------------------------------------------------
  1053.   # ● 主处理
  1054.   #--------------------------------------------------------------------------
  1055.   def main
  1056.     s1 = "增加体力 HP SP"
  1057.     s2 = "增加"+$data_system.words.str
  1058.     s3 = "增加"+$data_system.words.dex
  1059.     s4 = "增加"+$data_system.words.agi
  1060.     s5 = "增加"+$data_system.words.int
  1061.     s6 = "确认加点"
  1062.     s7 = "点数重置"
  1063.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
  1064.     @command_window.index = @menu_index
  1065.     # 获取角色
  1066.     @actor = $game_party.actors[@actor_index]
  1067.     # 将角色的剩余点数带入
  1068.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  1069.     # 初始化临时量
  1070.     $temp_str = 0
  1071.     $temp_dex = 0
  1072.     $temp_agi = 0
  1073.     $temp_int = 0
  1074.     $temp_hp = 0
  1075.     $temp_sp = 0
  1076.     #=========================================================================
  1077.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  1078.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  1079.     #=========================================================================
  1080.     # 每提升一次力量,提升多少附加能力
  1081.     #=========================================================================
  1082.     @str_hp = 5     # 每提升一次力量附加提升多少HP
  1083.     @str_sp = 0     # 每提升一次力量附加提升多少SP
  1084.     @str_dex = 1    # 每提升一次力量附加提升多少灵巧
  1085.     @str_agi = 1    # 每提升一次力量附加提升多少速度
  1086.     @str_int = 0    # 每提升一次力量附加提升多少魔力
  1087.     @str_str = 3    # 每提升一次力量附加提升多少力量
  1088.     #=========================================================================
  1089.     # 每提升一次灵巧,提升多少附加能力
  1090.     #=========================================================================
  1091.     @dex_hp = 2     # 每提升一次灵巧附加提升多少HP
  1092.     @dex_sp = 3     # 每提升一次灵巧附加提升多少SP
  1093.     @dex_str = 1    # 每提升一次灵巧附加提升多少力量
  1094.     @dex_agi = 1    # 每提升一次灵巧附加提升多少速度
  1095.     @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
  1096.     @dex_dex = 3    # 每提升一次灵巧附加提升多少灵巧
  1097.     #=========================================================================
  1098.     # 每提升一次速度,提升多少附加能力
  1099.     #=========================================================================
  1100.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  1101.     @agi_sp = 0     # 每提升一次速度附加提升多少SP
  1102.     @agi_str = 0    # 每提升一次速度附加提升多少力量
  1103.     @agi_dex = 1    # 每提升一次速度附加提升多少灵巧
  1104.     @agi_int = 0    # 每提升一次速度附加提升多少魔力
  1105.     @agi_agi = 3    # 每提升一次速度附加提升多少速度
  1106.     #=========================================================================
  1107.     # 每提升一次魔力,提升多少附加能力
  1108.     #=========================================================================
  1109.     @int_hp = 1     # 每提升一次魔力附加提升多少HP
  1110.     @int_sp = 15    # 每提升一次魔力附加提升多少SP
  1111.     @int_str = -1   # 每提升一次魔力附加提升多少力量
  1112.     @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
  1113.     @int_agi = 0   # 每提升一次魔力附加提升多少速度
  1114.     @int_int = 7   # 每提升一次魔力附加提升多少魔力
  1115.     #=========================================================================
  1116.     # 每提升一次体力,提升多少附加能力
  1117.     #=========================================================================
  1118.     @hp = 20       # 每提升一次体力提升多少HP
  1119.     @sp = 10       # 每提升一次体力提升多少SP
  1120.     @hp_str = 0   # 每提升一次体力提升多少力量
  1121.     @hp_dex = 0   # 每提升一次体力提升多少速度
  1122.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  1123.     @hp_int = -1   # 每提升一次体力提升多少魔力   
  1124.     # 定义说明文字
  1125.     @text_hp_sc = "体力可以增加生存的能力,增加HP与SP的最大上限!"
  1126.     @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
  1127.     @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和防御系数!"
  1128.     @text_agi_sc = $data_system.words.agi + "可以提高行动速度、逃跑成功率!"
  1129.     @text_int_sc = $data_system.words.int + "可以提高魔法攻击的效果!"
  1130.     @text_save = "保存分配情况并返回游戏"
  1131.     @text_reset= "重新分配能力点数"
  1132.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  1133.     @text_hp = "最大" + $data_system.words.hp + "值"
  1134.     @text_sp = "最大" + $data_system.words.sp + "值"
  1135.     @text_str = "最大" + $data_system.words.str + "值"
  1136.     @text_dex = "最大" + $data_system.words.dex + "值"
  1137.     @text_agi = "最大" + $data_system.words.agi + "值"
  1138.     @text_int = "最大" + $data_system.words.int + "值"
  1139.     s_disable
  1140.     # 生成状态窗口
  1141.     @lvup_window = Window_Lvup.new(@actor)
  1142.     @lvup_window.x = 128
  1143.     @lvup_window.y = 0   
  1144.     # 生成帮助窗口并初始化帮助文本
  1145.     @help_window = Window_Lvup_Help.new   
  1146.     # 执行过渡
  1147.     Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
  1148.     # 主循环
  1149.     loop do
  1150.       # 刷新游戏画面
  1151.       Graphics.update
  1152.       # 刷新输入信息
  1153.       Input.update
  1154.       # 刷新画面
  1155.       update
  1156.       # 如果切换画面就中断循环
  1157.       if $scene != self
  1158.         break
  1159.       end
  1160.     end
  1161.     # 准备过渡
  1162.     Graphics.freeze
  1163.     # 释放窗口
  1164.     @command_window.dispose
  1165.     @lvup_window.dispose
  1166.     @help_window.dispose
  1167.   end
  1168.   #--------------------------------------------------------------------------
  1169.   # ● 刷新画面
  1170.   #--------------------------------------------------------------------------
  1171.   def update
  1172.     # 刷新窗口
  1173.     @command_window.update
  1174.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  1175.     s_disable
  1176.     @lvup_window.update
  1177.     #=============================================================
  1178.     # 按下 B 键的情况下
  1179.     #=============================================================
  1180.     if Input.trigger?(Input::B)
  1181.       # 演奏取消 SE
  1182.       $game_system.se_play($data_system.cancel_se)
  1183.       # 切换到地图画面
  1184.       $scene = Scene_Menu.new
  1185.       return
  1186.     end
  1187.     #=============================================================
  1188.     # 按下 C 键的情况下
  1189.     #=============================================================
  1190.     if Input.trigger?(Input::C)      
  1191.       if @command_window.index == 5
  1192.           # 演奏确定 SE
  1193.         $game_system.se_play($data_system.decision_se)
  1194.         # 将角色的剩余点数带回
  1195.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  1196.         # 将角色点数实际加上
  1197.         @actor.str += $temp_str
  1198.         @actor.dex += $temp_dex
  1199.         @actor.agi += $temp_agi
  1200.         @actor.int += $temp_int
  1201.         @actor.maxhp += $temp_hp
  1202.         @actor.maxsp += $temp_sp
  1203.         # 切换到地图画面
  1204.         $scene = Scene_Menu.new
  1205.         return
  1206.       end
  1207.       if @command_window.index == 6
  1208.           # 演奏确定 SE
  1209.         $game_system.se_play($data_system.cancel_se)
  1210.           # 将角色的剩余点数带入
  1211.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  1212.           # 初始化临时量
  1213.         $temp_str = 0
  1214.         $temp_dex = 0
  1215.         $temp_agi = 0
  1216.         $temp_int = 0
  1217.         $temp_hp = 0
  1218.         $temp_sp = 0
  1219.         @lvup_window.refresh
  1220.         return
  1221.       end
  1222.       if $point == 0
  1223.         # 演奏冻结 SE
  1224.         $game_system.se_play($data_system.buzzer_se)
  1225.         return
  1226.       end
  1227.       case @command_window.index
  1228.       when 0
  1229.         # 演奏确定 SE
  1230.         $game_system.se_play($data_system.decision_se)
  1231.         $temp_hp += @hp
  1232.         $temp_sp += @sp
  1233.         $temp_str += @hp_str
  1234.         $temp_dex += @hp_dex
  1235.         $temp_agi += @hp_agi
  1236.         $temp_int += @hp_int
  1237.         $point -= 1
  1238.         @lvup_window.refresh
  1239.         s_disable
  1240.         return
  1241.       when 1
  1242.         # 演奏确定 SE
  1243.         $game_system.se_play($data_system.decision_se)
  1244.         $temp_str += @str_str
  1245.         $temp_hp += @str_hp
  1246.         $temp_sp += @str_sp
  1247.         $temp_dex += @str_dex
  1248.         $temp_agi += @str_agi
  1249.         $temp_int += @str_int
  1250.         $point -= 1
  1251.         @lvup_window.refresh
  1252.         s_disable
  1253.         return
  1254.       when 2
  1255.         # 演奏确定 SE
  1256.         $game_system.se_play($data_system.decision_se)
  1257.         $temp_dex += @dex_dex
  1258.         $temp_hp += @dex_hp
  1259.         $temp_sp += @dex_sp
  1260.         $temp_str += @dex_str
  1261.         $temp_agi += @dex_agi
  1262.         $temp_int += @dex_int
  1263.         $point -= 1
  1264.         @lvup_window.refresh
  1265.         s_disable
  1266.         return
  1267.       when 3
  1268.         # 演奏确定 SE
  1269.         $game_system.se_play($data_system.decision_se)
  1270.         $temp_agi += @agi_agi
  1271.         $temp_hp += @agi_hp
  1272.         $temp_sp += @agi_sp
  1273.         $temp_str += @agi_str
  1274.         $temp_dex += @agi_dex
  1275.         $temp_int += @agi_int
  1276.         $point -= 1
  1277.         @lvup_window.refresh
  1278.         s_disable
  1279.         return
  1280.       when 4
  1281.         # 演奏确定 SE
  1282.         $game_system.se_play($data_system.decision_se)
  1283.         $temp_int += @int_int
  1284.         $temp_hp += @int_hp
  1285.         $temp_sp += @int_sp
  1286.         $temp_str += @int_str
  1287.         $temp_dex += @int_dex
  1288.         $temp_agi += @int_agi
  1289.         $point -= 1
  1290.         @lvup_window.refresh
  1291.         s_disable
  1292.         return
  1293.       end
  1294.     end
  1295.     #=============================================================
  1296.     # 什么都没有按下的情况
  1297.     #=============================================================
  1298.     case @command_window.index   
  1299.     when 0  # 增加体力
  1300.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
  1301.       temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
  1302.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  1303.     when 1  # 增加力量
  1304.       temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
  1305.       temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
  1306.       @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
  1307.     when 2  # 增加灵巧
  1308.       temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
  1309.       temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
  1310.       @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
  1311.     when 3  # 增加速度
  1312.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
  1313.       temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
  1314.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  1315.     when 4  # 增加魔力
  1316.       temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
  1317.       temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
  1318.       @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
  1319.     when 5 # 保存设定
  1320.       @help_window.lvup_text(@text_save)
  1321.     when 6 # 点数重置
  1322.       @help_window.lvup_text(@text_reset)     
  1323.     end
  1324.     #=============================================================
  1325.     # 按下R与L换人的情况
  1326.     #=============================================================      
  1327.     if Input.trigger?(Input::R)
  1328.       # 演奏光标 SE
  1329.       $game_system.se_play($data_system.cursor_se)
  1330.       # 移至下一位角色
  1331.       @actor_index += 1
  1332.       @actor_index %= $game_party.actors.size
  1333.       # 切换到别的状态画面
  1334.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  1335.       return
  1336.     end
  1337.     # 按下 L 键的情况下
  1338.     if Input.trigger?(Input::L)
  1339.       # 演奏光标 SE
  1340.       $game_system.se_play($data_system.cursor_se)
  1341.       # 移至上一位角色
  1342.       @actor_index += $game_party.actors.size - 1
  1343.       @actor_index %= $game_party.actors.size
  1344.       # 切换到别的状态画面
  1345.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  1346.       return
  1347.     end
  1348.   end  
  1349.   #--------------------------------------------------------------------------
  1350.   # ● 选项明暗判断
  1351.   #--------------------------------------------------------------------------
  1352.   def s_disable
  1353.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  1354.     if $point == 0
  1355.       @command_window.disable_item(0)
  1356.       @command_window.disable_item(1)
  1357.       @command_window.disable_item(2)
  1358.       @command_window.disable_item(3)
  1359.       @command_window.disable_item(4)
  1360.     else
  1361.       @command_window.able_item(0)
  1362.       @command_window.able_item(1)      
  1363.       @command_window.able_item(2)
  1364.       @command_window.able_item(3)
  1365.       @command_window.able_item(4)
  1366.     end
  1367.   end
  1368. end

  1369. #==============================================================================
  1370. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1371. #==============================================================================

  1372. #==============================================================================
  1373. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1374. #==============================================================================
复制代码


从433行,是设置Scene_Menu的部分。本人不懂代码,求高手指点。s9 =剧情任务那个选项是我后加的,任务脚本是《详尽任务显示界面》
30岁了,也要继续创造梦想啊。
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2015-8-26 23:19:10 | 显示全部楼层
稍微整理了一下脚本,指令之间的对应已经修好,升级加点和整队都能使用,
进入任务界面弹错的原因是脚本列表里没有【Scene_Mission】这个脚本,
尝试在范例工程(任务系统原出处)里面的脚本列表全局搜索(ctrl+shift+f)“class Scene_Mission”,
然后把class直到对应的end之间的这个类放到现在的工程里来。
已修的脚本如下:
整队和加点部分


  1. #插件(升级加点,换队伍顺序,人物介绍,动态行走图)

  2. #==============================================================================
  3. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  4. #==============================================================================


  5. # 作者: 柳柳
  6. #
  7. # 说明:这是功能我再比较早期的时候发布在幻森,不过那时候比较笨,方法很糟糕
  8. #       这次是拿上就可以用的。
  9. #
  10. # 感谢:Claimh的脚本使我想起这个功能重做了一遍,本想直接用他的,不过他的算法过分
  11. #       冗余了,没好意思用。
  12. #==============================================================================
  13. # 使用方法:默认情况下把静态图变为了走步图。如果想自行修改,提供功能如下:
  14. #
  15. # 角色走步图:draw_walk_actor_graphic
  16. # 角色转向图:draw_turn_actor_graphic
  17. #
  18. # 回复原有静态角色图:删除100行以后的内容。修改下面这个变量可以更改行走速度
  19. #==============================================================================

  20. WALK_REFRESH_FRAME_SPEED = 15  # 刷新的速度,越大越慢,你可以改为3左右试试看

  21. #==============================================================================
  22. # Window_Base
  23. #==============================================================================
  24. class Window_Base < Window
  25.   #--------------------------------------------------------------------------
  26.   # 初始化方法
  27.   #--------------------------------------------------------------------------
  28.   alias initialize_walk initialize
  29.   def initialize(x, y, width, height)
  30.     initialize_walk(x, y, width, height)
  31.     @start_walk = false
  32.     @turn_index = 0
  33.     @turn_phase = 0
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ★  角色行走图
  37.   #     actor : 角色
  38.   #     x     : 描绘的 X 坐标
  39.   #     y     : 描绘的 Y 坐标
  40.   #--------------------------------------------------------------------------
  41.   def draw_walk_actor_graphic(actor, x, y)
  42.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  43.     cw = bitmap.width / 4
  44.     ch = bitmap.height / 4
  45.     @start_turn = true
  46.     case @turn_phase
  47.     when 0
  48.       x_x = 0
  49.     when 1
  50.       x_x = cw
  51.     when 2
  52.       x_x = cw * 2
  53.     when 3
  54.       x_x = cw * 3
  55.     end
  56.     src_rect = Rect.new(x_x, 0, cw, ch)
  57.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ★  角色转向图
  61.   #     actor : 角色
  62.   #     x     : 描绘的 X 坐标
  63.   #     y     : 描绘的 Y 坐标
  64.   #--------------------------------------------------------------------------
  65.   def draw_turn_actor_graphic(actor, x, y)
  66.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  67.     cw = bitmap.width / 4
  68.     ch = bitmap.height / 4
  69.     @start_turn = true
  70.     case @turn_phase
  71.     when 0
  72.       x_x = 0
  73.     when 1
  74.       x_x = ch
  75.     when 2
  76.       x_x = ch * 3
  77.     when 3
  78.       x_x = ch * 2
  79.     end
  80.     src_rect = Rect.new(0, x_x, cw, ch)
  81.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   #  更新(可别使用刷新,玩命耗费内存= =)
  85.   #--------------------------------------------------------------------------
  86.   alias walk_update update
  87.   def update
  88.     walk_update
  89.     if @start_turn == true
  90.       @turn_index += 1
  91.       if @turn_index == WALK_REFRESH_FRAME_SPEED
  92.         refresh
  93.         @turn_index = 0
  94.         @turn_phase = (@turn_phase+1)%4
  95.       end
  96.     end
  97.   end  
  98. end

  99. #==============================================================================
  100. # Window_Base
  101. #==============================================================================
  102. class Window_Base < Window
  103.   #--------------------------------------------------------------------------
  104.   # 把原有静态图改为动态走步图
  105.   #--------------------------------------------------------------------------
  106.   def draw_actor_graphic(actor, x, y)
  107.     draw_walk_actor_graphic(actor, x, y)
  108.   end
  109. end

  110. #==============================================================================
  111. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  112. #==============================================================================

  113. #==============================================================================
  114. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  115. #==============================================================================


  116. # 脚本使用设定:

  117. LEVEL_UP_POINT = 3  # 每升一级所增加的点数
  118. LEVEL_UP_VARIABLE = 200  # 储存角色点数的变量编号与角色id编号的差值
  119.                          # 默认情况 = 200,
  120.                          # 则是数据库里1号角色的加点数存于101号变量
  121.                          # 3号角色的加点数存于103号变量。
  122.                          # 你可以直接操作变量赠与角色可分配点数

  123. # 每增加一次点数,各项能力值的变化:357-410行

  124. # 使用方法介绍:

  125. # 本脚本不会取代原升级功能 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  126. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  127. # 1-99级全部等于一个相同数值就行了。

  128. # 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
  129. # 默认都是0号

  130. # 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
  131. # 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new

  132. # 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG

  133. #==============================================================================
  134. # ■ Window_Command
  135. #------------------------------------------------------------------------------
  136. #  一般的命令选择行窗口。(追加定义)
  137. #==============================================================================
  138. class Window_Command < Window_Selectable
  139.   #--------------------------------------------------------------------------
  140.   # ● 项目有效化
  141.   #     index : 项目编号
  142.   #--------------------------------------------------------------------------
  143.   def able_item(index)
  144.     draw_item(index, normal_color)
  145.   end
  146. end
  147. #==============================================================================
  148. # ■ Game_Actor
  149. #------------------------------------------------------------------------------
  150. #  处理角色的类。(再定义)
  151. #==============================================================================
  152. class Game_Actor < Game_Battler
  153.   #--------------------------------------------------------------------------
  154.   # ● 更改 EXP
  155.   #     exp : 新的 EXP
  156.   #--------------------------------------------------------------------------
  157.   def exp=(exp)
  158.     @exp = [[exp, 9999999].min, 0].max
  159.     # 升级
  160.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  161.       @level += 1
  162.       # 增加4点可自由分配的点数
  163.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  164.       # 学会特技
  165.       for j in $data_classes[@class_id].learnings
  166.         if j.level == @level
  167.           learn_skill(j.skill_id)
  168.         end
  169.       end
  170.     end
  171.     # 降级
  172.     while @exp < @exp_list[@level]
  173.       @level -= 1
  174.     end
  175.     # 修正当前的 HP 与 SP 超过最大值
  176.     @hp = [@hp, self.maxhp].min
  177.     @sp = [@sp, self.maxsp].min
  178.   end
  179. end
  180. #==============================================================================
  181. # ■ Window_Base
  182. #------------------------------------------------------------------------------
  183. #  游戏中全部窗口的超级类(追加定义)
  184. #==============================================================================
  185. class Window_Base < Window
  186.   #--------------------------------------------------------------------------
  187.   # ● 描绘 HP
  188.   #     actor : 角色
  189.   #     x     : 描画目标 X 坐标
  190.   #     y     : 描画目标 Y 坐标
  191.   #     width : 描画目标的宽
  192.   #--------------------------------------------------------------------------
  193.   def draw_actor_hp_lvup(actor, x, y)
  194.     self.contents.font.color = system_color
  195.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.hp)
  196.     if $temp_hp == 0
  197.       self.contents.font.color = normal_color
  198.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
  199.     else
  200.       maxhp = actor.maxhp + $temp_hp
  201.       self.contents.font.color = Color.new(255, 128, 128, 255)
  202.       self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  203.       self.contents.font.color = normal_color      
  204.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  205.       if $temp_hp >=0
  206.         self.contents.font.color = Color.new(255, 128, 128, 255)
  207.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  208.       else
  209.         self.contents.font.color = Color.new(255,255,0,255)
  210.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  211.       end
  212.       self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
  213.       self.contents.font.color = normal_color
  214.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 描绘 SP
  219.   #     actor : 角色
  220.   #     x     : 描画目标 X 坐标
  221.   #     y     : 描画目标 Y 坐标
  222.   #     width : 描画目标的宽
  223.   #--------------------------------------------------------------------------
  224.   def draw_actor_sp_lvup(actor, x, y)
  225.     self.contents.font.color = system_color
  226.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
  227.     if $temp_sp == 0
  228.       self.contents.font.color = normal_color
  229.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
  230.     else
  231.       maxsp = actor.maxsp + $temp_sp
  232.       self.contents.font.color = Color.new(255, 128, 128, 255)
  233.       self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  234.       self.contents.font.color = normal_color      
  235.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  236.       if $temp_sp >=0
  237.         self.contents.font.color = Color.new(255, 128, 128, 255)
  238.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  239.       else
  240.         self.contents.font.color = Color.new(255,255,0,255)
  241.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  242.       end
  243.       self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
  244.       self.contents.font.color = normal_color
  245.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  246.     end
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● 描绘能力值
  250.   #     actor : 角色
  251.   #     x     : 描画目标 X 坐标
  252.   #     y     : 描画目标 Y 坐标
  253.   #     type  : 能力值种类 (0~4)
  254.   #--------------------------------------------------------------------------
  255.   def draw_actor_lvup(actor, x, y, type)   
  256.     # 定义数字颜色
  257.     lvup = normal_color
  258.     upcolor = Color.new(255, 128, 128, 255)
  259.     self.contents.font.color = normal_color   
  260.     case type
  261.     when 0
  262.       parameter_name = $data_system.words.str
  263.       parameter_value = actor.str
  264.       parameter_value_temp = parameter_value + $temp_str
  265.       if $temp_str != 0
  266.         lvup = upcolor
  267.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  268.         if $temp_str >= 0
  269.           self.contents.font.color = lvup
  270.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  271.         else
  272.           self.contents.font.color = Color.new(255,255,0,255)
  273.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  274.         end        
  275.         self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
  276.         self.contents.font.color = normal_color
  277.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  278.       end
  279.     when 1
  280.       parameter_name = $data_system.words.dex
  281.       parameter_value = actor.dex
  282.       parameter_value_temp = parameter_value + $temp_dex
  283.       if $temp_dex != 0
  284.         lvup = upcolor
  285.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  286.         if $temp_dex >= 0
  287.           self.contents.font.color = lvup
  288.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  289.         else
  290.           self.contents.font.color = Color.new(255,255,0,255)
  291.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  292.         end        
  293.         self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
  294.         self.contents.font.color = normal_color
  295.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  296.       end
  297.     when 2
  298.       parameter_name = $data_system.words.agi
  299.       parameter_value = actor.agi
  300.       parameter_value_temp = parameter_value + $temp_agi
  301.       if $temp_agi != 0
  302.         lvup = upcolor
  303.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  304.         if $temp_agi >= 0
  305.           self.contents.font.color = lvup
  306.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  307.         else
  308.           self.contents.font.color = Color.new(255,255,0,255)
  309.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  310.         end        
  311.         self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  312.         self.contents.font.color = normal_color
  313.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  314.       end
  315.     when 3
  316.       parameter_name = $data_system.words.int
  317.       parameter_value = actor.int
  318.       parameter_value_temp = parameter_value + $temp_int
  319.       if $temp_int != 0
  320.         lvup = upcolor
  321.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  322.         if $temp_int >= 0
  323.           self.contents.font.color = lvup
  324.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  325.         else
  326.           self.contents.font.color = Color.new(255,255,0,255)
  327.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  328.         end        
  329.         self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
  330.         self.contents.font.color = normal_color
  331.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  332.       end
  333.     when 4
  334.       parameter_name = "剩余点数"
  335.       parameter_value = $point
  336.       if $point != 0
  337.         lvup = upcolor
  338.       end
  339.     end   
  340.     self.contents.font.color = system_color
  341.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  342.     self.contents.font.color = normal_color
  343.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
  344.     if type != 4
  345.       self.contents.draw_text(x + 150, y, 36, 32, "→")
  346.     end  
  347.     self.contents.font.color = lvup
  348.     self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
  349.     self.contents.font.color = normal_color        
  350.   end
  351. end
  352. #==============================================================================
  353. # ■ Window_lvup
  354. #------------------------------------------------------------------------------
  355. #  显示升级状态窗口。
  356. #==============================================================================
  357. class Window_Lvup < Window_Base
  358.   #--------------------------------------------------------------------------
  359.   # ● 初始化对像
  360.   #     actor : 角色
  361.   #--------------------------------------------------------------------------
  362.   def initialize(actor)
  363.     super(0, 0, 512, 320)
  364.     self.contents = Bitmap.new(width - 32, height - 32)
  365.     @actor = actor
  366.     refresh
  367.   end  
  368.   #--------------------------------------------------------------------------
  369.   # ● 刷新
  370.   #--------------------------------------------------------------------------
  371.   def refresh
  372.     self.contents.clear
  373.     draw_actor_graphic(@actor, 40, 112)
  374.     draw_actor_name(@actor, 4, 0)
  375.     draw_actor_class(@actor, 4 + 144, 0)
  376.     draw_actor_level(@actor, 96, 32)
  377.     draw_actor_state(@actor, 96, 64)   
  378.     draw_actor_hp_lvup(@actor, 96+128, 32)
  379.     draw_actor_sp_lvup(@actor, 96+128, 64)
  380.     draw_actor_lvup(@actor, 96, 128, 0)
  381.     draw_actor_lvup(@actor, 96, 160, 1)
  382.     draw_actor_lvup(@actor, 96, 192, 2)
  383.     draw_actor_lvup(@actor, 96, 224, 3)
  384.     draw_actor_lvup(@actor, 96, 256, 4)
  385.   end
  386. end
  387. #==============================================================================
  388. # ■ Window_Help
  389. #------------------------------------------------------------------------------
  390. #  特技及物品的说明、角色的状态显示的窗口。
  391. #==============================================================================
  392. class Window_Lvup_Help < Window_Base
  393.   #--------------------------------------------------------------------------
  394.   # ● 初始化对像
  395.   #--------------------------------------------------------------------------
  396.   def initialize
  397.     super(0, 320, 640, 160)
  398.     self.contents = Bitmap.new(width - 32, height - 32)
  399.     @test = "" #——这个东西用来检测,节约内存专用
  400.   end  
  401.   #--------------------------------------------------------------------------
  402.   # ● 设置文本
  403.   #--------------------------------------------------------------------------
  404.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  405.     if @test != text1
  406.       @test = text1
  407.     else
  408.       return
  409.     end   
  410.     self.contents.clear
  411.     self.contents.font.color = normal_color
  412.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  413.     if text2 != nil
  414.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  415.     end
  416.     self.contents.font.size -= 4
  417.     if text3 != nil
  418.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  419.     end
  420.     if text4 != nil
  421.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  422.     end
  423.     self.contents.font.size += 4
  424.   end
  425. end
  426. #==============================================================================
  427. # ■ Scene_lvup
  428. #------------------------------------------------------------------------------
  429. #  处理升级画面的类。
  430. #==============================================================================
  431. class Scene_Lvup
  432.   #--------------------------------------------------------------------------
  433.   # ● 初始化对像
  434.   #     actor_index : 角色索引
  435.   #     menu_index : 选项起始位置
  436.   #--------------------------------------------------------------------------
  437.   def initialize(actor_index = 0 , menu_index = 0)
  438.     @actor_index = actor_index
  439.     @menu_index = menu_index
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 主处理
  443.   #--------------------------------------------------------------------------
  444.   def main
  445.     s1 = "增加体力 HP SP"
  446.     s2 = "增加"+$data_system.words.str
  447.     s3 = "增加"+$data_system.words.dex
  448.     s4 = "增加"+$data_system.words.agi
  449.     s5 = "增加"+$data_system.words.int
  450.     s6 = "确认加点"
  451.     s7 = "点数重置"
  452.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
  453.     @command_window.index = @menu_index
  454.     # 获取角色
  455.     @actor = $game_party.actors[@actor_index]
  456.     # 将角色的剩余点数带入
  457.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  458.     # 初始化临时量
  459.     $temp_str = 0
  460.     $temp_dex = 0
  461.     $temp_agi = 0
  462.     $temp_int = 0
  463.     $temp_hp = 0
  464.     $temp_sp = 0
  465.     #=========================================================================
  466.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  467.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  468.     #=========================================================================
  469.     # 每提升一次力量,提升多少附加能力
  470.     #=========================================================================
  471.     @str_hp = 5     # 每提升一次力量附加提升多少HP
  472.     @str_sp = 0     # 每提升一次力量附加提升多少SP
  473.     @str_dex = 1    # 每提升一次力量附加提升多少灵巧
  474.     @str_agi = 1    # 每提升一次力量附加提升多少速度
  475.     @str_int = 0    # 每提升一次力量附加提升多少魔力
  476.     @str_str = 3    # 每提升一次力量附加提升多少力量
  477.     #=========================================================================
  478.     # 每提升一次灵巧,提升多少附加能力
  479.     #=========================================================================
  480.     @dex_hp = 2     # 每提升一次灵巧附加提升多少HP
  481.     @dex_sp = 3     # 每提升一次灵巧附加提升多少SP
  482.     @dex_str = 1    # 每提升一次灵巧附加提升多少力量
  483.     @dex_agi = 1    # 每提升一次灵巧附加提升多少速度
  484.     @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
  485.     @dex_dex = 3    # 每提升一次灵巧附加提升多少灵巧
  486.     #=========================================================================
  487.     # 每提升一次速度,提升多少附加能力
  488.     #=========================================================================
  489.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  490.     @agi_sp = 0     # 每提升一次速度附加提升多少SP
  491.     @agi_str = 0    # 每提升一次速度附加提升多少力量
  492.     @agi_dex = 1    # 每提升一次速度附加提升多少灵巧
  493.     @agi_int = 0    # 每提升一次速度附加提升多少魔力
  494.     @agi_agi = 3    # 每提升一次速度附加提升多少速度
  495.     #=========================================================================
  496.     # 每提升一次魔力,提升多少附加能力
  497.     #=========================================================================
  498.     @int_hp = 1     # 每提升一次魔力附加提升多少HP
  499.     @int_sp = 15    # 每提升一次魔力附加提升多少SP
  500.     @int_str = -1   # 每提升一次魔力附加提升多少力量
  501.     @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
  502.     @int_agi = 0   # 每提升一次魔力附加提升多少速度
  503.     @int_int = 7   # 每提升一次魔力附加提升多少魔力
  504.     #=========================================================================
  505.     # 每提升一次体力,提升多少附加能力
  506.     #=========================================================================
  507.     @hp = 20       # 每提升一次体力提升多少HP
  508.     @sp = 10       # 每提升一次体力提升多少SP
  509.     @hp_str = 0   # 每提升一次体力提升多少力量
  510.     @hp_dex = 0   # 每提升一次体力提升多少速度
  511.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  512.     @hp_int = -1   # 每提升一次体力提升多少魔力   
  513.     # 定义说明文字
  514.     @text_hp_sc = "体力可以增加生存的能力,增加HP与SP的最大上限!"
  515.     @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
  516.     @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和防御系数!"
  517.     @text_agi_sc = $data_system.words.agi + "可以提高行动速度、逃跑成功率!"
  518.     @text_int_sc = $data_system.words.int + "可以提高魔法攻击的效果!"
  519.     @text_save = "保存分配情况并返回游戏"
  520.     @text_reset= "重新分配能力点数"
  521.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  522.     @text_hp = "最大" + $data_system.words.hp + "值"
  523.     @text_sp = "最大" + $data_system.words.sp + "值"
  524.     @text_str = "最大" + $data_system.words.str + "值"
  525.     @text_dex = "最大" + $data_system.words.dex + "值"
  526.     @text_agi = "最大" + $data_system.words.agi + "值"
  527.     @text_int = "最大" + $data_system.words.int + "值"
  528.     s_disable
  529.     # 生成状态窗口
  530.     @lvup_window = Window_Lvup.new(@actor)
  531.     @lvup_window.x = 128
  532.     @lvup_window.y = 0   
  533.     # 生成帮助窗口并初始化帮助文本
  534.     @help_window = Window_Lvup_Help.new   
  535.     # 执行过渡
  536.     Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
  537.     # 主循环
  538.     loop do
  539.       # 刷新游戏画面
  540.       Graphics.update
  541.       # 刷新输入信息
  542.       Input.update
  543.       # 刷新画面
  544.       update
  545.       # 如果切换画面就中断循环
  546.       if $scene != self
  547.         break
  548.       end
  549.     end
  550.     # 准备过渡
  551.     Graphics.freeze
  552.     # 释放窗口
  553.     @command_window.dispose
  554.     @lvup_window.dispose
  555.     @help_window.dispose
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # ● 刷新画面
  559.   #--------------------------------------------------------------------------
  560.   def update
  561.     # 刷新窗口
  562.     @command_window.update
  563.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  564.     s_disable
  565.     @lvup_window.update
  566.     #=============================================================
  567.     # 按下 B 键的情况下
  568.     #=============================================================
  569.     if Input.trigger?(Input::B)
  570.       # 演奏取消 SE
  571.       $game_system.se_play($data_system.cancel_se)
  572.       # 切换到地图画面
  573.       $scene = Scene_Menu.new
  574.       return
  575.     end
  576.     #=============================================================
  577.     # 按下 C 键的情况下
  578.     #=============================================================
  579.     if Input.trigger?(Input::C)      
  580.       if @command_window.index == 5
  581.           # 演奏确定 SE
  582.         $game_system.se_play($data_system.decision_se)
  583.         # 将角色的剩余点数带回
  584.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  585.         # 将角色点数实际加上
  586.         @actor.str += $temp_str
  587.         @actor.dex += $temp_dex
  588.         @actor.agi += $temp_agi
  589.         @actor.int += $temp_int
  590.         @actor.maxhp += $temp_hp
  591.         @actor.maxsp += $temp_sp
  592.         # 切换到地图画面
  593.         $scene = Scene_Menu.new
  594.         return
  595.       end
  596.       if @command_window.index == 6
  597.           # 演奏确定 SE
  598.         $game_system.se_play($data_system.cancel_se)
  599.           # 将角色的剩余点数带入
  600.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  601.           # 初始化临时量
  602.         $temp_str = 0
  603.         $temp_dex = 0
  604.         $temp_agi = 0
  605.         $temp_int = 0
  606.         $temp_hp = 0
  607.         $temp_sp = 0
  608.         @lvup_window.refresh
  609.         return
  610.       end
  611.       if $point == 0
  612.         # 演奏冻结 SE
  613.         $game_system.se_play($data_system.buzzer_se)
  614.         return
  615.       end
  616.       case @command_window.index
  617.       when 0
  618.         # 演奏确定 SE
  619.         $game_system.se_play($data_system.decision_se)
  620.         $temp_hp += @hp
  621.         $temp_sp += @sp
  622.         $temp_str += @hp_str
  623.         $temp_dex += @hp_dex
  624.         $temp_agi += @hp_agi
  625.         $temp_int += @hp_int
  626.         $point -= 1
  627.         @lvup_window.refresh
  628.         s_disable
  629.         return
  630.       when 1
  631.         # 演奏确定 SE
  632.         $game_system.se_play($data_system.decision_se)
  633.         $temp_str += @str_str
  634.         $temp_hp += @str_hp
  635.         $temp_sp += @str_sp
  636.         $temp_dex += @str_dex
  637.         $temp_agi += @str_agi
  638.         $temp_int += @str_int
  639.         $point -= 1
  640.         @lvup_window.refresh
  641.         s_disable
  642.         return
  643.       when 2
  644.         # 演奏确定 SE
  645.         $game_system.se_play($data_system.decision_se)
  646.         $temp_dex += @dex_dex
  647.         $temp_hp += @dex_hp
  648.         $temp_sp += @dex_sp
  649.         $temp_str += @dex_str
  650.         $temp_agi += @dex_agi
  651.         $temp_int += @dex_int
  652.         $point -= 1
  653.         @lvup_window.refresh
  654.         s_disable
  655.         return
  656.       when 3
  657.         # 演奏确定 SE
  658.         $game_system.se_play($data_system.decision_se)
  659.         $temp_agi += @agi_agi
  660.         $temp_hp += @agi_hp
  661.         $temp_sp += @agi_sp
  662.         $temp_str += @agi_str
  663.         $temp_dex += @agi_dex
  664.         $temp_int += @agi_int
  665.         $point -= 1
  666.         @lvup_window.refresh
  667.         s_disable
  668.         return
  669.       when 4
  670.         # 演奏确定 SE
  671.         $game_system.se_play($data_system.decision_se)
  672.         $temp_int += @int_int
  673.         $temp_hp += @int_hp
  674.         $temp_sp += @int_sp
  675.         $temp_str += @int_str
  676.         $temp_dex += @int_dex
  677.         $temp_agi += @int_agi
  678.         $point -= 1
  679.         @lvup_window.refresh
  680.         s_disable
  681.         return
  682.       end
  683.     end
  684.     #=============================================================
  685.     # 什么都没有按下的情况
  686.     #=============================================================
  687.     case @command_window.index   
  688.     when 0  # 增加体力
  689.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
  690.       temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
  691.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  692.     when 1  # 增加力量
  693.       temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
  694.       temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
  695.       @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
  696.     when 2  # 增加灵巧
  697.       temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
  698.       temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
  699.       @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
  700.     when 3  # 增加速度
  701.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
  702.       temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
  703.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  704.     when 4  # 增加魔力
  705.       temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
  706.       temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
  707.       @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
  708.     when 5 # 保存设定
  709.       @help_window.lvup_text(@text_save)
  710.     when 6 # 点数重置
  711.       @help_window.lvup_text(@text_reset)     
  712.     end
  713.     #=============================================================
  714.     # 按下R与L换人的情况
  715.     #=============================================================      
  716.     if Input.trigger?(Input::R)
  717.       # 演奏光标 SE
  718.       $game_system.se_play($data_system.cursor_se)
  719.       # 移至下一位角色
  720.       @actor_index += 1
  721.       @actor_index %= $game_party.actors.size
  722.       # 切换到别的状态画面
  723.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  724.       return
  725.     end
  726.     # 按下 L 键的情况下
  727.     if Input.trigger?(Input::L)
  728.       # 演奏光标 SE
  729.       $game_system.se_play($data_system.cursor_se)
  730.       # 移至上一位角色
  731.       @actor_index += $game_party.actors.size - 1
  732.       @actor_index %= $game_party.actors.size
  733.       # 切换到别的状态画面
  734.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  735.       return
  736.     end
  737.   end  
  738.   #--------------------------------------------------------------------------
  739.   # ● 选项明暗判断
  740.   #--------------------------------------------------------------------------
  741.   def s_disable
  742.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  743.     if $point == 0
  744.       @command_window.disable_item(0)
  745.       @command_window.disable_item(1)
  746.       @command_window.disable_item(2)
  747.       @command_window.disable_item(3)
  748.       @command_window.disable_item(4)
  749.     else
  750.       @command_window.able_item(0)
  751.       @command_window.able_item(1)      
  752.       @command_window.able_item(2)
  753.       @command_window.able_item(3)
  754.       @command_window.able_item(4)
  755.     end
  756.   end
  757. end

  758. #==============================================================================
  759. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  760. #==============================================================================
复制代码


菜单部分
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. class Scene_Save
  5.   #--------------------------------------------------------------------------
  6.   # ● 写入存档数据
  7.   #     file : 写入用文件对像 (已经打开)
  8.   #--------------------------------------------------------------------------
  9.   def write_save_data(file)
  10.     # 生成描绘存档文件用的角色图形
  11.     characters = []
  12.     for i in 0...[$game_party.actors.size,4].min
  13.       actor = $game_party.actors[i]
  14.       characters.push([actor.character_name, actor.character_hue])
  15.     end
  16.     # 写入描绘存档文件用的角色数据
  17.     Marshal.dump(characters, file)
  18.     # 写入测量游戏时间用画面计数
  19.     Marshal.dump(Graphics.frame_count, file)
  20.     # 增加 1 次存档次数
  21.     $game_system.save_count += 1
  22.     # 保存魔法编号
  23.     # (将编辑器保存的值以随机值替换)
  24.     $game_system.magic_number = $data_system.magic_number
  25.     # 写入各种游戏对像
  26.     Marshal.dump($game_system, file)
  27.     Marshal.dump($game_switches, file)
  28.     Marshal.dump($game_variables, file)
  29.     Marshal.dump($game_self_switches, file)
  30.     Marshal.dump($game_screen, file)
  31.     Marshal.dump($game_actors, file)
  32.     Marshal.dump($game_party, file)
  33.     Marshal.dump($game_troop, file)
  34.     Marshal.dump($game_map, file)
  35.     Marshal.dump($game_player, file)
  36.   end
  37. end

  38. class Scene_Battle
  39.   #--------------------------------------------------------------------------
  40.   # ● 设置物品或特技对像方的战斗者
  41.   #     scope : 特技或者是物品的范围
  42.   #--------------------------------------------------------------------------
  43.   def set_target_battlers(scope)
  44.     # 行动方的战斗者是敌人的情况下
  45.     if @active_battler.is_a?(Game_Enemy)
  46.       # 效果范围分支
  47.       case scope
  48.       when 1  # 敌单体
  49.         index = @active_battler.current_action.target_index
  50.         @target_battlers.push($game_party.smooth_target_actor(index))
  51.       when 2  # 敌全体
  52.         for actor in 0...[$game_party.actors.size,4].min
  53.           if $game_party.actors[actor].exist?
  54.             @target_battlers.push($game_party.actors[actor])
  55.           end
  56.         end
  57.       when 3  # 我方单体
  58.         index = @active_battler.current_action.target_index
  59.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  60.       when 4  # 我方全体
  61.         for enemy in $game_troop.enemies
  62.           if enemy.exist?
  63.             @target_battlers.push(enemy)
  64.           end
  65.         end
  66.       when 5  # 我方单体 (HP 0)
  67.         index = @active_battler.current_action.target_index
  68.         enemy = $game_troop.enemies[index]
  69.         if enemy != nil and enemy.hp0?
  70.           @target_battlers.push(enemy)
  71.         end
  72.       when 6  # 我方全体 (HP 0)
  73.         for enemy in $game_troop.enemies
  74.           if enemy != nil and enemy.hp0?
  75.             @target_battlers.push(enemy)
  76.           end
  77.         end
  78.       when 7  # 使用者
  79.         @target_battlers.push(@active_battler)
  80.       end
  81.     end
  82.     # 行动方的战斗者是角色的情况下
  83.     if @active_battler.is_a?(Game_Actor)
  84.       # 效果范围分支
  85.       case scope
  86.       when 1  # 敌单体
  87.         index = @active_battler.current_action.target_index
  88.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  89.       when 2  # 敌全体
  90.         for enemy in $game_troop.enemies
  91.           if enemy.exist?
  92.             @target_battlers.push(enemy)
  93.           end
  94.         end
  95.       when 3  # 我方单体
  96.         index = @active_battler.current_action.target_index
  97.         @target_battlers.push($game_party.smooth_target_actor(index))
  98.       when 4  # 我方全体
  99.         for actor in 0...[$game_party.actors.size,4].min
  100.           if $game_party.actors[actor].exist?
  101.             @target_battlers.push($game_party.actors[actor])
  102.           end
  103.         end
  104.       when 5  # 我方单体 (HP 0)
  105.         index = @active_battler.current_action.target_index
  106.         actor = $game_party.actors[index]
  107.         if actor != nil and actor.hp0?
  108.           @target_battlers.push(actor)
  109.         end
  110.       when 6  # 我方全体 (HP 0)
  111.         for actor in 0...[$game_party.actors.size,4].min
  112.           if $game_party.actors[actor] != nil and $game_party.actors[actor].hp0?
  113.             @target_battlers.push($game_party.actors[actor])
  114.           end
  115.         end
  116.       when 7  # 使用者
  117.         @target_battlers.push(@active_battler)
  118.       end
  119.     end
  120.   end  
  121.   #--------------------------------------------------------------------------
  122.   # ● 生成行动循序
  123.   #--------------------------------------------------------------------------
  124.   def make_action_orders
  125.     # 初始化序列 @action_battlers
  126.     @action_battlers = []
  127.     # 添加敌人到 @action_battlers 序列
  128.     for enemy in $game_troop.enemies
  129.       @action_battlers.push(enemy)
  130.     end
  131.     # 添加角色到 @action_battlers 序列
  132.     for actor in 0...[$game_party.actors.size,4].min
  133.       @action_battlers.push($game_party.actors[actor])
  134.     end
  135.     # 确定全体的行动速度
  136.     for battler in @action_battlers
  137.       battler.make_action_speed
  138.     end
  139.     # 按照行动速度从大到小排列
  140.     @action_battlers.sort! {|a,b|
  141.       b.current_action.speed - a.current_action.speed }
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 开始结束战斗回合
  145.   #--------------------------------------------------------------------------
  146.   def start_phase5
  147.     # 转移到回合 5
  148.     @phase = 5
  149.     if $game_switches[79] == true
  150.       $game_variables[100] += 1
  151.     end
  152.     # 演奏战斗结束 ME
  153.     $game_system.me_play($game_system.battle_end_me)
  154.     # 还原为战斗开始前的 BGM
  155.     $game_system.bgm_play($game_temp.map_bgm)
  156.     # 初始化 EXP、金钱、宝物
  157.     exp = 0
  158.     gold = 0
  159.     treasures = []
  160.     # 循环
  161.     for enemy in $game_troop.enemies
  162.       # 敌人不是隐藏状态的情况下
  163.       unless enemy.hidden
  164.         # 获得 EXP、增加金钱
  165.         exp += enemy.exp
  166.         gold += enemy.gold
  167.         # 出现宝物判定
  168.         if rand(100) < enemy.treasure_prob
  169.           if enemy.item_id > 0
  170.             treasures.push($data_items[enemy.item_id])
  171.           end
  172.           if enemy.weapon_id > 0
  173.             treasures.push($data_weapons[enemy.weapon_id])
  174.           end
  175.           if enemy.armor_id > 0
  176.             treasures.push($data_armors[enemy.armor_id])
  177.           end
  178.         end
  179.       end
  180.     end
  181.     # 限制宝物数为 6 个
  182.     treasures = treasures[0..5]
  183.     # 获得 EXP
  184.     for i in 0...[$game_party.actors.size,4].min
  185.       actor = $game_party.actors[i]
  186.       if actor.cant_get_exp? == false
  187.         last_level = actor.level
  188.         actor.exp += exp
  189.         if actor.level > last_level
  190.           @status_window.level_up(i)
  191.         end
  192.       end
  193.     end
  194.     # 获得金钱
  195.     $game_party.gain_gold(gold)
  196.     # 获得宝物
  197.     for item in treasures
  198.       case item
  199.       when RPG::Item
  200.         $game_party.gain_item(item.id, 1)
  201.       when RPG::Weapon
  202.         $game_party.gain_weapon(item.id, 1)
  203.       when RPG::Armor
  204.         $game_party.gain_armor(item.id, 1)
  205.       end
  206.     end
  207.     # 生成战斗结果窗口
  208.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  209.     # 设置等待计数
  210.     @phase5_wait_count = 100
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 转到输入下一个角色的命令
  214.   #--------------------------------------------------------------------------
  215.   def phase3_next_actor
  216.     # 循环
  217.     begin
  218.       # 角色的明灭效果 OFF
  219.       if @active_battler != nil
  220.         @active_battler.blink = false
  221.       end
  222.       # 最后的角色的情况
  223.       if @actor_index == [$game_party.actors.size-1,3].min
  224.         # 开始主回合
  225.         start_phase4
  226.         return
  227.       end
  228.       # 推进角色索引
  229.       @actor_index += 1
  230.       @active_battler = $game_party.actors[@actor_index]
  231.       @active_battler.blink = true
  232.     # 如果角色是在无法接受指令的状态就再试
  233.     end until @active_battler.inputable?
  234.     # 设置角色的命令窗口
  235.     phase3_setup_command_window
  236.   end
  237. end


  238. class Arrow_Actor < Arrow_Base  
  239.   #--------------------------------------------------------------------------
  240.   # ● 刷新画面
  241.   #--------------------------------------------------------------------------
  242.   def update
  243.     super
  244.     # 光标右
  245.     if Input.repeat?(Input::RIGHT)
  246.       $game_system.se_play($data_system.cursor_se)
  247.       @index += 1
  248.       @index %= [$game_party.actors.size,4].min
  249.     end
  250.     # 光标左
  251.     if Input.repeat?(Input::LEFT)
  252.       $game_system.se_play($data_system.cursor_se)
  253.       @index += $game_party.actors.size - 1
  254.       @index %= [$game_party.actors.size,4].min
  255.     end
  256.     # 设置活动块坐标
  257.     if self.actor != nil
  258.       self.x = self.actor.screen_x
  259.       self.y = self.actor.screen_y
  260.     end
  261.   end
  262. end

  263. #==============================================================================
  264. # ■ Window_Target
  265. #------------------------------------------------------------------------------
  266. #  物品画面与特技画面的、使用对像角色选择窗口。
  267. #==============================================================================

  268. class Window_Target < Window_Selectable
  269. #--------------------------------------------------------------------------
  270. # ● 初始化对像
  271. #--------------------------------------------------------------------------
  272. def initialize
  273.    super(0, 0, 336, 480)
  274.    self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
  275.    self.z += 10
  276.    @item_max = $game_party.actors.size
  277.    @top_row = 0
  278.    refresh
  279. end
  280. #--------------------------------------------------------------------------
  281. # ● 刷新
  282. #--------------------------------------------------------------------------
  283. def refresh
  284.    self.contents.clear
  285.    for i in 0...$game_party.actors.size
  286.      x = 4
  287.      y = i * 112
  288.      actor = $game_party.actors[i]
  289.      draw_actor_name(actor, x, y)
  290.      draw_actor_class(actor, x + 144, y)
  291.      draw_actor_level(actor, x + 8, y + 32)
  292.      draw_actor_state(actor, x + 8, y + 64)
  293.      draw_actor_hp(actor, x + 152, y + 32)
  294.      draw_actor_sp(actor, x + 152, y + 64)
  295.    end
  296. end  
  297. #--------------------------------------------------------------------------
  298. # ● 刷新光标矩形
  299. #--------------------------------------------------------------------------
  300. def update_cursor_rect   
  301.    # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
  302.    if @index <= -2
  303.      self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
  304.    elsif @index == -1
  305.      self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
  306.    else
  307.      tpy = @index * 112 - self.oy
  308.      self.cursor_rect.set(0, tpy, self.width - 32, 96)
  309.      if @index < @top_row
  310.        @top_row = @index
  311.        self.oy = @top_row *112
  312.      end
  313.      if @index > @top_row+3
  314.        @top_row = @index-3
  315.        self.oy = @top_row *112
  316.      end
  317.    end   
  318. end
  319. end
  320. #==============================================================================
  321. # ■ Window_MenuStatus
  322. #------------------------------------------------------------------------------
  323. #  显示菜单画面和同伴状态的窗口。
  324. #==============================================================================

  325. class Window_MenuStatus < Window_Selectable
  326.   #--------------------------------------------------------------------------
  327.   # ● 初始化目标
  328.   #--------------------------------------------------------------------------
  329.   def initialize
  330.     super(0, 0, 480, 480)
  331.     self.contents = Bitmap.new(width - 32,  $game_party.actors.size*112)
  332.     refresh
  333.     @top_row = 0
  334.     self.active = false
  335.     self.index = -1
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 刷新
  339.   #--------------------------------------------------------------------------
  340.   def refresh
  341.     self.contents.clear
  342.     @item_max = $game_party.actors.size
  343.     for i in 0...$game_party.actors.size
  344.       x = 64
  345.       y = i * 112
  346.       if i <=3
  347.         self.contents.font.color = Color.new(255,255,0,255)
  348.         self.contents.draw_text(x,y,340,32,"[出战]",2)
  349.         self.contents.font.color = normal_color
  350.       else
  351.         self.contents.font.color = Color.new(128,128,128,255)
  352.         self.contents.draw_text(x,y,340,32,"[待机]",2)
  353.         self.contents.font.color = normal_color
  354.       end      
  355.       actor = $game_party.actors[i]
  356.       draw_actor_graphic(actor, x - 40, y + 80)
  357.       draw_actor_name(actor, x, y)
  358.       draw_actor_class(actor, x + 144, y)
  359.       draw_actor_level(actor, x, y + 32)
  360.       draw_actor_state(actor, x + 90, y + 32)
  361.       draw_actor_exp(actor, x, y + 64)
  362.       draw_actor_hp(actor, x + 236, y + 32)
  363.       draw_actor_sp(actor, x + 236, y + 64)
  364.     end
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● 刷新光标矩形
  368.   #--------------------------------------------------------------------------
  369.   def update_cursor_rect
  370.     if @index < 0
  371.       self.cursor_rect.empty
  372.     else
  373.       tpy = @index * 112 - self.oy
  374.       self.cursor_rect.set(0, tpy, self.width - 32, 96)
  375.       if @index < @top_row
  376.         @top_row = @index
  377.         self.oy = @top_row *112
  378.       end
  379.       if @index > @top_row+3
  380.         @top_row = @index-3
  381.         self.oy = @top_row *112
  382.       end
  383.     end
  384.   end
  385. end

  386. class Game_Party
  387.   #--------------------------------------------------------------------------
  388.   # ● 全灭判定
  389.   #--------------------------------------------------------------------------
  390.   def all_dead?
  391.     # 同伴人数为 0 的情况下
  392.     if $game_party.actors.size == 0
  393.       return false
  394.     end
  395.     # 同伴中无人 HP 在 0 以上
  396.     for i in 0..3
  397.       if @actors[i] != nil and@actors[i].hp >0
  398.         return false
  399.       end
  400.     end
  401.     # 全灭
  402.     return true
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 加入同伴
  406.   #     actor_id : 角色 ID
  407.   #--------------------------------------------------------------------------
  408.   def add_actor(actor_id)
  409.     # 获取角色
  410.     actor = $game_actors[actor_id]
  411.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  412.     if not @actors.include?(actor)
  413.       # 添加角色
  414.       @actors.push(actor)
  415.       # 还原主角
  416.       $game_player.refresh
  417.     end
  418.   end
  419. end

  420. #==============================================================================
  421. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  422. #==============================================================================


  423. class Scene_Menu
  424. # --------------------------------
  425.   def initialize(menu_index = 0)
  426.     @menu_index = menu_index
  427.     @changer = 0
  428.     @where = 0
  429.     @checker = 0
  430.   end
  431. # --------------------------------
  432.   def main
  433.     s1 = $data_system.words.item
  434.     s2 = $data_system.words.skill
  435.     s3 = $data_system.words.equip
  436.     s4 = "状态"
  437.     s5 = "储存进度"
  438.     s6 = "离开游戏"
  439.     s7 = "调整队伍"
  440.     s8 = "升级加点"
  441.     s9 = "剧情任务"
  442.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
  443.     @command_window.index = @menu_index
  444.     if $game_party.actors.size == 0
  445.       @command_window.disable_item(0)
  446.       @command_window.disable_item(1)
  447.       @command_window.disable_item(2)
  448.       @command_window.disable_item(3)
  449.     end
  450.     if $game_system.save_disabled
  451.       @command_window.disable_item(4)
  452.     end
  453.     if $game_party.actors.size == 1
  454.       @command_window.disable_item(6)
  455.     end
  456.     @playtime_window = Window_PlayTime.new
  457.     @playtime_window.x = 0
  458.     @playtime_window.y = 320
  459.     @gold_window = Window_Gold.new
  460.     @gold_window.x = 0
  461.     @gold_window.y = 416
  462.     @status_window = Window_MenuStatus.new
  463.     @status_window.x = 160
  464.     @status_window.y = 0
  465.     Graphics.transition
  466.     loop do
  467.       Graphics.update
  468.       Input.update
  469.       update
  470.       if $scene != self
  471.         break
  472.       end
  473.     end
  474.     Graphics.freeze
  475.     @command_window.dispose
  476.     @playtime_window.dispose
  477.     @gold_window.dispose
  478.     @status_window.dispose
  479.   end
  480. # --------------------------------
  481.   def update
  482.     @command_window.update
  483.     @playtime_window.update
  484.     @gold_window.update
  485.     @status_window.update
  486.     if @command_window.active
  487.       update_command
  488.       return
  489.     end
  490.     if @status_window.active
  491.       update_status
  492.       return
  493.     end
  494.   end
  495. # --------------------------------
  496.   def update_command
  497.     if Input.trigger?(Input::B)
  498.       $game_system.se_play($data_system.cancel_se)
  499.       $scene = Scene_Map.new
  500.       return
  501.     end
  502.     if Input.trigger?(Input::C)
  503.       if $game_party.actors.size == 0 and @command_window.index < 4
  504.         $game_system.se_play($data_system.buzzer_se)
  505.         return
  506.       end
  507.       if $game_party.actors.size == 1 and @command_window.index ==6
  508.         $game_system.se_play($data_system.buzzer_se)
  509.         return
  510.       end
  511.       case @command_window.index
  512.       when 0
  513.         $game_system.se_play($data_system.decision_se)
  514.         $scene = Scene_Item.new
  515.       when 1
  516.         $game_system.se_play($data_system.decision_se)
  517.         @command_window.active = false
  518.         @status_window.active = true
  519.         @status_window.index = 0
  520.       when 2
  521.         $game_system.se_play($data_system.decision_se)
  522.         @command_window.active = false
  523.         @status_window.active = true
  524.         @status_window.index = 0
  525.       when 3
  526.         $game_system.se_play($data_system.decision_se)
  527.         @command_window.active = false
  528.         @status_window.active = true
  529.         @status_window.index = 0
  530.       when 4
  531.         if $game_system.save_disabled
  532.           $game_system.se_play($data_system.buzzer_se)
  533.           return
  534.         end
  535.         $game_system.se_play($data_system.decision_se)
  536.         $scene = Scene_Save.new
  537.       when 5
  538.         $game_system.se_play($data_system.decision_se)
  539.         $scene = Scene_End.new
  540.       when 6
  541.         $game_system.se_play($data_system.decision_se)
  542.         @checker = 0
  543.         @command_window.active = false
  544.         @status_window.active = true
  545.         @status_window.index = 0
  546.       when 7
  547.         $game_system.se_play($data_system.decision_se)
  548.         @command_window.active = false
  549.         @status_window.active = true
  550.         @status_window.index = 0
  551.       when 8
  552.         $scene = Scene_Mission.new
  553.       when 9
  554.         $game_system.se_play($data_system.decision_se)
  555.         $scene = Scene_Charactor.new(@status_window.index)
  556.       end
  557.       return
  558.     end
  559.   end
  560. # --------------------------------
  561.   def update_status
  562.     if Input.trigger?(Input::B)
  563.       $game_system.se_play($data_system.cancel_se)
  564.       @command_window.active = true
  565.       @status_window.active = false
  566.       @status_window.index = -1
  567.       return
  568.     end
  569.     if Input.trigger?(Input::C)
  570.       case @command_window.index
  571.       when 1
  572.         if $game_party.actors[@status_window.index].restriction >= 2
  573.           $game_system.se_play($data_system.buzzer_se)
  574.           return
  575.         end
  576.         $game_system.se_play($data_system.decision_se)
  577.         $scene = Scene_Skill.new(@status_window.index)
  578.       when 2
  579.         $game_system.se_play($data_system.decision_se)
  580.         $scene = Scene_Status.new(@status_window.index)
  581.       when 3
  582.         $game_system.se_play($data_system.decision_se)
  583.         $scene = Scene_Equip.new(@status_window.index)
  584.       when 6
  585.         $game_system.se_play($data_system.decision_se)
  586.         if @checker == 0
  587.           @changer = $game_party.actors[@status_window.index]
  588.           @where = @status_window.index
  589.           @checker = 1
  590.         else
  591.           $game_party.actors[@where] = $game_party.actors[@status_window.index]
  592.           $game_party.actors[@status_window.index] = @changer
  593.           @checker = 0
  594.           @status_window.refresh
  595.         end
  596.       when 7
  597.         $game_system.se_play($data_system.decision_se)
  598.         $scene = Scene_Lvup.new(@status_window.index)
  599.       end
  600.       return
  601.     end
  602.   end
  603. end

  604. #==============================================================================
  605. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  606. #==============================================================================
复制代码

评分

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

查看全部评分

回复

使用道具 举报

梦石
0
星屑
219
在线时间
47 小时
注册时间
2009-7-5
回帖
55
 楼主| 发表于 2015-8-27 05:28:50 | 显示全部楼层
cinderelmini 发表于 2015-8-26 23:19
稍微整理了一下脚本,指令之间的对应已经修好,升级加点和整队都能使用,
进入任务界面弹错的原因是脚本列 ...

class Scene_Mission这个我在范例工程也搜不到啊。
额。。用了你发的脚本以后,我发现,状态栏与装备栏反过来了。
点状态会进入装备界面,点装备会进入状态界面。
30岁了,也要继续创造梦想啊。
回复

使用道具 举报

梦石
0
星屑
219
在线时间
47 小时
注册时间
2009-7-5
回帖
55
 楼主| 发表于 2015-8-27 05:47:47 | 显示全部楼层
cinderelmini 发表于 2015-8-26 23:19
稍微整理了一下脚本,指令之间的对应已经修好,升级加点和整队都能使用,
进入任务界面弹错的原因是脚本列 ...

自己又鼓弄了一会儿,意外的都调好了!

非常感谢您的帮助!谢谢!
30岁了,也要继续创造梦想啊。
回复

使用道具 举报

梦石
0
星屑
219
在线时间
47 小时
注册时间
2009-7-5
回帖
55
 楼主| 发表于 2015-8-27 06:00:37 | 显示全部楼层
本帖最后由 sixapple 于 2015-8-27 06:10 编辑
cinderelmini 发表于 2015-8-26 23:19
稍微整理了一下脚本,指令之间的对应已经修好,升级加点和整队都能使用,
进入任务界面弹错的原因是脚本列 ...


那个。。抱歉,我又发现了一个问题,实在是麻烦了。
调整队伍也出现了毛病,变换领队功能不好使
30岁了,也要继续创造梦想啊。
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2015-8-27 13:03:53 | 显示全部楼层
sixapple 发表于 2015-8-27 06:00
那个。。抱歉,我又发现了一个问题,实在是麻烦了。
调整队伍也出现了毛病,变换领队功能不好使 ...

关于状态和装备弄反了很抱歉。。当时脑子晕晕的。。
只需要吧def update_status里面的when 2和when 3换一下就好。。
至于更换领队,一样在def update_status里面,
when 6加一句刷新就可以了:

  1.         $game_system.se_play($data_system.decision_se)
  2.         if @checker == 0
  3.           @changer = $game_party.actors[@status_window.index]
  4.           @where = @status_window.index
  5.           @checker = 1
  6.         else
  7.           $game_party.actors[@where] = $game_party.actors[@status_window.index]
  8.           $game_party.actors[@status_window.index] = @changer
  9.           @checker = 0
  10.           @status_window.refresh
  11.           $game_player.refresh   # 刷新队伍
  12.         end
复制代码
PS:任务系统的Scene在原来的任务系统范例工程里不可能搜不到的。。
毕竟是他自己引用的东西。。(或者这个任务Scene是你自己加的?)
回复

使用道具 举报

梦石
0
星屑
219
在线时间
47 小时
注册时间
2009-7-5
回帖
55
 楼主| 发表于 2015-8-27 18:22:28 | 显示全部楼层
cinderelmini 发表于 2015-8-27 13:03
关于状态和装备弄反了很抱歉。。当时脑子晕晕的。。
只需要吧def update_status里面的when 2和when 3换一 ...

解决了!实在是太感谢了,帮了这么多忙,谢谢!
30岁了,也要继续创造梦想啊。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部