Need help updating my menu!

(Using rpg maker vx ace, yanfly engine)

Hi everybody, I've got myself a little stumped in regards to how to update the player's menu 

I'm making a game where there's only one 'main' party member, who is accompanied by a single follower, who can be swapped out.  Basically what I've done is I've rebranded the main player's subclass to act as a sort of jury rigged follower system...  Selecting a subclass (using Yanfly's Class system) runs a common event script that also changes whatever party member is currently following the main character and unlocks a new set of skills specific to that follower that the player can now use.  

Specifically, the main menu screen doesn't update the new ally characteristics whenever they're switched out.  I need to exit the menu and re-open it before the visual representation of the player's stats change to their correct values, which is kind of bad.  

I assume its because Yanfly's menu doesn't really have a refresh method, so it only truly updates when it's closed and reopens.  Problem is I don't really know how to do this! 

------------------------------------------------------------------------------------------------------------------------

EDIT:  Here's a video showing what I'm talking about (please turn annotations on!)

------------------------------------------------------------------------------------------------------------------------

Scripts used: 

slightly modified Yanfly Menu (original YEA menu file is found here)

Spoiler
#==============================================================================# ■ Window_Base#==============================================================================class Window_Base < Window #-------------------------------------------------------------------------- # overwrite method: draw_actor_simple_status #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, dx, dy) dy -= line_height / 2 dw = contents.width - dx - 124 #all party members get their name drawn. draw_actor_name(actor, dx, dy) if YEA::MENU:😀RAW_TP_GAUGE && actor.draw_tp? && !actor.draw_mp? draw_actor_level(actor, dx, dy + line_height * 1) draw_actor_icons(actor, dx, dy + line_height * 2) draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw + 1) draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw + 1) #draw current atk & def values draw_actor_param(actor, dx, dy + line_height * 2, 2) draw_actor_param(actor, dx, dy + line_height * 3, 3) #if we're with an ally and have an MP bar, show it. elsif YEA::MENU:😀RAW_TP_GAUGE && actor.draw_tp? && actor.draw_mp? if $imported["YEA-BattleEngine"] draw_actor_level(actor, dx, dy + line_height * 1) draw_actor_icons(actor, dx, dy + line_height * 2) draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw + 1) draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw + 1) draw_actor_mp(actor, dx + 120, dy + 1 + line_height * 5, dw + 1) #draw current atk & def values draw_actor_param(actor, dx, dy + line_height * 2, 2) draw_actor_param(actor, dx, dy + line_height * 3, 3) draw_ally_stats(actor, dx, dy) end elsif YEA::MENU:😀RAW_TP_GAUGE && actor.draw_mp? draw_actor_mp(actor, dx + 120, dy + 1 + line_height * 5, dw + 1) end endend # Window_Base
slightly modified Yanfly Engine Ace- Class System  (original YEA Class System file is found here)

Spoiler
Code:
  #--------------------------------------------------------------------------  # on_class_ok  #--------------------------------------------------------------------------  def on_class_ok    Sound.play_equip    class_id = @item_window.item.id    maintain = YEA::CLASS_SYSTEM::MAINTAIN_LEVELS    hp = @actor.hp * 1.0 / @actor.mhp    mp = @actor.mp * 1.0 / [@actor.mmp, 1].max    case @command_window.current_symbol    when :primary      @actor.change_class(class_id, maintain)    when :subclass      @actor.change_subclass(class_id)      #this calls a common event that changes the party member following us      #and lets the player use a new set of secondary skills.      $game_temp.reserve_common_event(class_id)          else      @item_window.activate      return    end    @actor.hp = (@actor.mhp * hp).to_i    @actor.mp = (@actor.mmp * mp).to_i    @status_window.refresh    @item_window.update_class      end
I've moved this thread to Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Please give links to the scripts you have problems with, we need to see them to help.
Oh, sorry!  I will keep that in mind for my next posts. 

Here's the scripts in question, they're kind of... jury-rigged:

Modified Yanfly Menu Engine - http://pastebin.com/PDuUmzkN   (original can be found here )

Modified Window Base (just added blurbs for the ally info) - http://pastebin.com/AgLRccxQ

(EDIT: scripts are listed above in the opening post)

let me know if you need anything else!
Well for starters, you've created an infinite loop which is probably why it crashes. The method "draw_actor_simple_status" calls the method "refresh" which calls "draw_actor_simple_status" and so on forever.
Well for starters, you've created an infinite loop which is probably why it crashes. The method "draw_actor_simple_status" calls the method "refresh" which calls "draw_actor_simple_status" and so on forever.
Oh... uh, crap lol.  How should do you think I go about fixing this loop?   
http://rpgmaker.net/engines/rmvxace/utilities/70/ 

