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

Project1

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

[已经解决] 物品特效效果脚本出一点问题,求修正。

[复制链接]

Lv5.捕梦者 (版主)

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
帖子
11485

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

跳转到指定楼层
1
发表于 2013-8-19 21:29:53 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================
  6.  
  7. class Scene_Battle
  8.  
  9.   #--------------------------------------------------------------------------
  10.   # ● 开始主回合
  11.   #--------------------------------------------------------------------------
  12.   def start_phase4
  13.     # 转移到回合 4
  14.     @phase = 4
  15.     # 回合数计数
  16.     $game_temp.battle_turn += 1
  17.     # 搜索全页的战斗事件
  18.     for index in 0...$data_troops[@troop_id].pages.size
  19.       # 获取事件页
  20.       page = $data_troops[@troop_id].pages[index]
  21.       # 本页的范围是 [回合] 的情况下
  22.       if page.span == 1
  23.         # 设置已经执行标志
  24.         $game_temp.battle_event_flags[index] = false
  25.       end
  26.     end
  27.     # 设置角色为非选择状态
  28.     @actor_index = -1
  29.     @active_battler = nil
  30.     # 有效化同伴指令窗口
  31.     @party_command_window.active = false
  32.     @party_command_window.visible = false
  33.     # 无效化角色指令窗口
  34.     @actor_command_window.active = false
  35.     @actor_command_window.visible = false
  36.     # 设置主回合标志
  37.     $game_temp.battle_main_phase = true
  38.     # 生成敌人行动
  39.     for enemy in $game_troop.enemies
  40.       enemy.make_action
  41.     end
  42.     # 生成行动顺序
  43.     make_action_orders
  44.     # 移动到步骤 1
  45.     @phase4_step = 1
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 生成行动循序
  49.   #--------------------------------------------------------------------------
  50.   def make_action_orders
  51.     # 初始化序列 @action_battlers
  52.     @action_battlers = []
  53.     # 添加敌人到 @action_battlers 序列
  54.     for enemy in $game_troop.enemies
  55.       @action_battlers.push(enemy)
  56.     end
  57.     # 添加角色到 @action_battlers 序列
  58.     for actor in $game_party.actors
  59.       @action_battlers.push(actor)
  60.     end
  61.     # 确定全体的行动速度
  62.     for battler in @action_battlers
  63.       battler.make_action_speed
  64.     end
  65.     # 按照行动速度从大到小排列
  66.     @action_battlers.sort! {|a,b|
  67.       b.current_action.speed - a.current_action.speed }
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 刷新画面 (主回合)
  71.   #--------------------------------------------------------------------------
  72.   def update_phase4
  73.     case @phase4_step
  74.     when 1
  75.       update_phase4_step1
  76.     when 2
  77.       update_phase4_step2
  78.     when 3
  79.       update_phase4_step3
  80.     when 4
  81.       update_phase4_step4
  82.     when 5
  83.       update_phase4_step5
  84.     when 6
  85.       update_phase4_step6
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  90.   #--------------------------------------------------------------------------
  91.   def update_phase4_step1
  92.     # 隐藏帮助窗口
  93.     @help_window.visible = false
  94.     # 判定胜败
  95.     if judge
  96.       # 胜利或者失败的情况下 : 过程结束
  97.       return
  98.     end
  99.     # 强制行动的战斗者不存在的情况下
  100.     if $game_temp.forcing_battler == nil
  101.       # 设置战斗事件
  102.       setup_battle_event
  103.       # 执行战斗事件中的情况下
  104.       if $game_system.battle_interpreter.running?
  105.         return
  106.       end
  107.     end
  108.     # 强制行动的战斗者存在的情况下
  109.     if $game_temp.forcing_battler != nil
  110.       # 在头部添加后移动
  111.       @action_battlers.delete($game_temp.forcing_battler)
  112.       @action_battlers.unshift($game_temp.forcing_battler)
  113.     end
  114.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  115.     if @action_battlers.size == 0
  116.       # 开始同伴命令回合
  117.       start_phase2
  118.       return
  119.     end
  120.     # 初始化动画 ID 和公共事件 ID
  121.     @animation1_id = 0
  122.     @animation2_id = 0
  123.     @common_event_id = 0
  124.     # 未行动的战斗者移动到序列的头部
  125.     @active_battler = @action_battlers.shift
  126.     # 如果已经在战斗之外的情况下
  127.     if @active_battler.index == nil
  128.       return
  129.     end
  130.     # 连续伤害
  131.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  132.       @active_battler.slip_damage_effect
  133.       @active_battler.damage_pop = true
  134.     end
  135.      ########################################万兽熊最高###########################
  136.     #####################################行动方是否为角色
  137.      if @active_battler.is_a?(Game_Actor)
  138.        if $game_party.item_number(20) > 0 #拥有20号物品时
  139.       @help_window.set_text("物品发挥特效", 1)
  140.         ####获取HP回复数值##########################
  141.        @active_battler.damage = -($game_party.item_number(20)*3*@active_battler.maxhp/100).to_i
  142.        ####获取SP回复数值##########################
  143.        resp = -($game_party.item_number(20)*3*@active_battler.maxsp/100).to_i
  144.        @active_battler.hp -= @active_battler.damage
  145.        @active_battler.sp -= resp
  146.        #显示SP数值需要其它脚本支持
  147.        @active_battler.animation_id = 15 #显示15号动画
  148.        @active_battler.damage_pop = true
  149.        end
  150.       end
  151.     end
  152.     ##########################################################################################
  153.     # 自然解除状态
  154.     @active_battler.remove_states_auto
  155.     # 刷新状态窗口
  156.     @status_window.refresh
  157.     # 移至步骤 2
  158.     @phase4_step = 2
  159.   end


以上是物品特效脚本。
但是当某个角色死亡时,这个物品还是会发挥效果。
求助怎么样修改才能让某个角色死亡,不发动效果?
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

Lv5.捕梦者 (版主)

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
帖子
11485

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

3
 楼主| 发表于 2013-8-19 21:46:20 | 只看该作者
wwwcctvty 发表于 2013-8-19 21:38
if self.dead?
xxxxx
end

将这句插入到if $game_party.item_number(20) > 0
之下后会报错······

点评

把self改成 @active_battler  发表于 2013-8-19 21:50
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
586 小时
注册时间
2012-5-31
帖子
768
2
发表于 2013-8-19 21:38:05 | 只看该作者
if self.dead?
xxxxx
end

点评

谢谢,BUG修复了。  发表于 2013-8-19 21:56

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-29 19:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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