查看: 2715|回复: 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 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

class Scene_Save
  #--------------------------------------------------------------------------
  # ● 写入存档数据
  #     file : 写入用文件对像 (已经打开)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    # 生成描绘存档文件用的角色图形
    characters = []
    for i in 0...[$game_party.actors.size,4].min
      actor = $game_party.actors
      characters.push([actor.character_name, actor.character_hue])
    end
    # 写入描绘存档文件用的角色数据
    Marshal.dump(characters, file)
    # 写入测量游戏时间用画面计数
    Marshal.dump(Graphics.frame_count, file)
    # 增加 1 次存档次数
    $game_system.save_count += 1
    # 保存魔法编号
    # (将编辑器保存的值以随机值替换)
    $game_system.magic_number = $data_system.magic_number
    # 写入各种游戏对像
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 设置物品或特技对像方的战斗者
  #     scope : 特技或者是物品的范围
  #--------------------------------------------------------------------------
  def set_target_battlers(scope)
    # 行动方的战斗者是敌人的情况下
    if @active_battler.is_a?(Game_Enemy)
      # 效果范围分支
      case scope
      when 1  # 敌单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 2  # 敌全体
        for actor in 0...[$game_party.actors.size,4].min
          if $game_party.actors[actor].exist?
            @target_battlers.push($game_party.actors[actor])
          end
        end
      when 3  # 我方单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 4  # 我方全体
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      when 5  # 我方单体 (HP 0)
        index = @active_battler.current_action.target_index
        enemy = $game_troop.enemies[index]
        if enemy != nil and enemy.hp0?
          @target_battlers.push(enemy)
        end
      when 6  # 我方全体 (HP 0)
        for enemy in $game_troop.enemies
          if enemy != nil and enemy.hp0?
            @target_battlers.push(enemy)
          end
        end
      when 7  # 使用者
        @target_battlers.push(@active_battler)
      end
    end
    # 行动方的战斗者是角色的情况下
    if @active_battler.is_a?(Game_Actor)
      # 效果范围分支
      case scope
      when 1  # 敌单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 2  # 敌全体
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      when 3  # 我方单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 4  # 我方全体
        for actor in 0...[$game_party.actors.size,4].min
          if $game_party.actors[actor].exist?
            @target_battlers.push($game_party.actors[actor])
          end
        end
      when 5  # 我方单体 (HP 0)
        index = @active_battler.current_action.target_index
        actor = $game_party.actors[index]
        if actor != nil and actor.hp0?
          @target_battlers.push(actor)
        end
      when 6  # 我方全体 (HP 0)
        for actor in 0...[$game_party.actors.size,4].min
          if $game_party.actors[actor] != nil and $game_party.actors[actor].hp0?
            @target_battlers.push($game_party.actors[actor])
          end
        end
      when 7  # 使用者
        @target_battlers.push(@active_battler)
      end
    end
  end  
  #--------------------------------------------------------------------------
  # ● 生成行动循序
  #--------------------------------------------------------------------------
  def make_action_orders
    # 初始化序列 @action_battlers
    @action_battlers = []
    # 添加敌人到 @action_battlers 序列
    for enemy in $game_troop.enemies
      @action_battlers.push(enemy)
    end
    # 添加角色到 @action_battlers 序列
    for actor in 0...[$game_party.actors.size,4].min
      @action_battlers.push($game_party.actors[actor])
    end
    # 确定全体的行动速度
    for battler in @action_battlers
      battler.make_action_speed
    end
    # 按照行动速度从大到小排列
    @action_battlers.sort! {|a,b|
      b.current_action.speed - a.current_action.speed }
  end
  #--------------------------------------------------------------------------
  # ● 开始结束战斗回合
  #--------------------------------------------------------------------------
  def start_phase5
    # 转移到回合 5
    @phase = 5
        if $game_switches[79] == true
  $game_variables[100] += 1
  end
    # 演奏战斗结束 ME
    $game_system.me_play($game_system.battle_end_me)
    # 还原为战斗开始前的 BGM
    $game_system.bgm_play($game_temp.map_bgm)
    # 初始化 EXP、金钱、宝物
    exp = 0
    gold = 0
    treasures = []
    # 循环
    for enemy in $game_troop.enemies
      # 敌人不是隐藏状态的情况下
      unless enemy.hidden
        # 获得 EXP、增加金钱
        exp += enemy.exp
        gold += enemy.gold
        # 出现宝物判定
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # 限制宝物数为 6 个
    treasures = treasures[0..5]
    # 获得 EXP
    for i in 0...[$game_party.actors.size,4].min
      actor = $game_party.actors
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # 获得金钱
    $game_party.gain_gold(gold)
    # 获得宝物
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # 生成战斗结果窗口
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # 设置等待计数
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # ● 转到输入下一个角色的命令
  #--------------------------------------------------------------------------
  def phase3_next_actor
    # 循环
    begin
      # 角色的明灭效果 OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # 最后的角色的情况
      if @actor_index == [$game_party.actors.size-1,3].min
        # 开始主回合
        start_phase4
        return
      end
      # 推进角色索引
      @actor_index += 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
    # 如果角色是在无法接受指令的状态就再试
    end until @active_battler.inputable?
    # 设置角色的命令窗口
    phase3_setup_command_window
  end
