The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: WcW on May 14, 2007, 01:09:45 AM

Title: [RESOLVED] Simple CMS
Post by: WcW on May 14, 2007, 01:09:45 AM
This isn't too hard, I don't think.  There's a rough draft attached, but if it's messed up or not descriptive enough, here's what I want in words.  Also, I have everying thing except the CMS and the Options, and I'm requesting one of those here, so here goes:

In the top-right:  The Status window from the DMS
On the bottom, below the Status Window:
  Left: Gold
  Center: playtime
  Right: Steps
On the right, the menu selection thing, that has the following:
  Inventory
  Skills
  Equip
  Status
  Party
  Quest
  Save
  Load
  Option
  Close

And that's it.  Hopefully someone can do this for me (and get full credits), or at least explain to me how to do it.
Title: Re: Simple CMS[Request]
Post by: modern algebra on May 14, 2007, 01:40:05 AM
I can do it, I think.

Is this a one-person CMS? or would you allow scrolling through multiple party members?
Title: Re: Simple CMS[Request]
Post by: WcW on May 14, 2007, 09:28:35 PM
The status window is the same one from the normal men screen, that's why I said "Status window fro mthe DMS."  DMS does stand for Default Menu Screen, right? 
Sorry if that sounded a little harsh.
Title: Re: Simple CMS[Request]
Post by: modern algebra on May 15, 2007, 01:17:58 AM
OH, sorry, I misunderstood. I thought you meant the status window for a single player, not MenuStatus. Yeah, okay, I will start on it now.

Can I have the class names for the non-default scripts?


Also, what do you want "Close" to do. I assumed you want it to close the menu screen, but then you have no Exit Game option, so I began to doubt that interpretation.

And, this will require some resizing of the MenuStatus Window. That Ok?
Title: Re: Simple CMS[Request]
Post by: WcW on May 15, 2007, 02:15:08 AM
@First Request:  Yep, everything except Options, but I can probably script that in myself (I'm not totally helpless) Party: $scene = Scene_PartySwitcher.new, Quest: $scene = Scene_Quest.new

@Second Request: Send it back to the map, why would you add an option for closing the game when you can press X?

@Third Request: Yep.  That's fine.

Thanks for the help, I understand the concept of scripts but not how to make them work.
Title: Re: Simple CMS[Request]
Post by: modern algebra on May 15, 2007, 02:41:48 AM

#==============================================================================
# WcW's Custom Menu Edit
#==============================================================================

#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 480, 385)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 91
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 75)
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 26)
      draw_actor_state(actor, x + 90, y + 26)
      draw_actor_exp(actor, x, y + 52)
      draw_actor_hp(actor, x + 236, y + 26)
      draw_actor_sp(actor, x + 236, y + 52)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 91, self.width - 32, 92)
    end
  end
end


#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Party"
    s6 = "Quest"
    s7 = "Save"
    s8 = "Load"
    s9 = "Options"
    s10 = "Close"
    @command_window = Window_Command.new(130, [s1, s2, s3, s4, s5, s6,s7,s8,s9,s10])
    @command_window.x = 510
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, status, and party
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(6)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 160
    @playtime_window.y = 385
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 385
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 320
    @gold_window.y = 385
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 0
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # party
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to Party screen
        $scene = Scene_PartySwitcher.new
      when 5 # Quest
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to Quest Screen
        $scene = Scene_Quest.new
      when 6 # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 7 # load
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Load.new
      when 8 # options
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Options.new
      when 9 # Close Menu
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to map screen
        $scene = Scene_Map.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end


Okay, all done. Tell me if you have any problems with it
Title: Re: Simple CMS[Request]
Post by: WcW on May 15, 2007, 02:49:55 AM
Okay, everything works just fine, except the Quests- its not your fault, its mine.  I need something added to the Quest command so that I can turn it on/off, please.

P.S.: I repped you- my first one, just got that privilege  :D
Title: Re: Simple CMS[Request]
Post by: modern algebra on May 15, 2007, 03:11:43 AM
Alright, no problem:

Try inserting this:


    # If Quest is disabled
    if $quest_disabled == true
      # Disable quest
      @command_window.disable_item(5)
    end


right after this:


    if $game_party.actors.size == 0
      # Disable items, skills, equipment, status, and party
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    end


Now, to disable, just use a call script with this:

$quest_disabled = true

And to enable, use this:

$quest_disabled = nil
Title: Re: Simple CMS[Request]
Post by: WcW on May 15, 2007, 11:30:03 AM
Thanks, Modern.  I do't have time tlo try it right now, but I looked over it and I'm pretty sure it'll work now.

EDIT:  Yep, works perfectly.  Thanks again.
Title: Re: [Resolved] Simple CMS
Post by: modern algebra on May 15, 2007, 12:12:26 PM
No problem, I'm glad I could help

:pimp: