查看: 2171|回复: 8

[已经过期] 如何做出可叠加的“连续伤害”

[复制链接]
梦石
0
星屑
50
在线时间
35 小时
注册时间
2016-1-17
回帖
47
发表于 2016-8-11 23:06:26 | 显示全部楼层 |阅读模式

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

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

×
由于觉得游戏里光有中毒状态太单调了,于是没事找事想增加一个烧伤状态(每回合掉最大生命值2.5%)
结果找了很多脚本全都失败了。。。每回合掉血这种事只能从两个状态中优先选择一个,不能共存。(但如果一个状态掉/回血另一个状态掉/回蓝是可以的)
捣鼓了一晚上没什么结果,所以来请教大家。
梦石
0
星屑
50
在线时间
35 小时
注册时间
2016-1-17
回帖
47
 楼主| 发表于 2016-8-11 23:10:26 | 显示全部楼层
目前最有可能能成功的方案:
再网上找到了一个人写的脚本——
#--------------------------------------------------------------------------
  # ● 应用连续伤害效果
  #--------------------------------------------------------------------------
  def slip_damage_effect  
    # 设置伤害

      self.damage = self.maxhp / 10

      # 分散

      if self.damage.abs > 0

        amp = [self.damage.abs * 15 / 100, 1].max

        self.damage += rand(amp+1) + rand(amp+1) - amp

      end

      # HP 的伤害减法运算

      self.hp -= self.damage

修改一下比例就好了,若果要设定回复或者更高伤害,就设定几个新的状态,并在添加判断语句来实现。
比如3号状态为毒,伤害比例每回合最大生命值5%,4号状态为猛毒,伤害比例每回合最大生命值10%就可以这样
#--------------------------------------------------------------------------
  # ● 应用连续伤害效果
  #--------------------------------------------------------------------------
  def slip_damage_effect

    if self.state?(3)
  
    # 设置伤害

      self.damage = self.maxhp / 20

      # 分散

      if self.damage.abs > 0

        amp = [self.damage.abs * 15 / 100, 1].max

        self.damage += rand(amp+1) + rand(amp+1) - amp

      end

      # HP 的伤害减法运算

      self.hp -= self.damage
   
    #猛毒
      
    elsif self.state?(4)
      #设置伤害

      self.damage = self.maxhp / 10

      # 分散

      if self.damage.abs > 0

        amp = [self.damage.abs * 15 / 100, 1].max

        self.damage += rand(amp+1) + rand(amp+1) - amp

      end

      # HP 的伤害减法运算

      self.hp -= self.damage
      
      end
    # 过程结束
    return true
  end
不能扣血叠加,但另一项讯息是——
连续伤害的脚本帖出来看看,如果是if排列,那可以叠加,如果是elsif排列,那只能中一种,看看连续伤害的脚本怎么写的,将elsif全部改为if再补上end就可以实现叠加了。
可惜自己太笨试了半天都没成功。。。
要怎么修改这个脚本?


回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2016-8-12 10:52:19 | 显示全部楼层
本帖最后由 soulsaga 于 2016-8-12 10:55 编辑

能发一下你改过的脚本上来让大家看看什么问题么..

点评

脚本在发底下,忘记使用回复了。。。  发表于 2016-8-12 11:35
回复

使用道具 举报

梦石
0
星屑
50
在线时间
35 小时
注册时间
2016-1-17
回帖
47
 楼主| 发表于 2016-8-12 11:32:46 | 显示全部楼层
   1. 在Scene_Battle 4中的修改
    # 连续伤害
    if @active_battler.hp > 0 and @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
#烧伤
if @active_battler.state?(4) and @active_battler.hp >0  #-恢复魔法
      @active_battler.damage=@active_battler.maxhp/40#每回合造成最大生命2.5%的伤害
      @active_battler.damage=@active_battler.damage.to_i
      @active_battler.hp-=@active_battler.damage
      @active_battler.damage_pop = true
end
结果——失败,系统优先烧伤状态



但是,如果换成回血状态
     #自愈
   if @active_battler.state?(4) and @active_battler.hp >0  #-恢复魔法
      @active_battler.damage=-(@active_battler.maxhp-@active_battler.hp)/10#恢复生命百分比,这里设置为10%,也可设置固定值
      @active_battler.damage=@active_battler.damage.to_i
      @active_battler.hp-=@active_battler.damage
      @active_battler.damage_pop = true
    end
每回合回复已损失生命值10%,可以和中毒状态共存(先中毒扣血再自愈回血)
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2016-8-12 13:03:45 | 显示全部楼层
本帖最后由 soulsaga 于 2016-8-13 16:18 编辑
  1.   # ● 应用连续伤害效果
  2.   #--------------------------------------------------------------------------
  3.   def slip_damage_effect

  4.      if self.state?(3)
  5.    
  6.      # 设置伤害

  7.       self.damage = self.maxhp / 20

  8.        # 分散

  9.       if self.damage.abs > 0

  10.          amp = [self.damage.abs * 15 / 100, 1].max

  11.          self.damage += rand(amp+1) + rand(amp+1) - amp

  12.        # HP 的伤害减法运算

  13.       self.hp -= self.damage
  14.       return true
  15.       end
  16.       end
  17.    
  18.      #猛毒
  19.       
  20.      if self.state?(4)
  21.        #设置伤害

  22.       self.damage = self.maxhp / 10

  23.        # 分散

  24.       if self.damage.abs > 0

  25.          amp = [self.damage.abs * 15 / 100, 1].max

  26.          self.damage += rand(amp+1) + rand(amp+1) - amp

  27.        # HP 的伤害减法运算

  28.       self.hp -= self.damage
  29.       return true
  30.        end
  31.        end
  32. end
  33.      # 过程结束
复制代码

漏了DEF对应的END..补上..

评分

参与人数 1星屑 +5 收起 理由
夜狠简单 + 5 触瞎

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
35 小时
注册时间
2016-1-17
回帖
47
 楼主| 发表于 2016-8-12 13:24:57 | 显示全部楼层
soulsaga 发表于 2016-8-12 13:03
# ● 应用连续伤害效果
  #------------------------------------------------------------------------- ...

这个脚本不行,
如果直接复制在Game_Battler 3中,在战斗测试中会在攻击的时候回提示
self.damage *= elements_correct(attacker.element_set)     #Game_Battler 3第53行
出错了。

点评

补上一点:叫NoMethoderror  发表于 2016-8-12 13:31
回复

使用道具 举报

梦石
0
星屑
50
在线时间
35 小时
注册时间
2016-1-17
回帖
47
 楼主| 发表于 2016-8-12 14:01:54 | 显示全部楼层
不好意思,我刚刚仔细看来一下,发现烧伤和中毒两个状态的伤害使用之前的脚本可以叠加!!!
但由于系统只显示烧伤的数字而没有发现
因此问题基本已经解决(是从来没有问题好吧。。。)。
但如果还能锦上添花的那就是让数字显示烧伤和中毒的合计数值或者分别显示。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部