end

class Arrow_Actor < Arrow_Base  
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
    # 光标右
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @index += 1
      @index %= [$game_party.actors.size,4].min
    end
    # 光标左
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @index += $game_party.actors.size - 1
      @index %= [$game_party.actors.size,4].min
    end
    # 设置活动块坐标
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
end

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

class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
   super(0, 0, 336, 480)
   self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
   self.z += 10
   @item_max = $game_party.actors.size
   @top_row = 0
   refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   for i in 0...$game_party.actors.size
     x = 4
     y = i * 112
     actor = $game_party.actors
     draw_actor_name(actor, x, y)
     draw_actor_class(actor, x + 144, y)
     draw_actor_level(actor, x + 8, y + 32)
     draw_actor_state(actor, x + 8, y + 64)
     draw_actor_hp(actor, x + 152, y + 32)
     draw_actor_sp(actor, x + 152, y + 64)
   end
end  
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect   
   # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
   if @index <= -2
     self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
   elsif @index == -1
     self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
   else
     tpy = @index * 112 - self.oy
     self.cursor_rect.set(0, tpy, self.width - 32, 96)
     if @index < @top_row
       @top_row = @index
       self.oy = @top_row *112
     end
     if @index > @top_row+3
       @top_row = @index-3
       self.oy = @top_row *112
     end
   end   
end
end
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
#  显示菜单画面和同伴状态的窗口。
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化目标
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 480, 480)
    self.contents = Bitmap.new(width - 32,  $game_party.actors.size*112)
    refresh
    @top_row = 0
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 112
      if i <=3
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x,y,340,32,"[出战]",2)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = Color.new(128,128,128,255)
        self.contents.draw_text(x,y,340,32,"[待机]",2)
        self.contents.font.color = normal_color
      end      
      actor = $game_party.actors
      draw_actor_graphic(actor, x - 40, y + 80)
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 32)
      draw_actor_state(actor, x + 90, y + 32)
      draw_actor_exp(actor, x, y + 64)
      draw_actor_hp(actor, x + 236, y + 32)
      draw_actor_sp(actor, x + 236, y + 64)
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新光标矩形
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      tpy = @index * 112 - self.oy
      self.cursor_rect.set(0, tpy, self.width - 32, 96)
      if @index < @top_row
        @top_row = @index
        self.oy = @top_row *112
      end
      if @index > @top_row+3
        @top_row = @index-3
        self.oy = @top_row *112
      end
    end
  end
end

