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

Project1

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

[已经过期] 状态效果同步执行

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
112 小时
注册时间
2012-3-16
帖子
65
跳转到指定楼层
1
发表于 2013-7-9 11:02:59 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
RMXP的默认脚本里,当角色附加状态的时候要行动的时候状态效果才会执行,有没办法改成回合开始的时候先执行状态效果。
举例:
4人战斗,比如4个人都中了【毒】,然后1号角色行动的时候才会执行【毒】的状态扣除1号角色的HP,
                                    2号角色行动的时候才会执行【毒】的状态扣除1号角色的HP,
                                    以此类推。。。
如何改成,回合开始就直接4个人同时把【毒】的状态先执行了。

Lv5.捕梦者

梦石
0
星屑
33071
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

2
发表于 2013-7-9 16:30:59 | 只看该作者
按LZ的要求,把 连续伤害(毒)提前了

复制下面的脚本,替换全部的 Scene_Battle 4
  1. class Scene_Battle
  2.   #--------------------------------------------------------------------------
  3.   # ● 开始主回合
  4.   #--------------------------------------------------------------------------
  5.   def start_phase4
  6.     # 转移到回合 4
  7.     @phase = 4
  8.     # 回合数计数
  9.     $game_temp.battle_turn += 1
  10.     # 搜索全页的战斗事件
  11.     for index in 0...$data_troops[@troop_id].pages.size
  12.       # 获取事件页
  13.       page = $data_troops[@troop_id].pages[index]
  14.       # 本页的范围是 [回合] 的情况下
  15.       if page.span == 1
  16.         # 设置已经执行标志
  17.         $game_temp.battle_event_flags[index] = false
  18.       end
  19.     end
  20.     # 设置角色为非选择状态
  21.     @actor_index = -1
  22.     @active_battler = nil
  23.     #######################################################################
  24.     # 连续伤害
  25.     for actor in $game_party.actors
  26.       if actor.hp > 0 and actor.slip_damage?
  27.         actor.slip_damage_effect
  28.         actor.damage_pop = true
  29.         actor.remove_states_auto
  30.       end
  31.     end
  32.     for enemy in $game_troop.enemies
  33.       if enemy.hp > 0 and enemy.slip_damage?
  34.         enemy.slip_damage_effect
  35.         enemy.damage_pop = true
  36.         enemy.remove_states_auto
  37.       end
  38.     end
  39.     #######################################################################
  40.     # 刷新状态窗口
  41.     @status_window.refresh
  42.     # 有效化同伴指令窗口
  43.     @party_command_window.active = false
  44.     @party_command_window.visible = false
  45.     # 无效化角色指令窗口
  46.     @actor_command_window.active = false
  47.     @actor_command_window.visible = false
  48.     # 设置主回合标志
  49.     $game_temp.battle_main_phase = true
  50.     # 生成敌人行动
  51.     for enemy in $game_troop.enemies
  52.       enemy.make_action
  53.     end
  54.     # 生成行动顺序
  55.     make_action_orders
  56.     # 移动到步骤 1
  57.     @phase4_step = 1
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 生成行动循序
  61.   #--------------------------------------------------------------------------
  62.   def make_action_orders
  63.     # 初始化序列 @action_battlers
  64.     @action_battlers = []
  65.     # 添加敌人到 @action_battlers 序列
  66.     for enemy in $game_troop.enemies
  67.       @action_battlers.push(enemy)
  68.     end
  69.     # 添加角色到 @action_battlers 序列
  70.     for actor in $game_party.actors
  71.       @action_battlers.push(actor)
  72.     end
  73.     # 确定全体的行动速度
  74.     for battler in @action_battlers
  75.       battler.make_action_speed
  76.     end
  77.     # 按照行动速度从大到小排列
  78.     @action_battlers.sort! {|a,b|
  79.       b.current_action.speed - a.current_action.speed }
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 刷新画面 (主回合)
  83.   #--------------------------------------------------------------------------
  84.   def update_phase4
  85.     case @phase4_step
  86.     when 1
  87.       update_phase4_step1
  88.     when 2
  89.       update_phase4_step2
  90.     when 3
  91.       update_phase4_step3
  92.     when 4
  93.       update_phase4_step4
  94.     when 5
  95.       update_phase4_step5
  96.     when 6
  97.       update_phase4_step6
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  102.   #--------------------------------------------------------------------------
  103.   def update_phase4_step1
  104.     # 隐藏帮助窗口
  105.     @help_window.visible = false
  106.     # 判定胜败
  107.     if judge
  108.       # 胜利或者失败的情况下 : 过程结束
  109.       return
  110.     end
  111.     # 强制行动的战斗者不存在的情况下
  112.     if $game_temp.forcing_battler == nil
  113.       # 设置战斗事件
  114.       setup_battle_event
  115.       # 执行战斗事件中的情况下
  116.       if $game_system.battle_interpreter.running?
  117.         return
  118.       end
  119.     end
  120.     # 强制行动的战斗者存在的情况下
  121.     if $game_temp.forcing_battler != nil
  122.       # 在头部添加后移动
  123.       @action_battlers.delete($game_temp.forcing_battler)
  124.       @action_battlers.unshift($game_temp.forcing_battler)
  125.     end
  126.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  127.     if @action_battlers.size == 0
  128.       # 开始同伴命令回合
  129.       start_phase2
  130.       return
  131.     end
  132.     # 初始化动画 ID 和公共事件 ID
  133.     @animation1_id = 0
  134.     @animation2_id = 0
  135.     @common_event_id = 0
  136.     # 未行动的战斗者移动到序列的头部
  137.     @active_battler = @action_battlers.shift
  138.     # 如果已经在战斗之外的情况下
  139.     if @active_battler.index == nil
  140.       return
  141.     end
  142.     # 移至步骤 2
  143.     @phase4_step = 2
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  147.   #--------------------------------------------------------------------------
  148.   def update_phase4_step2
  149.     # 如果不是强制行动
  150.     unless @active_battler.current_action.forcing
  151.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  152.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  153.         # 设置行动为攻击
  154.         @active_battler.current_action.kind = 0
  155.         @active_battler.current_action.basic = 0
  156.       end
  157.       # 限制为 [不能行动] 的情况下
  158.       if @active_battler.restriction == 4
  159.         # 清除行动强制对像的战斗者
  160.         $game_temp.forcing_battler = nil
  161.         # 移至步骤 1
  162.         @phase4_step = 1
  163.         return
  164.       end
  165.     end
  166.     # 清除对像战斗者
  167.     @target_battlers = []
  168.     # 行动种类分支
  169.     case @active_battler.current_action.kind
  170.     when 0  # 基本
  171.       make_basic_action_result
  172.     when 1  # 特技
  173.       make_skill_action_result
  174.     when 2  # 物品
  175.       make_item_action_result
  176.     end
  177.     # 移至步骤 3
  178.     if @phase4_step == 2
  179.       @phase4_step = 3
  180.     end
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 生成基本行动结果
  184.   #--------------------------------------------------------------------------
  185.   def make_basic_action_result
  186.     # 攻击的情况下
  187.     if @active_battler.current_action.basic == 0
  188.       # 设置攻击 ID
  189.       @animation1_id = @active_battler.animation1_id
  190.       @animation2_id = @active_battler.animation2_id
  191.       # 行动方的战斗者是敌人的情况下
  192.       if @active_battler.is_a?(Game_Enemy)
  193.         if @active_battler.restriction == 3
  194.           target = $game_troop.random_target_enemy
  195.         elsif @active_battler.restriction == 2
  196.           target = $game_party.random_target_actor
  197.         else
  198.           index = @active_battler.current_action.target_index
  199.           target = $game_party.smooth_target_actor(index)
  200.         end
  201.       end
  202.       # 行动方的战斗者是角色的情况下
  203.       if @active_battler.is_a?(Game_Actor)
  204.         if @active_battler.restriction == 3
  205.           target = $game_party.random_target_actor
  206.         elsif @active_battler.restriction == 2
  207.           target = $game_troop.random_target_enemy
  208.         else
  209.           index = @active_battler.current_action.target_index
  210.           target = $game_troop.smooth_target_enemy(index)
  211.         end
  212.       end
  213.       # 设置对像方的战斗者序列
  214.       @target_battlers = [target]
  215.       # 应用通常攻击效果
  216.       for target in @target_battlers
  217.         target.attack_effect(@active_battler)
  218.       end
  219.       return
  220.     end
  221.     # 防御的情况下
  222.     if @active_battler.current_action.basic == 1
  223.       # 帮助窗口显示"防御"
  224.       @help_window.set_text($data_system.words.guard, 1)
  225.       return
  226.     end
  227.     # 逃跑的情况下
  228.     if @active_battler.is_a?(Game_Enemy) and
  229.        @active_battler.current_action.basic == 2
  230.       #  帮助窗口显示"逃跑"
  231.       @help_window.set_text("逃跑", 1)
  232.       # 逃跑
  233.       @active_battler.escape
  234.       return
  235.     end
  236.     # 什么也不做的情况下
  237.     if @active_battler.current_action.basic == 3
  238.       # 清除强制行动对像的战斗者
  239.       $game_temp.forcing_battler = nil
  240.       # 移至步骤 1
  241.       @phase4_step = 1
  242.       return
  243.     end
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 设置物品或特技对像方的战斗者
  247.   #     scope : 特技或者是物品的范围
  248.   #--------------------------------------------------------------------------
  249.   def set_target_battlers(scope)
  250.     # 行动方的战斗者是敌人的情况下
  251.     if @active_battler.is_a?(Game_Enemy)
  252.       # 效果范围分支
  253.       case scope
  254.       when 1  # 敌单体
  255.         index = @active_battler.current_action.target_index
  256.         @target_battlers.push($game_party.smooth_target_actor(index))
  257.       when 2  # 敌全体
  258.         for actor in $game_party.actors
  259.           if actor.exist?
  260.             @target_battlers.push(actor)
  261.           end
  262.         end
  263.       when 3  # 我方单体
  264.         index = @active_battler.current_action.target_index
  265.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  266.       when 4  # 我方全体
  267.         for enemy in $game_troop.enemies
  268.           if enemy.exist?
  269.             @target_battlers.push(enemy)
  270.           end
  271.         end
  272.       when 5  # 我方单体 (HP 0)
  273.         index = @active_battler.current_action.target_index
  274.         enemy = $game_troop.enemies[index]
  275.         if enemy != nil and enemy.hp0?
  276.           @target_battlers.push(enemy)
  277.         end
  278.       when 6  # 我方全体 (HP 0)
  279.         for enemy in $game_troop.enemies
  280.           if enemy != nil and enemy.hp0?
  281.             @target_battlers.push(enemy)
  282.           end
  283.         end
  284.       when 7  # 使用者
  285.         @target_battlers.push(@active_battler)
  286.       end
  287.     end
  288.     # 行动方的战斗者是角色的情况下
  289.     if @active_battler.is_a?(Game_Actor)
  290.       # 效果范围分支
  291.       case scope
  292.       when 1  # 敌单体
  293.         index = @active_battler.current_action.target_index
  294.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  295.       when 2  # 敌全体
  296.         for enemy in $game_troop.enemies
  297.           if enemy.exist?
  298.             @target_battlers.push(enemy)
  299.           end
  300.         end
  301.       when 3  # 我方单体
  302.         index = @active_battler.current_action.target_index
  303.         @target_battlers.push($game_party.smooth_target_actor(index))
  304.       when 4  # 我方全体
  305.         for actor in $game_party.actors
  306.           if actor.exist?
  307.             @target_battlers.push(actor)
  308.           end
  309.         end
  310.       when 5  # 我方单体 (HP 0)
  311.         index = @active_battler.current_action.target_index
  312.         actor = $game_party.actors[index]
  313.         if actor != nil and actor.hp0?
  314.           @target_battlers.push(actor)
  315.         end
  316.       when 6  # 我方全体 (HP 0)
  317.         for actor in $game_party.actors
  318.           if actor != nil and actor.hp0?
  319.             @target_battlers.push(actor)
  320.           end
  321.         end
  322.       when 7  # 使用者
  323.         @target_battlers.push(@active_battler)
  324.       end
  325.     end
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● 生成特技行动结果
  329.   #--------------------------------------------------------------------------
  330.   def make_skill_action_result
  331.     # 获取特技
  332.     [url=home.php?mod=space&uid=260100]@skill[/url] = $data_skills[@active_battler.current_action.skill_id]
  333.     # 如果不是强制行动
  334.     unless @active_battler.current_action.forcing
  335.       # 因为 SP 耗尽而无法使用的情况下
  336.       unless @active_battler.skill_can_use?(@skill.id)
  337.         # 清除强制行动对像的战斗者
  338.         $game_temp.forcing_battler = nil
  339.         # 移至步骤 1
  340.         @phase4_step = 1
  341.         return
  342.       end
  343.     end
  344.     # 消耗 SP
  345.     @active_battler.sp -= @skill.sp_cost
  346.     # 刷新状态窗口
  347.     @status_window.refresh
  348.     # 在帮助窗口显示特技名
  349.     @help_window.set_text(@skill.name, 1)
  350.     # 设置动画 ID
  351.     @animation1_id = @skill.animation1_id
  352.     @animation2_id = @skill.animation2_id
  353.     # 设置公共事件 ID
  354.     @common_event_id = @skill.common_event_id
  355.     # 设置对像侧战斗者
  356.     set_target_battlers(@skill.scope)
  357.     # 应用特技效果
  358.     for target in @target_battlers
  359.       target.skill_effect(@active_battler, @skill)
  360.     end
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ● 生成物品行动结果
  364.   #--------------------------------------------------------------------------
  365.   def make_item_action_result
  366.     # 获取物品
  367.     @item = $data_items[@active_battler.current_action.item_id]
  368.     # 因为物品耗尽而无法使用的情况下
  369.     unless $game_party.item_can_use?(@item.id)
  370.       # 移至步骤 1
  371.       @phase4_step = 1
  372.       return
  373.     end
  374.     # 消耗品的情况下
  375.     if @item.consumable
  376.       # 使用的物品减 1
  377.       $game_party.lose_item(@item.id, 1)
  378.     end
  379.     # 在帮助窗口显示物品名
  380.     @help_window.set_text(@item.name, 1)
  381.     # 设置动画 ID
  382.     @animation1_id = @item.animation1_id
  383.     @animation2_id = @item.animation2_id
  384.     # 设置公共事件 ID
  385.     @common_event_id = @item.common_event_id
  386.     # 确定对像
  387.     index = @active_battler.current_action.target_index
  388.     target = $game_party.smooth_target_actor(index)
  389.     # 设置对像侧战斗者
  390.     set_target_battlers(@item.scope)
  391.     # 应用物品效果
  392.     for target in @target_battlers
  393.       target.item_effect(@item)
  394.     end
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  398.   #--------------------------------------------------------------------------
  399.   def update_phase4_step3
  400.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  401.     if @animation1_id == 0
  402.       @active_battler.white_flash = true
  403.     else
  404.       @active_battler.animation_id = @animation1_id
  405.       @active_battler.animation_hit = true
  406.     end
  407.     # 移至步骤 4
  408.     @phase4_step = 4
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  412.   #--------------------------------------------------------------------------
  413.   def update_phase4_step4
  414.     # 对像方动画
  415.     for target in @target_battlers
  416.       target.animation_id = @animation2_id
  417.       target.animation_hit = (target.damage != "Miss")
  418.     end
  419.     # 限制动画长度、最低 8 帧
  420.     @wait_count = 8
  421.     # 移至步骤 5
  422.     @phase4_step = 5
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  426.   #--------------------------------------------------------------------------
  427.   def update_phase4_step5
  428.     # 隐藏帮助窗口
  429.     @help_window.visible = false
  430.     # 刷新状态窗口
  431.     @status_window.refresh
  432.     # 显示伤害
  433.     for target in @target_battlers
  434.       if target.damage != nil
  435.         target.damage_pop = true
  436.       end
  437.     end
  438.     # 移至步骤 6
  439.     @phase4_step = 6
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  443.   #--------------------------------------------------------------------------
  444.   def update_phase4_step6
  445.     # 清除强制行动对像的战斗者
  446.     $game_temp.forcing_battler = nil
  447.     # 公共事件 ID 有效的情况下
  448.     if @common_event_id > 0
  449.       # 设置事件
  450.       common_event = $data_common_events[@common_event_id]
  451.       $game_system.battle_interpreter.setup(common_event.list, 0)
  452.     end
  453.     # 移至步骤 1
  454.     @phase4_step = 1
  455.   end
  456. end
复制代码

评分

参与人数 1星屑 +105 收起 理由
弗雷德 + 105 认可答案

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 18:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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