The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: Arrow on March 17, 2008, 01:24:06 AM

Title: [RMVX] Mother Style CMS
Post by: Arrow on March 17, 2008, 01:24:06 AM
Mother Style CMS
Version: 1.0
Author: Worale (Original) - Arrow-1 (Alteration) [Worale simply wishes to be credited in some form or another- I would kinda like a spot in your "Credits Reel", assuming that this gets to be as complete as I want it to be.]
Date: March 16th, 2008 (as of v1.0)

Version History



Planned Future Versions


Description


This script, edited from Worale's "Lite Menu" script, is meant to be a replicate of the CMS in the Mother series. I'm using this to sort of learn the ins and outs of RGSS2.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg296.imageshack.us%2Fimg296%2F1363%2F51449460af3.png&hash=408ee43c027a91e361ed8af910ce6e196b6cbc7d)

Instructions

First, you will need to replace Scene_Base with the first of the two scripts below. Just replace the whole damn thing. Then, insert the second script into a blank new slot above Main.

You're done.

Script


Scene_Base

Code: [Select]
#==============================================================================
# ** Scene_Base
#------------------------------------------------------------------------------
#  This is a superclass of all scenes in the game.
#==============================================================================

class Scene_Base
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    start                         # Start processing
    perform_transition            # Perform transition
    post_start                    # Post-start processing
    Input.update                  # Update input information
    loop do
      Graphics.update             # Update game screen
      Input.update                # Update input information
      update                      # Update frame
      break if $scene != self     # When screen is switched, interrupt loop
    end
    Graphics.update
    pre_terminate                 # Pre-termination processing
    Graphics.freeze               # Prepare transition
    terminate                     # Termination processing
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
  end
  #--------------------------------------------------------------------------
  # * Execute Transition
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(0)
  end
  #--------------------------------------------------------------------------
  # * Post-Start Processing
  #--------------------------------------------------------------------------
  def post_start
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
  end
  #--------------------------------------------------------------------------
  # * Pre-termination Processing
  #--------------------------------------------------------------------------
  def pre_terminate
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    Graphics.transition(0)
  end
  #--------------------------------------------------------------------------
  # * Create Snapshot for Using as Background of Another Screen
  #--------------------------------------------------------------------------
  def snapshot_for_background
    $game_temp.background_bitmap.dispose
    $game_temp.background_bitmap = Graphics.snap_to_bitmap
  end
  #--------------------------------------------------------------------------
  # * Create Background for Menu Screen
  #--------------------------------------------------------------------------
  def create_menu_background
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = $game_temp.background_bitmap
    update_menu_background
  end
  #--------------------------------------------------------------------------
  # * Dispose of Background for Menu Screen
  #--------------------------------------------------------------------------
  def dispose_menu_background
    @menuback_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Update Background for Menu Screen
  #--------------------------------------------------------------------------
  def update_menu_background
  end
end


Mother Menu

Code: [Select]
#==============================================================================
# ¦ [RMVX] Lite Menu Version 1.01
#------------------------------------------------------------------------------
# by Woratana [woratana@hotmail.com]
# released on 03/02/2008
#
# Features Version 1.01
# - Fixed Bug in Gold_Text
# Features Version 1.0
# - Allow user to config menu
# - Add Gold/Location Window (user can turn on/off)
#==============================================================================

module Wor_Litemenu
  #================
  # SETUP Script Here!
  #================
  MENU_WINDOW_Y = 10
  MENU_WINDOW_X = 10
  CHARA_WINDOW_Y = 160
  CHARA_WINDOW_WIDTH = 175
  SHOW_LV = false
  SHOW_LOCATION_WINDOW = true
  VOCAB_LOCATION = ""
  VOCAB_GOLD = "$"
  LOCATION_WINDOW_Y = 128
  LOCATION_WINDOW_X = 10
  LOCATION_TEXT_X = 0
  GOLD_TEXT_X = 2
end

class Scene_Menu < Scene_Base

  def initialize(menu_index = 0)
@menu_index = menu_index
  end

  def start
super
  create_menu_background
create_command_window
lite_create_location_window if Wor_Litemenu::SHOW_LOCATION_WINDOW == true
lite_create_actor_window
  end
 
# START LITE METHOD
  def lite_create_actor_window
