查看: 1507|回复: 6

[原创发布] 【脚本】指定N次战斗后消除的状态

[复制链接]
梦石
0
星屑
42235
在线时间
6017 小时
注册时间
2006-11-10
回帖
6966
发表于 2025-3-5 10:12:07 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 灯笼菜刀王 于 2025-3-5 10:15 编辑

一个小脚本,看到有这类需求就写一下

使用方法: 把脚本塞到main之前, 然后事件脚本写: 吃猫饭(角色id,状态id,持续场次)
                 ※ 角色id填-1时为全员,填0时为道具使用对象

栗子:  吃猫饭(1,2,3)  #=>1号角色获得2号状态,持续3场战斗后解除, 状态在3次战斗期间因其他原因解除也没影响, 要同时附加多个状态就再写一句

附赠一个获得道具/技能使用对象的id函数 : $target_id

冲突: 改动了 def use_item_to_actors , 有冲突就把备注里的那句移动到对方脚本的对应位置, 然后删掉 42-49行即可

[pre lang="ruby"]#-----------------------------------------------------
# 指定N次战斗后消除的状态    By:灯笼菜刀王
#
# 使用方法, 事件脚本写: 吃猫饭(角色id,状态id,持续场次)
# ※ 角色id填-1时为全员,填0时为道具使用对象
#-----------------------------------------------------
class Game_Interpreter
  def 吃猫饭(actor_id,state_id,turn)
    return if turn < 1 or actor_id < -1
    if actor_id == -1
      $game_party.members.each{|i| i.add_state(state_id)}
      b = "members.each{|i| i.remove_state(#{state_id})}"
    else
      actor_id = $target_id if actor_id == 0 and $target_id != nil
      $game_actors[actor_id].add_state(state_id)
      b = "$game_actors[#{actor_id}].remove_state(#{state_id})"
    end
    $game_party.battle_end_inter_push(turn,b)
  end
end
class Game_Party < Game_Unit
  attr_accessor :battle_end_inter
  alias :old_initialize :initialize
  def initialize
    old_initialize
    @battle_end_inter = []
  end
  def battle_end_inter_push(turn,s)
    if @battle_end_inter[turn - 1].nil?
      @battle_end_inter[turn - 1] = s
    else
      @battle_end_inter[turn - 1] += ";#{s}"
    end
  end
  def on_battle_end
    super
    if (r=@battle_end_inter.shift) != nil
      eval(r)
    end
  end
end
class Scene_ItemBase < Scene_MenuBase
  def use_item_to_actors
    item_target_actors.each do |target|
      $target_id = target.id #冲突就把这句移动过去,然后删掉42-49行
      item.repeats.times { target.item_apply(user, item) }
    end
  end
end
class Scene_Battle < Scene_Base
  alias :old_apply_item_effects :apply_item_effects
  def apply_item_effects(target, item)
    $target_id = target.id
    old_apply_item_effects(target, item)
  end
end[/pre]
梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2025-3-5 10:58:08 | 显示全部楼层
又是这个ID又是这个函数,不懂哦,只会插脚本。要配合什么脚本用吗?还是这个直接用呀?
回复

使用道具 举报

梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2025-3-5 11:00:12 | 显示全部楼层
怎么填写呀,角色ID是1  要怎么写呀

点评

看栗子  发表于 2025-3-5 11:11
回复

使用道具 举报

梦石
0
星屑
2859
在线时间
661 小时
注册时间
2012-5-3
回帖
76

开拓者

发表于 2025-3-5 18:50:02 | 显示全部楼层
djs789783 发表于 2025-3-5 11:00
怎么填写呀,角色ID是1  要怎么写呀

作者都已经说的很清楚了,使用方法, 事件脚本写: 吃猫饭(角色id,状态id,持续场次),你好歹自己要动脑筋研究一下吧。。。。
回复

使用道具 举报

梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2025-3-6 03:18:13 | 显示全部楼层
邱小谦 发表于 2025-3-5 18:50
作者都已经说的很清楚了,使用方法, 事件脚本写: 吃猫饭(角色id,状态id,持续场次),你好歹自己要动脑筋研 ...

这个知道啊,我试了,出错了,而且他还有未完成的。

对了,请问有没有可以让物品添加HP的方法?像那个什么破限只能在护甲类添加HP<MAXHP: +45000>物品的有没有办法?添加?
回复

使用道具 举报

梦石
0
星屑
719
在线时间
124 小时
注册时间
2024-4-13
回帖
25
发表于 2025-3-6 08:46:30 | 显示全部楼层
本帖最后由 chen12311 于 2025-3-6 10:51 编辑
djs789783
这个知道啊,我试了,出错了,而且他还有未完成的。
对了,请问有没有可以让物品添加HP的方法?像那个什么破限只能在护甲类添加HP<MAXHP: +45000>物品的有没有办法?添加?

不是很明白你说的话,但你试试看这个
  1. module Armo_MAX
  2.   Note= /<MAXHP[::] (\d+)>/
  3. end
  4. class RPG::EquipItem
  5.   def Armor_NOTE
  6.     @note =~ Armo_MAX::Note ? $1.to_i : nil
  7.   end
  8. end
  9. class Game_Actor < Game_Battler
  10. #  def param_max(param_id) #这段毫无意义
  11. #    return 99999 if param_id == 0  # MHP
  12. #    return 9999   if param_id == 1  # MMP
  13. #    return 999
  14. #  end
  15.   def armor_mhp
  16.     a=0
  17.     armors.each do|armor|
  18.       next unless armor.Armor_NOTE
  19.       a=armor.Armor_NOTE
  20.     end
  21.     a
  22.   end
  23.   def param(param_id)
  24.     return super unless param_id==0 && armor_mhp
  25.     value = param_base(param_id) + param_plus(param_id)
  26.     value *= param_rate(param_id) * param_buff_rate(param_id)
  27.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i + armor_mhp
  28.   end
  29. end
复制代码

在护甲备注加<MAXHP: (MHP)>
好累,想摸鱼.......
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部