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

Project1

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

[已经解决] 战斗换人脚本,如何让不出战的角色也获得经验?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1435 小时
注册时间
2009-7-27
帖子
1452
跳转到指定楼层
1
发表于 2012-1-10 17:50:23 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式
就是说,在队伍的4个人,不管有没有出战都会获得经验和显示升级提示。但是不在队伍的角色不算。请高手帮帮忙。
  1. module LimBattlePlug

  2. # 队伍最大人数
  3. MaxPartySize = 4

  4. # 出战人数
  5. MaxBattlerSize = 1

  6. # 换人语句
  7. WordChangeBattler = "换人"

  8. # 换人时播放的动画
  9. AnimationChangeBattler = 0

  10. end

  11. class Game_BattleAction
  12.   attr_accessor :change_to_battler
  13.   # 初始化
  14.   alias lbp_initialize initialize
  15.   def initialize
  16.     lbp_initialize
  17.     @change_to_battler = 0
  18.   end
  19.   # 欲更换角色编号
  20.   def set_change_battler
  21.     @kind = 3
  22.   end
  23.   # 判断行动是否为更换角色
  24.   def is_change_battler?
  25.     return (@kind == 3)
  26.   end
  27. end

  28. class Game_Party
  29.   include LimBattlePlug
  30.   attr_reader :actors2
  31.   alias lpb_initialize initialize
  32.   def initialize
  33.     lpb_initialize
  34.     @actors2 = []
  35.   end
  36.   # 角色加入
  37.   def add_actor(actor_id)
  38.     actor = $game_actors[actor_id]
  39.     if @actors.size < MaxPartySize and not @actors.include?(actor)
  40.       @actors.push(actor)
  41.       $game_player.refresh
  42.     end
  43.   end
  44.   # 设置战斗的角色
  45.   def set_actor_to_battle
  46.     @actors2 = []
  47.     @actors.each do |actor|
  48.       @actors2.push(actor)
  49.     end
  50.     @actors = []
  51.     @actors2.each do |actor|
  52.       @actors.push(actor)
  53.       break if @actors.size == MaxBattlerSize
  54.     end
  55.   end
  56.   # 还原战斗的角色
  57.   def set_actor_to_normal
  58.     @actors = []
  59.     @actors2.each do |actor|
  60.       @actors.push(actor)
  61.     end
  62.   end
  63.   # 获取角色id数组
  64.   def get_actors_id
  65.     id = []
  66.     @actors.each{|actor|id.push(actor.id)}
  67.     return id
  68.   end
  69.   # 获取角色id数组
  70.   def get_actors2_id
  71.     id = []
  72.     @actors2.each{|actor|id.push(actor.id)}
  73.     return id
  74.   end
  75.   # 兑换角色
  76.   def change_actor(index,id)
  77.     @actors[index] = $game_actors[id]
  78.   end
  79.   # 全灭判定
  80.   def all_dead?
  81.     # 同伴人数为 0 的情况下
  82.     if $game_party.actors.size == 0
  83.       return false
  84.     end
  85.     # 同伴中无人 HP 在 0 以上
  86.     for actor in @actors2
  87.       if actor.hp > 0
  88.         return false
  89.       end
  90.     end
  91.     for actor in @actors
  92.       if actor.hp > 0
  93.         return false
  94.       end
  95.     end
  96.     # 全灭
  97.     return true
  98.   end
  99.   # 其他角色
  100.   def other_actors
  101.     actors = []
  102.     @actors2.each{|actor|actors.push(actor) if [email protected]?(actor)}
  103.     return actors
  104.   end
  105.   # 角色位置互换
  106.   def change_actor_pos(id1,id2)
  107.     actor_id = []
  108.     @actors.each do |actor|
  109.       actor_id.push(actor.id)
  110.     end
  111.     return if !actor_id.include?(id1) and !actor_id.include?(id2)
  112.     id1_index = id2_index = -1
  113.     (0...actor_id.size).each do |i|
  114.       if actor_id[i] == id1
  115.         id1_index = i
  116.       elsif actor_id[i] == id2
  117.         id2_index = i
  118.       end
  119.     end
  120.     temp_actor = @actors[id1_index]
  121.     @actors[id1_index] = @actors[id2_index]
  122.     @actors[id2_index] = temp_actor
  123.   end
  124. end

  125. class Window_Actor < Window_Selectable
  126.   # 初始化
  127.   def initialize
  128.     super(0,64,640,256)
  129.     self.back_opacity = 160
  130.     refresh
  131.     self.index = -1
  132.     self.active = false
  133.   end
  134.   # 刷新
  135.   def refresh
  136.     @item_max = $game_party.actors2.size
  137.     @data = []
  138.     $game_party.actors.each do |actor|
  139.       @data.push(actor)
  140.     end
  141.     $game_party.actors2.each do |actor|
  142.       @data.push(actor) if [email protected]?(actor)
  143.     end
  144.     if self.contents != nil
  145.       self.contents.clear
  146.       self.contents = nil
  147.     end
  148.     self.contents = Bitmap.new(608,@data.size*32)
  149.     x = 4
  150.     y = 0
  151.   @data.each do |actor|
  152.       bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
  153.       rect = Rect.new(0,0,bitmap.width/4,31)
  154.       self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
  155.       draw_actor_name(actor,x+36,y)
  156.       draw_actor_state(actor,156,y)
  157.       draw_actor_hp(actor,x+256,y,96)
  158.       draw_actor_sp(actor,x+376,y,96)
  159.       if $game_party.actors.include?(actor)
  160.         self.contents.font.color = text_color(6)
  161.         cword = "出战"
  162.       else
  163.         self.contents.font.color = text_color(0)
  164.         cword = "待战"
  165.       end
  166.       self.contents.draw_text(x+496,y,60,32,cword)
  167.       y += 32
  168.     end
  169.   end
  170.   # 获取当前角色编号
  171.   def actor_id
  172.     return @data[self.index].id
  173.   end
  174.   # 刷新帮助
  175.   def update_help
  176.     @help_window.set_text(@data[self.index] == nil ?\
  177.                           "" : @data[self.index].name)
  178.   end
  179. end

  180. class Scene_Battle
  181.   include LimBattlePlug
  182.   # 初始化
  183.   def initialize
  184.     $game_party.set_actor_to_battle
  185.   end
  186.   # 主处理
  187.   def main
  188.     # 初始化战斗用的各种暂时数据
  189.     $game_temp.in_battle = true
  190.     $game_temp.battle_turn = 0
  191.     $game_temp.battle_event_flags.clear
  192.     $game_temp.battle_abort = false
  193.     $game_temp.battle_main_phase = false
  194.     $game_temp.battleback_name = $game_map.battleback_name
  195.     $game_temp.forcing_battler = nil
  196.     # 初始化战斗用事件解释器
  197.     $game_system.battle_interpreter.setup(nil, 0)
  198.     # 准备队伍
  199.     @troop_id = $game_temp.battle_troop_id
  200.     $game_troop.setup(@troop_id)
  201.     # 生成角色命令窗口
  202.     s1 = $data_system.words.attack
  203.     s2 = $data_system.words.skill
  204.     s3 = $data_system.words.guard
  205.     s4 = $data_system.words.item
  206.     s5 = WordChangeBattler
  207.     @actor_command_window = Window_Command.new(85, [s1, s2, s3, s4,s5])
  208.     @actor_command_window.y = 128
  209.     @actor_command_window.back_opacity = 160
  210.     @actor_command_window.active = false
  211.     @actor_command_window.visible = false
  212.     # 生成其它窗口
  213.     @party_command_window = Window_PartyCommand.new
  214.     @help_window = Window_Help.new
  215.     @help_window.back_opacity = 160
  216.     @help_window.visible = false
  217.     @status_window = Window_BattleStatus.new
  218.     @message_window = Window_Message.new
  219.     # 生成活动块
  220.     @spriteset = Spriteset_Battle.new
  221.     # 初始化等待计数
  222.     @wait_count = 0
  223.     # 执行过渡
  224.     if $data_system.battle_transition == ""
  225.       Graphics.transition(20)
  226.     else
  227.       Graphics.transition(40, "Graphics/Transitions/" +
  228.         $data_system.battle_transition)
  229.     end
  230.     # 开始自由战斗回合
  231.     start_phase1
  232.     # 主循环
  233.     loop do
  234.       # 刷新游戏画面
  235.       Graphics.update
  236.       # 刷新输入信息
  237.       Input.update
  238.       # 刷新画面
  239.       update
  240.       # 如果画面切换的话就中断循环
  241.       if $scene != self
  242.         break
  243.       end
  244.     end
  245.     # 刷新地图
  246.     $game_map.refresh
  247.     # 准备过渡
  248.     Graphics.freeze
  249.     # 释放窗口
  250.     @actor_command_window.dispose
  251.     @party_command_window.dispose
  252.     @help_window.dispose
  253.     @status_window.dispose
  254.     @message_window.dispose
  255.     if @skill_window != nil
  256.       @skill_window.dispose
  257.     end
  258.     if @item_window != nil
  259.       @item_window.dispose
  260.     end
  261.     if @actor_window != nil
  262.       @actor_window.dispose
  263.     end
  264.     if @result_window != nil
  265.       @result_window.dispose
  266.     end
  267.     # 释放活动块
  268.     @spriteset.dispose
  269.     # 标题画面切换中的情况
  270.     if $scene.is_a?(Scene_Title)
  271.       # 淡入淡出画面
  272.       Graphics.transition
  273.       Graphics.freeze
  274.     end
  275.     # 战斗测试或者游戏结束以外的画面切换中的情况
  276.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  277.       $scene = nil
  278.     end
  279.   end
  280.   # 战斗结束
  281.   alias lpb_battle_end battle_end
  282.   def battle_end(n)
  283.     lpb_battle_end(n)
  284.     $game_party.set_actor_to_normal
  285.   end
  286.   # 开始回合3
  287.   alias lbp_start_phase3 start_phase3
  288.   def start_phase3
  289.     @changed_battler_id = []
  290.     lbp_start_phase3
  291.   end
  292.   # 刷新角色命令回合画面
  293.   def update_phase3
  294.     # 敌人光标有效的情况下
  295.     if @enemy_arrow != nil
  296.       update_phase3_enemy_select
  297.     # 角色光标有效的情况下
  298.     elsif @actor_arrow != nil
  299.       update_phase3_actor_select
  300.     # 特技窗口有效的情况下
  301.     elsif @skill_window != nil
  302.       update_phase3_skill_select
  303.     # 物品窗口有效的情况下
  304.     elsif @item_window != nil
  305.       update_phase3_item_select
  306.     elsif @actor_window != nil
  307.       update_phase3_battler_select
  308.     # 角色指令窗口有效的情况下
  309.     elsif @actor_command_window.active
  310.       update_phase3_basic_command
  311.     end
  312.   end
  313.   # 角色基本命令
  314.   def update_phase3_basic_command
  315.     # 按下 B 键的情况下
  316.     if Input.trigger?(Input::B)
  317.       # 演奏取消 SE
  318.       $game_system.se_play($data_system.cancel_se)
  319.       # 转向前一个角色的指令输入
  320.       phase3_prior_actor
  321.       return
  322.     end
  323.     # 按下 C 键的情况下
  324.     if Input.trigger?(Input::C)
  325.       # 角色指令窗口光标位置分之
  326.       case @actor_command_window.index
  327.       when 0  # 攻击
  328.         # 演奏确定 SE
  329.         $game_system.se_play($data_system.decision_se)
  330.         # 设置行动
  331.         @active_battler.current_action.kind = 0
  332.         @active_battler.current_action.basic = 0
  333.         # 开始选择敌人
  334.         start_enemy_select
  335.       when 1  # 特技
  336.         # 演奏确定 SE
  337.         $game_system.se_play($data_system.decision_se)
  338.         # 设置行动
  339.         @active_battler.current_action.kind = 1
  340.         # 开始选择特技
  341.         start_skill_select
  342.       when 2  # 防御
  343.         # 演奏确定 SE
  344.         $game_system.se_play($data_system.decision_se)
  345.         # 设置行动
  346.         @active_battler.current_action.kind = 0
  347.         @active_battler.current_action.basic = 1
  348.         # 转向下一位角色的指令输入
  349.         phase3_next_actor
  350.       when 3  # 物品
  351.         # 演奏确定 SE
  352.         $game_system.se_play($data_system.decision_se)
  353.         # 设置行动
  354.         @active_battler.current_action.kind = 2
  355.         # 开始选择物品
  356.         start_item_select
  357.       when 4 # 换人
  358.         $game_system.se_play($data_system.decision_se)
  359.         @active_battler.current_action.set_change_battler
  360.         start_battler_select
  361.       end
  362.       return
  363.     end
  364.   end
  365.   # 开始角色选择
  366.   def start_battler_select
  367.     @actor_window = Window_Actor.new
  368.     @actor_window.active = true
  369.     @actor_window.index = 0
  370.     @actor_window.help_window = @help_window
  371.     @actor_command_window.active = false
  372.     @actor_command_window.visible = false
  373.   end
  374.   # 结束角色选择
  375.   def end_battler_select
  376.     @actor_window.dispose
  377.     @actor_window = nil
  378.     @help_window.visible = false
  379.     @actor_command_window.active = true
  380.     @actor_command_window.visible = true
  381.   end
  382.   # 刷新角色选择
  383.   def update_phase3_battler_select
  384.     @actor_window.visible = true
  385.     @actor_window.update
  386.     if Input.trigger?(Input::B)
  387.       $game_system.se_play($data_system.cancel_se)
  388.       end_battler_select
  389.       return
  390.     end
  391.     if Input.trigger?(Input::C)
  392.       actor_id = @actor_window.actor_id
  393.       if $game_party.get_actors_id.include?(actor_id) or
  394.          $game_actors[actor_id].dead? or
  395.          @changed_battler_id.include?(actor_id)
  396.         $game_system.se_play($data_system.buzzer_se)
  397.         return
  398.       end
  399.       $game_system.se_play($data_system.decision_se)
  400.       @active_battler.current_action.change_to_battler = actor_id
  401.       @changed_battler_id.push(actor_id)
  402.       end_battler_select
  403.       phase3_next_actor
  404.       return
  405.     end
  406.   end
  407.   # 行动方动画
  408.   def update_phase4_step3
  409.     if @active_battler.current_action.is_change_battler?
  410.       @animation1_id = AnimationChangeBattler
  411.       @target_battlers = []
  412.     end
  413.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  414.     if @animation1_id == 0
  415.       @active_battler.white_flash = true
  416.     else
  417.       @active_battler.animation_id = @animation1_id
  418.       @active_battler.animation_hit = true
  419.     end
  420.     # 移至步骤 4
  421.     @phase4_step = 4
  422.   end
  423.   # 对象方动画
  424.   def update_phase4_step4
  425.     if @active_battler.current_action.is_change_battler?
  426.       actor1_id = @active_battler.current_action.change_to_battler
  427.       actor2_id = @active_battler.id
  428.       (0...$game_party.actors.size).each do |i|
  429.         if $game_party.actors[i].id == actor2_id
  430.           $game_party.change_actor(i,actor1_id)
  431.           @active_battler = $game_actors[actor1_id]
  432.           @status_window.refresh
  433.         end
  434.       end
  435.     end
  436.     # 对像方动画
  437.     for target in @target_battlers
  438.       target.animation_id = @animation2_id
  439.       target.animation_hit = (target.damage != "Miss")
  440.     end
  441.     # 限制动画长度、最低 8 帧
  442.     @wait_count = 8
  443.     # 移至步骤 5
  444.     @phase4_step = 5
  445.   end
  446.   # 公共事件
  447.   def update_phase4_step6
  448.     @target_battlers.each do |target|
  449.       if target.is_a?(Game_Actor) and target.dead? and
  450.          !$game_party.other_actors.all?{|actor|actor.dead?}
  451.         @actor_window = Window_Actor.new
  452.         @actor_window.index = 0
  453.         @actor_window.active = true
  454.         @actor_window.help_window = @help_window
  455.         actor_id = -1
  456.         loop do
  457.           Graphics.update
  458.           Input.update
  459.           @actor_window.update
  460.           if Input.trigger?(Input::C)
  461.             actor = $game_actors[@actor_window.actor_id]
  462.             if actor.dead? or
  463.                (@changed_battler_id.include?(actor.id) and
  464.                 target.current_action.change_to_battler != actor.id) or
  465.                $game_party.actors.include?(actor)
  466.               $game_system.se_play($data_system.buzzer_se)
  467.             else
  468.               actor_id = actor.id
  469.             end
  470.           end
  471.           break if actor_id >= 0
  472.         end
  473.         @actor_window.visible = false
  474.         @actor_window.dispose
  475.         @actor_window = nil
  476.         @help_window.visible = false
  477.         (0...$game_party.actors.size).each do |i|
  478.           if $game_party.actors[i].id == target.id
  479.             $game_party.change_actor(i,actor_id)
  480.             @status_window.refresh
  481.           end
  482.         end
  483.       end
  484.     end
  485.     # 清除强制行动对像的战斗者
  486.     $game_temp.forcing_battler = nil
  487.     # 公共事件 ID 有效的情况下
  488.     if @common_event_id > 0
  489.       # 设置事件
  490.       common_event = $data_common_events[@common_event_id]
  491.       $game_system.battle_interpreter.setup(common_event.list, 0)
  492.     end
  493.     # 移至步骤 1
  494.     @phase4_step = 1
  495.   end
  496.   end
