Solved - Neon Black Stacking States - Add Stack Count

So I figured it out 😀 I have a habit of figuring things out as soon as I ask for help...

Here's the added code, frankenstein'd in some stuff from Yanfly's Buff and State Manager:

#==============================================================================# ■ Window_Base#==============================================================================class Window_Base < Window #-------------------------------------------------------------------------- # alias method: draw_actor_icons #-------------------------------------------------------------------------- alias window_base_draw_actor_icons_bsm draw_actor_icons def draw_actor_icons(actor, dx, dy, dw = 96) window_base_draw_actor_icons_bsm(actor, dx, dy, dw) draw_actor_icon_stacks(actor, dx, dy, dw) end #-------------------------------------------------------------------------- # new method: draw_actor_icon_stacks #-------------------------------------------------------------------------- def draw_actor_icon_stacks(actor, dx, dy, dw) return unless SceneManager.scene_is?(Scene_Battle) reset_font_settings contents.font.out_color.alpha = 255 contents.font.size = 18 dy += -4 #--- actor.states.uniq.each do |state| stack_count = actor.state_stack(state.id) next if state.icon_index <= 0 draw_text(dx, dy, 24, line_height, stack_count, 2) dx += 24 end contents.font.out_color = Font.default_out_color reset_font_settings end end # Window_BaseNo guarantees of it working bug-free, I just barely got it working on my end and as should be evident here, I have no idea what I'm doing.

Spoiler
Neon Black's Stacking States: http://forums.rpgmakerweb.com/index.php?/topic/14110-stacking-states/
 
I'm trying to add some small text to the state icon showing how many stacks that state has (instead of changing the icon like the script already does). I've got the state count working, buuuuuut...well, it gets weird.
 
IZMW9qJ.png

 
The second state here is the one that's supposed to have four stacks, not the first. If I try to increment dx (dx += 24) with each iteration of the 'for state in...' loop, it just copies the stack_count over and over.
 
My addition, frankenstein'd from Yanfly's Buff and State Manager:
Code:
#==============================================================================# ■ Window_Base#==============================================================================class Window_Base < Window    #--------------------------------------------------------------------------  # alias method: draw_actor_icons  #--------------------------------------------------------------------------  alias window_base_draw_actor_icons_bsm draw_actor_icons  def draw_actor_icons(actor, dx, dy, dw = 96)    window_base_draw_actor_icons_bsm(actor, dx, dy, dw)    draw_actor_icon_stacks(actor, dx, dy, dw)  end    #--------------------------------------------------------------------------  # new method: draw_actor_icon_stacks  #--------------------------------------------------------------------------  def draw_actor_icon_stacks(actor, dx, dy, dw)    return unless SceneManager.scene_is?(Scene_Battle)    reset_font_settings    contents.font.out_color.alpha = 255    contents.font.bold = true    contents.font.size = 18    bx = dx    dy += -4    #---    for state in actor.states      stack_count = actor.state_stack(state.id)      break if dx + 24 >= dw + bx      next if state.icon_index <= 0      if state.auto_removal_timing > 0        draw_text(dx, dy, 24, line_height, stack_count, 2)      end    end    #---    contents.font.out_color = Font.default_out_color    reset_font_settings  end  end # Window_Base
So did you not use Buff and State Manager? 

I tried to put that in as is along with it and it gave me a stack too deep message.

I know the reason for it, I was just curious.

Original thread: https://forums.rpgmakerweb.com/threads/solved-neon-black-stacking-states-add-stack-count.38994/