Alissa's Quest CMS


Pengenalan

CMS (custom menu system) ini menambahkan menu Quests di bagian Main Menu. Quests digunakan untuk melihat misi-misi yang telah dilaksanakan/belum.






Petunjuk & Pemasangan

Di class Quests sudah disediakan fungsi buat manipulasi quest, yaitu: $quests.add_quest(objective) dan $quests.mark_quest(idx,mark). Pada penggunaannya di event, untuk menambahkan quest, gunakan event command (nomor variable nya sesuai kebutuhan anda, untuk menyimpan indeks quest baru):
Code:
@>Script: $game_variables[1] = $quests.add_quest("Sample Quest")

untuk menandai bahwa quest yg diberi 'telah dilaksanakan', gunakan event command:
Code:
@>Script: $quests.mark_quest($game_variables[1],1)


Script nya silahkan taruh diatas "Main"
Btw, kalo ngalamin masalah missing font saat jalanin demo, berarti anda butuh font "Gabriola", atau hilangin bagian di "Main":
Code:
  Font.default_name = "Gabriola"
  Font.default_size = 40




Screenshot
Spoiler:






Demo

Link: Mediafire


Script

Quest CMS - Scene_Quest:
Code:
#==============================================================================
# Alissa's Quest CMS
# for RPG Maker XP
# Version 1.0
#==============================================================================
# Information:
#  This CMS (custom menu system) adds Quests menu, allowing you to see
#  your missions you have to do.
#
#  To add a quest, use event command:
#    @>Script: $game_variables[1] = $quests.add_quest("Sample Quest")
#  To mark the quest as completed (1)/incomplete (0), use event command:
#    @>Script: $quests.mark_quest($game_variables[1],1)
#
# Credit
#  Alissa Liu
#
#==============================================================================

#==============================================================================
# ** Quests
#------------------------------------------------------------------------------
# Quest container class. Refer to "$quests" for the instance of
# this class.
#==============================================================================

class Quests
  attr_reader :quest_name
  attr_reader :quest_mark
  def initialize
    @quest_name = Array.new
    @quest_mark = Array.new
  end
  def add_quest(objective)
    @quest_name.push(objective)
    @quest_mark.push(0)
    return @quest_name.length-1
  end
  def mark_quest(idx,mark)
    @quest_mark[idx] = mark
  end
end

#==============================================================================
# ** Window_Quests
#------------------------------------------------------------------------------
# This class shows quest list in Scene_Quest.
#==============================================================================

class Window_Quests < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if $quests.quest_name.length>0
      for i in 0..$quests.quest_name.length-1
        if $quests.quest_mark[i]==1
          mark = "+"
          mark2 = " (completed)"
        else
          mark = "-"
          mark2 = ""
        end
        self.contents.draw_text(0, 32*i, 640, 32, mark+" "+$quests.quest_name[i]+mark2)
      end
    else
      self.contents.draw_text(0, 0, 640, 32, "(Quests not discovered yet)")
    end
  end
end

#==============================================================================
# ** Scene_Quest
#------------------------------------------------------------------------------
#  This class performs Scene_Quest.
#==============================================================================

class Scene_Quest
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @questit_window = Window_Help.new
    @questit_window.set_text("Quests")
    @quest_window = Window_Quests.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @questit_window.dispose
    @quest_window.dispose
  end
  def update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(6)
      return
    end
  end
end


Quest CMS - Scene_Menu:
Code:
#==============================================================================
# Alissa's Quest CMS
# for RPG Maker XP
# Version 1.0
#==============================================================================
# Information:
#  This CMS (custom menu system) adds Quests menu, allowing you to see
#  your missions you have to do.
#
#  To add a quest, use event command:
#    @>Script: $game_variables[1] = $quests.add_quest("Sample Quest")
#  To mark the quest as completed (1)/incomplete (0), use event command:
#    @>Script: $quests.mark_quest($game_variables[1],1)
#
# Credit
#  Alissa Liu
#
#==============================================================================

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

class Scene_Menu
  #--------------------------------------------------------------------------
  # * 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 = "Save"
    s6 = "End Game"
    s7 = "Quests"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @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 (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  # 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 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      when 6  # quests
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_Quest.new
      end
      return
    end
  end
end


Quest CMS - Scene_Title:
Code:
#==============================================================================
# Alissa's Quest CMS
# for RPG Maker XP
# Version 1.0
#==============================================================================
# Information:
#  This CMS (custom menu system) adds Quests menu, allowing you to see
#  your missions you have to do.
#
#  To add a quest, use event command:
#    @>Script: $game_variables[1] = $quests.add_quest("Sample Quest")
#  To mark the quest as completed (1)/incomplete (0), use event command:
#    @>Script: $quests.mark_quest($game_variables[1],1)
#
# Credit
#  Alissa Liu
#
#==============================================================================

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Stop BGM
    Audio.bgm_stop
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each type of game object
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables    = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party        = Game_Party.new
    $game_troop        = Game_Troop.new
    $game_map          = Game_Map.new
    $game_player        = Game_Player.new
    # Set up initial party
    $game_party.setup_starting_members
    # Set up initial map position
    $game_map.setup($data_system.start_map_id)
    # Move player to initial position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # Refresh player
    $game_player.refresh
    # Run automatic change for BGM and BGS set with map
    $game_map.autoplay
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $quests = Quests.new
    $scene = Scene_Map.new
  end
end


Penulis : Irgi Kusuma ~ Sebuah blog yang menyediakan berbagai macam informasi

Artikel Alissa's Quest CMS ini dipublish oleh Irgi Kusuma pada hari Minggu, 26 Februari 2012. Semoga artikel ini dapat bermanfaat.Terimakasih atas kunjungan Anda silahkan tinggalkan komentar.sudah ada 0 komentar: di postingan Alissa's Quest CMS
 

0 komentar:

Posting Komentar