Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 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:
#==============================================================================
# ■ 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 
= [101102402403103104105106111411112,
         
403113115116117118119121122123124125126127,
         
128129131132133134135136201202203204205206,
         
207208209210221222223224225231232233234235
         
236241241242245246247248249250251301601602,
         
603302303311312313314315316317318319320321,
         
322331332333334335336337338339340351352353,
         
354355, ]
      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
   Copy Events XP DerVVulfman 7 525 03-24-2024, 03:27 PM
Last Post: Melana
   Choices Change Events kyonides 1 279 02-21-2024, 09:16 PM
Last Post: kyonides
   Refreshable Events kyonides 1 669 06-03-2023, 08:27 AM
Last Post: kyonides
   Immense Events DerVVulfman 11 16,711 06-07-2020, 03:45 AM
Last Post: DerVVulfman
   H-Mode7 Visual Equipment Chaotech Games 8 34,661 03-30-2017, 01:58 AM
Last Post: wrathx
   Moghunter Menus: Scene Menu Itigo DerVVulfman 9 21,483 04-10-2016, 03:22 AM
Last Post: DerVVulfman
   Events Always Under DerVVulfman 3 6,647 02-23-2015, 11:06 PM
Last Post: Taylor
   Face Menu VXA SoulPour777 0 4,170 02-28-2014, 03:35 PM
Last Post: SoulPour777
   ProjectMeLT XRXS - 5-6 Character Menu JackMonty 0 5,095 04-16-2013, 02:41 PM
Last Post: JackMonty
   L's Simple Main Menu #1 - DMS Edit Landarma 4 10,639 01-18-2013, 07:13 AM
Last Post: Landarma



Users browsing this thread: