Special Support - A great place to learn to Script

It does say in Seph's OP that discussion should be limited to the default system. I just hadn't read the OP in over a year. My bad.

Be Well
Hm... is there a function of Window_Selectable or Window_Command or whatever that disables a choice? Like turning off a choice in a window. Specifically, what I want to do is make the player unable to select that 'empty space' in the equipment select screen, so he must be always equipping something. I figured there is an 'enabled' flag that I just need to turn off, only I can't find out how.
There is a "disable_item" method in Window_Command, but all it does is draw the item 'greyed out'. You have to handle the disabled item in the update method of the scene. Look at Scene_Menu, line 152 for Save.

If the user selects the empty spot, you just want the window to do nothing. (not return the empty weapon back to the 'right' window)

What if we modify the update_item method of Scene_Equip... my comments in ##

  1.  
  2.     # If C button was pressed
  3.     if Input.trigger?(Input::C)
  4.       # Get currently selected data on the item window  ## do this first so we can test it
  5.       item = @item_window.item
  6.       ## If the item is nil, just return without doing anything. (play the buzzer so the player know he's doing something wrong)
  7.       if item == nil
  8.         # Play buzzer SE
  9.         $game_system.se_play($data_system.buzzer_se)
  10.         return
  11.       end
  12.       ## otherwise... continue as normal and swap out the equipment.
  13.       # Play equip SE
  14.       $game_system.se_play($data_system.equip_se)
  15.       # Change equipment
  16.       ##  the conditional statement is no longer necessary, as item will never be nil. but it doesn't need to be changed
  17.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  18.       # Activate right window
  19.       @right_window.active = true
  20.       @item_window.active = false
  21.       @item_window.index = -1
  22.       # Remake right window and item window contents
  23.       @right_window.refresh
  24.       @item_window.refresh
  25.       return
  26.     end
  27.  
Expand to see the code.
That worked terrifically, thanks!
Hello there everyone. I was screwing around a bit with script commands looking at the help file that comes with rmxp and decided to try to change the attributes of a spell in the middle of an event. I checked around the file, some of the scripts, and got to the variable. I got to the following peace of code:

  1. $data_skills[1] = [1, "Heal", "9-Magic17", "Heal all allies", 4, 0, 2, 15, "105-Heal01", 0, 0, -150, 0, 0, 0, 0, 0, 50, 100, 0, 100, 15, [], [], []]
Expand to see the code.
.

A strange thing though, is that I am getting an error on the default script, Window_Skill, on line 71, its says that icon_name is an undefined method.

I know that its possible to screw around somethings that you set on the database on mid game because I managed to change the usable weapons and armors of a certain class.
That's about it, hopefully someone could give me some clarifications on this matter.
The skills aren't arrays, they are RPG::Skill objects.
Instead of this..
  1. $data_skills[1] = [1, "Heal", "9-Magic17", etc...]
Expand to see the code.

...it should be like this:
  1. $data_skills[1] = RPG::Skill.new
  2. $data_skills[1].id = 1
  3. $data_skills[1].name = "Heal"
  4. $data_skills[1].icon_name = "9-Magic17"
  5. # Etc...
Expand to see the code.


The same happens for any other "RPG::" class, except for RPG::Cache (it's not for Database objects).

If more people tried to figure how things works like you did we would have much more programmers around. :) Keep it up, sounds like you'll be a very good scripter someday. ^^
SEE YA!!!!!
wow man, thanks O.O. Regardless of the small time I have, I'm trying my best to get the way that RGSS works since I started with RMXP, and only now I'm noticing how it works. Thanks for the help dude! :thumb:
Where can i find the formula for Battle Damage calculation..
because im trying to change it to the Fomula used in FF12. =]
Depends if you're using RMXP or RMVX.

RMXP: Game_Battler 3 script, *_effect()
RMVX: Game_Battler script, make_attack_damage_value() and make_obj_damage_value()


