Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [MODIFICATION]From Questbook to Achievementsbook, New version out! Version 1.3.2!
stripe103
post Jan 14 2010, 07:11 AM
Post #1


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




[Modification]Achievements Book
Version: 1.3.2
Author: Stripe103
Date: June 30, 2010



Version History
Version 1.0 (Sep 23, 2009)
Yea, there was acctually a version 1, but I took it down short after
as many said that it was to hard and that there weren't any instructions

Version 1.1.0 (Jan 10, 2010)
Instructions added.
"XBOX Button" added

Version 1.1.2 (Jan 21, 2010)
Script only two script instead of 12.
"XBOX Button" integrated in script.

Version 1.2.0 (Jan 28, 2010)
Windowskin added(no, I'm not very good at making windowskins, but it works)
More options added

Version 1.2.1 (Jan 28, 2010)
Just a little update to make it more compatible with some scripts.

Version 1.3.0 (Mar 30, 2010)
I have added a Notification script that Night_Runner made for me for my game, but I thought that it would be great here.

Version 1.3.2 (Jun 30, 2010)
Ability to have the map as a background and to make the game continue even if in the menu.
You can now change which key you want to use as the XBOX Button.


Description

This achievements script is a modification from another script: Zeriabs QuestBook 1.2. The reason I chose to edit this is because I think it allready looked a bit like the XBOX Achievements menu. So I edited it to work like it too.
The main goal I'm aiming at is to make it look and work exactly like the XBOX achievements screen with windowskins and images.
There is a lot to do before this is done.


How much rescourses does the system take?
  • 1 variable. To store the GamerScore.
  • 1 switch. For the XBOX Button.
  • 1 Common events. For the achievement check.
  • Then one variable for every achievement you have.





Features

Popup window. This Feature is evented.(Trying to make this scripted[1])
"XBOX Button". When you are in the map, you can get to the achievements screen just by hitting "E".
Instead of going into it through the menu.
You can change this yourself to whatever key on the keyboard you want.
A GamerScore variable.
Choose the name of your GamerScore.
Customizable background image and ability to use map as background.
Customizable windowskins at top and bottom.
Customizable Notification(by Night_Runner)

Screenshots


The Achievements Screen


The Notification Window by Night_Runner

Instructions


There is a instructions file inside the demo.


Script


Please download the demo as there is both image files, instructions, a sound file and a common event in it.


Credit





Support



If you have any questions, post in this thread or PM me.

Known Compatibility Issues


None for the moment.

Demo
[DOWNLOAD]
Filetype: .exe
Filesize: 293 Kb
Host: Mediafire


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
Redd
post Jan 14 2010, 03:38 PM
Post #2


:<
Group Icon

Group: Revolutionary
Posts: 2,310
Type: Developer
RM Skill: Advanced




Err, should be posted in RGSS Scripts.

I love it though much better than the one I have now.

EDIT: The only problem I have with it is that it uses too much scripts. I just want to have one script, not 12 of them. So once you combine them all into one, I'll be happy.


__________________________
Go to the top of the page
 
+Quote Post
   
The Law G14
post Jan 14 2010, 05:28 PM
Post #3


Scripter FTW
Group Icon

Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5




Moved to the RPG Maker XP Scripts Forum.


__________________________

To put in sig, copy this link:
CODE
[url="http://www.rpgrevolution.com/forums/index.php?showtopic=51540"][img]http://img40.imageshack.us/img40/6504/conceptthelawbanner.png[/img][/url]


Sig Stuff


"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!

If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One

My Project Thread: Gai's Hunters


Go to the top of the page
 
+Quote Post
   
Redd
post Jan 14 2010, 06:09 PM
Post #4


:<
Group Icon

Group: Revolutionary
Posts: 2,310
Type: Developer
RM Skill: Advanced




Hey here's the whole thing in one script. Configuration is at the top of the script.
[spoiler=Long Script]
Here is the code:
CODE
#==============================================================================
# ** Achievement settings
#------------------------------------------------------------------------------
#  This place is for you to set some settings to the achievement menu
#==============================================================================

#Choose what variable to use to store the GamerScore
GSVARIABLE = 9

# Choose what you want to call it instead of GamerScore.
GAMERSCORE = "Redd Points"

# Choose what you want to call Gamerscore for short.
GAMESHORT = "RP"
#==============================================================================
# ** Achievements
#------------------------------------------------------------------------------
#  This place is for you to enter the achievements.
#==============================================================================

######################
## Start a new game ##
######################
# Unfinished part
ga = Game_Achievement.new  
da = Data_Achievement.new
# In the unfinished part there should not be an icon specified
da.name = "Starter"
da.info = "Start a new game"
da.gamesco = "50"
ac = Achievement_Criteria.new   # No criteria, active from the start
ga.add_achievement(da,ac)

# Completed part
da = Data_Achievement.new
da.icon = "icon.png" # Icon here
da.name = "Starter"
da.info = "Started a new game"
da.gamesco = "50"
ac = Achievement_Criteria.new(["variable", 15, ">=", 1])
# Here you should just set this number    /\ to what
# variable you want to use.
ga.add_achievement(da,ac)

# This is just to stop the achievement for dissapearing
da = Data_Achievement.new
ac = Achievement_Criteria.new(["Switch", 999, true])
ga.set_completed_achievement(da,ac)
# Adds the final quest to $game_achievements
$game_achievements.add(ga)

#######################
## Arrive in Aradiah ##
#######################
# Unfinished part
ga = Game_Achievement.new  
da = Data_Achievement.new
# In the unfinished part there should not be an icon specified
da.name = "Arrive"
da.info = "Arrive in Aradiah"
da.gamesco = "40"
ac = Achievement_Criteria.new   # No criteria, active from the start
ga.add_achievement(da,ac)

# Completed part
da = Data_Achievement.new
da.icon = "icon.png" # Icon here
da.name = "Arrived"
da.info = "Arrived in Aradiah"
da.gamesco = "40"
ac = Achievement_Criteria.new(["variable", 16, ">=", 1])
# Here you should just set this number    /\ to what
# variable you want to use.
ga.add_achievement(da,ac)

# This is just to stop the achievement for dissapearing
da = Data_Achievement.new
ac = Achievement_Criteria.new(["Switch", 999, true])
ga.set_completed_achievement(da,ac)
# Adds the final quest to $game_achievements
$game_achievements.add(ga)
#End of configuration
#==============================================================================
# * Window_Base
#------------------------------------------------------------------------------
#  Defines the draw_achievement_icon method in Window_Base
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Achievement Icon
  #     icon_name : filename of the icon
  #     x         : draw spot x-coordinate
  #     y         : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_achievement_icon(icon_name, x, y)
    begin
      bitmap = RPG::Cache.picture(icon_name)
    rescue
      bitmap = RPG::Cache.picture(Data_Achievement::PATH + Data_Achievement::DEFAULT_ICON)
    end
    cw = 80
    ch = 80
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x, y, bitmap, src_rect)
  end # def
  
end # class
#==============================================================================
# ** Data_Achievement
#------------------------------------------------------------------------------
#  A achievement object.
#  Stores information about the particular achievement.
#  All icons are assumed to be stored in the same directory
#==============================================================================

class Data_Achievement
  # The path in the pictures folder
  PATH = "Ach/"
  # The name of the default icon
  DEFAULT_ICON = "ach_locked.png"
  
  # The following are of the String class.
  attr_reader   :name          # Name
  attr_reader   :info           # What to do to get it
  attr_reader   :info2           # If you need another line
  attr_reader   :info3           # If you need yet another line
  attr_reader   :gamesco           # GamerScore

  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @name = ""
    @info = ""
    @info2 = ""
    @info3 = ""
    @gamesco = ""
    @icon = DEFAULT_ICON
  end # def
  
  #--------------------------------------------------------------------------
  # * Gets the name and location of the icon in the picture folder
  #--------------------------------------------------------------------------
  def get_icon
    return PATH + @icon
  end # def
  
  #--------------------------------------------------------------------------
  # * Set Achievement Name
  #     string : A string containing the name
  #--------------------------------------------------------------------------
  def name=(string)
    if string.is_a?(String)
      @name = string
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Set Information
  #     string : A string containing the first information line
  #--------------------------------------------------------------------------
  def info=(string)
    if string.is_a?(String)
      @info = string
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Set Information line 2
  #     string : A string containing the second information line
  #--------------------------------------------------------------------------
  def info2=(string)
    if string.is_a?(String)
      @info2 = string
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Set Information line 3
  #     string : A string containing the third information line
  #--------------------------------------------------------------------------
  def info3=(string)
    if string.is_a?(String)
      @info3 = string
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Set GamerScore
  #     string : A string containing the third information line
  #--------------------------------------------------------------------------
  def gamesco=(string)
    if string.is_a?(String)
      @gamesco = string
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Set Icon
  #     string : A string containing the filename of the icon
  #              No change is done if the file does not exists
  #--------------------------------------------------------------------------
  def icon=(string)
    if string.is_a?(String)
      @icon = string
    end # if
  end # def
end # class
#==============================================================================
# ** Achievement_Criteria
#==============================================================================

