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

Project1

 找回密码
 注册会员
搜索
查看: 2488|回复: 6

[已经解决] 每回合自动回血回蓝或损血的脚本跳字問題

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2240
在线时间
416 小时
注册时间
2016-10-1
帖子
42
发表于 2020-3-31 15:33:04 | 显示全部楼层 |阅读模式

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

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

x


以下是我使用的每回合自动回血回蓝或损血的脚本,但是有个问题,这个脚本若是同时有回血跟损血的状态,战斗中跳字会变成只有损血,没有回血字样(绿色的数字),经过测试跟脚本的放置顺序有关
  1. # HP回復小
  2.     if battler.state?(3) and battler.hp >0  #-恢复生命
  3.       battler.hp_recover_effect_10
  4.       battler.damage_pop["hp_plus"] = true
  5.     end                                                                                    #HP傷害小
  6.     if battler.state?(3) and battler.hp >0  #-生命傷害
  7.        battler.hp_recover_effect_14
  8.       battler.damage_pop["hp_plus"] = true
  9.     end  
复制代码

如果说HP伤害放置在 HP回复的下面,战斗跳字就会只显示损血,反之跳字就会是回血字样,游戏中计算血量的方式是正常的,只是跳字问题
有办法能解决吗?
以下完整脚本



  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● リフレッシュ
  9.   #--------------------------------------------------------------------------
  10.   def refresh_phase(battler)
  11.     battler.at -= @max
  12.     if battler.movable?
  13.       battler.atp = 100 * battler.at / @max
  14.     end
  15.     spell_reset(battler)
  16.    #########################狀態判斷#################################
  17.     # 連續傷害
  18.     if battler.hp > 0 and battler.slip_damage?
  19.       battler.slip_damage_effect
  20.       battler.damage_pop["slip"] = true
  21.     end
  22.     # HP回復小
  23.     if battler.state?(3) and battler.hp >0  #-恢复生命
  24.       battler.hp_recover_effect_10
  25.       battler.damage_pop["hp_plus"] = true
  26.     end
  27.     # SP回復小
  28.     if battler.state?(3) and battler.hp >0  #-SP恢復
  29.       battler.sp_recover_effect_11
  30.       battler.damage_pop["sp_plus"] = true
  31.     end
  32.     # HP傷害小
  33.     if battler.state?(3) and battler.hp >0  #-生命傷害
  34.        battler.hp_recover_effect_14
  35.       battler.damage_pop["hp_plus"] = true
  36.     end
  37.     # SP傷害小
  38.     if battler.state?(3) and battler.hp >0  #-SP傷害
  39.       battler.sp_recover_effect_15
  40.       battler.damage_pop["sp_plus"] = true
  41.     end
  42.    
  43.    
  44.    #####################狀態判斷結束###################################
  45.     # ステート自然解除
  46.     battler.remove_states_auto
  47.     # ステータスウィンドウをリフレッシュ
  48.     status_refresh(battler, true)
  49.     unless battler.movable?
  50.       return
  51.     end
  52.     # ターン数カウント
  53.     @turn_cnt += 1
  54.   end
  55. end

  56. class Game_Battler
  57.   # HP
  58.   def hp_common
  59.     # 分散
  60.     if self.damage["hp_plus"].abs > 0
  61.       amp = [self.damage["hp_plus"].abs * 15 / 100, 1].max
  62.      self.damage["hp_plus"] += rand(amp+1) + rand(amp+1) - amp
  63.     end
  64.     # HP からダメージを減算
  65.     self.hp -= self.damage["hp_plus"]
  66.   end
  67.   ######################定義HP傷害#######################################
  68.   def hp_recover_effect_10
  69.     # ダメージを設定
  70.     self.damage["hp_plus"] = -self.maxhp / 5
  71.    
  72.     # 分散 and 減算
  73.     hp_common
  74.     # メソッド終了
  75.     return true
  76.   end
  77.   
  78.   def hp_recover_effect_14
  79.     # ダメージを設定
  80.     self.damage["hp_plus"] = self.maxhp / 10
  81.    
  82.     # 分散 and 減算
  83.     hp_common
  84.     # メソッド終了
  85.     return true
  86.   end
  87.   
  88.   #####################定義HP傷害結束####################################
  89.   
  90.   # SP
  91.   def sp_common
  92.     # 分散
  93.     if self.damage_sp["sp_plus"].abs > 0
  94.       amp = [self.damage_sp["sp_plus"].abs * 15 / 100, 1].max
  95.       self.damage_sp["sp_plus"] += rand(amp+1) + rand(amp+1) - amp
  96.     end
  97.     # HP からダメージを減算
  98.     self.sp -= self.damage_sp["sp_plus"]
  99.   end
  100.   #####################定義SP傷害########################################
  101.   def sp_recover_effect_11
  102.     # ダメージを設定
  103.     self.damage_sp["sp_plus"] = -self.maxsp / 10
  104.     # SP からダメージを減算
  105.     sp_common
  106.     # メソッド終了
  107.     return true
  108.   end
  109.   
  110.   def sp_recover_effect_15
  111.     # ダメージを設定
  112.     self.damage_sp["sp_plus"] = self.maxsp / 15
  113.     # SP からダメージを減算
  114.     sp_common
  115.     # メソッド終了
  116.     return true
  117.   end
  118.   
  119.   ########################定義SP傷害結束######################################
  120. end

