If the state does not have a turn count then it will be the icon in the database.
What you're suggesting is tracking what turn the actor got inflicted and add one to the icon for each turn up to three and then remove state. That is more complicated in my opinion.
the state icons for the code I wrote will be there for the each actor. If the state is not removed at the end of battle, then it will be in the menu.(if you have states shown in the menu)
By default poison does not get removed at end of battle or by steps or turns etc. So until it is cured it will always be the poison icon.
Sleep and paralysis have turns, so they will have changing icons.
Also note that states do not add on turns. If an actor inflicted with sleep has two turns left and then inflicted with sleep again it will change to 3-5 not 5-7, so it does not add on. Which I think is not your interest anyways.
*Scratch all that
I did a search for scripts in my folder and found one by Grilled Paste (google translate)
[ツクール 時々 スクリプト 後 自作ゲー 大体 赤ペヤ]<br> 主に、RPGツクールVX/Ace/MV/MZ 関連の何かをやっていきます。<br> <br>
mata-tuku.ldblog.jp
I modified it to have a hard limit of 3. So when inflicted it starts at three turns (if the state applies that many.
This also only changes the icon in battle.
You were right about the draw_actor_icons, I just didn't see how, because I was looking at the code and thinking it needs to be changed at the actor level.
Here is the modified script. It starts at icon 3 then goes to 2 then 1. so your icon set will need to have the icons reversed from what you showed.
Ruby:
=begin
#==============================================================================
[Name] Display of remaining turns of state + α
[Author] Grilled paste
[Distributor] Relaxing Maker miscellaneous goods
http://mata-tuku.ldblog.jp/
# ------------------------------------------------- -----------------------------
[Change log]・2012/10/28 public
・2012/12/01 Bug fixes. Added "Hide state icon with display priority 0" function
Moddified by Roninator2 to change icon and not show number
#==============================================================================
#------------------------------------------------------------------------------
[Correspondence]
・ Only RGSS3 is possible
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
[function]
-Only during battle, the number of remaining turns of state and ability change
is displayed on the icon.
-Hide the icon of the state where the display priority is 0.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
[how to use]
-There is no special operation. Just install this script and it will work.
#------------------------------------------------------------------------------
[Redefined part]
・Window_Base の draw_actor_icons
#------------------------------------------------------------------------------
[○: New definition, ◎: Alias definition, ●: Redefinition]
#------------------------------------------------------------------------------
=end
$YkNr_Scripts ||= {}
$YkNr_Scripts[:ShowStatesTurns] = true
# * If you do not use this script, set ↑ to false.
if $YkNr_Scripts[:ShowStatesTurns]
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ◎ Get the current state as an array of icon numbers
#--------------------------------------------------------------------------
alias yknr_ShowStatesTurnsGame_BattlerBase_state_icons :state_icons
def state_icons
states = self.states.select {|state| !state.priority.zero? }
yknr_ShowStatesTurnsGame_BattlerBase_state_icons
end
#--------------------------------------------------------------------------
# ○ Get the current state as an array of the number of remaining turns
#--------------------------------------------------------------------------
def state_turns
turns = []
states.each do |s|
if !s.icon_index.zero?
is_turn = !s.auto_removal_timing.zero? && !s.priority.zero?
turn = is_turn ? @state_turns[s.id].truncate : -1
turns.push(turn)
end
end
turns
end
#--------------------------------------------------------------------------
# ○ Get the current enhancement /
# weakness in an array of the number of remaining turns
#--------------------------------------------------------------------------
def buff_turns
turns = []
@buffs.each_with_index do |lv, i|
turns.push(@buff_turns[i].truncate) if !lv.zero?
end
turns
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● Draw state and enhancement / weakness icons
#--------------------------------------------------------------------------
def draw_actor_icons(actor, x, y, width = 96)
last_font = contents.font.clone
contents.font.size = 19
contents.font.bold = true
contents.font.color = crisis_color
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
turns = (actor.state_turns + actor.buff_turns)[0, width / 24]
turns.each_with_index do |n, i|
turns[i] = 2 if n > 2
end
icons.each_with_index do |n, i|
draw_icon(n + turns[i], x + 24 * i, y)
#~ if $game_party.in_battle && turns[i] != -1
#~ draw_text(x + 24 * i, y, 24, line_height, turns[i] + 1, 2)
#~ end
end
contents.font = last_font
end
end
end # $YkNr_Scripts