class Achievement_Criteria
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(*args)
    # Each argument is considered as a condition and is stored in @conditions
    @conditions = args
  end # def
  
  #--------------------------------------------------------------------------
  # * Checks the conditions. Returns true if all the conditions are met
  #--------------------------------------------------------------------------
  def check
    # Goes through the conditions
    for condition in @conditions
      # Creates a begin-rescue block to catch errors.
      begin
        break   if !condition.is_a?(Array) && !condition[0].is_a?(String)
        case condition[0].downcase   # The first field in the array
        when "variable"
          # Converts '=' into '==' to avoid changing the variable
          condition[2] = "=="   if condition[2] == "="
          command = "$game_variables[#{condition[1]}] #{condition[2]} " +
                    "#{condition[3]}"
          return false    unless eval(command)
          when "switch"
          return false    unless $game_switches[condition[1]] == condition[2]
        end
      rescue Exception => err
        # Prints an error message if and only if $DEBUG is true
        # The erroneous condition is considered to be "true"
        if $DEBUG
          output = "Achievement_Criteria:Check\n\n"+ err.type.to_s + "\n" +
                   err.to_s + "\n\n" + "Backtrace(10):\n\n" +
                   err.backtrace[0...10].join("\n").to_s
          print output
        end
      end # begin
    end # for
    # Returns true if no condition is false.
    return true
  end # def
end # class
#==============================================================================
# ** Game_Achievement
#------------------------------------------------------------------------------
#  Manages the process in the achievements.
#==============================================================================

class Game_Achievement
  attr_reader :completed
  attr_reader :active
  attr_reader :current_achievement
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     achievement : Must be a Data_Achievement
  #--------------------------------------------------------------------------
  def initialize
    @data = []
    # Completed achievement
    @completed_achievement = []
    # A achievement is not completed in the start
    @completed = false
    # Neither is it active
    @active = false
    # Updates
    update
  end # def
  
  #--------------------------------------------------------------------------
  # * Resets the achievement
  #--------------------------------------------------------------------------
  def reset
    # Remove the current achievement
    @current_achievement = nil
    # A achievement is not completed in the start
    @completed = false
    # Neither is it active
    @active = false
    # Updates
    update
  end # def
  
  #--------------------------------------------------------------------------
  # * Updates the current_achievement
  #--------------------------------------------------------------------------
  def update
    # Return if the achievement have completed
    @completed = false
    #------------------------------------------------------------------------
    # Checks if the achievement is completed. Assumes that @completed_achievement
    # only has 2 (or more) elements if the first element is a Data_Achievement and the
    # second is a Achievement_Criteria.
    #------------------------------------------------------------------------
    if (@completed_achievement.size > 1) && @completed_achievement[1].check
      @completed = true
      @current_achievement = @completed_achievement[0]
      # No need to update the achievement further
      return
    end # if
    # Checks the status of the achievement
    for i in 0...@data.size
      # Runs through the elements backwards.
      j = @data.size - (i + 1)
      # Checks if the conditions for the achievement part are met
      if @data[j][1].check
        # Sets the current_achievement to the quest which conditions are met
        @current_achievement = @data[j][0]
        # Checks if the achievement should be considered completed
        if i == 0 and @completed_achievement.size <= 1
          @completed = true
          @completed_achievement = @data[j]
        end # if
        break
      end # if
    end # for
    # Checks if the achievement should be actived
    if !@active && @current_achievement.is_a?(Data_Achievement)
      @active = true  # Is actived
    end
  end # def
  
  #--------------------------------------------------------------------------
  # * Add a achievement (achievement part)
  #     achievement : Must be a Data_Achievement
  #--------------------------------------------------------------------------
  def add_achievement(achievement, condition)
    if achievement.is_a?(Data_Achievement) && condition.is_a?(Achievement_Criteria)
      @data.push([achievement,condition])
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Set the completed achievement part
  #     achievement : Must be a Data_Achievement
  #--------------------------------------------------------------------------
  def set_completed_achievement(achievement, condition)
    if achievement.is_a?(Data_Achievement)
      @completed_achievement = [achievement, condition]
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Error handling
  #     string : A String containing the error message
  #--------------------------------------------------------------------------
  def error(err)
    # Only prints the error message if the game is played through the editor
    if $DEBUG
      print err
    end # if
  end # def
end # class
#==============================================================================
# ** Game_Achievements
#------------------------------------------------------------------------------
#  This class handles quests. It's a wrapper for the built-in class "Array."
#  Refer to "$game_achievements" for the instance of this class.
#  
#  The quest potion 0 is considered to be the main achievement.
#  ($game_achievements[0])
#==============================================================================

