Achievements

● ARCHIVED · READ-ONLY
Started by Koru-chan 11 posts View original ↗
  1. This is kind of a hybrid between a script request and RGSS3 help, but I'd say mostly script request so I put it in here.

    I'm looking for a nice, easy-to-use achievement/trophy script. I thought I'd seen one on the master list wiki but I tried ctrl+Fing the heck out of it and couldn't find what I needed. I thought the same of rpgmakervxace.net but they seem to currently be suffering from 500 Internal Server Error syndrome right now. If anyone can point me toward a blog post I'm missing or something my dumb eyes just missed, I'd greatly appreciate it.

    Only read below if one does not exist that you know of.

    Spoiler
    If one doesn't exist for ace, here is my next question: how do I make one? I can do very simple things with scripts but one thing I've still yet to figure out is how to take an array and dissect it for my purposes, which is how I'd like to do this if I have to make the script.First let me elaborate. I'm sure most people know what I'm talking about when I say achievement script but I'll spell it out just in case. I'm basically looking for a script that can be made where when the player hits a certain number of something or does a specific task you set as special, a message box pops up announcing the achievement they've received and possible rewards it might have given them. Then if they check their achievements screen, they can easily see it highlighted in some way as "achieved." It can be anything from "Won 100 battles" to "died from zombie decapitation".

    I can figure out how to make a custom screen for the achievement list easily enough. I also figure achievement setup would be as easy as "if battles won < 100 and battle won, +1, if >= 100, achievement get, end" except a lot less dumb and a bit more codeish.

    It's how the rest of it goes that I'm kind of confused on. I'm still very much new at this. I'm not even sure if an array is the most efficient way to do this sort of thing. But I imagined something like this:



    Code:
    achievement_array_1 = [[[requirement1, value1],[requirement2, value2]], true, 10, reward=optional]
    achievement_array_2 = [[requirement1, value1], false, 20, reward=optional]
    In this case, you'd have a requirement and value pair where the requirement is what is being compared for the achievement and the value is its value. In the case of something like battles won, value would be an integer, in the case of something like "cleared chapter 1", it would be a true/false value.

    The true in array 1 (and false in array 2) would be if the achievement is visible before you get it. In a world of warcraft example, some achievements you haven't earned yet (actually, most of them) show up grayed-out in the achievement window until you get them, but some are hidden and either show up after you get the achievement or after you get another achievement (for example, you can't see there's an achievement for getting 100 pets until you get the achievement for 75 pets, then the 100 pets one shows up grayed-out). I'd want a way to switch this one way or the other in-game, obviously.

    The number is how many achievement points the achievement would be worth. It would be useful if, say, I made a vendor that would only sell certain things to you if you had a certain amount of achievement points.

    Finally, a reward. Not all achievements would give a reward so it would need to be able to function with that last slot empty if needed. But if a reward is given, it would be placed there. This is another one I'm not too sure of. It would be easy to make it an item ID I suppose, though if I wanted to award a weapon, armor, or gold, then it becomes more complex to make it able to understand any of those values in a single spot in the array, I'd imagine.

    I'm not sure if that's even a good way to do it but that was the idea that popped in my head. The issue I have is that I'm stupid with arrays. They don't like me no matter how much I try to read up on them. I just seem to have a mental block with them and am never able to understand documentation on how they work.

    I can put an array like that together, but I have no clue how to take a bit of code and make it say "Take index 0 of the array and do this with it, take index 1 of the array and do something else."

    If anyone can help me with how to mess with the arrays like this or if there's a simpler way for me to set this up that doesn't involve a mile long code, PM me if you could. I mean, if I have to make this script for my project I'm not sure I'd have the skill to clean it up all nice for public use, so if there are any shortcuts I can use that are less than script-sharing friendly I'm still willing to try it.
  2. Is this what you happen to be after? It's the only one I know of so.....

    Spoiler
    =beginCSCA Achievements

    version: 1.0

    Created by: Casper667 from http://www.caspergaming.com/

    Compatibility:

    Compatible only with VXAce.

    IMPORTANT: ALL CSCA Scripts should be compatible with each other unless

    otherwise noted.

    INTRODUCTION:

    This script creates an achievement system in your game.

    FEATURES:

    -Achievements!

    -Can assign a reward for each achievement

    -Can display a progress bar for each achievement

    -Automatically earn achievements when progress bar gets to 100%.

    -Can play an SE when achievement is unlocked

    -Popup window when achievement is earned

    -Able to use custom graphic in place of achievement window(size is 248x72),

    image will be resized if bigger or smaller.

    SETUP

    Setup required. Instructions below.

    To set an achievement as true, use the following script call:

    $game_achievements[achievement_id] = true

    where achievement_id would be the same number as ACHIEVEMENTS[achievement_id]

    CREDIT & TERMS

    Free to use in noncommercial games if credit is given to:

    casper667 from http://www.caspergaming.com/

    If using in commercial game, please contact me.

    www.rpgmakervxace.net/user/193-casper667/

    or

    www.caspergaming.com

    =end

    module CSCA # Don't touch

    module ACHIEVEMENTS # Don't touch

    #=======================================================================#

    # Declaring arrays, do not touch #

    #=======================================================================#

    ACHIEVEMENTS = [] # Don't touch

    DESCRIPTION = [] # Don't touch

    PROGRESS = [] # Don't touch

    REWARDS = [] # Don't touch

    #=======================================================================#

    # Description Setup #

    #=======================================================================#

    #DESCRIPTION[x] = ["Descriptive Text","Seperate lines with commas!"]

    DESCRIPTION[0] = ["Open 10 Treasure Chests","to unlock."]

    DESCRIPTION[1] = ["You opened 10 Treasure","Chests!"]

    DESCRIPTION[2] = ["Obtain a sword."]

    #=======================================================================#

    # Progress Setup #

    #=======================================================================#

    #PROGRESS[x] = [id, upper bound, "describe numbers", :type]

    # The type can be either:

    # :var = amount stored in $game_variables[id]

    # :item = amount of $data_items[id]

    # :weapon = amount of $data_weapons[id]

    # :armor = amount of $data_armors[id]

    # :gold = amount of gold, ignores id value

    # :step = amount of steps, ignores id value

    # :save = amount of saves, ignores id value

    # :battle = amount of battles, ignores id value

    # :playtime = playtime, ignores id value

    # * :loot = amount of gold looted, ignores id value

    # * :dtake = amount of damage taken, ignores id value

    # * :ddeal = amount of damage dealt, ignores id value

    # * :gspend = amount of gold spent at shops, ignores id value

    # * :gearn = amount of gold earned from selling to shops, ignores id value

    # * :iuse = amount of items used, ignores id value

    # * :ibuy = amount of items bought from shops, ignores id value

    # * :isell = amount of items sold to shops, ignores id value

    # * Requires CSCA Extra Stats(1.1+) Get it here:

    # http://www.rpgmakerv...ca-extra-stats/

    PROGRESS[0] = [5, 10, "Treasures Opened", :var] # 10 max, tracks variable ID5.

    PROGRESS[1] = [0, 100, "Total Gold", :gold] # 100 max, tracks party's gold.

    #=======================================================================#

    # Rewards Setup #

    #=======================================================================#

    #REWARDS[x] = [amount, id, type]

    # The type can be either:

    # :item = amount of $data_items[id]

    # :weapon = amount of $data_weapons[id]

    # :armor = amount of $data_armors[id]

    # :gold = amount of gold, ignores id value

    REWARDS[0] = [100, 0, :gold] # 100 gold.

    REWARDS[1] = [5, 1, :item] # 5 of item ID 1.

    #=======================================================================#

    # Achievement Setup #

    #=======================================================================#

    #ACHIEVEMENT[x] = ["Name After Unlock","Name Before Unlock"(optional),

    #Description, Description after unlock(optional),progress tracking(optional),

    #reward(optional),popup graphic(optional)]

    # If you are not using an optional feature, write: nil

    ACHIEVEMENTS[0] = ["Treasure Hunter","???",DESCRIPTION[0],DESCRIPTION[1],

    PROGRESS[0],REWARDS[0],nil]

    ACHIEVEMENTS[1] = ["Treasure Hunter II",nil,DESCRIPTION[2],nil,nil,nil,"DarkSpace1"]

    #=======================================================================#

    # Misc. Setup #

    #=======================================================================#

    SCENE_NAME = "Achievements" # Text shown in the head window.

    TOTAL = "Total Achievements Unlocked: " # Text shown before total numbers.

    PROGRESS = "Progress:" # Text above progress bar

    REWARD = "Reward: " # Text shown before the reward amount/name.

    UNLOCKED = "Achievement Unlocked!" # Text shown when achievement unlocked.

    EARNED_ICON = 621 # Icon to display if achievement is earned.

    UNEARNED_ICON = 622 # Icon to display if achievement is unearned.

    NUMBERED = false # If true, numbers achieve list. If false, uses icons.

    CENTER = false # Center the description text ? True/false

    STOP_TRACK = false # Stop tracking achievement progress after earned?

    COLOR1 = 20 # Color1 of the progress gauge.

    COLOR2 = 21 # Color2 of the progress gauge.

    SOUND = "Applause1" # SE Played when an achievement is earned. Set to nil to disable.

    POP_ALIGN = :bottom # Alignment of Popup on map when achievement is earned.

    # :bottom = bottom center, :middle = middle of screen, :top = top center

    # Set to nil to disable the Popup Window.

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

    # END SETUP! DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING #

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

    end

    end

    $imported = {} if $imported.nil?

    $imported["CSCA-Achievements"] = true

    #==============================================================================

    # ** DataManager

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

    # Overwrites: make_save_contents

    # Aliases: create_game_objects, extract_save_contents

    #==============================================================================

    module DataManager

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

    # alias method. #

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

    class <<self; alias csca_ach_create_game_objects create_game_objects; end

    def self.create_game_objects

    csca_ach_create_game_objects

    $game_achievements = Game_Achievements.new

    end

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

    # overwrite method. #

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

    def self.make_save_contents

    contents = {}

    contents[:system] = $game_system

    contents[:timer] = $game_timer

    contents[:message] = $game_message

    contents[:switches] = $game_switches

    contents[:variables] = $game_variables

    contents[:self_switches] = $game_self_switches

    contents[:actors] = $game_actors

    contents[:party] = $game_party

    contents[:troop] = $game_troop

    contents[:map] = $game_map

    contents[:player] = $game_player

    contents[:achievements] = $game_achievements

    contents

    end

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

    # alias method #

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

    class <<self; alias csca_ach_extract_save_contents extract_save_contents; end

    def self.extract_save_contents(contents)

    csca_ach_extract_save_contents(contents)

    $game_achievements = contents[:achievements]

    end

    end

    #==============================================================================

    # ** Game_Achievements

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

    # This class handles achievements.

    # The instance of this class is referenced by $game_achievements

    #==============================================================================

    class Game_Achievements

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

    # Object Initialization #

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

    def initialize

    @data = []

    end

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

    # Get Achievement #

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

    def [](achievement_id)

    @data[achievement_id] || false

    end

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

    # Set Achievement #

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

    def []=(achievement_id, value)

    @data[achievement_id] = value

    on_change(achievement_id)

    end

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

    # Processing When Setting Achievements #

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

    def on_change(achievement_id)

    $game_party.csca_achievement_reward(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][5]) unless

    CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][5].nil?

    Audio.se_play("Audio/SE/" + CSCA::ACHIEVEMENTS::SOUND, 80, 100) unless

    CSCA::ACHIEVEMENTS::SOUND.nil?

    $game_map.achievement_id = achievement_id

    $game_map.achievement_earned = true

    end

    end

    #==============================================================================

    # ** CSCA_Scene_Achievements

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

    # This class performs the achievement screen processing.

    #==============================================================================

    class CSCA_Scene_Achievements < Scene_MenuBase

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

    # Start Processing #

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

    def start

    super

    create_head_window

    create_achievement_window

    create_selection_window

    create_totals_window

    end

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

    # Create Background #

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

    def create_background

    super

    @background_sprite.tone.set(0, 0, 0, 128)

    end

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

    # Create Header Window #

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

    def create_head_window

    @head_window = CSCA_Window_AchievementsMainHead.new(0, 0)

    @head_window.viewport = @viewport

    end

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

    # Create Achievement Selection Window #

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

    def create_selection_window

    @command_window = CSCA_Window_AchievementSelect.new(0,@head_window.height,

    Graphics.width/2,Graphics.height-@head_window.height-48)

    @command_window.viewport = @viewport

    @command_window.help_window = @achievement_window

    @command_window.set_handler:)cancel, method:)return_scene))

    @command_window.activate

    end

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

    # Create Achievement Window #

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

    def create_achievement_window

    @achievement_window = CSCA_Window_AchievementDisplay.new(Graphics.width/2,

    @head_window.height,Graphics.width/2,Graphics.height-@head_window.height-48)

    @achievement_window.viewport = @viewport

    end

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

    # Create Achievement Totals Window #

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

    def create_totals_window

    @totals_window = CSCA_Window_AchievementTotals.new(0,@head_window.height+

    @achievement_window.height,Graphics.width,Graphics.height-@head_window.height-

    @achievement_window.height)

    @totals_window.viewport = @viewport

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementsMainHead

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

    # This window displays the achievement header window.

    #==============================================================================

    class CSCA_Window_AchievementsMainHead < Window_Base

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

    # Object Initialization #

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

    def initialize(x, y)

    super(x, y, Graphics.width, line_height * 2)

    refresh

    end

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

    # Refresh #

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

    def refresh

    contents.clear

    draw_text(0, 0, contents.width, line_height, CSCA::ACHIEVEMENTS::SCENE_NAME, 1)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementSelect

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

    # This window displays the achievement names, numbers, and icons.

    #==============================================================================

    class CSCA_Window_AchievementSelect < Window_Selectable

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

    # Object Initialization #

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

    def initialize(x,y,width,height)

    super

    @data = []

    refresh

    select(0)

    end

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

    # Get Item Max #

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

    def item_max

    @data ? @data.size : 1

    end

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

    # Get Item #

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

    def item

    @data && index >= 0 ? @data[index] : nil

    end

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

    # Populate item list #

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

    def make_item_list

    @data = CSCA::ACHIEVEMENTS::ACHIEVEMENTS

    end

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

    # Draw Items #

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

    def draw_item(index)

    item = @data[index]

    if item

    rect = item_rect(index)

    CSCA::ACHIEVEMENTS::NUMBERED ? draw_item_id(rect, index) : draw_ach_icon(rect, index)

    if $game_achievements[index] || CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][1].nil?

    name = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][0]

    else

    name = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][1]

    end

    draw_text(rect.x + 32, rect.y, contents.width - 40, line_height, name)

    end

    end

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

    # Draw Numbers #

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

    def draw_item_id(rect, index)

    draw_text(rect, sprintf("%2d.", index + 1))

    end

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

    # Draw Icons #

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

    def draw_ach_icon(rect, index)

    $game_achievements[index] ? draw_icon(CSCA::ACHIEVEMENTS::EARNED_ICON,rect.x+5,rect.y) :

    draw_icon(CSCA::ACHIEVEMENTS::UNEARNED_ICON,rect.x+5,rect.y)

    end

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

    # Refresh #

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

    def refresh

    make_item_list

    create_contents

    draw_all_items

    end

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

    # Update Help Window #

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

    def update_help

    @help_window.set_item(index)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementTotals

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

    # This window displays the achievement header window.

    #==============================================================================

    class CSCA_Window_AchievementTotals < Window_Base

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

    # Object Initialization #

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

    def initialize(x, y, w, h)

    super(x, y, w, h)

    refresh

    end

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

    # Refresh #

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

    def refresh

    contents.clear

    total_achieves = CSCA::ACHIEVEMENTS::ACHIEVEMENTS.size

    unlocked = 0

    for i in 0...CSCA::ACHIEVEMENTS::ACHIEVEMENTS.size

    unlocked += 1 if $game_achievements

    end

    string = CSCA::ACHIEVEMENTS::TOTAL+unlocked.to_s+"/"+total_achieves.to_s

    draw_text(0,0,contents.width,line_height,string,1)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementDisplay

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

    # This window displays the achievement descriptions.

    #==============================================================================

    class CSCA_Window_AchievementDisplay < Window_Base

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

    # Object Initialization #

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

    def initialize(x,y,w,h)

    super(x,y,w,h)

    end

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

    # Draw all info #

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

    def set_item(achievement_id)

    contents.clear

    draw_description(0,contents.width,line_height,achievement_id)

    draw_progress(0,line_height*8,contents.width,line_height,achievement_id) unless

    CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][4].nil?

    draw_reward(0,line_height*11,contents.width,line_height,achievement_id) unless

    CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][5].nil?

    end

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

    # Draw description #

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

    def draw_description(x,w,h,achievement)

    if !$game_achievements[achievement] || CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][3].nil?

    description = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][2]

    else

    description = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][3]

    end

    for i in 0...description.size

    draw_text(x,h*i,w,h,description.to_s, centered_text?)

    end

    end

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

    # Get centered option #

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

    def centered_text?

    CSCA::ACHIEVEMENTS::CENTER ? 1 : 0

    end

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

    # Draw Progress bar #

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

    def draw_progress(x,y,w,h,achievement)

    color1 = text_color(CSCA::ACHIEVEMENTS::COLOR1)

    color2 = text_color(CSCA::ACHIEVEMENTS::COLOR2)

    contents.font.size = 20

    draw_text(x,y,w,h,CSCA::ACHIEVEMENTS::pROGRESS,1)

    if $game_achievements[achievement] && CSCA::ACHIEVEMENTS::STOP_TRACK

    draw_gauge(x,y+line_height-8,w,1/1,color1,color2)

    string = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][1].to_s

    draw_text(x,y+line_height-4,w,h,string+"/"+string,1)

    else

    draw_gauge(x,y+line_height-8,w,csca_get_rate(achievement),color1,color2)

    draw_gauge_numbers(x,y+line_height-4,w,h,achievement)

    end

    draw_text(x,y+line_height*2-12,w,h,CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][2],1)

    contents.font.size = 24

    end

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

    # Calculate Rate #

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

    def csca_get_rate(achievement)

    csca_get_numerator(achievement).to_f/csca_get_denominator(achievement).to_f

    end

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

    # Get Numerator #

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

    def csca_get_numerator(achievement)

    case CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][3]

    when :var

    return $game_variables[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]]

    when :item

    return $game_party.item_number($data_items[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]])

    when :weapon

    return $game_party.item_number($data_weapons[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]])

    when :armor

    return $game_party.item_number($data_armors[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]])

    when :gold

    return $game_party.gold

    when :step

    return $game_party.steps

    when :save

    return $game_system.save_count

    when :battle

    return $game_system.battle_count

    when :playtime

    return Graphics.frame_count / Graphics.frame_rate

    when :loot

    return $game_variables[CSCA_EXTRA_STATS::LOOTED] if $imported["CSCA-ExtraStats"]

    when :dtake

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] if $imported["CSCA-ExtraStats"]

    when :ddeal

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] if $imported["CSCA-ExtraStats"]

    when :gspend

    return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] if $imported["CSCA-ExtraStats"]

    when :gearn

    return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] if $imported["CSCA-ExtraStats"]

    when :iuse

    return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] if $imported["CSCA-ExtraStats"]

    when :ibuy

    return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] if $imported["CSCA-ExtraStats"]

    when :isell

    return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] if $imported["CSCA-ExtraStats"]

    end

    return 0

    end

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

    # Get Denominator #

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

    def csca_get_denominator(achievement)

    return CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][1]

    end

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

    # Draw Gauge Values #

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

    def draw_gauge_numbers(x,y,w,h,achievement)

    draw_text(x,y,w,h,csca_get_numerator(achievement).to_s+"/"+csca_get_denominator(achievement).to_s,1)

    end

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

    # Draw Reward #

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

    def draw_reward(x,y,w,h,achievement)

    reward_amount = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][0]

    reward_id = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][1]

    reward_type = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][2]

    case reward_type

    when :gold; reward = Vocab::currency_unit

    when :item; reward = " " + $data_items[reward_id].name

    when :weapon; reward = " " + $data_weapons[reward_id].name

    when :armor; reward = " " + $data_armors[reward_id].name

    end

    draw_text(x,y,w,h,CSCA::ACHIEVEMENTS::REWARD+reward_amount.to_s+reward)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementPop

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

    # This window displays when an achievement is unlocked if no custom graphic

    # is available.

    #==============================================================================

    class CSCA_Window_AchievementPop < Window_Base

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

    # Object Initialization #

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

    def initialize

    case CSCA::ACHIEVEMENTS::pOP_ALIGN

    when :bottom

    super(Graphics.width/4,Graphics.height-fitting_height(3),window_width,fitting_height(3))

    when :middle

    super(Graphics.width/4,Graphics.height/2-fitting_height(1),window_width,fitting_height(3))

    when :top

    super(Graphics.width/4,0,window_width,fitting_height(3))

    end

    self.opacity = 0

    self.contents_opacity = 0

    @show_count = 0

    refresh

    end

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

    # Get Window Width #

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

    def window_width

    return 272

    end

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

    # Frame Update #

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

    def update

    super

    if @show_count > 0

    update_fadein

    @show_count -= 1

    else

    update_fadeout

    end

    end

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

    # Update Fadein #

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

    def update_fadein

    unless $game_map.achievement_id.nil?

    self.opacity += 16 if CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6].nil?

    end

    self.contents_opacity += 16

    end

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

    # Update Fadeout #

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

    def update_fadeout

    unless $game_map.achievement_id.nil?

    self.opacity -= 16 if CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6].nil?

    end

    self.contents_opacity -= 16

    end

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

    # Open Window #

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

    def open

    refresh

    @show_count = 150

    self.contents_opacity = 0

    self.opacity = 0

    self

    end

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

    # Close Window #

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

    def close

    @show_count = 0

    self

    end

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

    # Refresh #

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

    def refresh

    contents.clear

    unless $game_map.achievement_id.nil?

    if CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6].nil?

    contents.font.bold = true

    draw_text(0,0,contents.width,line_height,CSCA::ACHIEVEMENTS::UNLOCKED,1)

    contents.font.bold = false

    draw_text(0,line_height,contents.width,line_height,CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][0],1)

    draw_reward($game_map.achievement_id) unless CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][5].nil?

    else

    draw_custom_image

    end

    end

    end

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

    # Draw Reward if Exist #

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

    def draw_reward(achievement)

    reward_amount = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][0]

    reward_id = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][1]

    reward_type = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][2]

    case reward_type

    when :gold; reward = Vocab::currency_unit

    when :item; reward = " " + $data_items[reward_id].name

    when :weapon; reward = " " + $data_weapons[reward_id].name

    when :armor; reward = " " + $data_armors[reward_id].name

    end

    draw_text(0,line_height*2,contents.width,line_height,

    CSCA::ACHIEVEMENTS::REWARD+reward_amount.to_s+reward,1)

    end

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

    # Draw Popup Graphic if Exist #

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

    def draw_custom_image

    bitmap = Cache.picture(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6])

    rect = Rect.new(0,0,bitmap.width,bitmap.height)

    target = Rect.new(0,0,contents.width,contents.height)

    contents.stretch_blt(target, bitmap, rect, 255)

    end

    end

    #==============================================================================

    # ** Scene_Map

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

    # Overwrites: none

    # Aliases: create_all_windows, update, pre_transfer

    #==============================================================================

    class Scene_Map < Scene_Base

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

    # alias method. #

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

    alias csca_create_all_windows create_all_windows

    def create_all_windows

    csca_create_all_windows

    csca_create_achievement_window unless CSCA::ACHIEVEMENTS::pOP_ALIGN.nil?

    end

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

    # new method; create achievement window #

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

    def csca_create_achievement_window

    @achievement_window = CSCA_Window_AchievementPop.new

    @achievement_window.viewport = @viewport

    end

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

    # alias method. #

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

    alias csca_ach_pre_transfer pre_transfer

    def pre_transfer

    @achievement_window.close unless CSCA::ACHIEVEMENTS::pOP_ALIGN.nil?

    csca_ach_pre_transfer

    end

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

    # alias method. #

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

    alias csca_ach_update update

    def update

    csca_ach_update

    if $game_map.achievement_earned

    @achievement_window.open unless CSCA::ACHIEVEMENTS::pOP_ALIGN.nil?

    $game_map.achievement_earned = false

    end

    end

    end

    #==============================================================================

    # ** Game_Party

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

    # Overwrites: none

    # Aliases: none

    #==============================================================================

    class Game_Party < Game_Unit

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

    # new method; Gives Reward #

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

    def csca_achievement_reward(reward)

    case reward[2]

    when :gold; gain_gold(reward[0])

    when :item; gain_item($data_items[reward[1]], reward[0])

    when :weapon; gain_item($data_weapons[reward[1]], reward[0])

    when :armor; gain_item($data_armors[reward[1]], reward[0])

    end

    end

    end

    #==============================================================================

    # ** Game_Map

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

    # Overwrites: none

    # Aliases: initialize, update

    #==============================================================================

    class Game_Map

    attr_accessor :achievement_earned

    attr_accessor :achievement_id

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

    # alias method. #

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

    alias csca_ach_initialize initialize

    def initialize

    csca_ach_initialize

    @achievement_earned = false

    @achievement_id = 0

    end

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

    # alias method. #

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

    alias csca_ach_update update

    def update(main = false)

    update_interpreter if main

    csca_ach_update(main = false)

    csca_update_achievements

    end

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

    # new method; automatically earn achievement if progress 100% #

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

    def csca_update_achievements

    data = CSCA::ACHIEVEMENTS::ACHIEVEMENTS

    for i in 0...data.size

    unless $game_achievements

    if csca_get_progress_completion(data)

    $game_achievements = true

    end

    end

    end

    end

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

    # new method; determine progress completion #

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

    def csca_get_progress_completion(achievement)

    return false if achievement[4].nil?

    return csca_ach_numerator(achievement)/csca_ach_denominator(achievement) >= 1

    end

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

    # new method; determine rate numerator #

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

    def csca_ach_numerator(achievement)

    case achievement[4][3]

    when :var

    return $game_variables[achievement[4][0]]

    when :item

    return $game_party.item_number(achievement[4][0])

    when :weapon

    return $game_party.item_number(achievement[4][0])

    when :armor

    return $game_party.item_number(achievement[4][0])

    when :gold

    return $game_party.gold

    when :step

    return $game_party.steps

    when :save

    return $game_system.save_count

    when :battle

    return $game_system.battle_count

    when :playtime

    return Graphics.frame_count / Graphics.frame_rate

    when :loot

    return $game_variables[CSCA_EXTRA_STATS::LOOTED] if $imported["CSCA-ExtraStats"]

    when :dtake

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] if $imported["CSCA-ExtraStats"]

    when :ddeal

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] if $imported["CSCA-ExtraStats"]

    when :gspend

    return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] if $imported["CSCA-ExtraStats"]

    when :gearn

    return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] if $imported["CSCA-ExtraStats"]

    when :iuse

    return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] if $imported["CSCA-ExtraStats"]

    when :ibuy

    return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] if $imported["CSCA-ExtraStats"]

    when :isell

    return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] if $imported["CSCA-ExtraStats"]

    end

    return 0

    end

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

    # new method; determine rate denominator #

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

    def csca_ach_denominator(achievement)

    return achievement[4][1]

    end

    end
  3. Oh thank you so much. Yes, this is perfect :3
  4. Zasian said:
    Is this what you happen to be after? It's the only one I know of so.....

    Spoiler
    =beginCSCA Achievements

    version: 1.0

    Created by: Casper667 from http://www.caspergaming.com/

    Compatibility:

    Compatible only with VXAce.

    IMPORTANT: ALL CSCA Scripts should be compatible with each other unless

    otherwise noted.

    INTRODUCTION:

    This script creates an achievement system in your game.

    FEATURES:

    -Achievements!

    -Can assign a reward for each achievement

    -Can display a progress bar for each achievement

    -Automatically earn achievements when progress bar gets to 100%.

    -Can play an SE when achievement is unlocked

    -Popup window when achievement is earned

    -Able to use custom graphic in place of achievement window(size is 248x72),

    image will be resized if bigger or smaller.

    SETUP

    Setup required. Instructions below.

    To set an achievement as true, use the following script call:

    $game_achievements[achievement_id] = true

    where achievement_id would be the same number as ACHIEVEMENTS[achievement_id]

    CREDIT & TERMS

    Free to use in noncommercial games if credit is given to:

    casper667 from http://www.caspergaming.com/

    If using in commercial game, please contact me.

    www.rpgmakervxace.net/user/193-casper667/

    or

    www.caspergaming.com

    =end

    module CSCA # Don't touch

    module ACHIEVEMENTS # Don't touch

    #=======================================================================#

    # Declaring arrays, do not touch #

    #=======================================================================#

    ACHIEVEMENTS = [] # Don't touch

    DESCRIPTION = [] # Don't touch

    PROGRESS = [] # Don't touch

    REWARDS = [] # Don't touch

    #=======================================================================#

    # Description Setup #

    #=======================================================================#

    #DESCRIPTION[x] = ["Descriptive Text","Seperate lines with commas!"]

    DESCRIPTION[0] = ["Open 10 Treasure Chests","to unlock."]

    DESCRIPTION[1] = ["You opened 10 Treasure","Chests!"]

    DESCRIPTION[2] = ["Obtain a sword."]

    #=======================================================================#

    # Progress Setup #

    #=======================================================================#

    #PROGRESS[x] = [id, upper bound, "describe numbers", :type]

    # The type can be either:

    # :var = amount stored in $game_variables[id]

    # :item = amount of $data_items[id]

    # :weapon = amount of $data_weapons[id]

    # :armor = amount of $data_armors[id]

    # :gold = amount of gold, ignores id value

    # :step = amount of steps, ignores id value

    # :save = amount of saves, ignores id value

    # :battle = amount of battles, ignores id value

    # :playtime = playtime, ignores id value

    # * :loot = amount of gold looted, ignores id value

    # * :dtake = amount of damage taken, ignores id value

    # * :ddeal = amount of damage dealt, ignores id value

    # * :gspend = amount of gold spent at shops, ignores id value

    # * :gearn = amount of gold earned from selling to shops, ignores id value

    # * :iuse = amount of items used, ignores id value

    # * :ibuy = amount of items bought from shops, ignores id value

    # * :isell = amount of items sold to shops, ignores id value

    # * Requires CSCA Extra Stats(1.1+) Get it here:

    # http://www.rpgmakerv...ca-extra-stats/

    PROGRESS[0] = [5, 10, "Treasures Opened", :var] # 10 max, tracks variable ID5.

    PROGRESS[1] = [0, 100, "Total Gold", :gold] # 100 max, tracks party's gold.

    #=======================================================================#

    # Rewards Setup #

    #=======================================================================#

    #REWARDS[x] = [amount, id, type]

    # The type can be either:

    # :item = amount of $data_items[id]

    # :weapon = amount of $data_weapons[id]

    # :armor = amount of $data_armors[id]

    # :gold = amount of gold, ignores id value

    REWARDS[0] = [100, 0, :gold] # 100 gold.

    REWARDS[1] = [5, 1, :item] # 5 of item ID 1.

    #=======================================================================#

    # Achievement Setup #

    #=======================================================================#

    #ACHIEVEMENT[x] = ["Name After Unlock","Name Before Unlock"(optional),

    #Description, Description after unlock(optional),progress tracking(optional),

    #reward(optional),popup graphic(optional)]

    # If you are not using an optional feature, write: nil

    ACHIEVEMENTS[0] = ["Treasure Hunter","???",DESCRIPTION[0],DESCRIPTION[1],

    PROGRESS[0],REWARDS[0],nil]

    ACHIEVEMENTS[1] = ["Treasure Hunter II",nil,DESCRIPTION[2],nil,nil,nil,"DarkSpace1"]

    #=======================================================================#

    # Misc. Setup #

    #=======================================================================#

    SCENE_NAME = "Achievements" # Text shown in the head window.

    TOTAL = "Total Achievements Unlocked: " # Text shown before total numbers.

    PROGRESS = "Progress:" # Text above progress bar

    REWARD = "Reward: " # Text shown before the reward amount/name.

    UNLOCKED = "Achievement Unlocked!" # Text shown when achievement unlocked.

    EARNED_ICON = 621 # Icon to display if achievement is earned.

    UNEARNED_ICON = 622 # Icon to display if achievement is unearned.

    NUMBERED = false # If true, numbers achieve list. If false, uses icons.

    CENTER = false # Center the description text ? True/false

    STOP_TRACK = false # Stop tracking achievement progress after earned?

    COLOR1 = 20 # Color1 of the progress gauge.

    COLOR2 = 21 # Color2 of the progress gauge.

    SOUND = "Applause1" # SE Played when an achievement is earned. Set to nil to disable.

    POP_ALIGN = :bottom # Alignment of Popup on map when achievement is earned.

    # :bottom = bottom center, :middle = middle of screen, :top = top center

    # Set to nil to disable the Popup Window.

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

    # END SETUP! DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING #

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

    end

    end

    $imported = {} if $imported.nil?

    $imported["CSCA-Achievements"] = true

    #==============================================================================

    # ** DataManager

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

    # Overwrites: make_save_contents

    # Aliases: create_game_objects, extract_save_contents

    #==============================================================================

    module DataManager

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

    # alias method. #

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

    class <<self; alias csca_ach_create_game_objects create_game_objects; end

    def self.create_game_objects

    csca_ach_create_game_objects

    $game_achievements = Game_Achievements.new

    end

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

    # overwrite method. #

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

    def self.make_save_contents

    contents = {}

    contents[:system] = $game_system

    contents[:timer] = $game_timer

    contents[:message] = $game_message

    contents[:switches] = $game_switches

    contents[:variables] = $game_variables

    contents[:self_switches] = $game_self_switches

    contents[:actors] = $game_actors

    contents[:party] = $game_party

    contents[:troop] = $game_troop

    contents[:map] = $game_map

    contents[:player] = $game_player

    contents[:achievements] = $game_achievements

    contents

    end

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

    # alias method #

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

    class <<self; alias csca_ach_extract_save_contents extract_save_contents; end

    def self.extract_save_contents(contents)

    csca_ach_extract_save_contents(contents)

    $game_achievements = contents[:achievements]

    end

    end

    #==============================================================================

    # ** Game_Achievements

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

    # This class handles achievements.

    # The instance of this class is referenced by $game_achievements

    #==============================================================================

    class Game_Achievements

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

    # Object Initialization #

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

    def initialize

    @data = []

    end

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

    # Get Achievement #

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

    def [](achievement_id)

    @data[achievement_id] || false

    end

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

    # Set Achievement #

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

    def []=(achievement_id, value)

    @data[achievement_id] = value

    on_change(achievement_id)

    end

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

    # Processing When Setting Achievements #

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

    def on_change(achievement_id)

    $game_party.csca_achievement_reward(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][5]) unless

    CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][5].nil?

    Audio.se_play("Audio/SE/" + CSCA::ACHIEVEMENTS::SOUND, 80, 100) unless

    CSCA::ACHIEVEMENTS::SOUND.nil?

    $game_map.achievement_id = achievement_id

    $game_map.achievement_earned = true

    end

    end

    #==============================================================================

    # ** CSCA_Scene_Achievements

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

    # This class performs the achievement screen processing.

    #==============================================================================

    class CSCA_Scene_Achievements < Scene_MenuBase

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

    # Start Processing #

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

    def start

    super

    create_head_window

    create_achievement_window

    create_selection_window

    create_totals_window

    end

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

    # Create Background #

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

    def create_background

    super

    @background_sprite.tone.set(0, 0, 0, 128)

    end

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

    # Create Header Window #

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

    def create_head_window

    @head_window = CSCA_Window_AchievementsMainHead.new(0, 0)

    @head_window.viewport = @viewport

    end

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

    # Create Achievement Selection Window #

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

    def create_selection_window

    @command_window = CSCA_Window_AchievementSelect.new(0,@head_window.height,

    Graphics.width/2,Graphics.height-@head_window.height-48)

    @command_window.viewport = @viewport

    @command_window.help_window = @achievement_window

    @command_window.set_handler:)cancel, method:)return_scene))

    @command_window.activate

    end

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

    # Create Achievement Window #

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

    def create_achievement_window

    @achievement_window = CSCA_Window_AchievementDisplay.new(Graphics.width/2,

    @head_window.height,Graphics.width/2,Graphics.height-@head_window.height-48)

    @achievement_window.viewport = @viewport

    end

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

    # Create Achievement Totals Window #

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

    def create_totals_window

    @totals_window = CSCA_Window_AchievementTotals.new(0,@head_window.height+

    @achievement_window.height,Graphics.width,Graphics.height-@head_window.height-

    @achievement_window.height)

    @totals_window.viewport = @viewport

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementsMainHead

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

    # This window displays the achievement header window.

    #==============================================================================

    class CSCA_Window_AchievementsMainHead < Window_Base

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

    # Object Initialization #

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

    def initialize(x, y)

    super(x, y, Graphics.width, line_height * 2)

    refresh

    end

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

    # Refresh #

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

    def refresh

    contents.clear

    draw_text(0, 0, contents.width, line_height, CSCA::ACHIEVEMENTS::SCENE_NAME, 1)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementSelect

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

    # This window displays the achievement names, numbers, and icons.

    #==============================================================================

    class CSCA_Window_AchievementSelect < Window_Selectable

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

    # Object Initialization #

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

    def initialize(x,y,width,height)

    super

    @data = []

    refresh

    select(0)

    end

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

    # Get Item Max #

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

    def item_max

    @data ? @data.size : 1

    end

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

    # Get Item #

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

    def item

    @data && index >= 0 ? @data[index] : nil

    end

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

    # Populate item list #

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

    def make_item_list

    @data = CSCA::ACHIEVEMENTS::ACHIEVEMENTS

    end

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

    # Draw Items #

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

    def draw_item(index)

    item = @data[index]

    if item

    rect = item_rect(index)

    CSCA::ACHIEVEMENTS::NUMBERED ? draw_item_id(rect, index) : draw_ach_icon(rect, index)

    if $game_achievements[index] || CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][1].nil?

    name = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][0]

    else

    name = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][1]

    end

    draw_text(rect.x + 32, rect.y, contents.width - 40, line_height, name)

    end

    end

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

    # Draw Numbers #

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

    def draw_item_id(rect, index)

    draw_text(rect, sprintf("%2d.", index + 1))

    end

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

    # Draw Icons #

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

    def draw_ach_icon(rect, index)

    $game_achievements[index] ? draw_icon(CSCA::ACHIEVEMENTS::EARNED_ICON,rect.x+5,rect.y) :

    draw_icon(CSCA::ACHIEVEMENTS::UNEARNED_ICON,rect.x+5,rect.y)

    end

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

    # Refresh #

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

    def refresh

    make_item_list

    create_contents

    draw_all_items

    end

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

    # Update Help Window #

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

    def update_help

    @help_window.set_item(index)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementTotals

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

    # This window displays the achievement header window.

    #==============================================================================

    class CSCA_Window_AchievementTotals < Window_Base

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

    # Object Initialization #

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

    def initialize(x, y, w, h)

    super(x, y, w, h)

    refresh

    end

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

    # Refresh #

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

    def refresh

    contents.clear

    total_achieves = CSCA::ACHIEVEMENTS::ACHIEVEMENTS.size

    unlocked = 0

    for i in 0...CSCA::ACHIEVEMENTS::ACHIEVEMENTS.size

    unlocked += 1 if $game_achievements

    end

    string = CSCA::ACHIEVEMENTS::TOTAL+unlocked.to_s+"/"+total_achieves.to_s

    draw_text(0,0,contents.width,line_height,string,1)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementDisplay

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

    # This window displays the achievement descriptions.

    #==============================================================================

    class CSCA_Window_AchievementDisplay < Window_Base

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

    # Object Initialization #

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

    def initialize(x,y,w,h)

    super(x,y,w,h)

    end

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

    # Draw all info #

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

    def set_item(achievement_id)

    contents.clear

    draw_description(0,contents.width,line_height,achievement_id)

    draw_progress(0,line_height*8,contents.width,line_height,achievement_id) unless

    CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][4].nil?

    draw_reward(0,line_height*11,contents.width,line_height,achievement_id) unless

    CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement_id][5].nil?

    end

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

    # Draw description #

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

    def draw_description(x,w,h,achievement)

    if !$game_achievements[achievement] || CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][3].nil?

    description = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][2]

    else

    description = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][3]

    end

    for i in 0...description.size

    draw_text(x,h*i,w,h,description.to_s, centered_text?)

    end

    end

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

    # Get centered option #

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

    def centered_text?

    CSCA::ACHIEVEMENTS::CENTER ? 1 : 0

    end

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

    # Draw Progress bar #

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

    def draw_progress(x,y,w,h,achievement)

    color1 = text_color(CSCA::ACHIEVEMENTS::COLOR1)

    color2 = text_color(CSCA::ACHIEVEMENTS::COLOR2)

    contents.font.size = 20

    draw_text(x,y,w,h,CSCA::ACHIEVEMENTS::pROGRESS,1)

    if $game_achievements[achievement] && CSCA::ACHIEVEMENTS::STOP_TRACK

    draw_gauge(x,y+line_height-8,w,1/1,color1,color2)

    string = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][1].to_s

    draw_text(x,y+line_height-4,w,h,string+"/"+string,1)

    else

    draw_gauge(x,y+line_height-8,w,csca_get_rate(achievement),color1,color2)

    draw_gauge_numbers(x,y+line_height-4,w,h,achievement)

    end

    draw_text(x,y+line_height*2-12,w,h,CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][2],1)

    contents.font.size = 24

    end

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

    # Calculate Rate #

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

    def csca_get_rate(achievement)

    csca_get_numerator(achievement).to_f/csca_get_denominator(achievement).to_f

    end

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

    # Get Numerator #

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

    def csca_get_numerator(achievement)

    case CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][3]

    when :var

    return $game_variables[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]]

    when :item

    return $game_party.item_number($data_items[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]])

    when :weapon

    return $game_party.item_number($data_weapons[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]])

    when :armor

    return $game_party.item_number($data_armors[CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0]])

    when :gold

    return $game_party.gold

    when :step

    return $game_party.steps

    when :save

    return $game_system.save_count

    when :battle

    return $game_system.battle_count

    when :playtime

    return Graphics.frame_count / Graphics.frame_rate

    when :loot

    return $game_variables[CSCA_EXTRA_STATS::LOOTED] if $imported["CSCA-ExtraStats"]

    when :dtake

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] if $imported["CSCA-ExtraStats"]

    when :ddeal

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] if $imported["CSCA-ExtraStats"]

    when :gspend

    return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] if $imported["CSCA-ExtraStats"]

    when :gearn

    return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] if $imported["CSCA-ExtraStats"]

    when :iuse

    return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] if $imported["CSCA-ExtraStats"]

    when :ibuy

    return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] if $imported["CSCA-ExtraStats"]

    when :isell

    return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] if $imported["CSCA-ExtraStats"]

    end

    return 0

    end

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

    # Get Denominator #

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

    def csca_get_denominator(achievement)

    return CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][1]

    end

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

    # Draw Gauge Values #

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

    def draw_gauge_numbers(x,y,w,h,achievement)

    draw_text(x,y,w,h,csca_get_numerator(achievement).to_s+"/"+csca_get_denominator(achievement).to_s,1)

    end

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

    # Draw Reward #

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

    def draw_reward(x,y,w,h,achievement)

    reward_amount = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][0]

    reward_id = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][1]

    reward_type = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][2]

    case reward_type

    when :gold; reward = Vocab::currency_unit

    when :item; reward = " " + $data_items[reward_id].name

    when :weapon; reward = " " + $data_weapons[reward_id].name

    when :armor; reward = " " + $data_armors[reward_id].name

    end

    draw_text(x,y,w,h,CSCA::ACHIEVEMENTS::REWARD+reward_amount.to_s+reward)

    end

    end

    #==============================================================================

    # ** CSCA_Window_AchievementPop

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

    # This window displays when an achievement is unlocked if no custom graphic

    # is available.

    #==============================================================================

    class CSCA_Window_AchievementPop < Window_Base

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

    # Object Initialization #

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

    def initialize

    case CSCA::ACHIEVEMENTS::pOP_ALIGN

    when :bottom

    super(Graphics.width/4,Graphics.height-fitting_height(3),window_width,fitting_height(3))

    when :middle

    super(Graphics.width/4,Graphics.height/2-fitting_height(1),window_width,fitting_height(3))

    when :top

    super(Graphics.width/4,0,window_width,fitting_height(3))

    end

    self.opacity = 0

    self.contents_opacity = 0

    @show_count = 0

    refresh

    end

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

    # Get Window Width #

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

    def window_width

    return 272

    end

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

    # Frame Update #

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

    def update

    super

    if @show_count > 0

    update_fadein

    @show_count -= 1

    else

    update_fadeout

    end

    end

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

    # Update Fadein #

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

    def update_fadein

    unless $game_map.achievement_id.nil?

    self.opacity += 16 if CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6].nil?

    end

    self.contents_opacity += 16

    end

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

    # Update Fadeout #

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

    def update_fadeout

    unless $game_map.achievement_id.nil?

    self.opacity -= 16 if CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6].nil?

    end

    self.contents_opacity -= 16

    end

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

    # Open Window #

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

    def open

    refresh

    @show_count = 150

    self.contents_opacity = 0

    self.opacity = 0

    self

    end

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

    # Close Window #

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

    def close

    @show_count = 0

    self

    end

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

    # Refresh #

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

    def refresh

    contents.clear

    unless $game_map.achievement_id.nil?

    if CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6].nil?

    contents.font.bold = true

    draw_text(0,0,contents.width,line_height,CSCA::ACHIEVEMENTS::UNLOCKED,1)

    contents.font.bold = false

    draw_text(0,line_height,contents.width,line_height,CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][0],1)

    draw_reward($game_map.achievement_id) unless CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][5].nil?

    else

    draw_custom_image

    end

    end

    end

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

    # Draw Reward if Exist #

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

    def draw_reward(achievement)

    reward_amount = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][0]

    reward_id = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][1]

    reward_type = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5][2]

    case reward_type

    when :gold; reward = Vocab::currency_unit

    when :item; reward = " " + $data_items[reward_id].name

    when :weapon; reward = " " + $data_weapons[reward_id].name

    when :armor; reward = " " + $data_armors[reward_id].name

    end

    draw_text(0,line_height*2,contents.width,line_height,

    CSCA::ACHIEVEMENTS::REWARD+reward_amount.to_s+reward,1)

    end

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

    # Draw Popup Graphic if Exist #

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

    def draw_custom_image

    bitmap = Cache.picture(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[$game_map.achievement_id][6])

    rect = Rect.new(0,0,bitmap.width,bitmap.height)

    target = Rect.new(0,0,contents.width,contents.height)

    contents.stretch_blt(target, bitmap, rect, 255)

    end

    end

    #==============================================================================

    # ** Scene_Map

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

    # Overwrites: none

    # Aliases: create_all_windows, update, pre_transfer

    #==============================================================================

    class Scene_Map < Scene_Base

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

    # alias method. #

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

    alias csca_create_all_windows create_all_windows

    def create_all_windows

    csca_create_all_windows

    csca_create_achievement_window unless CSCA::ACHIEVEMENTS::pOP_ALIGN.nil?

    end

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

    # new method; create achievement window #

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

    def csca_create_achievement_window

    @achievement_window = CSCA_Window_AchievementPop.new

    @achievement_window.viewport = @viewport

    end

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

    # alias method. #

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

    alias csca_ach_pre_transfer pre_transfer

    def pre_transfer

    @achievement_window.close unless CSCA::ACHIEVEMENTS::pOP_ALIGN.nil?

    csca_ach_pre_transfer

    end

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

    # alias method. #

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

    alias csca_ach_update update

    def update

    csca_ach_update

    if $game_map.achievement_earned

    @achievement_window.open unless CSCA::ACHIEVEMENTS::pOP_ALIGN.nil?

    $game_map.achievement_earned = false

    end

    end

    end

    #==============================================================================

    # ** Game_Party

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

    # Overwrites: none

    # Aliases: none

    #==============================================================================

    class Game_Party < Game_Unit

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

    # new method; Gives Reward #

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

    def csca_achievement_reward(reward)

    case reward[2]

    when :gold; gain_gold(reward[0])

    when :item; gain_item($data_items[reward[1]], reward[0])

    when :weapon; gain_item($data_weapons[reward[1]], reward[0])

    when :armor; gain_item($data_armors[reward[1]], reward[0])

    end

    end

    end

    #==============================================================================

    # ** Game_Map

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

    # Overwrites: none

    # Aliases: initialize, update

    #==============================================================================

    class Game_Map

    attr_accessor :achievement_earned

    attr_accessor :achievement_id

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

    # alias method. #

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

    alias csca_ach_initialize initialize

    def initialize

    csca_ach_initialize

    @achievement_earned = false

    @achievement_id = 0

    end

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

    # alias method. #

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

    alias csca_ach_update update

    def update(main = false)

    update_interpreter if main

    csca_ach_update(main = false)

    csca_update_achievements

    end

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

    # new method; automatically earn achievement if progress 100% #

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

    def csca_update_achievements

    data = CSCA::ACHIEVEMENTS::ACHIEVEMENTS

    for i in 0...data.size

    unless $game_achievements

    if csca_get_progress_completion(data)

    $game_achievements = true

    end

    end

    end

    end

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

    # new method; determine progress completion #

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

    def csca_get_progress_completion(achievement)

    return false if achievement[4].nil?

    return csca_ach_numerator(achievement)/csca_ach_denominator(achievement) >= 1

    end

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

    # new method; determine rate numerator #

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

    def csca_ach_numerator(achievement)

    case achievement[4][3]

    when :var

    return $game_variables[achievement[4][0]]

    when :item

    return $game_party.item_number(achievement[4][0])

    when :weapon

    return $game_party.item_number(achievement[4][0])

    when :armor

    return $game_party.item_number(achievement[4][0])

    when :gold

    return $game_party.gold

    when :step

    return $game_party.steps

    when :save

    return $game_system.save_count

    when :battle

    return $game_system.battle_count

    when :playtime

    return Graphics.frame_count / Graphics.frame_rate

    when :loot

    return $game_variables[CSCA_EXTRA_STATS::LOOTED] if $imported["CSCA-ExtraStats"]

    when :dtake

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] if $imported["CSCA-ExtraStats"]

    when :ddeal

    return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] if $imported["CSCA-ExtraStats"]

    when :gspend

    return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] if $imported["CSCA-ExtraStats"]

    when :gearn

    return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] if $imported["CSCA-ExtraStats"]

    when :iuse

    return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] if $imported["CSCA-ExtraStats"]

    when :ibuy

    return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] if $imported["CSCA-ExtraStats"]

    when :isell

    return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] if $imported["CSCA-ExtraStats"]

    end

    return 0

    end

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

    # new method; determine rate denominator #

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

    def csca_ach_denominator(achievement)

    return achievement[4][1]

    end

    end
    wow,\. this is... \!really really cool.
  5. Glad to help. Not sure if you realise this yet or not, but you can assign a custom picture to display whenever you reach an achievement which is cool. Have fun making achievement eye candy xD.
  6. Yeah, I saw :D

    One more thing. You wouldn't happen to have CSCA Extra Stats(1.1+) would you? rpgmakervxace.net is still down and it gives the achievement script more features to work with.
  7. I didn't so I went to the website and got it for you.

    Spoiler
    =begin

    CSCA Extra Stats

    version: 1.1

    Created by: Casper667 from http://www.caspergaming.com/

    Compatibility:

    Compatible for VXAce.

    IMPORTANT: ALL CSCA Scripts should be compatible with each other unless

    otherwise noted.

    Update history

    Version 1.0

    -Original Script

    Version 1.1

    -Added tracking for gold looted from battle

    -Aliased everything

    -Added support for CSCA Skill Shop

    FFEATURES:

    This script will track a few things not tracked by default. Currently, it tracks

    the amount of damage taken and dealt during battle, the amount of items bought

    and sold at shops, the amount of gold spent/made from buying/selling to shops,

    the amount of items used, and the amount of gold looted from battles.

    Stats Tracked:

    Gold spent at shops

    Gold earned at shops

    Items bought from shops

    Items sold to shops

    Damage taken

    Damage dealt

    Items used

    Gold looted from battle

    How to use these features is explained below in the setup section.

    SETUP BELOW IS REQUIRED!

    CREDIT

    Free to use in any game(commercial or not) if credit is given to:

    casper667 from http://www.caspergaming.com/

    =end

    module CSCA_EXTRA_STATS # Don't Touch This.

    ###############

    # SETUP BEGIN #

    ###############

    GOLDSPENT = 20 # Variable ID. Stores the amount of gold spent on items at shops.

    GOLDGAINED = 21 # Variable ID. Stores amount of gold made from selling to shops.

    ITEMSBOUGHT = 22 # Variable ID. Stores amount of items bought from shops.

    ITEMSSOLD = 23 # Variable ID. Stores amount of items sold to shops.

    DAMAGE_TAKEN = 24 # Variable ID. Stores damage dealt to actors.

    DAMAGE_DEALT = 25 # Variable ID. Stores damage dealt to enemies.

    ITEMS_USED = 26 # Variable ID. Stores amount of items used.

    LOOTED = 27 # Variable ID. Stores amount of items used.

    #############

    # SETUP END #

    #############

    end # Don't touch this

    $imported = {} if $imported.nil?

    $imported["CSCA-ExtraStats"] = true

    class Scene_Shop < Scene_MenuBase

    alias csca_buy do_buy

    def do_buy(number)

    csca_buy(number)

    $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] += number

    $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] += (number * buying_price)

    end

    alias csca_sell do_sell

    def do_sell(number)

    csca_sell(number)

    $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] += number

    $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] += (number * selling_price)

    end

    end

    class Game_Battler < Game_BattlerBase

    alias csca_stat_execute_damage execute_damage

    def execute_damage(user)

    if actor?

    $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] += @result.hp_damage

    else

    $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] += @result.hp_damage

    end

    csca_stat_execute_damage(user)

    end

    end

    class Scene_Battle < Scene_Base

    alias csca_stat_use_item use_item

    def use_item

    item = @subject.current_action.item

    if item.is_a?(RPG::Item)

    $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] += 1

    end

    csca_stat_use_item

    end

    end

    class Scene_Item < Scene_ItemBase

    alias csca_use_item use_item

    def use_item

    csca_use_item

    $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] += 1

    end

    end

    module BattleManager

    class <<self; alias csca_gold_looted gain_gold; end

    def self.gain_gold

    $game_variables[CSCA_EXTRA_STATS::LOOTED] += $game_troop.gold_total

    csca_gold_looted

    end

    end

    if $imported["CSCA-SkillShop"]

    class CSCA_Scene_Skill_Shop < Scene_MenuBase

    alias csca_stat_do_buy do_buy

    def do_buy(actor, skill)

    $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] += buying_price

    csca_stat_do_buy(actor, skill)

    end

    end

    end # $imported["CSCA-SkillShop"]
  8. That's so weird. I went to caspergaming.com and couldn't find a script section anywhere. :(

    But thank you! <3 You're a lifesaver!
  9. Hahaha I had the same issue but if you go down to the bottom of the page there's a developer tools section. That is where the scripts are hidden it took me awhile to notice it as well. But no worries all is well now xD have fun with these scripts.
  10. This may be a necro post and for that I apologize but I am extremely interested in having an "Acheivement System" and was curious as to where I should put these two scripts mentioned above? Thank you!
  11. Unfortunately, this is definitely a necro. However, you can create your own topic with details on what you want. Please make sure you read the request rules here:

    Closed for necro. If the OP wants this reopened, PM me.