(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)
slightly modified Yanfly Engine Ace- Class System (original YEA Class System file is found here)
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)
#==============================================================================# ■ 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
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