class Game_Achievements
  # Adds a method to read the data
  attr_reader     :data
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @data = []
  end # def
  #--------------------------------------------------------------------------
  # * Get Achievement
  #     achievement_id : achievement ID
  #--------------------------------------------------------------------------
  def [](achievement_id)
    return @data[achievement_id]
  end # def
  #--------------------------------------------------------------------------
  # * Set Achievement
  #     achievement_id : achievement ID
  #     achievement    : the achievement
  #--------------------------------------------------------------------------
  def []=(achievement_id, achievement)
    if achievement.is_a?(Game_Achievement) && achievement_id % @data.size == 0
      @data[achievement_id] = achievement
    end  # if
  end # def
  #--------------------------------------------------------------------------
  # * Add Achievement
  #     achievement : the achievement
  #--------------------------------------------------------------------------
  def add(achievement)
    if achievement.is_a?(Game_Achievement)
      @data.push(achievement)
    end # if
  end # def
  #--------------------------------------------------------------------------
  # * Resets the achievements
  #--------------------------------------------------------------------------
  def reset
    for achievement in @data
      achievement.reset
    end # if
  end # def
  #--------------------------------------------------------------------------
  # * Gets active achievements. Newest will be listed first
  #   Note: The main achievement if active will always have position 0. (result[0])
  #--------------------------------------------------------------------------
  def get_active_achievements
    result = []
    # Goes through the achievements
    for i in 1...@data.size
      element = @data[i]
      # Updates the element
      element.update
      # Checks if element is active and not completed
      if element.active && !element.completed
        # Pushes the active element into the results
        result.push(element)
      end # if
    end # for
    # Checks if the main achievement is active and not completed (index 0 in @data)
    @data[0].update
    if @data[0].active && !@data[0].completed
      result.push(@data[0])
    end # if
    # Reverse result so the main achievement have index 0 followed by the newest
    # achievement at index 1, the second newest at index 2 and so on.
    result.reverse!
    # Returns the resulting array
    return result
  end # def
  #--------------------------------------------------------------------------
  # * Gets completed achievements. Newest will be listed first
  #   Note: The main achievement will always be on position 0. (result[0])
  #--------------------------------------------------------------------------
  def get_completed_achievements
    result = []
    # Goes through the achievements
    for i in 1...@data.size
      element = @data[i]
      # Updates the element
      element.update
      # Checks if element is completed.
      if element.completed
        # Pushes the active element into the results
        result.push(element)
      end # if
    end # for
    # Checks if the main achievement is active and not completed (index 0 in @data)
    if @data[0].completed
      result.push(@data[0])
    end # if
    # Reverse result so the main achievement have index 0 followed by the newest
    # achievement at index 1, the second newest at index 2 and so on.
    result.reverse!
    # Returns the resulting array
    return result
  end # def
end # class

# The global variable used for storing achievements
$game_achievements = Game_Achievements.new
#==============================================================================
# ** Window_Achievementbook_Header
#------------------------------------------------------------------------------
#  This window designates achievement information in the header of the
#  achievementbook.
#==============================================================================

class Window_Achievementbook_Header < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #       achievement : The achievement which information will be used
  #--------------------------------------------------------------------------
  def initialize(achievement)
    super(0, 0, 640, 158)
    # Creates the Bitmap
    self.contents = Bitmap.new(width - 32, height - 32)
    # Draws the header
    refresh(achievement)
  end # def
  
  #--------------------------------------------------------------------------
  # * Refresh
  #       achievement : The achievement which information will be used
  #--------------------------------------------------------------------------
  def refresh(achievement)
    # Redraw text
    self.contents.clear
    # checks if the quest is a Game_Achievement.
    if achievement.is_a?(Game_Achievement)
      # Gets the current achievement part
      current_achievement = achievement.current_achievement
    else
      if achievement.is_a?(Integer)
        # Draws the no completed achievement header
        draw_noachievement_header
      else
        # Draws the mainmenu header
        draw_mainmenu_header
      end
      # Stops processing this method (Refresh)
      return
    end
    # Changes the color of the text to Teal
    self.contents.font.color = text_color(4)
    # Bolds the text
    self.contents.font.bold = true
    # Draws the non-changing text in bold
    self.contents.draw_text(4, 0, 80, 32, "Name:")
    self.contents.draw_text(4, 32, 80, 32, "Info:")
    # Unbolds the text
    self.contents.font.bold = false
    # Draws the name of the achievement next to "Name:"
    self.contents.font.color = text_color(0)
    self.contents.draw_text(80, 0, 540, 32, current_achievement.name)
    # Draws the first info line of the achievement next to "Info:"
    self.contents.font.color = text_color(0)
    self.contents.draw_text(80, 32, 540, 32, current_achievement.info)
    # Draws the second info line of the achievement under "Info:"
    self.contents.font.color = text_color(0)
    self.contents.draw_text(80, 64, 540, 32, current_achievement.info2)
    # Draws the third info line of the achievement under "Info:"
    self.contents.font.color = text_color(0)
    self.contents.draw_text(80, 94, 540, 32, current_achievement.info3)
    # Draws the GamerScore text and number
    self.contents.font.color = text_color(4)
    self.contents.draw_text(275, 100, 100, 32, GAMESHORT, 2)
    self.contents.font.color = text_color(0)
    self.contents.draw_text(380, 100, 100, 32, current_achievement.gamesco, 0)
  end # def

  #--------------------------------------------------------------------------
  # * Draws the header in the case where no achievements have been completed
  #--------------------------------------------------------------------------
  def draw_noachievement_header
    # Changes the color of the text to Gray
    self.contents.font.color = text_color(7)
    # Draws the text centered in the window
    self.contents.draw_text(0, 32, 608, 32, "No achievements have been completed", 1)
  end # def
  
  #--------------------------------------------------------------------------
  # * Draws the header in the case where the main menu icon is selected
  #--------------------------------------------------------------------------
  def draw_mainmenu_header
    # Changes the color of the text to Teal
    self.contents.font.color = text_color(4)
    # Draws the text centered in the window
    self.contents.draw_text(0, 32, 608, 32, "Return to the Main Menu", 1)
  end # def