SEE YA!!!!!
im using RMXP..
I'm looking for a way to make it so when you equip a new weapon it changes your Char's graphic. Basicly what i'm trying to do is make it so when you dont have a weapon equiped you'r char's graphic is normal but when you equip a sword it changes to the graphic of that char to one holding a sword etc
@FF12_Master:
In that case, you should check the "Game_Battler 3" script, that contains a bunch of functions concerning the damage calculations.

@mrslayer:
You'll need to edit the "Sprite_Character" script. On RMXP, you'll have to bump some new code into the update() method. On RMVX this is done on update_bitmap() method -- although the changes will be basically the same.
For checking the character's currently equipped weapon, you'll use the @character variable, that points to the Game_Actor object of the character.


SEE YA!!!!!
ok cheers..
In RMXP where do I set the coordinates for this:
  1. super("Which file would you like to save to?")
Expand to see the code.


which is located in Scene_Save?
  1. class Game_System
  2.   attr_accessor :font                              # font
  3.   attr_accessor :size                              # size
  4.   alias re_init initialize
  5.   def initialize
  6.      @font = "Arial"
  7.      @size = 20
  8.      re_init
  9.   end
  10. end
  11.  
  12. class Font
  13.   alias change_font initialize
  14.   def initialize
  15.      change_font
  16.      self.name = $game_system.font
  17.      self.size = $game_system.size
  18.   end
  19. end
Expand to see the code.


I need to know if this is setup right. It does indeed change the font but I want it where I can use $game_system.font = "Font here" but everytime I use it it never works. Can someone help please?

@kiralim: Check in Scene_File for save_windows.x or .y I think :P

EDIT: @kiralim: use this in Scene_File under line 29
  1.  
  2. @savefile_windows.x = whatever
  3. @savefile_windows.y = whatever
  4.  
Expand to see the code.
My question is how do the Input.Triggers work? I read the Script Support topic on changing the directional buttons to WASD, but I didn't really understand it. I know the code for the Input.Triggers (for the directional buttons only) exist in the Game_Player page, but I don't know where the rest are (Action, Cancel, etc. buttons) or how to change them.
~ShadowofUndine
gameguy27 wrote:
@kiralim: Check in Scene_File for save_windows.x or .y I think :P

EDIT: @kiralim: use this in Scene_File under line 29
  1.  
  2. @savefile_windows.x = whatever
  3. @savefile_windows.y = whatever
  4.  
Expand to see the code.