复制代码

Lv5.捕梦者

梦石
0
星屑
37749
在线时间
5383 小时
注册时间
2006-11-10
帖子
6545
发表于 2020-3-31 18:29:31 | 显示全部楼层
本帖最后由 灯笼菜刀王 于 2020-3-31 18:31 编辑

  搜索 "sp_plus" "hp_plus" 把加和减用不同的KEY就OK拉, 可能

点评

具体该如何使用呢?有点看不懂  发表于 2020-3-31 20:25
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
37749
在线时间
5383 小时
注册时间
2006-11-10
帖子
6545
发表于 2020-3-31 20:44:21 | 显示全部楼层
本帖最后由 灯笼菜刀王 于 2020-3-31 20:47 编辑
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● リフレッシュ
  9.   #--------------------------------------------------------------------------
  10.   def refresh_phase(battler)
  11.     battler.at -= @max
  12.     if battler.movable?
  13.       battler.atp = 100 * battler.at / @max
  14.     end
  15.     spell_reset(battler)
  16.    #########################狀態判斷#################################
  17.     # 連續傷害
  18.     if battler.hp > 0 and battler.slip_damage?
  19.       battler.slip_damage_effect
  20.       battler.damage_pop["slip"] = true
  21.     end
  22.     # HP回復小
  23.     if battler.state?(3) and battler.hp >0  #-恢复生命
  24.       battler.hp_recover_effect_10
  25.       battler.damage_pop["hp_plus1"] = true
  26.     end
  27.     # SP回復小
  28.     if battler.state?(3) and battler.hp >0  #-SP恢復
  29.       battler.sp_recover_effect_11
  30.       battler.damage_pop["sp_plus1"] = true
  31.     end
  32.     # HP傷害小
  33.     if battler.state?(3) and battler.hp >0  #-生命傷害
  34.        battler.hp_recover_effect_14
  35.       battler.damage_pop["hp_plus"] = true
  36.     end
  37.     # SP傷害小
  38.     if battler.state?(3) and battler.hp >0  #-SP傷害
  39.       battler.sp_recover_effect_15
  40.       battler.damage_pop["sp_plus"] = true
  41.     end
  42.    
  43.    
  44.    #####################狀態判斷結束###################################
  45.     # ステート自然解除
  46.     battler.remove_states_auto
  47.     # ステータスウィンドウをリフレッシュ
  48.     status_refresh(battler, true)
  49.     unless battler.movable?
  50.       return
  51.     end
  52.     # ターン数カウント
  53.     @turn_cnt += 1
  54.   end
  55. end

  56. class Game_Battler
  57.   # HP
  58.   def hp_common
  59.     # 分散
  60.     if self.damage["hp_plus"].abs > 0
  61.       amp = [self.damage["hp_plus"].abs * 15 / 100, 1].max
  62.      self.damage["hp_plus"] += rand(amp+1) + rand(amp+1) - amp
  63.     end
  64.     # HP からダメージを減算
  65.     self.hp -= self.damage["hp_plus"]
  66.   end
  67.   def hp_common1
  68.     # 分散
  69.     if self.damage["hp_plus1"].abs > 0
  70.       amp = [self.damage["hp_plus1"].abs * 15 / 100, 1].max
  71.      self.damage["hp_plus1"] += rand(amp+1) + rand(amp+1) - amp
  72.     end
  73.     # HP からダメージを減算
  74.     self.hp -= self.damage["hp_plus1"]
  75.   end
  76.   ######################定義HP傷害#######################################
  77.   def hp_recover_effect_10
  78.     # ダメージを設定
  79.     self.damage["hp_plus1"] = -self.maxhp / 5
  80.    
  81.     # 分散 and 減算
  82.     hp_common1
  83.     # メソッド終了
  84.     return true
  85.   end
  86.   
  87.   def hp_recover_effect_14
  88.     # ダメージを設定
  89.     self.damage["hp_plus"] = self.maxhp / 10
  90.    
  91.     # 分散 and 減算
  92.     hp_common
  93.     # メソッド終了
  94.     return true
  95.   end
  96.   
  97.   #####################定義HP傷害結束####################################
  98.   
  99.   # SP
  100.   def sp_common
  101.     # 分散
  102.     if self.damage_sp["sp_plus"].abs > 0
  103.       amp = [self.damage_sp["sp_plus"].abs * 15 / 100, 1].max
  104.       self.damage_sp["sp_plus"] += rand(amp+1) + rand(amp+1) - amp
  105.     end
  106.     # HP からダメージを減算
  107.     self.sp -= self.damage_sp["sp_plus"]
  108.   end
  109.   def sp_common1
  110.     # 分散
  111.     if self.damage_sp["sp_plus1"].abs > 0
  112.       amp = [self.damage_sp["sp_plus1"].abs * 15 / 100, 1].max
  113.       self.damage_sp["sp_plus1"] += rand(amp+1) + rand(amp+1) - amp
  114.     end
  115.     # HP からダメージを減算
  116.     self.sp -= self.damage_sp["sp_plus1"]
  117.   end
  118.   #####################定義SP傷害########################################
  119.   def sp_recover_effect_11
  120.     # ダメージを設定
  121.     self.damage_sp["sp_plus1"] = -self.maxsp / 10
  122.     # SP からダメージを減算
  123.     sp_common1
  124.     # メソッド終了
  125.     return true
  126.   end
  127.   
  128.   def sp_recover_effect_15
  129.     # ダメージを設定
  130.     self.damage_sp["sp_plus"] = self.maxsp / 15
  131.     # SP からダメージを減算
  132.     sp_common
  133.     # メソッド終了
  134.     return true
  135.   end
  136.   
  137.   ########################定義SP傷害結束######################################
  138. end

复制代码


  你的这段脚本只是进行伤害计算, 并没有显示伤害的处理,如果这样改可以那就没事,如果还不行那就要继续去 sprite battler 里去给它们做区分

评分

参与人数 2星屑 +100 +2 收起 理由
RyanBern + 100 + 1 认可答案
mmm999xp + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2240
在线时间
416 小时
注册时间
2016-10-1
帖子
42
 楼主| 发表于 2020-3-31 21:55:17 | 显示全部楼层
灯笼菜刀王 发表于 2020-3-31 20:44
你的这段脚本只是进行伤害计算, 并没有显示伤害的处理,如果这样改可以那就没事,如果还不行那 ...

谢谢你提供的方法,虽然解决了我文中的问题,但是有一个新问题,就是同时持有多种补血状态时,只显示一种回血跳字,例如我设定3号跟4号状态都是每回合回血,角色同时持有3号跟4号状态时,似乎只显示4号状态的回血

点评

依样画葫芦,按同样的方法去区分KEY就行了  发表于 2020-3-31 22:59
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2240
在线时间
416 小时
注册时间
2016-10-1
帖子
42
 楼主| 发表于 2020-4-2 00:42:30 | 显示全部楼层
灯笼菜刀王 发表于 2020-3-31 20:44
你的这段脚本只是进行伤害计算, 并没有显示伤害的处理,如果这样改可以那就没事,如果还不行那 ...

太谢谢你了 问题解决了
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-18 13:55

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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