end # class
#==============================================================================
# ** Window_Achievementbook_Header
#------------------------------------------------------------------------------
#  This window designates achievement information in the header of the
#  achievementbook.
#==============================================================================

class Window_Achievementbook_CurrentGS < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #       achievement : The achievement which information will be used
  #--------------------------------------------------------------------------
  def initialize(achievement)
    super(390, 0, 250, 50)
    # Creates the Bitmap
    self.contents = Bitmap.new(width - 32, height - 32)
    # Draws the header
    refresh(achievement)
  end # def
  
  #--------------------------------------------------------------------------
  # * Refresh
  #       achievement : The achievement which information will be used
  #--------------------------------------------------------------------------
  def refresh(achievement)
    # Redraw text
    self.contents.clear
    # checks if the quest is a Game_Achievement.
    if achievement.is_a?(Game_Achievement)
      # Gets the current achievement part
      current_achievement = achievement.current_achievement
    else
      if achievement.is_a?(Integer)
        # Draws the no completed achievement header
        draw_noachievement_header
      else
        # Draws the mainmenu header
        draw_mainmenu_header
      end
      # Stops processing this method (Refresh)
      return
    end
    # Draws the Current GamerScore text and number
    self.contents.font.color = text_color(4)
    self.contents.draw_text(1, -8, 150, 32, GAMERSCORE, 2)
    self.contents.font.color = text_color(0)
    self.contents.draw_text(160, -8, 100, 32, $game_variables[GSVARIABLE].to_s, 0)
  end # def
end # class
#==============================================================================
# ** Window_Achievementbook
#------------------------------------------------------------------------------
#  This window designates the achievement selection on the achievementbook screen.
#==============================================================================

class Window_Achievementbook < Window_Selectable
  # Constants
  MAIN_MENU_ICON_PATH = "Ach/mainmenu.png"
  
  # Attributes
  #attr_accessor   :active_achievments # Tells whether active achievements
  #                 are show or not
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(achievementset)
    super(0, 158, 640, 322)
    # Saves the achievement set given
    @data = achievementset
    # Old data (stores refrences to old data)
    @old_data = {}
    # Amount of items
    @item_max = @data.size
    # The amount of items on each line   (Items per row)
    @column_max = 6
    # Starts on index 0 (Top-Left)
    @index = 0
    # Active achievements are shown at start up
    @active_achievements = true
    # Creates Bitmap
    self.contents = Bitmap.new(width - 32, @item_max / @column_max * 96 + 96)
    refresh
  end # def
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Redraw text
    self.contents.clear
    # Draws the icons
    for i in 0...@item_max
      draw_icon(i,@data[i].current_achievement.get_icon)
    end # for
    # Checks if there is a mainmenu icon
    if @active_achievements
      # An extra icon is drawn with the main menu icon     (Another item)
      @item_max = @data.size + 1
      draw_icon(@item_max - 1, MAIN_MENU_ICON_PATH)
    else
      # There are as many items as there are achievements in the data
      @item_max = @data.size
    end # if
    # Checks if there are any items
    if @item_max == 0
      # Removes the cursor when there are no item
      @index = -1
    elsif @index == -1
      # Sets the cursor to the first element
      @index = 0
    end # if
  end # def

  #--------------------------------------------------------------------------
  # * Draws the icon of the achievement at the i'th space
  #--------------------------------------------------------------------------
  def draw_icon(i, icon_name)
    # Calculates the x- and y-coordinates
    x = (i % @column_max) * 99 + 16
    y = (i / @column_max) * 96 - 10
    # Draws the given achievement icon at the given position
    draw_achievement_icon(icon_name, x, y + 18)
  end # def
  
  #--------------------------------------------------------------------------
  # * Sets a new set achievements as data
  #--------------------------------------------------------------------------
  def set_data(achievementset, active_achievements)
    if achievementset == @data && active_achievements == @active_achievements
      return
    end
    # Stores old data
    @old_data[[@data,@active_achievements]] = self.contents
    # Sets whether or not the achievementset is of the active achievements
    @active_achievements = active_achievements
    # Sets the achievementset as data
    @data = achievementset
    # Amount of items
    @item_max = @data.size
    # Creates Bitmap
    if @old_data[[@data,@active_achievements]] != nil
      self.contents = @old_data[[@data,@active_achievements]]
    else
      self.contents = Bitmap.new(width - 32, @item_max / @column_max * 96 + 96)
    end
    # Refreshes (redraws) the window with the new data
    refresh
  end
  
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end # if
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end # if
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end # if
    # Calculate cursor coordinates
    x = (@index % @column_max) * 99 + 8       #112
    y = (@index / @column_max) * 96 - self.oy
    self.cursor_rect.set(x, y, 96, 96)
  end # def
  
  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    # Divide y-coordinate of window contents transfer origin by 1 row
    # height of 96
    return self.oy / 96
  end # def

  #--------------------------------------------------------------------------
  # * Set Top Row
  #     row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    row = row % row_max
    self.oy = row * 96
  end # def

  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    # Subtract a frame height of 32 from the window height, and divide it by
    # 1 row height of 96
    return (self.height - 32) / 96
  end # def
  
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    super
    # Disposes the stored bitmaps
    @old_data.each_value {|value| value.dispose}
  end
  
end # class
#==============================================================================
# ** Achievementbook
#------------------------------------------------------------------------------
# Stripe103
#
# Modification of:
# Questbook
#------------
# Zeriab
# 1.2
# 2007-10-01 (year-month-day)
#==============================================================================

#==============================================================================
# ** Scene_Achievementbook
#------------------------------------------------------------------------------
#  This window designates the achievement selection on the achievementbook screen.
#==============================================================================

class Scene_Achievementbook
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(scene = Scene_Menu.new)
    # Gets the active achievement
    @active_achievementset = $game_achievements.get_active_achievements
    # Gets the completed achievements
    @completed_achievementset = $game_achievements.get_completed_achievements
    # Starts at the main_menu
    @last_index = 0
    # The completed achievements starts in the top-left corner
    @other_index = 0
    # Active achievements are shown when the achievementlog has opened
    @active_achievements = true
    # Sets the current achievements set
    @current_achievementset = @active_achievementset
    # The next scene it will skip to is the scene given
    @next_scene = scene
  end # def
  
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Achievement selection window
    @achievement_select = Window_Achievementbook.new(@current_achievementset)
    @achievement_select.opacity = WINDOW_OPACITY
    # Achievement info-header window
    @achievement_header = Window_Achievementbook_Header.new(@current_achievementset[0])
    @achievement_header.opacity = WINDOW_OPACITY
    # Achievement Current Gamerscore window
    @achievement_current = Window_Achievementbook_CurrentGS.new(@current_achievementset[0])
    @achievement_current.opacity = WINDOW_OPACITY
    # Execute transition
    Graphics.transition
    # Scene Objects #@back_sprite
    @scene_objects = [@achievement_select, @achievement_header, @achievement_current]
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Updates Scene Objects
      @scene_objects.each { |x| x.update}
      ## Frame update
      update
      # Abort loop if screen is changed
      break if $scene != self
    end # loop
    # Prepare for transition
    Graphics.freeze
    # Dispose Scene Objects
    @scene_objects.each { |x| x.dispose }
  end # def
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def switch
    # Switch to the previously remembered index (In case L or R was used)
    tmp = @achievement_select.index
    @achievement_select.index = @other_index
    @other_index = tmp
    # Plays the Cursor sound effect
    $game_system.se_play($data_system.cursor_se)
    # Checks if there are active achievements shown
    if @active_achievements
      # Completed achievement is to be shown. (Active achievement NOT shown)
      @active_achievements = false
      # Sets the current achievementset to the completed achievementset
      @current_achievementset = @completed_achievementset
    else
      # Active achievements is to be shown.
      @active_achievements = true
      # Sets the current achievementset to the active achievementset
      @current_achievementset = @active_achievementset
    end # if
    # Sets the data in the selection window
    @achievement_select.set_data(@current_achievementset, @active_achievementss)
    # Checks if there are any fields
    if @achievement_select.index > -1
      # Opdates the header
      @achievement_header.refresh(@current_achievementset[0])
    else
      # Updates the header
      @achievement_header.refresh(1)
    end # if
  end # def
  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If RIGHT Button Is Pressed
    if Input.trigger?(Input::RIGHT)
      # Checks if there are any items to select.
      if @achievement_select.index <= -1
      end # if
    end # if
    # If LEFT Button Is Pressed
    if Input.trigger?(Input::LEFT)
      # Checks if the last index is the same as the current. (All left)
      if @last_index == @achievement_select.index || @achievement_select.index <= -1
      end # if
    end # if
    # Checks if the index in @achievement_select have changed
    if @last_index != @achievement_select.index && @achievement_select.index > -1
      # Updates the last_index
      @last_index = @achievement_select.index
      # Updates the header
      @achievement_header.refresh(@current_achievementset[@last_index])
    end # if
    # If C Button Is Pressed
    if Input.trigger?(Input::C) && @achievement_select.index > -1
      # Checks if the main menu icon is present
      if @active_achievements
        # Checks that a achievement is not select. (So it must be the main menu)
        if (@achievement_select.index >= $game_achievements.get_active_achievements.size)
          # Plays the Cancel sound effect
          $game_system.se_play($data_system.cancel_se)
          # Changes the scene to the main menu
          $scene = Scene_Menu.new
          # Stops processing this method
          return
        end # if
      end # if
    end # if
    # If R Is Pressed
    if Input.trigger?(Input::R)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to next scene
      $scene = @next_scene
      # Changes the achievement info to become invisible
      # The achievement select is active as the info is not visible
      @achievement_select.active = true
      # Stops processing this method
      return
    end # if
    # If B Button Is Pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to next scene
      $scene = @next_scene
      # Changes the achievement info to become invisible
      # The achievement select is active as the info is not visible
      @achievement_select.active = true
      # Goes to main menu
      $scene = Scene_Menu.new
    end # if
  end # def
end

# The opacity of the windows. 0 = invisible and 255 = totally visible
WINDOW_OPACITY = 255
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  Aliases and uses the on_decision method to reset $game_achievements on the proper
#  time.
#==============================================================================

class Scene_Load < Scene_File
  # Check if the alias already exists (To avoid F12 errors)
  unless self.method_defined?(:zeriab_achievementbook_scene_load_on_decision)
    alias zeriab_achievementbook_scene_load_on_decision :on_decision
  end
  def on_decision(*args)
    # Call the original method
    zeriab_achievementbook_scene_load_on_decision(*args)
    # Check if the scene has changed
    unless $scene == self
      # Reset quest data
      $game_achievements.reset
    end
  end
end

There you go smile.gif
[/spoiler]

EDIT: Also instead of going in Achievement/Icons/ the icons will go in just a folder named Ach in the Pictures folder instead.
DOUBLE EDIT: I hate these spoilers...


__________________________
Go to the top of the page
 
+Quote Post
   
stripe103
post Jan 19 2010, 01:57 AM
Post #5


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




I'm glad you liked it laugh.gif

@ Redd
Thanks for making it all into one script. Though I cant get it to work

This post has been edited by stripe103: Jan 19 2010, 02:00 AM


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
stripe103
post Jan 21 2010, 11:54 AM
Post #6


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




Hi! I just wanted to say that there is a update available for download!
Version 1.12 with some minor improvements.

Only two scripts instead of 12
"XBOX Button" integrated in script instead of using a common event.
More options.



__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
stripe103
post Mar 30 2010, 04:14 AM
Post #7


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




A new version is available for download. Version 1.3.0!

The new thing is the Notification script by Night_Runner.
I asked him to make one for my game, and I thought that it would be good here.


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
Nub Cake
post Jun 30 2010, 07:05 AM
Post #8


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Event Designer
RM Skill: Skilled




Hi
I love the script you made there, but i was wondering where you could change button of showing the achievements.
I know im not the best at scripts and since i use the XAS Battle System i have keys at Q, W, A, S, D, Z, X, C and then tried to read trough the script to see if i could figure out where i could change the button. But as i said im not really good at scripting :/
So then till the last part i ask you x)
If you could just say in what section of the three scripts (like Settings, line 438), cuz i want to change it to E tongue.gif

Thanks for your time
-Nub Cake

This post has been edited by Nub Cake: Jun 30 2010, 07:05 AM


__________________________


[Show/Hide] To make my signature smaller

[Show/Hide] Koroshite Gakuen - Paused - lack of inspiration


Koroshite Gakuen means Killing in the School, and my current project is finally gonna be the first game i complete.

As for plans, i have though of the chat options, full screen, menu and might a diary, and a phone system.

The game is based on a girl, still unnamed, and it's a day at the high school where they play mafia.

