扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 135|回复: 0

[转载发布] ARPG用范围性影响能力值的技能

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-3-29 03:52
  • 签到天数: 127 天

    连续签到: 11 天

    [LV.7]常住居民III

    2349

    主题

    420

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    11309
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    14106

    灌水之王

    发表于 2024-4-19 18:36:23 | 显示全部楼层 |阅读模式
    先说明一下.此纯属搞着玩= =

    效果嘛.看下面的 flash.

    使用说明请看脚本开头处和范例里的公共事件 1 号.



    多余的话:
    Tilemap 的闪烁感觉边缘太硬了.
    换成 loop_animation 可能会好些.
    但是那样貌似会又把一些遮挡物、不可通行的图块给覆盖住= =
    要改 Tilemap 的闪烁颜色的话可以在脚本开头的 Colors 常量数组里改.
    其索引对应相应状态的 定量值
    还有就是想把范围矩形改成别的什么形状的话请自行处理= =
    这玩意还可以扩展一下做做技能冷却/限制什么的.
    当矩形消失的时候才能再次使用或使用别的这类技能.
    有兴趣的话就自己动手做吧.嗯.
    大概就是这样了.

    注意事项:
    同一个状态最好不要被多个技能使用.因为是以状态的ID为主键建立的范围矩形数据对象.

    范例:


    脚本:
    1. #==============================================================================# ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息#===============================================================================begin  脚本作者:后知后觉  脚本功能:应用于地图上的直接战斗            可以在地图上设置某个矩形范围内            在这个范围内影响战斗者的能力值            并能让这个范围闪烁以醒目  使用方法:数据库状态的设置            定量:定量用来设置闪烁的颜色.0~10.一共11种.其中0为不无闪烁效果            经过 A 回合后 B%几率解除            因为是直接在地图上作战.所以这个貌似没什么用了.我就拿来用用了.            A : 持续的时间.结果为 A * 20.                当 $game_system.update 被执行了 A * 20 次后该区域就消失            B : 范围的长度.                在生成范围的时候要求设置一个中心点的x、y坐标                以该点为中心.B*2+1 为边长的矩形            这个矩形内对能力值的影响效果就是该状态的效果.            使用脚本 ArpgAuxiliarySkill.new(x,y,state_id,target)            来声场这个矩形对象.            其中x、y为中心店坐标,state_id 为状态id            target 为作用对象类型.整数型.为 0 的时候对所有人有效.                   默认 1 为对角色有效.2为对敌人有效.这个可以自定义决定.                   只是用来做判断用.当要获取信息的时候传递进来的值与.new                   的时候所保存的值相吻合的时候才会对能力值有影响。          这些能力值的影响本应该写进 Game_Battler 里去的.          不过冲突啊什么的最讨厌了.所以还是你自己写进去吧.          具体的应用到实际的计算当中请参考范例的公共事件1号.=end$hzhj_ArpgAuxiliarySkill.call if $hzhj_ArpgAuxiliarySkillclass ArpgAuxiliarySkill  Colors = [0,            0xf00,            0x0f0,            0x00f,            0xff0,            0xf0f,            0x0ff,            0xfff,            0xf84,            0x8f4,            0x84f]  attr_reader :time  attr_reader :x  attr_reader :y  attr_reader :key  attr_reader :state  attr_reader :rating  attr_reader :range  attr_reader :target  attr_reader :start_x  attr_reader :start_y  attr_reader :end_x  attr_reader :end_y  def initialize(x, y, state_id, target = 0)    @x = x    @y = y    @key = state_id    @state = $data_states[state_id]    @time = @state.hold_turn * 20    @range = @state.auto_release_prob    @target = target    @rating = @state.rating    $game_system.hzhj_hash[@key] = self    set_flash_data  end  def update    if @time > 0      @time -= 1      return    end    $game_system.hzhj_hash[@key] = nil    reset_flash_data  end  def set_xyt(x, y, time)    @x = x    @y = y    @time = time    reset_flash_data  end  def set_flash_data    @start_x = [@x - @range, 0].max    @start_y = [@y - @range, 0].max    @end_x = [@x + @range, $game_map.width - 1].min    @end_y = [@y + @range, $game_map.height - 1].min    for i in @start_x..@end_x      for j in @start_y..@end_y        if $game_map.passable?(i, j, 0)          $game_map.flash_data[i, j] = Colors[@rating]        end      end    end  end  def reset_flash_data    $game_map.flash_data = Table.new($game_map.width, $game_map.height)    values = $game_system.hzhj_hash.values    values.delete(nil)    for hzhj in values.sort!{|a,b|a.rating - b.rating}      hzhj.set_flash_data    end  endendclass Hzhj_Hash < Hash  def initialize    super  end  def []=(key, value)    if self[key].nil?      super(key, value)    else      if value.nil?        super(key, value)      else        self[key].set_xyt(value.x, value.y, value.time)      end    end  end  def hit_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.hit_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def maxhp_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.maxhp_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def maxsp_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.maxsp_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def str_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.str_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def dex_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.dex_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def agi_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.agi_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def int_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.int_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def atk_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.atk_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def pdef_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.pdef_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def mdef_rate(x, y, target)    n = 100    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n *= hzhj.state.mdef_rate / 100.0          end        end      end    end    return Integer(n.round)  end  def eva(x, y, target)    n = 0    for hzhj in self.values      next if hzhj.nil?      if x.between?(hzhj.start_x, hzhj.end_x)        if y.between?(hzhj.start_y, hzhj.end_y)          if target == hzhj.target or hzhj.target == 0            n += hzhj.state.eva          end        end      end    end    return Integer(n)  endendclass Game_System  attr_reader :hzhj_hash  alias hzhj_hash_game_system_initialize initialize  def initialize    hzhj_hash_game_system_initialize    @hzhj_hash = Hzhj_Hash.new  end  alias hzhj_hash_game_system_update update  def update    hzhj_hash_game_system_update    @hzhj_hash.values.each{|hzhj|hzhj.update if not hzhj.nil?}  endendclass Game_Map  attr_accessor :flash_data  alias hzhj_hash_game_map_setup setup  def setup(*args)    hzhj_hash_game_map_setup(*args)    $game_system.hzhj_hash.clear    @flash_data = Table.new(width, height)  endendclass Spriteset_Map  alias hzhj_hash_spriteset_map_initialize initialize  def initialize    hzhj_hash_spriteset_map_initialize    @tilemap.flash_data = $game_map.flash_data    @tilemap.update  end  alias hzhj_hash_spriteset_map_update update  def update    if @tilemap.flash_data != $game_map.flash_data      @tilemap.flash_data = $game_map.flash_data    end    hzhj_hash_spriteset_map_update  endendcallcc{|$hzhj_ArpgAuxiliarySkill|}#==============================================================================# ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息#==============================================================================复制代码
    复制代码
                 本帖来自P1论坛作者后知后觉,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=157512  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-4-20 11:17 , Processed in 0.082489 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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