This might sound ridiculous, but for a joke in the game I'm working on, I need the battle ui to switch to the default one, then switch back when a switch is turned on. The thing is, I have no idea how to start doing this so I've gotta ask for help here
VXAce Temporarily disabling yanfly battle ui
RPG Maker VXAce SupportYanfly's battle engine does more than just changing the ui, so switching between it and the vanilla interface is not that trivial. Can you be more precise what you mean exactly by ui here? Do you only care about having the actor's faces versus their names or do you also care about the other ui parts like skill, enemy selection etc. ?
I worked on a script in this thread to simulate the default actor list under yanfly's battle engine, if that is enough for you, I provide here an updated version of the script + a script to have the switch change the menu:
The addon to put below the other script to have a switch alter the menus:
I worked on a script in this thread to simulate the default actor list under yanfly's battle engine, if that is enough for you, I provide here an updated version of the script + a script to have the switch change the menu:
Ruby:
#==============================================================================
# Yanfly Battle Engine with original character menu v1.1
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 05/09/2025
# Requires: Yanfly Engine Ace - Ace Battle Engine v1.22
#==============================================================================
# Update history:
# 14/07/2025: v1.0 - Initial release
# 05/09/2025: v1.1 - Added an alias for compatibility with menu swicth
#==============================================================================
# Installation: put it below the required scripts
#==============================================================================
$imported = {} if $imported.nil?
$imported["TIM-YEA-ABE-OriginalMenu"] = true
if $imported["TIM-YEA-ABE-OriginalMenu"] && $imported["YEA-BattleEngine"]
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# alias method: col_max
#--------------------------------------------------------------------------
alias ybe_wbstatus_col_max col_max
def col_max; return 1; end
#--------------------------------------------------------------------------
# alias method: draw_item
#--------------------------------------------------------------------------
alias ybe_wbstatus_draw_item draw_item
def draw_item(index)
return if index.nil? #nil case
clear_item(index)
actor = battle_members[index]
return if actor.nil? #nil case
draw_basic_area(basic_area_rect(index), actor)
draw_gauge_area(gauge_area_rect(index), actor)
end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
alias ybe_wbstatus_item_rect item_rect
def item_rect(index); super(index); end
end #Window_BattleStatus
#==============================================================================
# Window_BattleStatusAid
#==============================================================================
class Window_BattleStatusAid < Window_BattleStatus
#--------------------------------------------------------------------------
# restore aliased methods: col_max, draw_item
#--------------------------------------------------------------------------
def col_max; ybe_wbstatus_col_max; end
def draw_item(index); ybe_wbstatus_draw_item(index); end
end #Window_BattleStatusAid
end #$imported["TIM-YEA-ABE-OriginalMenu"]
The addon to put below the other script to have a switch alter the menus:
Ruby:
#==============================================================================
# YBE vanilla menu swicth addon
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 05/09/2025
# Requires: Yanfly Battle Engine with original character menu v1.1
#==============================================================================
# Use: put it below the required scripts, set YBE_VANILLA_MENU
# to the id of the switch you wish to use to swicth between the two interfaces
# You can try in debug mode in battle to press F9 to see how the menu swicthes
#==============================================================================
$imported = {} if $imported.nil?
$imported["TIM-YEA-ABE-OriginalMenu-switch-addon"] = true
if $imported["TIM-YEA-ABE-OriginalMenu-switch-addon"] && $imported["TIM-YEA-ABE-OriginalMenu"] && $imported["YEA-BattleEngine"]
#==============================================================================
# module
#==============================================================================
module TIM
module SWITCH
#id of the switch you want to trigger to switch between vanilla and
#yanfly's menu:
YBE_VANILLA_MENU = 1
#Do not modify anything below:
def self.ybe_vanilla_menu?
$game_switches[YBE_VANILLA_MENU]
end
def self.ybe_vanilla_reverse_switch
$game_switches[YBE_VANILLA_MENU] = !$game_switches[YBE_VANILLA_MENU]
end
end #SWITCH
end #TIM
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
alias tim_switch_ybe_update_debug update_debug
def update_debug
tim_switch_ybe_update_debug
return unless $TEST || $BTEST
TIM::SWITCH.ybe_vanilla_reverse_switch if Input.trigger?(:F9)
end
end #Scene_Battle
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias tim_switch_ybe_initialize initialize
def initialize
@vanilla_menu = TIM::SWITCH.ybe_vanilla_menu?
tim_switch_ybe_initialize
end
#--------------------------------------------------------------------------
# alias method: col_max
#--------------------------------------------------------------------------
alias tim_switch_ybe_col_max col_max
def col_max
vanilla_menu? ? tim_switch_ybe_col_max : ybe_wbstatus_col_max
end
#--------------------------------------------------------------------------
# alias method: draw_item
#--------------------------------------------------------------------------
alias tim_switch_ybe_draw_item draw_item
def draw_item(index)
vanilla_menu? ? tim_switch_ybe_draw_item(index) : ybe_wbstatus_draw_item(index)
end
#--------------------------------------------------------------------------
# alias method: item_rect
#--------------------------------------------------------------------------
alias tim_switch_ybe_item_rect item_rect
def item_rect(index)
vanilla_menu? ? tim_switch_ybe_item_rect(index) : ybe_wbstatus_item_rect(index)
end
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias tim_switch_ybe_update update
def update
tim_switch_ybe_update
if TIM::SWITCH.ybe_vanilla_menu? != vanilla_menu?
@vanilla_menu = TIM::SWITCH.ybe_vanilla_menu?
refresh
cursor_rect.set(item_rect(@index))
end
end
#--------------------------------------------------------------------------
# new method: vanilla_menu?
#--------------------------------------------------------------------------
def vanilla_menu?; @vanilla_menu; end
end #Window_BattleStatus
end #$imported["TIM-YEA-ABE-OriginalMenu-switch-addon"] && $imported["TIM-YEA-ABE-OriginalMenu"] && $imported["YEA-BattleEngine"]
Holy crud, this was just what I needed. Forgot about this post I made till I saw your reply. Thank you a bunch, I've tried learning Ruby myself for the past few days and had no luck figuring all this out. Appreciate your help!
Don't feel bad if you have trouble with it. Some people understand the coding very well and others (like me) struggle with it even after 8 years of using it, even with taking two classes in ruby programming.
Nicely done, I didn't even know you could alias a method from a subclass method like you did. (col_max)
What programming training do you have? Is it something I can take?
I'm guessing you meant a superclass here as I call the aliased method in a child class (or subclass).
I'm not that familiar with Ruby and aliases, but I've observed that you could use the aliased methods like normal methods since they are like defining a new method name that refers to the same code as the aliased method.
I did a CS engineering school in France for 3 years (+2y of preparation class in maths) where I've learnt to program in C,C++ and Java among other things. I can dm you the name of the school to have a rough idea of what we did if you want more info.
As for Ruby, I've only learnt this on my own through RPG Maker code reading (the vanilla's code and some scripter's additions like Yanfly's). And I apply my own understanding of programming, I usually compare Ruby to Python with a bit of functional programming. As long as you understand Oriented Object Programming and the syntax of Ruby, you should have almost everything in your hands.
The rest is practice in programming scripts, solving issues and checking the web.
When I have a Ruby-specific question, I usually check the documentation, or I search my question on the web.
When I have a RGSS-specific question (like which rpg maker class does what), I usually do something between:
- checking the editor's rgss documentation
- checking Archeia's script calls thread
- looking for a script that does something similar and read parts of it to have an idea on how it's done
Also, I test a lot of things to answer my many own questions.
Hope that helps somehow.
Original thread: https://forums.rpgmakerweb.com/threads/temporarily-disabling-yanfly-battle-ui.179804/