Hey gameguy27, thanks for offering help. But nothing changed. Also if it helps, I'm using Moghunter's Scene_File:
  1. #_______________________________________________________________________________
  2. # MOG Scene File Ayumi V1.0          
  3. #_______________________________________________________________________________
  4. # By Moghunter          
  5. #_______________________________________________________________________________
  6. if true # True = Enable / False = Disable (Script)
  7. module MOG
  8. #Transition Time.
  9. MSVT = 0
  10. #Transition Type.
  11. MSVTT = "006-Stripe02"
  12. end
  13. $mogscript = {} if $mogscript == nil
  14. $mogscript["menu_ayumi"] = true
  15. ###############
  16. # Window_Base #
  17. ###############
  18. class Window_Base < Window
  19. def drw_win_file(x,y)
  20. dwf = RPG::Cache.picture("something")
  21. cw = dwf.width
  22. ch = dwf.height
  23. src_rect = Rect.new(0, 0, cw, ch)
  24. self.contents.blt(x , y - ch, dwf, src_rect)    
  25. end  
  26. def nada
  27. face = RPG::Cache.picture("")
  28. end  
  29. def draw_heroface3(actor,x,y)
  30. face = RPG::Cache.picture(actor.name + "_fc3") rescue nada
  31. cw = face.width
  32. ch = face.height
  33. src_rect = Rect.new(0, 0, cw, ch)
  34. self.contents.blt(x , y - ch, face, src_rect)    
  35. end  
  36. def draw_actor_level6(actor, x, y)
  37. self.contents.font.color = Color.new(255,131,31,255)
  38. self.contents.draw_text(x + 1, y + 1, 32, 32, "LV")  
  39. self.contents.font.color = Color.new(255,131,31,255)
  40. self.contents.draw_text(x, y, 32, 32, "LV")
  41. self.contents.font.color = Color.new(255,131,31,255)
  42. self.contents.draw_text(x + 17, y + 1, 24, 32, actor.level.to_s, 2)
  43. self.contents.font.color = Color.new(255,131,31,255)
  44. self.contents.draw_text(x + 16, y, 24, 32, actor.level.to_s, 2)
  45. end
  46. def draw_actor_name6(actor, x, y)
  47. self.contents.font.color = Color.new(255,131,31,255)
  48. self.contents.draw_text(x + 1, y + 1, 100, 32, actor.name,1)  
  49. self.contents.font.color = Color.new(255,131,31,255)
  50. self.contents.draw_text(x, y, 100, 32, actor.name,1)
  51. end
  52. end
  53. ############
  54. # Game_Map #
  55. ############
  56. class Game_Map
  57. def map_name
  58. @mapinfo = load_data("Data/MapInfos.rxdata") if @mapinfo == nil
  59. return @mapinfo[@map_id].name
  60. end
  61. end
  62. ###################
  63. # Window_SaveFile #
  64. ###################
  65. class Window_SaveFile < Window_Base
  66.   attr_reader   :filename                
  67.   attr_reader   :selected                
  68.   def initialize(file_index, filename)
  69.     super(0, 64 + file_index * 138, 640, 240)    
  70.     self.contents = Bitmap.new(width - 32, height - 32)  
  71.     self.opacity = 0
  72.     @file_index = file_index
  73.     @filename = "Save#{@file_index + 1}.rxdata"
  74.     @time_stamp = Time.at(0)
  75.     @file_exist = FileTest.exist?(@filename)
  76.     if @file_exist
  77.       file = File.open(@filename, "r")
  78.       @time_stamp = file.mtime
  79.       @characters = Marshal.load(file)
  80.       @frame_count = Marshal.load(file)
  81.       @game_system = Marshal.load(file)
  82.       @game_switches = Marshal.load(file)
  83.       @game_variables = Marshal.load(file)
  84.       @game_self_switches = Marshal.load(file)
  85.       @game_screen = Marshal.load(file)
  86.       @game_actors = Marshal.load(file)
  87.       @game_party = Marshal.load(file)
  88.       @game_troop = Marshal.load(file)
  89.       @game_map = Marshal.load(file)
  90.       @total_sec = @frame_count / Graphics.frame_rate
  91.       file.close
  92.     end
  93.     @wiref = 0
  94.     refresh
  95.     @selected = false
  96.   end  
  97.   def refresh
  98.     self.contents.clear
  99.     self.contents.font.name = "techno overload BRK"
  100.     drw_win_file(0,190)
  101.     name = "#{@file_index + 1}"
  102.     self.contents.font.color = Color.new(0,0,0,255)
  103.     self.contents.draw_text(55, 75, 600, 32, name)
  104.     self.contents.font.color = Color.new(255,131,31,255)
  105.     self.contents.draw_text(55, 75, 600, 32, name)    
  106.     @name_width = contents.text_size(name).width
  107.     if @file_exist
  108.       for i in [email hidden]
  109.         #bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  110.         #cw = bitmap.rect.width / 4
  111.         #ch = bitmap.rect.height / 4
  112.         #src_rect = Rect.new(cw * @wiref + 1 , 0, cw, ch)
  113.         #x = 300 - @characters.size + i * 64 - cw / 4
  114.         #self.contents.blt(x - 10, 150 - ch, bitmap, src_rect)
  115.         #x = 116
  116.         actors = @game_party.actors
  117.         for i in 0...[actors.size, 4].min
  118.         x     = i * 60
  119.         actor = actors[i]        
  120.         self.contents.font.size = 20
  121.         draw_actor_level6(actor, x + 156, 57)
  122.         actor = actors[0]    
  123.         draw_heroface3(actor,300, 122)    
  124.         #draw_actor_name6(actor, 160, 155)
  125.         self.contents.font.size = 22
  126.         end          
  127.       end      
  128.       hour = @total_sec / 60 / 60
  129.       min = @total_sec / 60 % 60
  130.       sec = @total_sec % 60
  131.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  132.       self.contents.font.color = Color.new(0,0,0,255)
  133.       self.contents.draw_text(5, 57, 550, 32, time_string, 2)
  134.       self.contents.draw_text(156 , 90, 300, 32, @game_map.map_name.to_s)
  135.       self.contents.font.color = Color.new(255,131,31,255)
  136.       self.contents.draw_text(156 , 90, 300, 32, @game_map.map_name.to_s)  
  137.       self.contents.draw_text(4, 57, 550, 32, time_string, 2)  
  138.    end
  139.   end
  140.   def selected=(selected)
  141.     @selected = selected
  142.   end
  143. end
  144. ##############
  145. # Scene_File #
  146. ##############
  147. class Scene_File
  148.   def initialize(help_text)
  149.     @help_text = help_text
  150.   end
  151.   def main
  152.     @mnback = Plane.new
  153.     @mnback.bitmap = RPG::Cache.picture("MN_BK3")
  154.     @mnback.opacity = 100
  155.     @mnback.z = 0
  156.     @mnlay = Sprite.new
  157.     @mnlay.bitmap = RPG::Cache.picture("Lay_File.PNG")
  158.     @mnlay.z = 2
  159.     @help_window = Window_Help.new
  160.     @help_window.set_text(@help_text)
  161.     @help_window.opacity = 0
  162.     @savefile_windows = []
  163.     for i in 0..2
  164.       @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
  165.     end
  166.     @savefile_windows[0]
  167.     @file_index = $game_temp.last_file_index
  168.     @savefile_windows[@file_index].selected = true
  169.     @savefile_windows[0].y = 40    
  170.     @savefile_windows[1].y= 105
  171.     @savefile_windows[2].y= 170    
  172.     @win_move_time = 0
  173.     @win_move = 0
  174.     @win_dire = 0
  175.     @win_opac = 255
  176.     @win1_y = 0
  177.     @win2_y = 0
  178.     @win3_y = 0
  179.     Graphics.transition(MOG::MSVT, "Graphics/Transitions/" + MOG::MSVTT)
  180.     loop do
  181.       Graphics.update
  182.       Input.update
  183.       update
  184.       if $scene != self
  185.         break
  186.       end
  187.     end
  188.     for i in 0..50
  189.     @mnback.ox += 1
  190.     @savefile_windows[0].x += 10    
  191.     @savefile_windows[1].x -= 10
  192.     @savefile_windows[2].x += 10
  193.     for i in @savefile_windows
  194.     i.contents_opacity -= 5
  195.     end  
  196.     Graphics.update  
  197.     end      
  198.     Graphics.freeze
  199.     @help_window.dispose
  200.     @mnback.dispose
  201.     @mnlay.dispose
  202.     for i in @savefile_windows
  203.       i.dispose
  204.     end
  205.   end
  206.   def update
  207.     @mnback.ox += 1
  208.     @win_opac += 3
  209.     @win_move_time += 1    
  210.     if @win_opac > 255
  211.        @win_opac = 255
  212.     end        
  213.     if @win_move_time > 60
  214.     @win_dire += 1
  215.     @win_move_time = 0    
  216.     end
  217.     if @win_dire > 1
  218.        @win_dire = 0
  219.     end
  220.     if @win_dire == 0
  221.        @win_move += 0
  222.     else  
  223.        @win_move -= 0
  224.     end        
  225.     if @file_index == 0
  226.     @savefile_windows[0].z = 2  
  227.     @savefile_windows[1].z = 1
  228.     @savefile_windows[2].z = 0  
  229.     @savefile_windows[0].x = @win_move
  230.     @savefile_windows[1].x = 0
  231.     @savefile_windows[1].x= 0
  232.     @savefile_windows[2].x = 0    
  233.     @savefile_windows[0].contents_opacity = @win_opac
  234.     @savefile_windows[1].contents_opacity = 200
  235.     @savefile_windows[2].contents_opacity =  200    
  236.     elsif @file_index == 1
  237.     @savefile_windows[0].z = 1  
  238.     @savefile_windows[1].z = 2
  239.     @savefile_windows[2].z = 1    
  240.     @savefile_windows[0].x = 0
  241.     @savefile_windows[1].x = @win_move
  242.     @savefile_windows[2].x = 0    
  243.     @savefile_windows[0].contents_opacity =  200
  244.     @savefile_windows[1].contents_opacity = @win_opac
  245.     @savefile_windows[2].contents_opacity =  200
  246.     else
  247.     @savefile_windows[0].z = 0  
  248.     @savefile_windows[1].z = 1
  249.     @savefile_windows[2].z = 2      
  250.     @savefile_windows[0].x = 0
  251.     @savefile_windows[1].x = 0
  252.     @savefile_windows[2].x = @win_move  
  253.     @savefile_windows[0].contents_opacity = 200
  254.     @savefile_windows[1].contents_opacity = 200
  255.     @savefile_windows[2].contents_opacity = @win_opac    
  256.     end    
  257.     @help_window.update    
  258.     for i in @savefile_windows
  259.       i.update
  260.     end
  261.     if Input.trigger?(Input::C)
  262.       on_decision(make_filename(@file_index))
  263.       $game_temp.last_file_index = @file_index
  264.       return
  265.     end
  266.     if Input.trigger?(Input::B)
  267.       on_cancel
  268.       return
  269.     end
  270.     if Input.repeat?(Input::DOWN)
  271.       if Input.trigger?(Input::DOWN) or @file_index < 3
  272.         $game_system.se_play($data_system.cursor_se)
  273.         @savefile_windows[@file_index].selected = false
  274.         @file_index = (@file_index + 1) % 3
  275.         @savefile_windows[@file_index].selected = true
  276.         return
  277.       end
  278.     end
  279.     if Input.repeat?(Input::UP)
  280.       if Input.trigger?(Input::UP) or @file_index > 0
  281.         $game_system.se_play($data_system.cursor_se)
  282.         @savefile_windows[@file_index].selected = false
  283.         @file_index = (@file_index - 1) % 3
  284.         @savefile_windows[@file_index].selected = true
  285.         return
  286.       end
  287.     end
  288.   end
  289.   def make_filename(file_index)
  290.     return "Save#{file_index + 1}.rxdata"
  291.   end
  292. end
  293. end
