Allow menu during events - for Visual Novels
#1
Brick 
In truth, I don't have a plan to release this system public on the basis I don't trust it to be stable. However I am showing it because I would like any pointers as to improvements on how to better handle what I have.

This script allows the menu to be opened during events. Due to the way events are handled in XP, this isn't quite straight-forward. This script backs up events to where they were after the menu was opened (important for re-reading messages), and makes sure to skip the "mid-command" lines RMXP seems to have (things like Show Choice are actually interpreted in multiple lines, not as a single command).

The last point is specifically something I want to watch out for. I have an array there of every command index that leads to an actual command, but I cannot say for certain that this is the most apt way to handle it?

PHP Code:
<?php 
#==============================================================================
# ■ Visuality System
# ● Core Functions
#==============================================================================

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# ● Alias Functions
#--------------------------------------------------------------------------
alias tayruu_vn_system_init initialize
#--------------------------------------------------------------------------
# ● Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :oldindex
attr_accessor
:leavingmenu
#--------------------------------------------------------------------------
# ● Object Initialization
#--------------------------------------------------------------------------
def initialize
tayruu_vn_system_init
@oldindex = -1
@leavingmenu = false
end
end

#==============================================================================
# ■ Interpreter (part 1)
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ● Alias Functions
#--------------------------------------------------------------------------
alias tayruu_vn_interpreter_update update
#--------------------------------------------------------------------------
# ● Frame Update
#--------------------------------------------------------------------------
def update
if $game_system.leavingmenu && @list != nil
@index = $game_system.oldindex
@index -= 1 unless @list[@index].code == 101
valid_commands
= [101, 102, 402, 403, 103, 104, 105, 106, 111, 411, 112,
403, 113, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 127,
128, 129, 131, 132, 133, 134, 135, 136, 201, 202, 203, 204, 205, 206,
207, 208, 209, 210, 221, 222, 223, 224, 225, 231, 232, 233, 234, 235,
236, 241, 241, 242, 245, 246, 247, 248, 249, 250, 251, 301, 601, 602,
603, 302, 303, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
322, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 351, 352, 353,
354, 355, ]
if !
valid_commands.include?(@list[@index].code)
@
index -= 1
end
$game_system
.leavingmenu = false
end
tayruu_vn_interpreter_update
$game_system
.oldindex = @index - 1 unless @index == nil
end
end

#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < SDK::Scene_Base
#--------------------------------------------------------------------------
# ● Frame Update : Message Test
#--------------------------------------------------------------------------
def update_message?
return
false
end
#--------------------------------------------------------------------------
# ● Frame Update : Menu Call
#--------------------------------------------------------------------------
def update_call_menu
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp
.menu_beep = true
end
end
end
end

#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < SDK::Scene_Base
#--------------------------------------------------------------------------
# ● Alias Functions
#--------------------------------------------------------------------------
alias tayruu_vn_menu_init initialize
#--------------------------------------------------------------------------
# ● Object Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
tayruu_vn_menu_init(menu_index)
$game_system.leavingmenu = true
end
end
Reply }
#2
Oh brill, that's handy, very handy. Thanks for sharing!
Reply }
#3
Minor update to avoid an error if you open the menu before any events happened. ... which wouldn't show up in a demo I'd imagine, but better safe than sorry 'case it affected other things.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Immense Events DerVVulfman 17 19,232 10-28-2024, 03:39 AM
Last Post: DerVVulfman
   DerVV's Point-Increasing Status Menu DerVVulfman 1 616 07-16-2024, 04:41 AM
Last Post: DerVVulfman
   Copy Events XP DerVVulfman 12 3,334 05-26-2024, 09:40 PM
Last Post: Mel
   Windowskin Selection Menu DerVVulfman 2 1,072 05-23-2024, 04:13 AM
Last Post: DerVVulfman
   Refreshable Events XP kyonides 1 1,313 06-03-2023, 08:27 AM
Last Post: kyonides
   H-Mode7 Visual Equipment Chaotech Games 8 36,719 03-30-2017, 01:58 AM
Last Post: wrathx
   Moghunter Menus: Scene Menu Itigo DerVVulfman 9 23,463 04-10-2016, 03:22 AM
Last Post: DerVVulfman
   Events Always Under DerVVulfman 3 7,534 02-23-2015, 11:06 PM
Last Post: Taylor
   ProjectMeLT XRXS - 5-6 Character Menu JackMonty 0 5,596 04-16-2013, 02:41 PM
Last Post: JackMonty
   L's Simple Main Menu #1 - DMS Edit Landarma 4 11,703 01-18-2013, 07:13 AM
Last Post: Landarma



Users browsing this thread: 1 Guest(s)