复制代码

博客:我的博客

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1435 小时
注册时间
2009-7-27
帖子
1452
7
 楼主| 发表于 2012-1-11 14:02:33 | 只看该作者
赤夜玄魔 发表于 2012-1-11 03:35
我晕……
把这个292行的脚本改成
只剩下至于名字压着字

之后,请转至另外一个问题了,有某个愚者制作游戏必须的脚本,跟你修改过的升级提示有冲突。请转至:http://rpg.blue/forum.php?mod=vi ... d=219196&extra=

博客:我的博客
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
28 小时
注册时间
2011-1-14
帖子
262
6
发表于 2012-1-11 03:35:10 | 只看该作者
爆焰 发表于 2012-1-11 02:29
谢谢,还剩下一个问题就是这个,如何修改位置至中间?我修改了super(0, 150, 160, 192)却没效果。
第一个 ...

我晕……
把这个292行的脚本

  1.           if @exp_gain_actor < $game_party.actors.size
  2.           @levelup_window.x = 160 * @exp_gain_actor
  3.          @levelup_window.y = 150
  4.           else
  5.          @levelup_window.x = 240
  6.           @levelup_window.y = 128
  7.          end
复制代码
改成
只剩下

  1. @levelup_window.x = 240
  2. @levelup_window.y = 128
  3. #就全部在中间了