Expand to see the code.
Line 69
  1. super(0, 64 + file_index * 138, 640, 240)    
Expand to see the code.

Change the 0 and the 64 + file_index * 138 to whatever
X = 0
Y = 64 + file_index * 138
ShadowofUndine wrote:
My question is how do the Input.Triggers work? I read the Script Support topic on changing the directional buttons to WASD, but I didn't really understand it. I know the code for the Input.Triggers (for the directional buttons only) exist in the Game_Player page, but I don't know where the rest are (Action, Cancel, etc. buttons) or how to change them.
~ShadowofUndine


First of all you'll need a Fulll Keyboard Support Script. RMXP Doesnt support the whole keyboard right away.

Now to change the action and cancel key you'd have to change alot of scripts.
In Scene_Map line 123
  1. if Input.trigger?(Input::B)
Expand to see the code.

Change the B in it. But I recommend Using Blizzard's Tons of Addons. It has a custom controls which also provides the whole keyboard. If you use his than replace line 123 with
  1. if Input.trigger?(Input::Key['W'])
Expand to see the code.


Now Scene_Title and the rest just search for either
  1. Input.trigger?(Input::B)
Expand to see the code.

or
  1. Input.trigger?(Input::C)
Expand to see the code.


Change all of those in all of the Scenes. There are also more Inputs than that as well in some of the Scenes.
@gamerguy27: Thanks. I'm having some trouble getting it to work, but I appreciate the help.
~ShadowofUndine
No problem. I'm learning how to script myself and I know it can be confusing. But yea I used BLizz's custom controls and it works pretty good I hope everything works out for you.
gameguy27 wrote:
Line 69
  1. super(0, 64 + file_index * 138, 640, 240)      