class Game_Party
  #--------------------------------------------------------------------------
  # ● 全灭判定
  #--------------------------------------------------------------------------
  def all_dead?
    # 同伴人数为 0 的情况下
    if $game_party.actors.size == 0
      return false
    end
    # 同伴中无人 HP 在 0 以上
    for i in 0..3
      if @actors != nil and@actors.hp >0
        return false
      end
    end
    # 全灭
    return true
  end
  #--------------------------------------------------------------------------
  # ● 加入同伴
  #     actor_id : 角色 ID
  #--------------------------------------------------------------------------
  def add_actor(actor_id)
    # 获取角色
    actor = $game_actors[actor_id]
    # 同伴人数未满 4 人、本角色不在队伍中的情况下
    if not @actors.include?(actor)
      # 添加角色
      @actors.push(actor)
      # 还原主角
      $game_player.refresh
    end
  end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================


class Scene_Menu
# --------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @changer = 0
    @where = 0
    @checker = 0
  end
# --------------------------------
  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "状态"
    s5 = "储存进度"
    s6 = "离开游戏"
    s7 = "调整队伍"
    s8 = "升级加点"
    s9 = "剧情任务"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
    @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    if $game_party.actors.size == 1
      @command_window.disable_item(6)
    end
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 320
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @playtime_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
# --------------------------------
  def update
    @command_window.update
    @playtime_window.update
    @gold_window.update
    @status_window.update
    if @command_window.active
      update_command
      return
    end
    if @status_window.active
      update_status
      return
    end
  end
# --------------------------------
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if $game_party.actors.size == 1 and @command_window.index ==6
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4
        if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
      when 5
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
      when 6
        $game_system.se_play($data_system.decision_se)
        @checker = 0
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 7
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 8
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 9
        $scene = Scene_Mission.new
      end
      return
    end
  end
# --------------------------------
  def update_status
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 1
        if $game_party.actors[@status_window.index].restriction >= 2
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Skill.new(@status_window.index)
      when 2
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Equip.new(@status_window.index)
      when 3
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Status.new(@status_window.index)
      when 6
        $game_system.se_play($data_system.decision_se)
        if @checker == 0
          @changer = $game_party.actors[@status_window.index]
          @where = @status_window.index
          @checker = 1
        else
          $game_party.actors[@where] = $game_party.actors[@status_window.index]
          $game_party.actors[@status_window.index] = @changer
          @checker = 0
          @status_window.refresh
        end
      when 7
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Lvup.new(@status_window.index)
      when 8
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Charactor.new(@status_window.index)
      when 9
        $scene = Scene_Mission.new
      end
      return
    end
  end
end



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

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================


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

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

#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # 初始化方法
  #--------------------------------------------------------------------------
  alias initialize_walk initialize
  def initialize(x, y, width, height)
    initialize_walk(x, y, width, height)
    @start_walk = false
    @turn_index = 0
    @turn_phase = 0
  end
  #--------------------------------------------------------------------------
  # ★  角色行走图
  #     actor : 角色
  #     x     : 描绘的 X 坐标
  #     y     : 描绘的 Y 坐标
  #--------------------------------------------------------------------------
  def draw_walk_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bitmap.width / 4
    ch = bitmap.height / 4
    @start_turn = true
    case @turn_phase
    when 0
      x_x = 0
    when 1
      x_x = cw
    when 2
      x_x = cw * 2
    when 3
      x_x = cw * 3
    end
    src_rect = Rect.new(x_x, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
  #--------------------------------------------------------------------------
  # ★  角色转向图
  #     actor : 角色
  #     x     : 描绘的 X 坐标
  #     y     : 描绘的 Y 坐标
  #--------------------------------------------------------------------------
  def draw_turn_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bitmap.width / 4
    ch = bitmap.height / 4
    @start_turn = true
    case @turn_phase
    when 0
      x_x = 0
    when 1
      x_x = ch
    when 2
      x_x = ch * 3
    when 3
      x_x = ch * 2
    end
    src_rect = Rect.new(0, x_x, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
  #--------------------------------------------------------------------------
  #  更新(可别使用刷新,玩命耗费内存= =)
  #--------------------------------------------------------------------------
  alias walk_update update
  def update
    walk_update
    if @start_turn == true
      @turn_index += 1
      if @turn_index == WALK_REFRESH_FRAME_SPEED
        refresh
        @turn_index = 0
        @turn_phase = (@turn_phase+1)%4
      end
    end
  end  
end

#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # 把原有静态图改为动态走步图
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    draw_walk_actor_graphic(actor, x, y)
  end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================


# 脚本使用设定:

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

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

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

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

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

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

#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  一般的命令选择行窗口。(追加定义)
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 项目有效化
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def able_item(index)
    draw_item(index, normal_color)
  end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。(再定义)
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 更改 EXP
  #     exp : 新的 EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # 升级
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # 增加4点可自由分配的点数
      $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
      # 学会特技
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # 降级
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # 修正当前的 HP 与 SP 超过最大值
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类(追加定义)
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 描绘 HP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_hp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.hp)
    if $temp_hp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
    else
      maxhp = actor.maxhp + $temp_hp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_hp >=0
        self.contents.font.color = Color.new(255, 128, 128, 255)
        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
      else
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
      end
      self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘 SP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_sp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
    if $temp_sp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
    else
      maxsp = actor.maxsp + $temp_sp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_sp >=0
        self.contents.font.color = Color.new(255, 128, 128, 255)
        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
      else
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
      end
      self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘能力值
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     type  : 能力值种类 (0~4)
  #--------------------------------------------------------------------------
  def draw_actor_lvup(actor, x, y, type)   
    # 定义数字颜色
    lvup = normal_color
    upcolor = Color.new(255, 128, 128, 255)
    self.contents.font.color = normal_color   
    case type
    when 0
      parameter_name = $data_system.words.str
      parameter_value = actor.str
      parameter_value_temp = parameter_value + $temp_str
      if $temp_str != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_str >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 1
      parameter_name = $data_system.words.dex
      parameter_value = actor.dex
      parameter_value_temp = parameter_value + $temp_dex
      if $temp_dex != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_dex >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 2
      parameter_name = $data_system.words.agi
      parameter_value = actor.agi
      parameter_value_temp = parameter_value + $temp_agi
      if $temp_agi != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_agi >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 3
      parameter_name = $data_system.words.int
      parameter_value = actor.int
      parameter_value_temp = parameter_value + $temp_int
      if $temp_int != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_int >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 4
      parameter_name = "剩余点数"
      parameter_value = $point
      if $point != 0
        lvup = upcolor
      end
    end   
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, 32, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
    if type != 4
      self.contents.draw_text(x + 150, y, 36, 32, "→")
    end  
    self.contents.font.color = lvup
    self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
    self.contents.font.color = normal_color        
  end
end
#==============================================================================
# ■ Window_lvup
#------------------------------------------------------------------------------
#  显示升级状态窗口。
#==============================================================================
class Window_Lvup < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor : 角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 512, 320)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_graphic(@actor, 40, 112)
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 4 + 144, 0)
    draw_actor_level(@actor, 96, 32)
    draw_actor_state(@actor, 96, 64)   
    draw_actor_hp_lvup(@actor, 96+128, 32)
    draw_actor_sp_lvup(@actor, 96+128, 64)
    draw_actor_lvup(@actor, 96, 128, 0)
    draw_actor_lvup(@actor, 96, 160, 1)
    draw_actor_lvup(@actor, 96, 192, 2)
    draw_actor_lvup(@actor, 96, 224, 3)
    draw_actor_lvup(@actor, 96, 256, 4)
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_Lvup_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @test = "" #——这个东西用来检测,节约内存专用
  end  
  #--------------------------------------------------------------------------
  # ● 设置文本
  #--------------------------------------------------------------------------
  def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
    if @test != text1
      @test = text1
    else
      return
    end   
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, self.width - 40, 32, text1)
    if text2 != nil
      self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
    end
    self.contents.font.size -= 4
    if text3 != nil
      self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
    end
    if text4 != nil
      self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
    end
    self.contents.font.size += 4
  end
end
#==============================================================================
# ■ Scene_lvup
#------------------------------------------------------------------------------
#  处理升级画面的类。
#==============================================================================
class Scene_Lvup
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor_index : 角色索引
  #     menu_index : 选项起始位置
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0 , menu_index = 0)
    @actor_index = actor_index
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    s1 = "增加体力 HP SP"
    s2 = "增加"+$data_system.words.str
    s3 = "增加"+$data_system.words.dex
    s4 = "增加"+$data_system.words.agi
    s5 = "增加"+$data_system.words.int
    s6 = "确认加点"
    s7 = "点数重置"
    @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # 获取角色
    @actor = $game_party.actors[@actor_index]
    # 将角色的剩余点数带入
    $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
    # 初始化临时量
    $temp_str = 0
    $temp_dex = 0
    $temp_agi = 0
    $temp_int = 0
    $temp_hp = 0
    $temp_sp = 0
    #=========================================================================
    # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
    #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
    #=========================================================================
    # 每提升一次力量,提升多少附加能力
    #=========================================================================
    @str_hp = 5     # 每提升一次力量附加提升多少HP
    @str_sp = 0     # 每提升一次力量附加提升多少SP
    @str_dex = 1    # 每提升一次力量附加提升多少灵巧
    @str_agi = 1    # 每提升一次力量附加提升多少速度
    @str_int = 0    # 每提升一次力量附加提升多少魔力
    @str_str = 3    # 每提升一次力量附加提升多少力量
    #=========================================================================
    # 每提升一次灵巧,提升多少附加能力
    #=========================================================================
    @dex_hp = 2     # 每提升一次灵巧附加提升多少HP
    @dex_sp = 3     # 每提升一次灵巧附加提升多少SP
    @dex_str = 1    # 每提升一次灵巧附加提升多少力量
    @dex_agi = 1    # 每提升一次灵巧附加提升多少速度
    @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
    @dex_dex = 3    # 每提升一次灵巧附加提升多少灵巧
    #=========================================================================
    # 每提升一次速度,提升多少附加能力
    #=========================================================================
    @agi_hp = 0     # 每提升一次速度附加提升多少HP
    @agi_sp = 0     # 每提升一次速度附加提升多少SP
    @agi_str = 0    # 每提升一次速度附加提升多少力量
    @agi_dex = 1    # 每提升一次速度附加提升多少灵巧
    @agi_int = 0    # 每提升一次速度附加提升多少魔力
    @agi_agi = 3    # 每提升一次速度附加提升多少速度
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @int_hp = 1     # 每提升一次魔力附加提升多少HP
    @int_sp = 15    # 每提升一次魔力附加提升多少SP
    @int_str = -1   # 每提升一次魔力附加提升多少力量
    @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
    @int_agi = 0   # 每提升一次魔力附加提升多少速度
    @int_int = 7   # 每提升一次魔力附加提升多少魔力
    #=========================================================================
    # 每提升一次体力,提升多少附加能力
    #=========================================================================
    @hp = 20       # 每提升一次体力提升多少HP
    @sp = 10       # 每提升一次体力提升多少SP
    @hp_str = 0   # 每提升一次体力提升多少力量
    @hp_dex = 0   # 每提升一次体力提升多少速度
    @hp_agi = 0   # 每提升一次体力提升多少灵巧
    @hp_int = -1   # 每提升一次体力提升多少魔力   
    # 定义说明文字
    @text_hp_sc = "体力可以增加生存的能力,增加HP与SP的最大上限!"
    @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
    @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和防御系数!"
    @text_agi_sc = $data_system.words.agi + "可以提高行动速度、逃跑成功率!"
    @text_int_sc = $data_system.words.int + "可以提高魔法攻击的效果!"
    @text_save = "保存分配情况并返回游戏"
    @text_reset= "重新分配能力点数"
    @text_2 = "每增加一次此项能力值,可以提升能力值"
    @text_hp = "最大" + $data_system.words.hp + "值"
    @text_sp = "最大" + $data_system.words.sp + "值"
    @text_str = "最大" + $data_system.words.str + "值"
    @text_dex = "最大" + $data_system.words.dex + "值"
    @text_agi = "最大" + $data_system.words.agi + "值"
    @text_int = "最大" + $data_system.words.int + "值"
    s_disable
    # 生成状态窗口
    @lvup_window = Window_Lvup.new(@actor)
    @lvup_window.x = 128
    @lvup_window.y = 0   
    # 生成帮助窗口并初始化帮助文本
    @help_window = Window_Lvup_Help.new   
    # 执行过渡
    Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果切换画面就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @command_window.dispose
    @lvup_window.dispose
    @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @command_window.update
    # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
    s_disable
    @lvup_window.update
    #=============================================================
    # 按下 B 键的情况下
    #=============================================================
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到地图画面
      $scene = Scene_Menu.new
      return
    end
    #=============================================================
    # 按下 C 键的情况下
    #=============================================================
    if Input.trigger?(Input::C)      
      if @command_window.index == 5
          # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 将角色的剩余点数带回
        $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
        # 将角色点数实际加上
        @actor.str += $temp_str
        @actor.dex += $temp_dex
        @actor.agi += $temp_agi
        @actor.int += $temp_int
        @actor.maxhp += $temp_hp
        @actor.maxsp += $temp_sp
        # 切换到地图画面
        $scene = Scene_Menu.new
        return
      end
      if @command_window.index == 6
          # 演奏确定 SE
        $game_system.se_play($data_system.cancel_se)
          # 将角色的剩余点数带入
        $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
          # 初始化临时量
        $temp_str = 0
        $temp_dex = 0
        $temp_agi = 0
        $temp_int = 0
        $temp_hp = 0
        $temp_sp = 0
        @lvup_window.refresh
        return
      end
      if $point == 0
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_hp += @hp
        $temp_sp += @sp
        $temp_str += @hp_str
        $temp_dex += @hp_dex
        $temp_agi += @hp_agi
        $temp_int += @hp_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 1
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_str += @str_str
        $temp_hp += @str_hp
        $temp_sp += @str_sp
        $temp_dex += @str_dex
        $temp_agi += @str_agi
        $temp_int += @str_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 2
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_dex += @dex_dex
        $temp_hp += @dex_hp
        $temp_sp += @dex_sp
        $temp_str += @dex_str
        $temp_agi += @dex_agi
        $temp_int += @dex_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 3
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_agi += @agi_agi
        $temp_hp += @agi_hp
        $temp_sp += @agi_sp
        $temp_str += @agi_str
        $temp_dex += @agi_dex
        $temp_int += @agi_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 4
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_int += @int_int
        $temp_hp += @int_hp
        $temp_sp += @int_sp
        $temp_str += @int_str
        $temp_dex += @int_dex
        $temp_agi += @int_agi
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      end
    end
    #=============================================================
    # 什么都没有按下的情况
    #=============================================================
    case @command_window.index   
    when 0  # 增加体力
      temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
      temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
      @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
    when 1  # 增加力量
      temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
      temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
      @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
    when 2  # 增加灵巧
      temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
      temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
      @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
    when 3  # 增加速度
      temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
      temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
      @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
    when 4  # 增加魔力
      temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
      temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
      @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
    when 5 # 保存设定
      @help_window.lvup_text(@text_save)
    when 6 # 点数重置
      @help_window.lvup_text(@text_reset)     
    end
    #=============================================================
    # 按下R与L换人的情况
    #=============================================================      
    if Input.trigger?(Input::R)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)
      # 移至下一位角色
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
    # 按下 L 键的情况下
    if Input.trigger?(Input::L)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)
      # 移至上一位角色
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
  end  
  #--------------------------------------------------------------------------
  # ● 选项明暗判断
  #--------------------------------------------------------------------------
  def s_disable
    # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
    if $point == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    else
      @command_window.able_item(0)
      @command_window.able_item(1)      
      @command_window.able_item(2)
      @command_window.able_item(3)
      @command_window.able_item(4)
    end
  end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

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

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

使用道具 举报

梦石
0
星屑
9716
在线时间
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
星屑
9716
在线时间
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.

在本版发帖返回顶部