member = []
@item_max = $game_party.members.size
for actor in $game_party.members
member.push ((actor.name) + " Lv." + (actor.level.to_s)) if Wor_Litemenu::SHOW_LV == true
member.push (actor.name) if Wor_Litemenu::SHOW_LV == false
end
@status_window = Window_Command.new(Wor_Litemenu::CHARA_WINDOW_WIDTH, member)
@status_window.index = @menu_index
@status_window.x = (554 /2) - (@status_window.width/2)
@status_window.y = Wor_Litemenu::CHARA_WINDOW_Y
@status_window.visible = false
  end

  def lite_get_map_name
mapdata = load_data("Data/MapInfos.rvdata")
map_id = $game_map.map_id
@map_name = mapdata[map_id].name
  end
 
  def lite_draw_currency_value(value, x, y, width)
cx = @location_window.contents.text_size(Vocab::gold).width
@location_window.contents.font.color = @location_window.normal_color
@location_window.contents.draw_text(x+12, y, @location_window.width+cx, 24, value, 0)
  end
 
  def lite_create_location_window
width = 300
height = 90
x = Wor_Litemenu::LOCATION_WINDOW_X
y = Wor_Litemenu::LOCATION_WINDOW_Y
@location_window = Window_Base.new(x, y, width/2-20, height/2+10)
@location_window.create_contents
  @location_window.contents.font.color = @location_window.system_color
@location_window.contents.draw_text(0, 0, 300, 24, Wor_Litemenu::VOCAB_GOLD)
@location_window.contents.font.color = @location_window.normal_color
lite_draw_currency_value($game_party.gold, 4, 0, Wor_Litemenu::GOLD_TEXT_X)

  end

# END LITE METHOD

  def terminate
super
dispose_menu_background
@command_window.dispose
@location_window.dispose if @location_window
@status_window.dispose
  end
 
  def update
super
update_menu_background
@command_window.update
if @command_window.active
  update_command_selection
elsif @status_window.active
  @status_window.update
  update_actor_selection
end
  end

  def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
@command_window = Window_Command.new(200, [s1, s2, s3, s4, s5, s6],2,3)
@command_window.index = @menu_index
@command_window.x = Wor_Litemenu::MENU_WINDOW_X
@command_window.y = Wor_Litemenu::MENU_WINDOW_Y
if $game_party.members.size == 0
  @command_window.draw_item(0, false)
  @command_window.draw_item(1, false)
  @command_window.draw_item(2, false)
  @command_window.draw_item(3, false)
end
if $game_system.save_disabled
  @command_window.draw_item(4, false)
end
  end

  def start_actor_selection
@command_window.active = false
@status_window.visible = true
@status_window.active = true
@status_window.index = 0
  end

  def end_actor_selection
@command_window.active = true
@status_window.visible = false
@status_window.active = false
@status_window.index = -1
  end
 
end

Credit



Thanks


Support


If it breaks, post here, then PM me with a link.

Known Compatibility Issues

I think you're cool.

Demo


...I really, really don't think you need one, but if you beg, I'll see what I can do.

Author's Notes


Note to self: Buy a gallon of milk, a loaf a bread, a stick of butter.

Restrictions

Go nuts.

Title: Re: [RMVX] Mother Style CMS
Post by: Leventhan on March 17, 2008, 07:21:29 AM
*goes nuts*
Title: Re: [RMVX] Mother Style CMS
Post by: modern algebra on March 18, 2008, 12:03:39 PM
Looks good, but I can't say I approve of your Scene_Base overwriting shenanigans.

Anyway, when you want to add something to Scene_Base, it is unnecessary to overwrite it entirely. First, because you can add things to a class even if it is not in the same sheet in the editor.

In other words, if I actually did want to overwrite the execute_transition method of Scene_Base, then it would be enough to make a new sheet in the editor anywhere below the real Scene_Base and put this in:

Code: [Select]
class Scene_Base
  #--------------------------------------------------------------------------
  # * Execute Transition
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(0)
  end
end

You do not perform major changes to Scene_Base, and, like I said, it is unnecessary to reproduce the entire class because you do not need to write over all of that other stuff.

From what I can tell, you have modified four methods of Scene_Base: perform_transition, terminate, snapshot_for_background, and create_menu_background. Thus, assuming we are overwriting and not aliasing, it is enough to add this into a new script:

Code: [Select]
class Scene_Base
  #--------------------------------------------------------------------------
  # * Execute Transition
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(0)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    Graphics.transition(0)
  end
  #--------------------------------------------------------------------------
  # * Create Snapshot for Using as Background of Another Screen
  #--------------------------------------------------------------------------
  def snapshot_for_background
    $game_temp.background_bitmap.dispose
    $game_temp.background_bitmap = Graphics.snap_to_bitmap
  end
  #--------------------------------------------------------------------------
  # * Create Background for Menu Screen
  #--------------------------------------------------------------------------
  def create_menu_background
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = $game_temp.background_bitmap
    update_menu_background
  end
end

Now, you shouldn't overwrite these methods - under normal circumstances you would alias them but my stronger objection is that you shouldn't be editing Scene_Base because by doing so you are affecting every other scene that uses these methods when you really only want to be affecting Scene_Menu

Now, I will teach you something. Scene_Menu, which you edit, is a subclass of Scene_Base (Scene_Menu < Scene_Base) - This means a lot of things, but for our purposes what it means is that whenever these methods in Scene_Base are accessed, they are accessed through Scene_Menu. So, what we really ought to do is place these methods in Scene_Menu, rather than Scene_Base.

So, now we have:

Code: [Select]

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Execute Transition
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(0)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias arrow1_mothermenu_trmnt terminate
  def terminate
    arrow1_mothermenu_trmnt
    Graphics.transition(0)
  end
  #--------------------------------------------------------------------------
  # * Create Snapshot for Using as Background of Another Screen
  #--------------------------------------------------------------------------
  def snapshot_for_background
    $game_temp.background_bitmap.dispose
    $game_temp.background_bitmap = Graphics.snap_to_bitmap
  end
  #--------------------------------------------------------------------------
  # * Create Background for Menu Screen
  #--------------------------------------------------------------------------
  def create_menu_background
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = $game_temp.background_bitmap
    update_menu_background
  end
end

Adding that will make it so that your script works exactly as it does now, but already you have cut out having to replace all of Scene_Menu and avoided a thousand compatibility issues with other scripts.

Now, I would normally use this opportunity to teach you about aliasing, but in this case you would actually use super if you wanted to call the old methods. I don't have time to get into it right now unfortunately. And actually, this is a case where aliasing is unnecessary. Just for good measure though, I'll point you to this tutorial that I never released because it makes some shaky, untrue claims, but it might give you a good idea about how to use aliasing, even if it misleads you about what aliasing is: http://rmrk.net/index.php/topic,20892.0.html

So really those are my only comments.

Anyway, good job Arrow - my criticism is long but there isn't much meat in it - it looks like you did a good job. I haven't looked at the other part of the script yet.

* moves to Database

EDIT::
Whoops, I lied actually. That script will not work because Worale also edits the terminate method. I threw in an alias there now so that nothing would screw up as long as this thing is below worale's,  but considering you are editing his script it actually makes sense to just put your changes in with his method. But as it is, it should work, unless I overlooked it more and worale edited the other methods too.
Title: Re: [RMVX] Mother Style CMS
Post by: worale on March 18, 2008, 07:21:38 PM
@Arrow

Nice Job :)

As MA said, you can just write your script on my Lite Menu. It will affect other scripts that use Scene_Base if you rewrite Scene_Base.


@MA

I rewrote all methods that didn't have 'lite_' in the method's name. (e.g. lite_create_actor_window, lite_get_map_name)

Here's the script's thread. http://rmrk.net/index.php/topic,24519.0.html
Title: Re: [RMVX] Mother Style CMS
Post by: Arrow on March 18, 2008, 07:51:41 PM
That is very useful! Thanks Modern, and Worale!

Thanks so much for helping me out like you have been Modern. ;_________;
Title: Re: [RMVX] Mother Style CMS
Post by: Demonic Blade on April 03, 2008, 02:05:25 PM
This looks pretty good, I might use it, but uh... are we supposed to take the edited script by Modern, or Arrow-1's...?
Title: Re: [RMVX] Mother Style CMS
Post by: Arrow on April 07, 2008, 08:15:06 PM
Use Modern's, I would say, his is cleaner. :D
Title: Re: [RMVX] Mother Style CMS
Post by: modern algebra on April 07, 2008, 09:14:12 PM
You'd still have to use worale's script for it to work, though.
Title: Re: [RMVX] Mother Style CMS
Post by: Demonic Blade on April 08, 2008, 02:52:21 PM
Yes, of course, I just meant that Arrow-1 hadn't excactly put it in the first post. I'd recommend putting Modern's in a spoiler or something like that, just so people won't have to ask the same questions over and over (I know that I don't always read every post of every topic I post something in...) ;) Still, looks nice

EDIT: I have realized that you have  switched two commands though. End game is save and save does nothing...