Expand to see the code.

Change the 0 and the 64 + file_index * 138 to whatever
X = 0
Y = 64 + file_index * 138


Sigh, still no effect, sorry. I tried changing the X and it moved the save file image's position. When I try changing Y, nothing happens.
kiralim wrote:
gameguy27 wrote:
Line 69
  1. super(0, 64 + file_index * 138, 640, 240)      
Expand to see the code.

Change the 0 and the 64 + file_index * 138 to whatever
X = 0
Y = 64 + file_index * 138


Sigh, still no effect, sorry. I tried changing the X and it moved the save file image's position. When I try changing Y, nothing happens.


Okay I looked through the script again and heres the Y it should work
Lines 169-171
  1.    
  2. @savefile_windows[0].y = 40    # This is for the first window
  3. @savefile_windows[1].y= 105    # This is for the second window
  4. @savefile_windows[2].y= 170    # This is for the third window
  5.  
Expand to see the code.
gameguy27 wrote:
kiralim wrote:
gameguy27 wrote:
Line 69
  1. super(0, 64 + file_index * 138, 640, 240)      
Expand to see the code.

Change the 0 and the 64 + file_index * 138 to whatever
X = 0
Y = 64 + file_index * 138


Sigh, still no effect, sorry. I tried changing the X and it moved the save file image's position. When I try changing Y, nothing happens.


Okay I looked through the script again and heres the Y it should work
Lines 169-171
  1.       
  2. @savefile_windows[0].y = 40      # This is for the first window
  3. @savefile_windows[1].y= 105      # This is for the second window
  4. @savefile_windows[2].y= 170      # This is for the third window
  5.  
Expand to see the code.


Nope that's the coordinates for the Save File image, not for the "Which file would you like to save?" text.
Oh ok well I'll look at it and I'll alter it until I get it kiralim. I like helping people if I can so keep a watch for I will figure it out.

Mind posting where you got it so I can have the image files? lol

EDIT: So you're not wanting to change the Save File's Image correct? You want to change the position of the Where would you like to save window right? Thats where I was confused.
Go to line 161
  1. @help_window.opacity = 0
Expand to see the code.

then add below it
  1. @helpwindow.x = Whatever
  2. @help_window.y = whatever
Expand to see the code.


I hope thats what you were looking for. If not I'll keep trying
Kiralim, if you're using Moghunter's script you should make a topic to ask that or, even better, ask at the Moghunter Save File script. This topic is for the standard scripts only! 😉
Anyway, here's what you should do:
~ Search on the scripts for "@help_window = Window_Help.new";
~ Below this line, put "@help_window.x = <number>" and "@help_window.y = <number>";
~ Done.

SEE YA!!!!!
I have a question concerning the Marhsal module. I get how it is used, with the dump and load methods. But when I look it up, the examples have it only dumping or loading one class. Where in the RGSS (at least for RMXP, haven't really done much with RMVX) it is able to dump and load multiple classes.

So my question is...how does it know which to load? Is it simply based on the order in which it was dumped, or does it somehow know where to put what class? Any help would be appreciated. :D
Think of Marshal's dump and load behavior as a line of people. Person1 enters a line, Person2 enters a line, Person1 exits line, Person2 exits line. The first thing you dump is the first thing that loads. First in first out. You can see this behavior if you look at Scene_File's write_save_data and read_save_data methods. Objects are dumped in the same order they are loaded. Most likely when the file is being written, and each individual class is serialized, it makes a marker describing the object size/deserialization process. However that's only my assumption I don't know much about the innards.

How does it know which one to load? Well keep in mind there are no defined types. Meaning you can't declare a variable of type integer. A variable assumes a type during assignment. Because of that Marshal doesn't need to know which class to load. It continues to read from the stream until it has reached the end of the file. It is your duty to remember the save/load order.

I tried to be verbose to cover most of it. If you still have a question let us know. Also below is a little code snippet demonstrating the work. The code can be placed right above main for a quick test if you wanted.

  1. file = File.open('test.sec', 'wb')
  2. Marshal.dump('test string', file)
  3. Marshal.dump('this is a waste of a file', file)
  4. file.close
  5.  
  6. file = File.open('test.sec', 'rb')
  7. string1 = Marshal.load(file)
  8. string2 = Marshal.load(file)
  9. file.close
  10.  
  11. p string1, # 'test string'
  12.   string2    # 'this is a waste of a file'
  13.  
  14. File.delete('test.sec')
Expand to see the code.
Okay thank you Khmp. I figured it did it sequentially. I couldn't think of how else it could. haha.
The proper and common way to make a new object that must be saved/loaded with the rest of the game's session data, you must alias these following methods, and create/save/load these objects after the origional method alias. Here's an example...

Title / Save / Load Spoiler
  1. #===============================================================================
  2. # ** Scene_Title
  3. #===============================================================================
  4.  
  5. class Scene_Title
  6.   #-----------------------------------------------------------------------------
  7.   # * Alias Listings
  8.   #-----------------------------------------------------------------------------
  9.   alias_method :cms_scntitle_commandnewgame, :command_new_game
  10.   #-----------------------------------------------------------------------------
  11.   # * Command : New Game
  12.   #-----------------------------------------------------------------------------
  13.   def command_new_game
  14.      cms_scntitle_commandnewgame
  15.      $game_menu = CMS.new
  16.   end
  17. end
  18.  
  19. #===============================================================================
  20. # ** Scene_Save
  21. #===============================================================================
  22.  
  23. class Scene_Save < Scene_File
  24.   #-----------------------------------------------------------------------------
  25.   # * Alias Listings
  26.   #-----------------------------------------------------------------------------
  27.   alias_method :cms_scnsave_writesavedata, :write_save_data
  28.   #-----------------------------------------------------------------------------
  29.   # * Write Save Data
  30.   #-----------------------------------------------------------------------------
  31.   def write_save_data(file)
  32.      cms_scnsave_writesavedata(file)
  33.      Marshal.dump($game_menu, file)
  34.   end
  35. end
  36.  
  37. #===============================================================================
  38. # ** Scene_Load
  39. #===============================================================================
  40.  
  41. class Scene_Load < Scene_File
  42.   #-----------------------------------------------------------------------------
  43.   # * Alias Listings
  44.   #-----------------------------------------------------------------------------
  45.   alias_method :cms_scnload_readsavedata, :read_save_data
  46.   #-----------------------------------------------------------------------------
  47.   # * Read Save Data
  48.   #-----------------------------------------------------------------------------
  49.   def read_save_data(file)
  50.      cms_scnload_readsavedata(file)
  51.      $game_menu = Marshal.load(file)
  52.   end
  53. end
Expand to see the code.


Naturally, putting these 3 class mods grouped together (and not individually floating around wherever in your scripts list) is going to enforce the FIFO (first in, first out) as said above.

Good luck with it :smoke:

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=33070