my first working cms
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


you can enable/disable save through event, which will effect if save is in the menu or not

press shift to rotate through the 2 menus

I need tips on how to improve it

the name is probably not original lol, but it was 3 am

read intructions as with any other script, and add this above main

Code:
#=============================================================
#Simplistic Radiance CMS
#
#   created by Tsunokiette - 1/8/2005
#=============================================================
#Instructions-
#   Add this above main
#    
#   Make a new folder named "Faces" inside the Characters folder.
#   To use the faces, make sure you add an 80*80 picture with
#   the exact same name as the characterset your character uses
#   inside the faces folder    
#=============================================================
#Credits-
#   Menu Status from FFVII Menu by AcedentProne
#   Dubealex (location)
#   http://www.phylomortis.com/html/rgss.html (info about scripts)
#   Plystire (help debuging)
#  freakboy (made me realize another simple error)
#=============================================================
#Notes-
#   Every part says it was created by me,
#   this is not true, the only thing made by me,
#   would be the actual scene.
#
#   I just got tired, and copied/pasted the
#   same header above each class, and was too lazy
#   to remove the "created by Tsunokiette - 1/8/2005"
#=============================================================    

#-------------------------------------------------------------

class Scene_Menu

#-------------------------------------------------------------

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

#-------------------------------------------------------------

   def main
      @spriteset = Spriteset_Map.new
      s1 = $data_system.words.item
      s2 = $data_system.words.skill
      s3 = $data_system.words.equip
      s4 = "Status"
      s5 = "Save"
      s6 = "Load"
      s7 = "Quit"
      @command_window = Window_Command.new (140,[s1, s2, s3, s4])
      @command_window.index = @menu_index
      @command_window.x = 250
      @command_window.y = 182
      @command_window.opacity = 255
      @command_window.back_opacity = 200
      if $game_party.actors.size == 0
         @command_window.disable_item (0)
         @command_window.disable_item (1)
         @command_window.disable_item (2)
         @command_window.disable_item (3)
      end
      if $game_system.save_disabled
         @command2_window = Window_Command2.new (140, [s6, s7])
      else
         @command2_window = Window_Command2.new (140, [s5, s6, s7])
      end          
      @command2_window.x = 250
      @command2_window.y = 347
      @command2_window.opacity = 255
      @command2_window.back_opacity = 200
      @playtime_window = Window_PlayTime.new
      @playtime_window.x = 0
      @playtime_window.y = 0
      @playtime_window.opacity = 255
      @playtime_window.back_opacity = 200
      @location_window = Window_Location.new
      @location_window.x = 220
      @location_window.y = 0
      @location_window.opacity = 255
      @location_window.back_opacity = 200
      @gold_window = Window_Gold.new
      @gold_window.x = 440
      @gold_window.y = 0
      @gold_window.opacity = 255
      @gold_window.back_opacity = 200
      @status_window = Window_MenuStatus.new
      @status_window.x = 40
      @status_window.y = 13
      @status_window.z = 2000
      @status_window.visible = false

      Graphics.transition
      loop do
         Graphics.update
         Input.update
         update
         if $scene != self
            break
         end
      end
      
      Graphics.freeze
         @command_window.dispose
         @command2_window.dispose
         @playtime_window.dispose
         @location_window.dispose
         @gold_window.dispose
         @status_window.dispose
         @spriteset.dispose
      end

#-------------------------------------------------------------

   def update
      @command_window.update
      @command2_window.update
      @playtime_window.update
      @location_window.update
      @gold_window.update
      @status_window.update
      if @command_window.active
         update_command
         return
      end
      if @command2_window.active
         update_command2
         return
      end
      if @status_window.active
         update_status
         return
      end
   end

#-------------------------------------------------------------

   def update_command
      if Input.trigger?(Input::A)
         @command_window.active = false
      @command_window.index = -1
         @command2_window.active = true
         @command2_window.index = 0
      end
      if Input.trigger?(Input::B)
         $game_system.se_play ($data_system.cancel_se)
         $scene = Scene_Map.new
         return
      end
      if Input.trigger?(Input::C)
         if $game_party.actors.size == 0 and @command_window.index < 4
            $game_system.se_play ($data_system.buzzer_se)
            return
         end
         case @command_window.index
            when 0
               $game_system.se_play ($data_system.decision_se)
               $scene = Scene_Item.new
            when 1
               $game_system.se_play ($data_system.decision_se)
               @command_window.active = false
               @status_window.active = true
               @status_window.visible = true
               @status_window.index = 0
            when 2
               $game_system.se_play ($data_system.decision_se)
               @command_window.active = false
               @status_window.active = true
               @status_window.visible = true
               @status_window.index = 0
            when 3
               $game_system.se_play ($data_system.decision_se)
               @command_window.active = false
               @status_window.active = true
               @status_window.visible = true
               @status_window.index = 0
            end
            return
      end
   end

#-------------------------------------------------------------

   def update_command2
      if Input.trigger?(Input::A)
         @command_window.active = true
      @command_window.index = 0
         @command2_window.active = false
         @command2_window.index = -1
      end
      if Input.trigger?(Input::B)
         $game_system.se_play ($data_system.cancel_se)
         $scene = Scene_Map.new
         return
      end
      if Input.trigger?(Input::C)
         if $game_system.save_disabled
            case @command2_window.index
               when 0
                  $game_system.se_play ($data_system.decision_se)
                  $scene = Scene_Load2.new
               when 1
                  $game_system.se_play ($data_system.decision_se)
                  $scene = Scene_End.new
               end
               return
         else
            case @command2_window.index
               when 0
                  $game_system.se_play ($data_system.decision_se)
                  $scene = Scene_Save.new
               when 1
                  $game_system.se_play ($data_system.decision_se)
                  $scene = Scene_Load2.new
               when 2
                  $game_system.se_play ($data_system.decision_se)
                  $scene = Scene_End.new
               end
               return
         end
      end
   end

#-------------------------------------------------------------
   def update_status
      if Input.trigger?(Input::B)
         $game_system.se_play ($data_system.cancel_se)
         @command_window.active = true
         @status_window.visible = false
      @status_window.active = false
         @status_window.index = -1
         return
      end
      if Input.trigger?(Input::C)
         case @command_window.index
         when 1
            if $game_party.actors[@status_window.index].restriction >= 2
               $game_system.se_play($data_system.buzzer_se)
            return
            end
            $game_system.se_play($data_system.decision_se)
            $scene = Scene_Skill.new (@status_window.index)
         when 2
            $game_system.se_play($data_system.decision_se)
            $scene = Scene_Equip.new (@status_window.index)
         when 3
            $game_system.se_play($data_system.decision_se)
            $scene = Scene_Status.new (@status_window.index)
         end
         return
      end
   end          
#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
#Game Status Menu
#
#   created by Tsunokiette - 1/8/2005
#=============================================================

#-------------------------------------------------------------

class Window_Command2 < Window_Selectable

#-------------------------------------------------------------

   def initialize (width, commands)
      super (0, 0, width, commands.size * 32 + 32)
      @item_max = commands.size
      @commands = commands
      self.contents = Bitmap.new (width - 32, @item_max * 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
      refresh
      self.active = false
      self.index = -1
   end

#-------------------------------------------------------------

   def refresh
      self.contents.clear
      for i in 0...@item_max
         draw_item (i, normal_color)
      end
   end

#-------------------------------------------------------------

   def draw_item (index, color)
      self.contents.font.color = color
      rect = Rect.new (4, 32 * index, self.contents.width - 8, 32)
      self.contents.fill_rect (rect, Color.new (0, 0, 0, 0))
      self.contents.draw_text (rect, @commands [index])
   end

#-------------------------------------------------------------

   def disable_item (index)
      draw_item (index, disabled_color)
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
#Playtime Window
#
#   created by Tsunokiette - 1/8/2005
#=============================================================

#-------------------------------------------------------------

class Window_PlayTime < Window_Base

#-------------------------------------------------------------

   def initialize
      super (0,0, 200, 80)
      self.contents = Bitmap.new (width - 32, height - 32)
    self.contents.font.size = $defaultfontsize
    self.contents.font.name = $defaultfonttype
      refresh
   end

#-------------------------------------------------------------

   def refresh
      self.contents.clear
      self.contents.font.color = system_color
      self.contents.draw_text (4, 0, 120, 32, "Elapsed Time")
      @total_sec = Graphics.frame_count / Graphics.frame_rate
      hour = @total_sec / 60 / 60
      min = @total_sec /60 % 60
      sec = @total_sec % 60
      text = sprintf ("%02d:%02d:%02d", hour, min, sec)
      self.contents.font.color = normal_color
      self.contents.draw_text (10, 24, 120, 28, text, 2)
   end

#-------------------------------------------------------------

   def update
      super
      if Graphics.frame_count / Graphics.frame_rate != @total_sec
         refresh
      end
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
# Game_Map Additional Code
#=============================================================

#-------------------------------------------------------------

class Game_Map

#-------------------------------------------------------------

   def name
      $map_infos [@map_id]
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
# Scene_Title Additional Code
#=============================================================

#-------------------------------------------------------------

class Scene_Title

#-------------------------------------------------------------

   $map_infos = load_data ("Data/MapInfos.rxdata")
   for key in $map_infos.keys
      $map_infos [key] = $map_infos[key].name
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
#Location_Window
#
#   created by Tsunokiette - 1/8/2005
#=============================================================

#-------------------------------------------------------------

class Window_Location < Window_Base

#-------------------------------------------------------------

   def initialize
      super (0, 0, 200, 80)
      self.contents = Bitmap.new (width - 32, height - 32)
    self.contents.font.size = $defaultfontsize
    self.contents.font.name = $defaultfonttype
      refresh
   end

#-------------------------------------------------------------

   def refresh
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text (5, 0, 110, 42, $game_map.name, 2)
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
#Gold_Window
#
#   created by Tsunokiette - 1/8/2005
#=============================================================

#-------------------------------------------------------------

class Window_Gold < Window_Base

#-------------------------------------------------------------

   def initialize
      super (0, 0, 200, 80)
      self.contents = Bitmap.new (width - 32, height - 32)
    self.contents.font.size = $defaultfontsize
    self.contents.font.name = $defaultfonttype
      refresh
   end

#-------------------------------------------------------------

   def refresh
      self.contents.clear
      cx = contents.text_size ($data_system.words.gold) .width
      self.contents.font.color = normal_color
      self.contents.draw_text (40, 5, 120-cx-2, 32, $game_party.gold.to_s, 2)
      self.contents.font.color = system_color
      self.contents.draw_text (160-cx, 5, cx, 32, $data_system.words.gold, 2)
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
# Window_Base Additional Code
#=============================================================


#-------------------------------------------------------------

class Window_Base < Window

#-------------------------------------------------------------

   def draw_actor_face (actor, x, y)
      face = RPG::Cache.character ("Faces/" + actor.character_name, actor.character_hue)
      fw = face.width
      fh = face.height
      src_rect = Rect.new (0, 0, fw, fh)
      self.contents.blt (x - fw / 23, y - fh, face, src_rect)
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
#Window_MenuStatus
#
#   created by Tsunokiette - 1/8/2005
#=============================================================

#-------------------------------------------------------------

class Window_MenuStatus < Window_Selectable

#-------------------------------------------------------------

   def initialize
      super (0, 0, 560, 454)
      self.contents = Bitmap.new (width - 32, height - 32)
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
      refresh
      self.active = false
      self.index = -1
   end

#-------------------------------------------------------------

   def refresh
      self.contents.clear
      @item_max = $game_party.actors.size
      for i in 0...$game_party.actors.size
         x = 94
         y = i * 110
         actor = $game_party.actors[i]
         draw_actor_face (actor, 12, y + 90)
         draw_actor_name (actor, x, y)
         draw_actor_class (actor, x + 120, y)
         draw_actor_level (actor, x, y + 18)
         draw_actor_state (actor, x + 230, y)
         draw_actor_exp (actor, x + 144, y + 38)
         draw_actor_hp (actor, x, y + 38)
         draw_actor_sp (actor, x, y + 58)
      end
   end

   def update_cursor_rect
      if @index < 0
         self.cursor_rect.empty
      else
         self.cursor_rect.set (0, @index * 116, self.width - 32, 96)
      end
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
#Scene_Load2
#
#   created by Tsunokiette - 1/8/2005
#=============================================================

#-------------------------------------------------------------

class Scene_Load2 < Scene_File

#-------------------------------------------------------------
def initialize
    $game_temp = Game_Temp.new
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
      if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Which file do you want to load?")
  end

#-------------------------------------------------------------
  def on_decision(filename)
    unless FileTest.exist?(filename)
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $game_system.se_play($data_system.load_se)
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    $game_map.update
    $scene = Scene_Map.new
  end

#-------------------------------------------------------------

  def on_cancel
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Menu.new
  end

#-------------------------------------------------------------

  def read_save_data(file)
    characters = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
    if $game_system.magic_number != $data_system.magic_number
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    $game_party.refresh
  end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
# Scene_End Change
#=============================================================

#-------------------------------------------------------------

class Scene_End

#-------------------------------------------------------------

   def command_cancel
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Menu.new
   end

#-------------------------------------------------------------

end

#-------------------------------------------------------------

#=============================================================
# Scene_Save Change
#=============================================================

#-------------------------------------------------------------

class Scene_Save < Scene_File

#-------------------------------------------------------------

  def on_cancel
    $game_system.se_play($data_system.cancel_se)
    if $game_temp.save_calling
      $game_temp.save_calling = false
      $scene = Scene_Map.new
      return
    end
    $scene = Scene_Menu.new
  end

#-------------------------------------------------------------

end

#-------------------------------------------------------------
}




Users browsing this thread: 1 Guest(s)