Mafia is a game where a few is selected to be mafia, and a a couple selected for detectives. The rest is innocent, and the mafias touch them and tells them their dead, and they eventually lie down, sit down or go to a certain room. Now, the detective can then go to them, and the dead guy will tell them one thing that can describe the murders appearance, but no names, and no one else knows what that guy told the detective. Either the mafia kills all, or the detective catches the mafias, and the game ends.

Now, the plan is that there happens an actual murder at the school, there isn't cops in the town, and there isn't enough resources to send more than one police officer, which can't figure out much. So as the police officer doesn't do too much, you decide to take it up yourself, track down the murder.

I don't feel like telling more as it kind of spoils it, but i can say that I'm still at the mapping, and i try my best to make them look as good as possible, as I'm a horrible mapper.

Decent art artist?

I could really use some help for some of the graphics for character faces, and eventually a few character pictures c:



I love to write stories, if you're stuck on your games story, i might be able to help :)
Go to the top of the page
 
+Quote Post
   
stripe103
post Jun 30 2010, 07:42 AM
Post #9


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




New version out! Version 1.3.2
New features:
You can now use the map as background and you can make the game continue even if in the menu.
You can now also change what key you want the XBOX Button to be.

Thanks Nub Cake. You made me finally finish this update biggrin.gif


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
Nub Cake
post Jun 30 2010, 01:35 PM
Post #10


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Event Designer
RM Skill: Skilled




QUOTE (stripe103 @ Jun 30 2010, 08:42 AM) *
New version out! Version 1.3.2
New features:
You can now use the map as background and you can make the game continue even if in the menu.
You can now also change what key you want the XBOX Button to be.

Thanks Nub Cake. You made me finally finish this update biggrin.gif

Well, could said we both helped each other tongue.gif

And all of the scripts under My Stuff is kind of useful and awesome! biggrin.gif
I hope you also can make a awesome quest log like the achievement book ^^

Thanks for all your stuff, i will be sure to credit you in my games thumbsup.gif

This post has been edited by Nub Cake: Jun 30 2010, 02:55 PM


__________________________


[Show/Hide] To make my signature smaller

[Show/Hide] Koroshite Gakuen - Paused - lack of inspiration


Koroshite Gakuen means Killing in the School, and my current project is finally gonna be the first game i complete.

As for plans, i have though of the chat options, full screen, menu and might a diary, and a phone system.

The game is based on a girl, still unnamed, and it's a day at the high school where they play mafia.

Mafia is a game where a few is selected to be mafia, and a a couple selected for detectives. The rest is innocent, and the mafias touch them and tells them their dead, and they eventually lie down, sit down or go to a certain room. Now, the detective can then go to them, and the dead guy will tell them one thing that can describe the murders appearance, but no names, and no one else knows what that guy told the detective. Either the mafia kills all, or the detective catches the mafias, and the game ends.

Now, the plan is that there happens an actual murder at the school, there isn't cops in the town, and there isn't enough resources to send more than one police officer, which can't figure out much. So as the police officer doesn't do too much, you decide to take it up yourself, track down the murder.

I don't feel like telling more as it kind of spoils it, but i can say that I'm still at the mapping, and i try my best to make them look as good as possible, as I'm a horrible mapper.

Decent art artist?

I could really use some help for some of the graphics for character faces, and eventually a few character pictures c:



I love to write stories, if you're stuck on your games story, i might be able to help :)
Go to the top of the page
 
+Quote Post
   
Locke
post Jun 30 2010, 11:03 PM
Post #11


Level 10
Group Icon

Group: Revolutionary
Posts: 151
Type: Mapper
RM Skill: Intermediate




Hey never seen this script maybe i just got bored with XP scripts
But hey, i like it laugh.gif


__________________________
We are one (Really i,m not joking)



I've seen many things when mankind rule the land


Which Final Fantasy Character Are You?
Go to the top of the page
 
+Quote Post
   
stripe103
post Jul 1 2010, 08:19 AM
Post #12


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




QUOTE (Nub Cake @ Jun 30 2010, 11:35 PM) *
Well, could said we both helped each other tongue.gif

And all of the scripts under My Stuff is kind of useful and awesome! biggrin.gif
I hope you also can make a awesome quest log like the achievement book ^^

Thanks for all your stuff, i will be sure to credit you in my games thumbsup.gif


Thanks! But hey. As it says in my first post here, it is only a modification of Zeriabs Questbook.

QUOTE (Locke @ Jul 1 2010, 09:03 AM) *
Hey never seen this script maybe i just got bored with XP scripts
But hey, i like it laugh.gif

Well, yea, I guess VX have a better scripting system but I personally think that the XP system is more logic to work with.


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 03:26 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker