Yanfly's Ace Engine doesn't refresh enough ?

I made that script (I don't know how to cde in ruby btw, im just copying stuff) which change the MP system into a shared pool. Except I use Yanfly's Ace engine, and in his engine, the MP's gauge only update on the active player's turn. Where am i supposed to edit to make their MP's gauges refresh after each attack ?

Code:
module SHARED_MP  endclass Game_BattlerBase    def skill_cost_payable?(skill)    tp >= skill_tp_cost(skill) && totalmp >= skill_mp_cost(skill)  end    def totalmp    x = $game_party.battle_members[0].mp    x = x + $game_party.battle_members[1].mp rescue x    x = x + $game_party.battle_members[2].mp rescue x    x = x + $game_party.battle_members[3].mp rescue x      return x  end    def mp=(mp)    @mp = mp    refresh  end      def pay_skill_cost(skill)#~    self.mp -= skill_mp_cost(skill)    varskill_mp_cost = skill_mp_cost(skill)    if actor?        for i in 0..3          varmp = $game_party.battle_members[i].mp rescue -1          if varmp >= varskill_mp_cost            $game_party.battle_members[i].mp -= varskill_mp_cost            varskill_mp_cost = 0          elsif varmp > 0             varskill_mp_cost -= $game_party.battle_members[i].mp            $game_party.battle_members[i].mp = 0          else          end      end        self.tp -= skill_tp_cost(skill)    end      endend
I kinda solved the problem by myself.

I changed Yanfly's draw_item(index) so each time it's called, it updates the draw_actor_mp for all 4 members (with a for statement).

class Window_BattleStatus < Window_Selectable

  #--------------------------------------------------------------------------

  # overwrite method: draw_item

  #--------------------------------------------------------------------------

  def draw_item(index)

    return if index.nil?

    clear_item(index)

    for index in 0...3

      actor = battle_members[index]

      rect = item_rect(index)

      return if actor.nil?

      draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)

      draw_actor_name(actor, rect.x, rect.y, rect.width-8)

      draw_actor_action(actor, rect.x, rect.y)

      draw_actor_icons(actor, rect.x, line_height*1, rect.width)

      gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS

      contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE

      draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)

      if draw_tp?(actor) && draw_mp?(actor)

        w = rect.width/2-2

        dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE

        draw_actor_tp(actor, rect.x+2, line_height*3, dw)

        dw = rect.width - rect.width/2 - 2

        draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)

      elsif draw_tp?(actor) && !draw_mp?(actor)

        draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)

      else

        draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)

      end

    end

  end

end
But it's kind of cheap ? And take more ressources? Dunno you tell me if you have advices, but the core issue is gone.
Mmm ...


I would expect a few things to go wrong there ...


What happens if you only have 2 or 3 actors? Does it crash?


I would expect the non-active battlers (those who are waiting their turn) would end up with text writing over itself, as you're not clearing theirs - only the current actor's.


You either need to put the clear_item(index) into the loop as well, or put JUST the redrawing of the MP into the "process all actors" loop ('cause you don't really want to redraw EVERYTHING for each actor, do you?) and clear just the rect that contains the MP gauge.
Yea i actually edited it into : (because sometimes graphics overlapped.)

class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) return if index.nil? clear_item(index) actor = battle_members[index] rect = item_rect(index) return if actor.nil? draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?) draw_actor_name(actor, rect.x, rect.y, rect.width-8) draw_actor_action(actor, rect.x, rect.y) draw_actor_icons(actor, rect.x, line_height*1, rect.width) gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4) for index in 0...3 actor = battle_members[index] rect = item_rect(index) return if actor.nil? if draw_tp?(actor) && draw_mp?(actor) w = rect.width/2-2 dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE draw_actor_tp(actor, rect.x+2, line_height*3, dw) dw = rect.width - rect.width/2 - 2 draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw) elsif draw_tp?(actor) && !draw_mp?(actor) draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4) else draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4) end end endendBut it didnt crash for some reason (i left a hole in my team in the middle just to check), probably because of how Yanfly handles holes in team? dunno.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-ace-engine-doesnt-refresh-enough.45660/