查看: 2263|回复: 4

[已经解决] 角色第二次战斗还是死亡动态图

[复制链接]
梦石
0
星屑
1556
在线时间
626 小时
注册时间
2010-8-5
回帖
317
发表于 2014-10-16 22:26:21 | 显示全部楼层 |阅读模式

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

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

×
我把大于20的角色设置成死亡后,第二次战斗时回复全状态.但是问题来了,虽然实现了效果

但是第一场战斗中 角色死亡后 呈现 死亡图,第二次战斗开始的样子还是 死亡图,行动后才变成待机图。

请问要在哪地方修改?这个是第二次战斗时回复全状态脚本
  1. class Scene_Battle
  2.   def initialize
  3.     #recover_hpsp
  4.   end
  5.   
  6.   def recover_hpsp
  7.     #baby = []
  8.     #for baby_id in 21..50
  9.     #  baby << $game_actors[baby_id]
  10.     #end
  11.     for actor in $game_party.actors# + baby
  12.       if actor.dead?
  13.         actor.states.delete(1)
  14.         if actor.id < 20
  15.           actor.hp = Integer(actor.maxhp * 0.05)
  16.           actor.sp = Integer(actor.maxsp * 0.05)
  17.         elsif actor.id > 20
  18.           actor.hp = actor.maxhp
  19.           actor.sp = actor.maxsp
  20.         end
  21.         actor.hp = 1 if actor.hp < 1
  22.         actor.sp = 1 if actor.sp < 1
  23.       end
  24.     end
  25.   end
  26.   
  27.   alias battle_end_recover_hpsp battle_end
  28.   def battle_end(result)
  29.     battle_end_recover_hpsp(result)
  30.     recover_hpsp
  31.   end
  32. end
复制代码


这个是Sprite_Battler
  1. #==============================================================================
  2. # ■ Sprite_Battler
  3. #------------------------------------------------------------------------------
  4. #  战斗显示用活动块。Game_Battler 类的实例监视、
  5. # 活动块的状态的监视。
  6. #==============================================================================

  7. class Sprite_Battler < RPG::Sprite
  8.   #--------------------------------------------------------------------------
  9.   # ● 定义实例变量
  10.   #--------------------------------------------------------------------------
  11.   attr_accessor :battler                  # 战斗者
  12.   attr_accessor :select_index
  13.   #--------------------------------------------------------------------------
  14.   # ● 初始化对像
  15.   #     viewport : 显示端口
  16.   #     battler  : 战斗者 (Game_Battler)
  17.   #--------------------------------------------------------------------------
  18.   def initialize(viewport, battler = nil)
  19.     super(viewport)
  20.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  21.     @battler_visible = false
  22.     @number = 0
  23.     @sprite_contens = Sprite.new#(viewport)
  24.     @sprite_contens.x = 0
  25.     @sprite_contens.y = 0
  26.     @sprite_contens.z = 0
  27.     @sprite_contens.bitmap = Bitmap.new(640,480)
  28.     @select_index = -1
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 释放
  32.   #--------------------------------------------------------------------------
  33.   def dispose
  34.    
  35.     if self.bitmap != nil
  36.       self.bitmap.dispose
  37.     end
  38.     if @sprite_contens.bitmap != nil
  39.       @sprite_contens.bitmap.dispose
  40.     end
  41.     super
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● 战斗中名字的描绘
  45.   #--------------------------------------------------------------------------
  46.   def draw_actor_name(actor, x, y)
  47.     @sprite_contens.bitmap.font.color = Color.new(0, 230, 50, 255)
  48.     @sprite_contens.bitmap.font.size = 16
  49.     @sprite_contens.bitmap.draw_text(x, y, 60, 65, actor.name,1)
  50.     @sprite_contens.z = 9
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 战斗血条描绘
  54.   #--------------------------------------------------------------------------
  55.   def draw_battle_hp(actor, x, y)
  56.     # 底图描绘
  57.     battle_hp_bitmap = RPG::Cache.picture("战斗条框")
  58.     src_rect = Rect.new(0, 0, battle_hp_bitmap.width, battle_hp_bitmap.height)
  59.     @sprite_contens.bitmap.blt(x+12, y+41, battle_hp_bitmap, src_rect)
  60.     @sprite_contens.z = 999
  61.     # 血条显示
  62.     battle_hp_bitmap = RPG::Cache.picture("战斗血条")
  63.     hp_width = battle_hp_bitmap.width * actor.hp / actor.maxhp
  64.     src_rect = Rect.new(0, 0, hp_width, battle_hp_bitmap.height)
  65.     @sprite_contens.bitmap.blt(x+13, y+42, battle_hp_bitmap, src_rect)
  66.     @sprite_contens.z = 999

  67.   end
  68.   
  69.   #--------------------------------------------------------------------------
  70.   # ● 刷新画面
  71.   #--------------------------------------------------------------------------
  72.   def update
  73.     super
  74.    
  75.       #刷新战斗血条
  76.     if @battler.is_a?(Game_Actor)
  77.       if not @sprite_contens.disposed?
  78.         if @battler_hp == 0 and not @battler.dead?
  79.           @sprite_contens.bitmap.clear
  80.           @sprite_contens.x = @battler.screen_x
  81.           @sprite_contens.y = @battler.screen_y
  82.           @sprite_contens.z = @battler.screen_z + 10
  83.           draw_actor_name(@battler, 0, 0)
  84.           #draw_battle_sp(@battler, 0, 27)
  85.           draw_battle_hp(@battler, 0, 0)
  86.           @battler_hp = @battler.hp
  87.         end
  88.         if @wait_count.to_i != 0
  89.           @sprite_contens.visible = false
  90.         else
  91.           @sprite_contens.visible = true
  92.         end
  93.       end
  94.     elsif @battler.is_a?(Game_Enemy)
  95.       unless @sprite_contens.disposed?
  96.         if @battler.hp0?
  97.           @sprite_contens.bitmap.clear
  98.         end
  99.       if @wait_count.to_i != 0
  100.         @sprite_contens.visible = false
  101.       else
  102.         @sprite_contens.visible = true
  103.       end
  104.       end
  105.     end


  106.     # 战斗者为 nil 的情况下
  107.     if @battler == nil
  108.       self.bitmap = nil
  109.       loop_animation(nil)
  110.       return
  111.     end
  112.     # 文件名和色相与当前情况有差异的情况下
  113.     if @battler.battler_name != @battler_name or
  114.        @battler.battler_hue != @battler_hue
  115.       # 获取、设置位图
  116.       @battler_name = @battler.battler_name
  117.       @battler_hue = @battler.battler_hue
  118.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  119.       @width = bitmap.width
  120.       [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  121.       self.ox = @width / 2
  122.       self.oy = @height
  123.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  124.       if @battler.dead? or @battler.hidden
  125.         self.opacity = 0
  126.       end
  127.     end
  128.     if @battler.startactive == "移动" or @battler.startactive == "返回" or @battler.startactive == "挨打" or @battler.startactive == "防御" or @battler.startactive == "死亡"
  129.       if Graphics.frame_count % 2 == 0
  130.         unless BattlerName[@battler.file_name].nil?
  131.           @number = (@number + 1) % BattlerName[@battler.file_name][@battler.startactive].size
  132.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.file_name][@battler.startactive][@number], @battler_hue)
  133.           #Graphics.update
  134.         end
  135.       end
  136.     else
  137.       if Graphics.frame_count % 3 == 0
  138.         unless BattlerName[@battler.file_name].nil?
  139.           @number = (@number + 1) % BattlerName[@battler.file_name][@battler.startactive].size
  140.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.file_name][@battler.startactive][@number], @battler_hue)
  141.         end
  142.       end
  143.     end
  144.     if @a != 1
  145. Mouse.set_bitmap("4.ani",[0,0,11,1])
  146. @a = 1
  147. end

  148.     x, y = Mouse.get_mouse_pos
  149.     if  x >= self.x - self.ox and x <= self.x + self.ox and y >= self.y - self.oy and y <= self.y and
  150.         self.bitmap.get_pixel(x - self.x + self.ox + self.src_rect.x, y - self.y + self.oy + self.src_rect.y).alpha > 0
  151.        self.tone.set(80, 80, 80)
  152.        @sprite_contens.bitmap.font.color = Color.new(0,30, 50, 0)
  153.          if @battler.is_a?(Game_Enemy)
  154.            # 这里修改光标,攻击敌人的光标什么名i在?4
  155.            if $Battle_Skill_Select or $Battle_Item_Select
  156.           #  Mouse.mouse_cursor("5.ani",[0,0,11,1])
  157.            else
  158.           #  Mouse.mouse_cursor("4.ani",[0,0,11,1])
  159.            end
  160.            if Mouse.trigger?(0x01)
  161.              $select_index = @battler.index
  162.            end
  163.          else
  164.           if $Battle_Skill_Select or $Battle_Item_Select
  165.           #  Mouse.mouse_cursor("5.ani",[0,0,11,1])
  166.           end   
  167.          end
  168.     else
  169.        self.tone.set(0, 0, 0)
  170.        # 复原普通鼠标
  171.    #    Mouse.mouse_cursor("mouse.ani",[0,0,11,1])   
  172.     end
  173.      
  174.      

  175.      
  176.      
  177.      
  178.      
  179.      
  180.      
  181.      
  182.     # 动画 ID 与当前的情况有差异的情况下
  183.     if @battler.damage == nil and #音乐咩。。。
  184.        @battler.state_animation_id != @state_animation_id
  185.       @state_animation_id = @battler.state_animation_id
  186.       loop_animation($data_animations[@state_animation_id])
  187.     end
  188.    
  189.     # 不可见的情况下
  190.     unless @battler_visible
  191.     # 出现
  192.       if not @battler.hidden and not @battler.dead? and
  193.          (@battler.damage == nil or @battler.damage_pop)
  194.         appear
  195.         @battler_visible = true
  196.       end
  197.     end
  198.     # 可见的情况下
  199.     if @battler_visible
  200.       # 逃跑
  201.       if @battler.hidden
  202.         $game_system.se_play($data_system.escape_se)
  203.         escape
  204.         @battler_visible = false
  205.       end
  206.       # 白色闪烁
  207.       if @battler.white_flash
  208.         whiten
  209.         @battler.white_flash = false
  210.       end
  211.       # 动画
  212.       if @battler.animation_id != 0
  213.         animation = $data_animations[@battler.animation_id]
  214.         animation(animation, @battler.animation_hit)
  215.         @battler.animation_id = 0
  216.       end
  217.       #伤害
  218. if @battler.damage_pop
  219.   if @battler.damage.is_a?(Numeric) and @battler.damage > 0
  220.     for i in 1..5
  221.       self.x += @battler.is_a?(Game_Actor) ? 8 : -8
  222.       self.y += @battler.is_a?(Game_Actor) ? 5 : -5
  223.       Graphics.update
  224.     end
  225.     for i in 1..5
  226.       self.x += @battler.is_a?(Game_Actor) ? -8 : 8
  227.       self.y += @battler.is_a?(Game_Actor) ? -5 : 5
  228.       Graphics.update
  229.     end
  230.   end
  231.   damage(@battler.damage, @battler.critical)
  232.   @battler.damage = nil
  233.   @battler.critical = false
  234.   @battler.damage_pop = false
  235. end
  236.       # korapusu★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  237.       if @battler.damage == nil and @battler.dead?
  238.         if @battler.is_a?(Game_Enemy)
  239.           $game_system.se_play($data_system.enemy_collapse_se)
  240.           @battler.startactive = "静态"
  241.         else
  242.           $game_system.se_play($data_system.actor_collapse_se)
  243.          @battler.startactive = "静态"
  244.         end
  245.         @battler_visible = false
  246.       end
  247.     end
  248. # 设置活动块的坐标
  249.     self.x = @battler.screen_x
  250.     self.y = @battler.screen_y
  251.     self.z = @battler.screen_z
  252.     [url=home.php?mod=space&uid=287812]@mx[/url] = self.bitmap.height
  253.     if @battler.is_a?(Game_Actor)
  254.         @sprite_contens.bitmap.clear
  255.         @sprite_contens.x = @battler.screen_x - 30
  256.         @sprite_contens.y = @battler.screen_y  - @mx -  20
  257.         @sprite_contens.z = self.z
  258.         draw_actor_name(@battler, 0,@mx)
  259.         draw_battle_hp(@battler, 0,0)
  260.       elsif @battler.is_a?(Game_Enemy)
  261.         @sprite_contens.bitmap.clear
  262.         @sprite_contens.x = @battler.screen_x - 30
  263.         @sprite_contens.y = @battler.screen_y - 20
  264.         draw_actor_name(@battler, 0, 0)
  265.       end
  266.     end
  267.    end
复制代码
梦石
0
星屑
55
在线时间
218 小时
注册时间
2013-12-17
回帖
368
发表于 2014-10-17 20:33:53 | 显示全部楼层
尝试在第二次战斗回复的时候修改战斗者的状态。

点评

脚本贴上来了。。  发表于 2014-10-17 21:57
RM脚本定制/修改/整合 群:143356012(入群注明来意)
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2014-10-18 15:45:07 | 显示全部楼层
先试试看第一次战斗死亡用技能物品复活后会不会变吧
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

幻想天神

梦石
0
星屑
55
在线时间
166 小时
注册时间
2012-3-24
回帖
355
发表于 2014-10-18 17:49:54 | 显示全部楼层
应该是提前修改战斗图吧。。吼吼
回复

使用道具 举报

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
回帖
1223
发表于 2014-10-19 07:29:22 | 显示全部楼层
本帖最后由 恐惧剑刃 于 2014-10-19 07:31 编辑

如果删掉复活脚本可以恢复正常的话(我总觉得不太可能!!!!)请删掉def initialize 以及下方的end
可能是重定义了方法。其实这个复活脚本和真移位一点边都不沾不会冲突。


初始化检测
  1. class Scene_Battle
  2.   def initialize
  3.     for actor in $game_party.actors
  4.       if actor.exist?
  5.         actor.startactive = "待机"
  6.       end
  7.     end
  8.   end
  9. end
复制代码
如果加入此脚本可以修复此BUG说明是初始化的问题,
看看Game_Battler 1中initialize部分的 @startactive = "待机"。


除此以外想不到其他可能!

点评

代入那个代码就OK了  发表于 2014-10-20 17:06

评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 塞糖

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部