复制代码
至于名字压着字
28行

  1. self.contents.draw_text( 0, 0, 160, 24, actor.name+" "+"等级上升")
复制代码
actor.name 指的是角色名称
" "+"等级上升" 空格+等级上升 的文字

这地方是排版问题,LZ应该能自己解决吧。
话说,熟人变少了,还是马甲变多了?
我将乘风而去,万丈深渊。新生命阻止我的冲动……好吧,我再活一年,但是……这是最后的一年……
……强烈支持国产游戏……

遵冥冥之意,然果有奇效!
我好像玩够了,该走了……

强烈反对国产脑残动画片在电视台播出……
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1435 小时
注册时间
2009-7-27
帖子
1452
5
 楼主| 发表于 2012-1-11 02:29:47 | 只看该作者
赤夜玄魔 发表于 2012-1-11 00:49
哦不好意思,应该是我的P没删……
258 的这句删了

谢谢,还剩下一个问题就是这个,如何修改位置至中间?我修改了super(0, 150, 160, 192)却没效果。
第一个人人物会这样,其他的都在中间,这是怎么改的?

博客:我的博客
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
28 小时
注册时间
2011-1-14
帖子
262
4
发表于 2012-1-11 00:49:31 | 只看该作者
本帖最后由 赤夜玄魔 于 2012-1-11 00:53 编辑
爆焰 发表于 2012-1-11 00:37
每次打完就出现这个,这是怎么回事?


哦不好意思,应该是我的P没删……
258 的这句
  1. p $game_party.actors2.size
复制代码
删了

解决这个问题的工程,小问题而已……相信LZ应该会吧…… 战斗换人+队伍内角色不参战也获得经验.rar (196.71 KB, 下载次数: 11)

话说,熟人变少了,还是马甲变多了?
我将乘风而去,万丈深渊。新生命阻止我的冲动……好吧,我再活一年,但是……这是最后的一年……
……强烈支持国产游戏……

遵冥冥之意,然果有奇效!
我好像玩够了,该走了……

强烈反对国产脑残动画片在电视台播出……
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1435 小时
注册时间
2009-7-27
帖子
1452
3
 楼主| 发表于 2012-1-11 00:37:22 | 只看该作者
赤夜玄魔 发表于 2012-1-10 20:13
我晕……你早说是挂在这个脚本上嘛……
这是lim写的战斗换人脚本的原版吧?
我帮你整合一下……

每次打完就出现这个,这是怎么回事?

博客:我的博客
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
28 小时
注册时间
2011-1-14
帖子
262
2
发表于 2012-1-10 20:13:06 | 只看该作者
本帖最后由 赤夜玄魔 于 2012-1-11 00:53 编辑

工程出错,请转到下两楼看……

