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

Project1

 找回密码
 注册会员
搜索
查看: 169|回复: 5
打印 上一主题 下一主题

[有事请教] 如何才能做到受到一定次数攻击就消失的状态?跪求大佬!

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2030
在线时间
179 小时
注册时间
2022-6-24
帖子
178
跳转到指定楼层
1
发表于 2024-7-11 21:46:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 ACRI 于 2024-7-12 01:35 编辑

如标题所说,就是想做一种,受到两三次攻击,然后就会消失的状态。
因为想要制作出弱多段攻击的boss,不论是什么办法都行,有什么脚本能做到,或者是事件都行!
站内倒是有个受到一次攻击就消失的状态脚本,但是有点不符合吧()

站内的类似脚本链接:https://rpg.blue/thread-400654-1-1.htmlhttps://rpg.blue/thread-411803-1-1.html

点评

如果能有两种方式就更好了,一种概率,一种固定次数的(在妄想中)  发表于 2024-7-12 01:33
在尝试做游戏了,但还是个菜狗(结果现在编程,音乐和剧情设计没开始学,画画也暂时没时间学了(;д;))

(个人精神状况不是很好,有时会说出一些奇怪且根本没法理解意思的话,直接无视就好,如果说出的话不小心冒犯到你,我会在精神状况良好时和你道歉的(`・ω・´)(不过一般在感觉到不适时会直接下线,请勿过于担心))

Lv2.观梦者

梦石
0
星屑
471
在线时间
68 小时
注册时间
2023-7-26
帖子
8
2
发表于 2024-7-13 19:42:51 | 只看该作者
翻到过这种脚本
你看看行不行

攻击次数解除.7z

1.15 KB, 下载次数: 2

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1407
在线时间
170 小时
注册时间
2019-10-4
帖子
232
3
发表于 2024-7-14 00:16:30 | 只看该作者
武器添加状态,添加等多个状态,然后添加负增益状态、抵消状态就可以。理论上是这样,实际我没有操作过
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6755
在线时间
593 小时
注册时间
2017-11-10
帖子
688

极短21参与

4
发表于 2025-2-4 22:23:31 | 只看该作者
=begin
#===============================================================================
Title: 状态充能
Author: Hime
Date: Jun 14, 2015
--------------------------------------------------------------------------------
** Change log
Jun 14, 2015
   - only reset state counts if state is still applied
Mar 22, 2014
   - fixed bug where states with charges are not removed after battle
Feb 28, 2014
   - state is correctly removed when charges drop to zero
Nov 16, 2013
   - is it possible to have the state but no state charge recorded?
Sep 14, 2013
   - added some methods for adding/removing state charges
Jun 23, 2013
   - Initial release
--------------------------------------------------------------------------------   
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Hime Works in your project
* Preserve this header
--------------------------------------------------------------------------------
** 说明

此脚本可以让状态有“充能”的效果,要求状态彻底移除前,需要被移除的次数
例如某个状态有3次充能,则状态移除3次后才会真正被移除.

这和“状态堆叠”不同,因为状态充能并不会让状态多次附加。
--------------------------------------------------------------------------------
** Installation

Place this script below Materials and above Main.
如果和 Yanfly的状态管理 同时使用, 请放在其之下

--------------------------------------------------------------------------------
** 使用方法

使用状态备注:

   <state charges: x>
   
  代表状态附加时,充能x次.

#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_StateCharges"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
  module State_Charges
   
    Regex = /<state[-_ ]charges: (\d+)>/i
  end
end
#===============================================================================
# ** Rest of the script
#===============================================================================
module RPG
  class State
    def state_charges
      return @state_charges unless @state_charges.nil?
      load_notetag_state_charges
      return @state_charges
    end
   
    def load_notetag_state_charges
      res = self.note.match(TH::State_Charges::Regex)
      @state_charges = res ? res[1].to_i : 1
    end
  end
end

class Game_BattlerBase
  
  alias :th_state_charges_clear_states :clear_states
  def clear_states
    th_state_charges_clear_states
    @state_charges = {}
  end
  
  alias :th_state_charges_erase_state :erase_state
  def erase_state(state_id)
    th_state_charges_erase_state(state_id)
    @state_charges.delete(state_id)
  end
end

class Game_Battler < Game_BattlerBase
  
  alias :th_state_charges_remove_state :remove_state
  def remove_state(state_id)
    if has_state_charges?(state_id)
      remove_state_charges(state_id, 1)
      reset_state_counts(state_id) if state?(state_id)
    else
      th_state_charges_remove_state(state_id)
    end
  end
  
  alias :th_state_charges_add_new_state :add_new_state
  def add_new_state(state_id)
    set_state_charges(state_id, $data_states[state_id].state_charges)
    th_state_charges_add_new_state(state_id)
  end
  
  def state_charges(state_id)
    return @state_charges[state_id]
  end
  
  def set_state_charges(state_id, amount)
    @state_charges[state_id] = amount
  end
  
  def add_state_charges(state_id, amount)
    @state_charges[state_id] += amount
  end
  
  def remove_state_charges(state_id, amount)
    @state_charges[state_id] = [@state_charges[state_id]-amount, 0].max
    th_state_charges_remove_state(state_id) if @state_charges[state_id] == 0
  end
  
  def has_state_charges?(state_id)
    return state?(state_id) && @state_charges[state_id] && @state_charges[state_id] > 0
  end
  
  alias :th_state_charges_remove_battle_states :remove_battle_states
  def remove_battle_states
    remove_battle_state_charges
    th_state_charges_remove_battle_states
  end
  
  #-----------------------------------------------------------------------------
  # New.
  #-----------------------------------------------------------------------------
  def remove_battle_state_charges
    states.each do |state|
      @state_charges[state.id] = 0 if state.remove_at_battle_end
    end
  end
end

点评

状态A设置成”受到攻击时100%解除“;然后脚本里设置次数 X  发表于 2025-2-4 22:27
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-23 19:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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