State Duration Rates
State Duration Ratesby lilyWhite
While VX Ace allows you to modify individual characters' chance of being afflicted by states, there is no way by default to allow modifiers on how long a state lasts. This script allows you to use element rates as modifiers on the duration of states. This is completely independent of the rate of inflicting the state, so this can be used, for example, to have enemies that are easily afflicted by a state but shake it off quickly or enemies that are difficult to land a state on but have it last a very long time.
To use, add this notetag to the state notes, where "x" is the number of the element rate you wish to use for the state:
Code:
<stateelem: x>
Then simply assign the element rate as normal. (i.e. >100% = longer duration, <100% = shorter duration)
Free for use in any commercial or non-commercial project! Credit to "lilyWhite"; I reserve the right to be slightly miffed if you get the capitalization wrong. :3
The script is within the spoiler below. Just copy into the Script Editor—no configuration required!
Spoiler Code:
=begin
= State Duration Rates, by lilyWhite =
This simple little script allows you to use element rates as a modifier to
the duration of states.
To use, add this notetag to the state:
<stateelem: x>
where x is the number of the element rate you wish to assign to the state.
Then simply assign the relevant element rate to whatever as usual. The
resulting duration rounds to the nearest number, up or down.
Usage: Free to use in any commercial or non-commercial project! Credit to
"lilyWhite"; I reserve the right to be slightly miffed if you get the
capitalization wrong. :3
=end
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Alias reset_state_counts
#--------------------------------------------------------------------------
alias elem_rate_state_counts reset_state_counts
def reset_state_counts(state_id)
elem_rate_state_counts(state_id)
state = $data_states
if stateelem(state)
@state_turns = (@state_turns * element_rate(stateelem(state))).round
@state_steps = (@state_steps * element_rate(stateelem(state))).round
end
end
#--------------------------------------------------------------------------
# * Get State Element Rate
#--------------------------------------------------------------------------
def stateelem(state)
if state.note =~ /<stateelem: (\d+)>/i
return $1.to_i
end
end
end
本贴来自国际rpgmaker官方论坛作者:stupid enough to like FF13处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/state-duration-rates.58920/
页:
[1]