I found this fantastic tool about a month ago. It's about as powerful as you can get.

Make sure to give them credit, for it is REALLY useful.
http://rpgmaker.net/engines/rmvxace/utilities/70/

I found this fantastic tool about a month ago. It's about as powerful as you can get.

Make sure to give them credit, for it is REALLY useful.
Woah, this looks crazy cool, but sadly it isn't really what I'm looking for... I'm just trying to figure out how to add an update clause to my menu!

I've finally found some free time to work on this project again, but this menu updating thing is still completely stumping me lol.  I've edited the opening post to include a video of the problem I'm talking about, as well as posted the updated scripts I'm using..
Woah, this looks crazy cool, but sadly it isn't really what I'm looking for... I'm just trying to figure out how to add an update clause to my menu!

I've finally found some free time to work on this project again, but this menu updating thing is still completely stumping me lol.  I've edited the opening post to include a video of the problem I'm talking about, as well as posted the updated scripts I'm using..
Ok, so this may actually be easy to fix. What you need is for the Window_MenuStatus object to refresh itself after changing your character's class but the problem is you don't have a reference to that object so you can't call it directly. There's a couple of ways I can think of to fix this. They're not the most pretty solutions mind you, but they should work. Here's one method:


class Game_Temp attr_accessor :menu_status_window # Menu Status Window alias subclass_initialize initialize def initialize subclass_initialize @menu_status_window = nil endendclass Window_MenuStatus alias subclass_initialize initialize def initialize subclass_initialize $game_temp.menu_status_window = self end def dispose $game_temp.menu_status_window = nil super end end

Then underneath your common event call in the class change window, put this:


if $game_temp.menu_status_window $game_temp.menu_status_window.refreshend

I haven't tested it mind you, so if it doesn't work, there's another thing we can try.
Ok, so this may actually be easy to fix. What you need is for the Window_MenuStatus object to refresh itself after changing your character's class but the problem is you don't have a reference to that object so you can't call it directly. There's a couple of ways I can think of to fix this. They're not the most pretty solutions mind you, but they should work. Here's one method:

Spoiler
I haven't tested it mind you, so if it doesn't work, there's another thing we can try.
Thank you for your assistance!  I understand the logic, but unfortunately the game brings up the following error when I try to access the menu now: 

Script 'Scene_Menu' line 43: ArgumentError occurred.wrong number of arguments (2 for 0) I just put the first script you provided on the bottom of Yanflys class menu script, which needs to be below the class script, so maybe that's affecting the outcome...

Looking into Scene_Menu line 43 it shows that the create status window bit wants the args '@command_window.width' and '0', though I'm not sure what it does with those.
Sorry, I just made a small mistake. Use this version instead.

Spoiler
Code:
class Game_Temp    attr_accessor   :menu_status_window          # Menu Status Window    alias subclass_initialize initialize  def initialize    subclass_initialize    @menu_status_window = nil  endend class Window_MenuStatus  alias subclass_initialize initialize  def initialize(x, y)    subclass_initialize(x, y)    $game_temp.menu_status_window = self  end  def dispose    $game_temp.menu_status_window = nil    super  end  end 
Sorry, I just made a small mistake. Use this version instead.

That fixed the error popup, but it looks like it doesn't make the menu update after a class switch...

Should I be renaming :menu_status_window to something else?  Also should I be placing the first script in any place in particular, or as a new script file?
That fixed the error popup, but it looks like it doesn't make the menu update after a class switch...

Should I be renaming :menu_status_window to something else?  Also should I be placing the first script in any place in particular, or as a new script file?
Ok, so after looking at the script some more there's a bigger problem. The common event you're calling won't run until you exit to the map. The fix I proposed assumed that code had already run and my code was refreshing the Menu Status window. So in order to make this work, we'll need to move whatever events you have in the common event into the subclass-change method.
Ok, so after looking at the script some more there's a bigger problem. The common event you're calling won't run until you exit to the map. The fix I proposed assumed that code had already run and my code was refreshing the Menu Status window. So in order to make this work, we'll need to move whatever events you have in the common event into the subclass-change method.
Yep, that was the problem, the menu's working like a charm now!   Thank you so much!
Cool. Glad it all worked out!

Original thread: https://forums.rpgmakerweb.com/threads/need-help-updating-my-menu.41642/