Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first 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.


i finally made my first CMS :)
i attached pic and code is here:
Code:
#==============================================================================
# â–�  Scene_Menu
#------------------------------------------------------------------------------
#  メニュー画��処� を行� クラス��。
#==============================================================================

  class Scene_Menu
  #--------------------------------------------------------------------------
  # â—? Initialize
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # â—? Main
  #--------------------------------------------------------------------------
  def main
    # コマンドウィンドウを作æˆ?
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @command_window.x = 480
    @command_window.y = 64
    # パーãƒ� ィ人数ã?Œ 0 人ã?®å� ´å?ˆ
    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
      # セーブを無å� ¹ã?«ã?™ã‚‹
      @command_window.disable_item(4)
    end
    # プレイ時間ウィンドウを作æˆ?
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 480
    @playtime_window.y = 288
    # ゴールドウィンドウを作æˆ?
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 384
    # スãƒ� ータスウィンドウを作æˆ?
    @status_window = Window_MenuStatus.new
    @status_window.x = 0
    @status_window.y = 64
    # help window
    @help_window = Window_Help.new
    @help_window.x = 0
    @help_window.y = 0
    case @command_window.index
      when 0
          @help_window.set_text("View/use your items.")
      when 1  # スキル
          @help_window.set_text("Check your skills.")
      when 2  # 装備
          @help_window.set_text("Equip weapons and armor.")
      when 3  # スãƒ� ータス
          @help_window.set_text("See the players status.")
      when 4  # セーブ
          @help_window.set_text("Save the current game.")
      when 5  # ゲーãƒ� 終äº�
          @help_window.set_text("End the current game.")
    end
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーãƒ� ç”»é?¢ã‚’æ›´æ–°
      Graphics.update
      # å…¥å� ›æƒ…å� ±ã‚’æ›´æ–°
      Input.update
      # フレーãƒ� æ›´æ–°
      update
      # ç”»é?¢ã?Œåˆ‡ã‚� 替ã‚?ã?£ã?Ÿã‚‰ãƒ«ãƒ¼ãƒ—を中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # ウィンドウを解放
    @command_window.dispose
    @playtime_window.dispose
    @gold_window.dispose
    @status_window.dispose
    @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # â—? Update
  #--------------------------------------------------------------------------
  def update
    # ウィンドウを更新
    @command_window.update
    @playtime_window.update
    @gold_window.update
    @status_window.update
    @help_window.update
    case @command_window.index
      when 0
          @help_window.set_text("View/use your items.")
      when 1  # スキル
          @help_window.set_text("Check your skills.")
      when 2  # 装備
          @help_window.set_text("Equip weapons and armor.")
      when 3  # スãƒ� ータス
          @help_window.set_text("See the players status.")
      when 4  # セーブ
          @help_window.set_text("Save the current game.")
      when 5  # ゲーãƒ� 終äº�
          @help_window.set_text("End the current game.")
    end
    # コマンドウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ: update_command を呼ã?¶
    if @command_window.active
      update_command
      return
    end
    # スãƒ� ータスウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ: update_status を呼ã?¶
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # â—? Update Command
  #--------------------------------------------------------------------------
  def update_command
    # B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
    if Input.trigger?(Input::B)
      # キャンセル SE ã‚’æ¼”å¥?
      $game_system.se_play($data_system.cancel_se)
      # マップ画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
      $scene = Scene_Map.new
      return
    end
    # C ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
    if Input.trigger?(Input::C)
      # パーãƒ� ィ人数ã?Œ 0 人ã?§ã€?セーブã€?ゲーãƒ� 終äº� 以外ã?®ã‚³ãƒžãƒ³ãƒ‰ã?®å� ´å?ˆ
      if $game_party.actors.size == 0 and @command_window.index < 4
        # ブザー SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # コマンドウィンドウã?®ã‚«ãƒ¼ã‚½ãƒ«ä½?ç½®ã?§åˆ� å²?
      case @command_window.index
      when 0  # アイãƒ� ãƒ�
        # 決定 � SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # アイãƒ� ãƒ� ç”»é?¢ã?«åˆ‡ã‚� 替ã?ˆ
        $scene = Scene_Item.new
      when 1  # スキル
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # スãƒ� ータスウィンドウをアクãƒ� ィブã?«ã?™ã‚‹
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # 装備
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # スãƒ� ータスウィンドウをアクãƒ� ィブã?«ã?™ã‚‹
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # スãƒ� ータス
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # スãƒ� ータスウィンドウをアクãƒ� ィブã?«ã?™ã‚‹
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # セーブ
        # セーブç¦?æ­¢ã?®å� ´å?ˆ
        if $game_system.save_disabled
          # ブザー SE ã‚’æ¼”å¥?
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # セーブ画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
        $scene = Scene_Save.new
      when 5  # ゲーãƒ� 終äº�
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # ゲーãƒ� 終äº� ç”»é?¢ã?«åˆ‡ã‚� 替ã?ˆ
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # â—? Update Status
  #--------------------------------------------------------------------------
  def update_status
    # B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
    if Input.trigger?(Input::B)
      # キャンセル SE ã‚’æ¼”å¥?
      $game_system.se_play($data_system.cancel_se)
      # コマンドウィンドウをアクãƒ� ィブã?«ã?™ã‚‹
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # C ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
    if Input.trigger?(Input::C)
      # コマンドウィンドウã?®ã‚«ãƒ¼ã‚½ãƒ«ä½?ç½®ã?§åˆ� å²?
      case @command_window.index
      when 1  # スキル
        # ã?“ã?®ã‚¢ã‚¯ã‚¿ãƒ¼ã?®è¡Œå‹•åˆ¶é™?ã?Œ 2 以ä¸� ã?®å� ´å?ˆ
        if $game_party.actors[@status_window.index].restriction >= 2
          # ブザー SE ã‚’æ¼”å¥?
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # スキル画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # 装備
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # 装備画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # スãƒ� ータス
        # 決定 SE ã‚’æ¼”å¥?
        $game_system.se_play($data_system.decision_se)
        # スãƒ� ータス画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end
And you need some modifications to Window_Gold
Code:
#==============================================================================
# â–�  Window_Gold
#------------------------------------------------------------------------------
#  ゴールドを表示�るウィンドウ��。
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # â—? オブジェクトåˆ?期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    refresh
  end
  #--------------------------------------------------------------------------
  # â—? リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, $data_system.words.gold.to_s + ":")
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s, 2)
  end
end
And some modifications to Window_MenuStatus:
Code:
#==============================================================================
# â–�  Window_MenuStatus
#------------------------------------------------------------------------------
#  メニュー画��パー� ィメン�ー�ス� ータスを表示�るウィンドウ��。
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # â—? オブジェクトåˆ?期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 480, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    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 = 64
      y = i * 96
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 80)
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 32)
      draw_actor_state(actor, x + 90, y + 32)
      draw_actor_exp(actor, x, y + 64)
      draw_actor_hp(actor, x + 236, y + 32)
      draw_actor_sp(actor, x + 236, y + 64)
    end
  end
  #--------------------------------------------------------------------------
  # â—? カーソルã?®çŸ©å½¢æ›´æ–°
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 96, self.width - 32, 96)
    end
  end
end
just overwrite those scripts with these and it will work, please report any bugs etc. so i can learn more :)
}




Users browsing this thread: