查看: 3108|回复: 2

[已经过期] 新人请教,XP里如何制作吸血技能,或者持续回复

[复制链接]
梦石
0
星屑
50
在线时间
6 小时
注册时间
2012-8-15
回帖
5
发表于 2017-5-9 17:48:00 | 显示全部楼层 |阅读模式

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

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

×
RT    脚本事件都可以……小白真的是弄不明白了……
梦石
1
星屑
24088
在线时间
3339 小时
注册时间
2011-7-8
回帖
3862

开拓者

发表于 2017-5-9 17:58:14 | 显示全部楼层
看我签名中的《战斗调用公共事件》
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复

使用道具 举报

梦石
0
星屑
1381
在线时间
295 小时
注册时间
2014-6-24
回帖
93
发表于 2017-5-12 18:42:38 | 显示全部楼层
现有的吸血脚本:
[pre lang="ruby"]#==============================================================================
# - 普通攻击简易吸血 -
# 只有学会特定技能的角色或敌人才可以吸血;
# 敌人要设置发动特技的条件,一个永远不被打开的开关;
# 为了方便起见,技能id越大视为吸血效果越好。
#==============================================================================
module Battler_XiXue
  Attack_Setup = {}
  #----------------------------------------------------------------------------
  # Attack_Setup[技能id] = [回复率, 触发概率, 分散度]
  #----------------------------------------------------------------------------
  Attack_Setup[113] = [20, 100, 1]
  Attack_Setup[114] = [30, 100, 1]
end
#==============================================================================
# - Game_Battler
#==============================================================================
class Game_Battler
  #----------------------------------------------------------------------------
  # 应用普通攻击效果
  #----------------------------------------------------------------------------
  alias :attack_effect_xixue_old :attack_effect
  def attack_effect(attacker)
    attack_effect_xixue_old(attacker)
    #--------------------------------------------------------------------------
    # 吸血判断
    #--------------------------------------------------------------------------
    if attacker.is_a?(Game_Actor)
      jj = attacker.skills & Battler_XiXue::Attack_Setup.keys
    else
      s = []
      for i in $data_enemies[attacker.id].actions
        s << i.skill_id
      end
      jj = s & Battler_XiXue::Attack_Setup.keys
    end
    #--------------------------------------------------------------------------
    # 吸血效果
    #--------------------------------------------------------------------------
    if jj.size > 0
      d = Battler_XiXue::Attack_Setup[jj.max]
      if self.damage.is_a?(Numeric) and self.damage > 0 and rand(100) < d[1]
        attacker.damage = 0 - self.damage * d[0] / 100
        d = attacker.damage * d[2] / 100
        d += 1 if d == 0
        f = 0 - d
        e = 0 - f
        v = [*e..f]
        attacker.damage += v[rand(v.size)]
        attacker.hp -= attacker.damage
      end
    end
  end
end
#==============================================================================
# - Scene_Battle 显示吸血效果 默认用
#==============================================================================
class Scene_Battle
  alias :update_phase4_step5_xixue_old :update_phase4_step5
  def update_phase4_step5
    update_phase4_step5_xixue_old
    if @active_battler.damage
      @active_battler.damage_pop = true
    end
  end
end
=begin
#==============================================================================
# - Scene_Battle 显示吸血效果 真移位用
#==============================================================================
class Scene_Battle
  alias :update_phase4_step4_xixue_old :update_phase4_step4
  def update_phase4_step4
    if @active_battler.damage
      @active_battler.damage_pop = true
    end
    update_phase4_step4_xixue_old
  end
end
#==============================================================================
# - Scene_Battle 显示吸血效果(字体颜色) 真移位追加
#==============================================================================
class Bitmap
  def draw_number(x, y, number,o,picture = RPG::Cache.system("number"))
    w = picture.width / 10
    h = picture.height / 5
    rect = Rect.new(0,0,w,h)
    if number.is_a?(Numeric)
      rect.set(0,h*2,w,h) if number < 0
      number = number.abs
    end
    number = number.to_s
    array = number.split(//)
    for i in 0...array.size
      array = array.to_i
    end
    case o
    when 1
      x += 81 - (array.size * 9)
    when 2
    end
    if number == "Miss"
      self.blt(x,y,picture,Rect.new(0,h*3,picture.width,h))
      return
    end
    for sz in array
      rect.x = sz * w
      self.blt(x,y,picture,rect)
      x += w
    end
  end
end
module RPG
  class Sprite < ::Sprite
    def damage(value, critical)
      dispose_damage
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_number(0, 12, value, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
  end
end
=end
[/pre]
自行修改 Attack_Setup[技能id] = [回复率, 触发概率, 分散度]

持续回血有点麻烦,但可以实现,楼主请跟着我的步骤修改脚本:

搜索 Game_Battler 3 “应用连续伤害效果” 也可以全局搜索def slip_damage_effect
将[pre lang="ruby"]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
    # 过程结束
    return true
  end[/pre]
改为:[pre lang="ruby"]def slip_damage_effect
    # 设定伤害
    if self.state?(20) # 持续回血的状态
      self.damage = -150#(每回合自动回血量)
    else
      self.damage = self.hp / 10
    end
    # 分散
    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
    # 过程结束
    return true
  end[/pre]
QQ图片20170512184042.png
还有,该状态必须勾选“连续伤害”,比如你要制作一个能持续回血的技能,那么技能就要附加这个状态才行

评分

参与人数 1梦石 +1 收起 理由
guoxiaomi + 1 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部