我晕……你早说是挂在这个脚本上嘛……
这是lim写的战斗换人脚本的原版吧?
我帮你整合一下……

奇怪啊,都不用再整了啊,你把这个换人脚本放在我帮你整合的升级提示后面就可以了啊,在队伍的人都能获得经验,而且好好的啊,没出错啊!

重新给你一个整合了这个战斗换人的升级提示,并且,在队伍的人都能获得经验……
另外之前给你的那个没整合这个脚本,用起来还需要开来开去,这个脚本就不用了……
放在换人脚本的前后应该都可以。
  1. $data_system_level_up_se = "" #升级时的音效设置
  2. $data_system_level_up_me = "Audio/ME/011-Item02" # 升级时播放的ME
  3. $data_system_skilllearn_se = "Audio/SE/106-Heal02" # 学会特技时播放的声效。

  4. #=============================================================
  5. # ■ Window_LevelUpWindow
  6. #-------------------------------------------------------------------
  7. #  バトル終了時、レベルアップした場合にステータスを表示するウィンドウです。
  8. #=============================================================
  9. class Window_LevelUpWindow < Window_Base
  10.   #---------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #------------------------------------------------------
  13.   def initialize(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
  14.     super(0, 150, 160, 192)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.visible = false
  17.     self.back_opacity = 160
  18.     refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
  19.   end
  20.   #-----------------------------------------------------------
  21.   # ● リフレッシュ
  22.   #---------------------------------------------------------
  23.   def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
  24.     self.contents.clear
  25.     self.contents.font.color = system_color
  26.     self.contents.font.size = 14
  27.     self.contents.draw_text( 0, 0, 160, 24, actor.name+" "+"等级上升")
  28.     self.contents.font.size = 18
  29.     self.contents.draw_text( 0, 28, 160, 24, $data_system.words.hp)
  30.     self.contents.draw_text( 0, 50, 160, 24, $data_system.words.sp)
  31.     self.contents.font.size = 14
  32.     self.contents.draw_text( 0, 72, 80, 24, $data_system.words.str)
  33.     self.contents.draw_text( 0, 94, 80, 24, $data_system.words.dex)
  34.     self.contents.draw_text( 0, 116, 80, 24, $data_system.words.agi)
  35.     self.contents.draw_text( 0, 138, 80, 24, $data_system.words.int)
  36.     self.contents.draw_text(92, 0, 128, 24, "→")
  37.     self.contents.draw_text(76, 28, 128, 24, "=")
  38.     self.contents.draw_text(76, 50, 128, 24, "=")
  39.     self.contents.draw_text(76, 72, 128, 24, "=")
  40.     self.contents.draw_text(76, 94, 128, 24, "=")
  41.     self.contents.draw_text(76, 116, 128, 24, "=")
  42.     self.contents.draw_text(76, 138, 128, 24, "=")
  43.     self.contents.font.color = normal_color
  44.     self.contents.draw_text( 0, 0, 88, 24, last_lv.to_s, 2)
  45.     self.contents.draw_text( 0, 28, 72, 24, "+" + up_hp.to_s, 2)
  46.     self.contents.draw_text( 0, 50, 72, 24, "+" + up_sp.to_s, 2)
  47.     self.contents.draw_text( 0, 72, 72, 24, "+" + up_str.to_s, 2)
  48.     self.contents.draw_text( 0, 94, 72, 24, "+" + up_dex.to_s, 2)
  49.     self.contents.draw_text( 0, 116, 72, 24, "+" + up_agi.to_s, 2)
  50.     self.contents.draw_text( 0, 138, 72, 24, "+" + up_int.to_s, 2)
  51.     self.contents.font.size = 20
  52.     self.contents.draw_text( 0, 0, 128, 24, actor.level.to_s, 2)
  53.     self.contents.draw_text( 0, 26, 128, 24, actor.maxhp.to_s, 2)
  54.     self.contents.draw_text( 0, 48, 128, 24, actor.maxsp.to_s, 2)
  55.     self.contents.draw_text( 0, 70, 128, 24, actor.str.to_s, 2)
  56.     self.contents.draw_text( 0, 92, 128, 24, actor.dex.to_s, 2)
  57.     self.contents.draw_text( 0, 114, 128, 24, actor.agi.to_s, 2)
  58.     self.contents.draw_text( 0, 136, 128, 24, actor.int.to_s, 2)
  59.   end
  60. end
  61. #===========================================================
  62. # ■ Window_SkillLearning
  63. #------------------------------------------------------------------------------
  64. #  レベルアップ時などにスキルを習得した場合にそれを表示するウィンドウです。
  65. #=============================================================
  66. class Window_SkillLearning < Window_Base
  67.   #-------------------------------------------------------------
  68.   # ● 公開インスタンス変数
  69.   #-----------------------------------------------------------
  70.   attr_reader :learned # スキルを習得したかどうか
  71.   #----------------------------------------------------------
  72.   # ● オブジェクト初期化
  73.   #----------------------------------------------------------
  74.   def initialize(class_id, last_lv, now_lv)
  75.     super(160, 64, 320, 64)
  76.     self.contents = Bitmap.new(width - 32, height - 28) # わざと▽を表示
  77.     self.visible = false
  78.     self.back_opacity = 160
  79.     @learned = false
  80.     refresh(class_id, last_lv, now_lv)
  81.   end
  82.   #------------------------------------------------------------
  83.   # ● リフレッシュ
  84.   #-------------------------------------------------------
  85.   def refresh(class_id, last_lv, now_lv)
  86.     for i in 0...$data_classes[class_id].learnings.size
  87.       learn_lv = $data_classes[class_id].learnings[i].level
  88.       # 今回のレベルアップ範囲で習得するスキルの場合
  89.       if learn_lv > last_lv and learn_lv <= now_lv
  90.         @learned = true
  91.         # SEの再生
  92.         if $data_system_skilllearn_se != ""
  93.           Audio.se_play($data_system_skilllearn_se)
  94.         end
  95.         # 各描写
  96.         skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name
  97.         self.contents.clear
  98.         self.contents.font.color = text_color(0)
  99.         self.contents.draw_text(0,0,448,32, "学会特技:"+skill_name)
  100.         self.contents.font.color = text_color(6)
  101.         self.contents.draw_text(0,0,448,32, "          "+skill_name)
  102.         self.contents.font.color = text_color(0)
  103.         self.visible = true
  104.         # メインループ
  105.         loop do
  106.           # ゲーム画面を更新
  107.           Graphics.update
  108.           # 入力情報を更新
  109.           Input.update
  110.           # フレーム更新
  111.           update
  112.           # 画面が切り替わったらループを中断
  113.           if @learned == false
  114.             break
  115.           end
  116.         end
  117.       # メインループここまで
  118.       end
  119.     end
  120.   end
  121.   #-----------------------------------------------------------
  122.   # ● フレーム更新
  123.   #------------------------------------------------------------
  124.   def update
  125.     # C ボタンが押された場合
  126.     if Input.trigger?(Input::C)
  127.       @learned = false
  128.       self.visible = false
  129.     end
  130.   end
  131. end
  132. #==================================================================
  133. # ■ Window_BattleStatus
  134. #==================================================================
  135. class Window_BattleStatus < Window_Base
  136.   #---------------------------------------------------------
  137.   # ● 追加?公開インスタンス変数
  138.   #-------------------------------------------------------
  139.   attr_accessor :level_up_flags # LEVEL UP!表示
  140. end
  141. #===============================================================
  142. # ■ Game_Battler
  143. #===============================================================
  144. class Game_Battler
  145.   #--------------------------------------------------------------
  146.   # ● 追加?公開インスタンス変数
  147.   #----------------------------------------------------------
  148.   attr_accessor :exp_gain_ban # EXP取得一時禁止
  149.   #------------------------------------------------------
  150.   # ● オブジェクト初期化
  151.   #-----------------------------------------------------
  152.   alias xrxs_bp10_initialize initialize
  153.   def initialize
  154.     @exp_gain_ban = false
  155.     xrxs_bp10_initialize
  156.   end
  157.   #-------------------------------------------------------
  158.   # ● ステート [EXP を獲得できない] 判定
  159.   #-----------------------------------------------------
  160.   alias xrxs_bp10_cant_get_exp? cant_get_exp?
  161.   def cant_get_exp?
  162.     if @exp_gain_ban == true
  163.       return true
  164.     else
  165.       return xrxs_bp10_cant_get_exp?
  166.     end
  167.   end
  168. end
  169. #==============================================================
  170. # ■ Scene_Battle
  171. #==============================================================
  172. class Scene_Battle
  173.   #--------------------------------------------------
  174.   # ● アフターバトルフェーズ開始
  175.   #--------------------------------------------------
  176.   alias xrxs_bp10_start_phase5 start_phase5
  177.   def start_phase5
  178.     # EXP 獲得禁止
  179.     for i in 0...$game_party.actors.size
  180.       $game_party.actors[i].exp_gain_ban = true
  181.     end
  182.     xrxs_bp10_start_phase5
  183.     # EXP 獲得禁止の解除
  184.     for i in 0...$game_party.actors.size
  185.       $game_party.actors[i].exp_gain_ban = false
  186.     end
  187.     # EXPを初期化
  188.     @exp_gained = 0
  189.     for enemy in $game_troop.enemies
  190.       # 獲得 EXPを追加 # エネミーが隠れ状態でない場合
  191.       @exp_gained += enemy.exp if not enemy.hidden
  192.     end
  193.     # 設定
  194.     @phase5_step = 1
  195.     @exp_gain_actor = -1
  196.     # リザルトウィンドウを表示
  197.     @result_window.visible = true
  198.   end
  199.   #----------------------------------------------------------
  200.   # ● フレーム更新 (アフターバトルフェーズ)
  201.   #--------------------------------------------------------
  202.   #alias xrxs_bp10_update_phase5 update_phase5
  203.   def update_phase5
  204.     case @phase5_step
  205.     when 1
  206.       update_phase5_step1
  207.     else
  208.     # ウェイトカウントが 0 より大きい場合
  209.       if @phase5_wait_count > 0
  210.         # ウェイトカウントを減らす
  211.         @phase5_wait_count -= 1
  212.         # ウェイトカウントが 0 になった場合
  213.         if @phase5_wait_count == 0
  214.           # リザルトウィンドウを表示
  215.           #@result_window.visible = true
  216.           # メインフェーズフラグをクリア
  217.           $game_temp.battle_main_phase = false
  218.           # ステータスウィンドウをリフレッシュ
  219.           @status_window.refresh
  220.         end
  221.       return
  222.       end
  223.       # C ボタンが押された場合
  224.       if Input.trigger?(Input::C)
  225.         # バトル終了
  226.         battle_end(0)
  227.       end
  228.     # レベルアップしている場合は強制バトル終了
  229.     battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
  230.     end
  231.   end
  232.   #-----------------------------------------------------------
  233.   # ● フレーム更新 (アフターバトルフェーズ 1 : レベルアップ)
  234.   #-----------------------------------------------------------
  235.   def update_phase5_step1
  236.     # C ボタンが押された場合
  237.     if Input.trigger?(Input::C)
  238.       # ウィンドウを閉じて次のアクターへ
  239.       @levelup_window.visible = false if @levelup_window != nil
  240.       @status_window.level_up_flags[@exp_gain_actor] = false
  241.       phase5_next_levelup
  242.     end
  243.   end
  244.   #---------------------------------------------------------
  245.   # ● 次のアクターのレベルアップ表示へ
  246.   #---------------------------------------------------------
  247.   def phase5_next_levelup
  248.     begin
  249.       # 次のアクターへ
  250.       @exp_gain_actor += 1
  251.       # 最後のアクターの場合
  252.       if @exp_gain_actor >= $game_party.actors2.size
  253.         # アフターバトルフェーズ開始
  254.         @phase5_step = 0
  255.         return
  256.       end
  257.       #p $game_party.actors2.size
  258.         actor = $game_party.actors2[@exp_gain_actor]
  259.       if actor.cant_get_exp? == false
  260.         # 現在の能力値を保持
  261.         last_level = actor.level
  262.         last_maxhp = actor.maxhp
  263.         last_maxsp = actor.maxsp
  264.         last_str = actor.str
  265.         last_dex = actor.dex
  266.         last_agi = actor.agi
  267.         last_int = actor.int
  268.         # 経験値取得の決定的瞬間(謎
  269.         actor.exp += @exp_gained
  270.         # 判定
  271.         if actor.level > last_level
  272.           actor.hp = actor.maxhp
  273.           actor.sp = actor.maxsp
  274.           # レベルアップした場合
  275.           @status_window.level_up(@exp_gain_actor)
  276.           # リザルトウィンドウを消す
  277.           @result_window.visible = false
  278.           # SEの再生
  279.           if $data_system_level_up_se != ""
  280.             Audio.se_play($data_system_level_up_se)
  281.           end
  282.           # MEの再生
  283.           if $data_system_level_up_me != ""
  284.             Audio.me_stop
  285.             Audio.me_play($data_system_level_up_me)
  286.           end
  287.           # LEVEL-UPウィンドウの設定
  288.           @levelup_window = Window_LevelUpWindow.new(actor, last_level,
  289.           actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,
  290.           actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)
  291.           if @exp_gain_actor < $game_party.actors.size
  292.           @levelup_window.x = 160 * @exp_gain_actor
  293.           @levelup_window.y = 150
  294.           else
  295.           @levelup_window.x = 240
  296.           @levelup_window.y = 128
  297.           end
  298.           @levelup_window.visible = true
  299.           # ステータスウィンドウをリフレッシュ
  300.           @status_window.refresh
  301.           # スキル習得ウィンドウの設定
  302.           @skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)
  303.           # ウェイトカウントを設定
  304.           @phase5_wait_count = 40
  305.           @phase5_step = 1
  306.           return
  307.         end
  308.       end
  309.     end until false
  310.   end
  311. end


  312. #=============================================================
  313. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  314. #=============================================================
复制代码

战斗换人+队伍内角色不参战也获得经验.rar

196.72 KB, 下载次数: 271

话说,熟人变少了,还是马甲变多了?
我将乘风而去,万丈深渊。新生命阻止我的冲动……好吧,我再活一年,但是……这是最后的一年……
……强烈支持国产游戏……

遵冥冥之意,然果有奇效!
我好像玩够了,该走了……

强烈反对国产脑残动画片在电视台播出……
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-23 19:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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