Gleason 15 Posted April 6, 2013 Dang...I dunno what to tell you, then :/ I use the achievement script and my computer's a little older than yours, I built it in September 2010 and it could run FFXIV okay at default graphics. I do know that regular event tiles can lag up a system if you have enough of them, but you said it's lagging on every screen. Hopefully Caspar or someone with more knowledge of the system can take a look at what's going on ^^; Share this post Link to post Share on other sites
casper667 131 Posted April 7, 2013 (edited) How many achievements are tracking automatically using the PROGRESS array? Does the lag only occur in the map scene? Does it lag on a blank project with no other scripts as well? If you could copy your achievement script settings for me I can test it out myself, but please also answer the questions I asked. Edited April 7, 2013 by casper667 Share this post Link to post Share on other sites
Tatsuki 1 Posted April 7, 2013 (edited) How many achievements are tracking automatically using the PROGRESS array? Does the lag only occur in the map scene? Does it lag on a blank project with no other scripts as well? If you could copy your achievement script settings for me I can test it out myself, but please also answer the questions I asked. Is the progress array not required? I could try removing some of those and see if it helps... When you say "only occur in the map scene", do you mean whether or not it occurs in battle as well? If so, I don't know offhand, I haven't tried battling since I came across the problem. Haven't tried it on a blank project, but it worked just fine with no lag before I added a bunch of new Achievements. When I had like 6 or 7 it ran fine, but then I went in and added the rest and... suddenly, lag. I'm just not sure if it's the amount in general causing lag, the amount being actively tracked, the amount + the number of events running, or whatever else the problem may be. Here's the Achievements code. =begin CSCA Achievements version: 1.2.3 Created by: Casper Gaming (http://www.caspergaming.com/) Compatibility: Made for RPGVXAce IMPORTANT: ALL CSCA Scripts should be compatible with each other unless otherwise noted. REQUIRES CSCA Core Script. ================================================================================ UPDATES: version 1.1(September 6th, 2012): - Optimized & Made more compatible version 1.2(September 19th, 2012): - Added support for encyclopedia completion % achievements version 1.2.1(November 25th, 2012): - Added score to achievements. version 1.2.2(November 26th, 2012): - Fixed bug with progress not tracking items, armors, and weapons properly. - Added the ability to use different icons for each achievement. version 1.2.3(March 18, 2013): - Added support for CSCA Currency System ================================================================================ INTRODUCTION: This script creates an achievement system in your game. FEATURES: -Achievements! -Score system similar to gamerscore. -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: Free to use in noncommercial games if credit is given to: Casper Gaming (http://www.caspergaming.com/) To use in a commercial game, please purchase a license here: http://www.caspergaming.com/licenses.html TERMS: http://www.caspergaming.com/terms_of_use.html =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 20 Treasure Chests."] DESCRIPTION[1] = ["Open 40 Treasure Chests."] DESCRIPTION[2] = ["Open 60 Treasure Chests."] DESCRIPTION[3] = ["Obtain 500 Gold."] DESCRIPTION[4] = ["Obtain 1,000 Gold."] DESCRIPTION[5] = ["Obtain 5,000 Gold."] DESCRIPTION[6] = ["Defeat all enemies in the Rank E Arena."] DESCRIPTION[7] = ["Recruit a Knight."] DESCRIPTION[8] = ["Recruit a White Mage."] DESCRIPTION[9] = ["Recruit a Black Mage."] DESCRIPTION[10] = ["Recruit a Thief."] DESCRIPTION[11] = ["Recruit a Monk."] DESCRIPTION[12] = ["Recruit a Bard."] DESCRIPTION[13] = ["Recruit an Archer."] DESCRIPTION[14] = ["Recruit 7 Party Members."] DESCRIPTION[15] = ["Become a Rank E Treasure Hunter."] DESCRIPTION[16] = ["Become a Rank D Treasure Hunter."] DESCRIPTION[17] = ["Reach 25% in the Completion Log."] DESCRIPTION[18] = ["Reach 50% in the Completion Log."] DESCRIPTION[19] = ["Reach 100% in the Completion Log."] #=======================================================================# # 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 # ** :ebes = % of bestiary completed, ignores id value # ** :eitm = % of items completed, ignores id value # ** :ewep = % of weapons completed, ignores id value # ** :earm = % of armors completed, ignores id value # ** :eskl = % of skills completed, ignores id value # ** :esta = % of states completed, ignores id value # ** :etot = % of total encyclopedia completed, ignores id value # ** :ecst = % of custom encyclopedia category completed, use id value for # the custom category's key value. # * Requires CSCA Extra Stats(1.1+) Get it here: # http://www.rpgmakervxace.net/topic/2030-csca-extra-stats/ # ** Requires CSCA Encyclopedia(3.0+) Get it here: # http://www.rpgmakervxace.net/topic/2775-csca-encyclopedia-w-bestiary/ # *** If using CSCA Currency System(http://www.rpgmakervxace.net/topic/13153-csca-currency-system/) # the ID value for gold will be the currency symbol. PROGRESS[0] = [2, 20, "Treasures Opened", :var] # 10 max, tracks variable ID5. PROGRESS[1] = [2, 40, "Treasures Opened", :var] # 100 max, tracks party's gold. PROGRESS[2] = [2, 60, "Treasures Opened", :var] # 10 max, tracks variable ID5 PROGRESS[3] = [0, 500, "Gold Obtained", :gold] PROGRESS[4] = [0, 1000, "Gold Obtained", :gold] PROGRESS[5] = [0, 5000, "Gold Obtained", :gold] PROGRESS[6] = [7, 4, "Rank E Arena Enemies Defeated", :var] PROGRESS[7] = [8, 1, "Knight Recruited?", :var] PROGRESS[8] = [9, 1, "White Mage Recruited?", :var] PROGRESS[9] = [10, 1, "Black Mage Recruited?", :var] PROGRESS[10] = [11, 1, "Thief Recruited?", :var] PROGRESS[11] = [12, 1, "Monk Recruited?", :var] PROGRESS[12] = [13, 1, "Bard Recruited?", :var] PROGRESS[13] = [14, 1, "Archer Recruited?", :var] PROGRESS[14] = [15, 7, "Party Members Recruited", :var] PROGRESS[15] = [16, 1, "Rank E License", :var] PROGRESS[16] = [17, 1, "Rank D License", :var] PROGRESS[17] = [0, 25, "Completion Log Complete", :etot] PROGRESS[18] = [0, 50, "Completion Log Complete", :etot] PROGRESS[19] = [0, 100, "Completion Log Complete", :etot] #=======================================================================# # 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* # * If using CSCA Currency System(http://www.rpgmakervxace.net/topic/13153-csca-currency-system/) # the ID value for gold will be the currency symbol. REWARDS[0] = CSCA_Item.new(100, 0, :gold) # 100 gold. REWARDS[1] = CSCA_Item.new(500, 0, :gold) # 5 of item ID 1. REWARDS[2] = CSCA_Item.new(1000, 0, :gold) # 100 gold. REWARDS[3] = CSCA_Item.new(3, 4, :item) # 100 gold. REWARDS[4] = CSCA_Item.new(3, 11, :item) # 100 gold. REWARDS[5] = CSCA_Item.new(3, 21, :item) # 100 gold. REWARDS[6] = CSCA_Item.new(1, 29, :weapon) # 100 gold. REWARDS[7] = CSCA_Item.new(1, 1, :armor) # 100 gold. REWARDS[8] = CSCA_Item.new(1, 26, :weapon) # 100 gold. REWARDS[9] = CSCA_Item.new(1, 26, :weapon) # 100 gold. REWARDS[10] = CSCA_Item.new(1, 51, :weapon) # 100 gold. REWARDS[11] = CSCA_Item.new(1, 202, :armor) # 100 gold. REWARDS[12] = CSCA_Item.new(1, 176, :weapon) # 100 gold. REWARDS[13] = CSCA_Item.new(1, 101, :weapon) # 100 gold. REWARDS[14] = CSCA_Item.new(1, 205, :armor) # 100 gold. REWARDS[15] = CSCA_Item.new(3, 1, :item) # 100 gold. REWARDS[16] = CSCA_Item.new(3, 2, :item) # 100 gold. REWARDS[17] = CSCA_Item.new(500, 0, :gold) # 100 gold. REWARDS[18] = CSCA_Item.new(1000, 0, :gold) # 100 gold. REWARDS[19] = CSCA_Item.new(3000, 0, :gold) # 100 gold. #=======================================================================# # Achievement Setup # #=======================================================================# #ACHIEVEMENT[x] = ["Name After Unlock","Name Before Unlock"(optional), #Description, Description after unlock(optional),progress tracking(optional), #reward(optional),popup graphic(optional), points worth, completion icon, #incomplete icon] # If you are not using an optional feature, write: nil ACHIEVEMENTS[0] = ["Treasure Hunter",nil,DESCRIPTION[0],nil, PROGRESS[0],REWARDS[0],nil, 5, 621, 622] ACHIEVEMENTS[1] = ["Treasure Hunter II",nil,DESCRIPTION[1],nil, PROGRESS[1],REWARDS[1],nil, 10, 621, 622] ACHIEVEMENTS[2] = ["Treasure Hunter III",nil,DESCRIPTION[2],nil, PROGRESS[2],REWARDS[2],nil, 15, 621, 622] ACHIEVEMENTS[3] = ["Gold Hunter I",nil,DESCRIPTION[3],nil, PROGRESS[3],REWARDS[3],nil, 5, 621, 622] ACHIEVEMENTS[4] = ["Gold Hunter II",nil,DESCRIPTION[4],nil, PROGRESS[4],REWARDS[4],nil, 10, 621, 622] ACHIEVEMENTS[5] = ["Gold Hunter III",nil,DESCRIPTION[5],nil, PROGRESS[5],REWARDS[5],nil, 15, 621, 622] ACHIEVEMENTS[6] = ["Arena Master E",nil,DESCRIPTION[6],nil, PROGRESS[6],REWARDS[6],nil, 10, 621, 622] ACHIEVEMENTS[7] = ["Knight Recruit",nil,DESCRIPTION[7],nil, PROGRESS[7],REWARDS[7],nil, 5, 621, 622] ACHIEVEMENTS[8] = ["White Mage Recruit",nil,DESCRIPTION[8],nil, PROGRESS[8],REWARDS[8],nil, 5, 621, 622] ACHIEVEMENTS[9] = ["Black Mage Recruit",nil,DESCRIPTION[9],nil, PROGRESS[9],REWARDS[9],nil, 5, 621, 622] ACHIEVEMENTS[10] = ["Thief Recruit",nil,DESCRIPTION[10],nil, PROGRESS[10],REWARDS[10],nil, 5, 621, 622] ACHIEVEMENTS[11] = ["Monk Recruit",nil,DESCRIPTION[11],nil, PROGRESS[11],REWARDS[11],nil, 5, 621, 622] ACHIEVEMENTS[12] = ["Bard Recruit",nil,DESCRIPTION[12],nil, PROGRESS[12],REWARDS[12],nil, 5, 621, 622] ACHIEVEMENTS[13] = ["Archer Recruit",nil,DESCRIPTION[13],nil, PROGRESS[13],REWARDS[13],nil, 5, 621, 622] ACHIEVEMENTS[14] = ["Party Members Recruit I",nil,DESCRIPTION[14],nil, PROGRESS[14],REWARDS[14],nil, 10, 621, 622] ACHIEVEMENTS[15] = ["Rank E Treasure Hunter",nil,DESCRIPTION[15],nil, PROGRESS[15],REWARDS[15],nil, 5, 621, 622] ACHIEVEMENTS[16] = ["Rank D Treasure Hunter",nil,DESCRIPTION[16],nil, PROGRESS[16],REWARDS[16],nil, 10, 621, 622] ACHIEVEMENTS[17] = ["Completion Log I",nil,DESCRIPTION[17],nil, PROGRESS[17],REWARDS[17],nil, 10, 621, 622] ACHIEVEMENTS[18] = ["Completion Log II",nil,DESCRIPTION[18],nil, PROGRESS[18],REWARDS[18],nil, 15, 621, 622] ACHIEVEMENTS[19] = ["Completion Log III",nil,DESCRIPTION[19],nil, PROGRESS[19],REWARDS[19],nil, 20, 621, 622] #=======================================================================# # Misc. Setup # #=======================================================================# HEADER = "Quests" # Text shown in the head window. TOTAL = "Quests Completed: " # Text shown before total numbers. SCORE = "Score: " # Text shown before score numbers. USE_SCORE = true # Use the score system? PROGRESS = "Progress:" # Text above progress bar REWARD = "Reward: " # Text shown before the reward amount/name. UNLOCKED = "Quest Completed!" # Text shown when achievement unlocked. NUMBERED = true # 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 msgbox('Missing Script: CSCA Core Script! CSCA Achievements requires this script to work properly.') if !$imported["CSCA-Core"] #============================================================================== # ** DataManager #------------------------------------------------------------------------------ # Handles achievement data. # Aliases: make_save_contents, 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. # #--------------------------------------------------------------------------# class <<self; alias csca_ach_save_contents make_save_contents; end def self.make_save_contents contents = csca_ach_save_contents 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_Header.new(0, 0, CSCA::ACHIEVEMENTS::HEADER) @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_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::ACHIEVEMENTS[index][8],rect.x+5,rect.y) : draw_icon(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][9],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 total_points = 0 points = 0 unlocked = 0 for i in 0...CSCA::ACHIEVEMENTS::ACHIEVEMENTS.size if $game_achievements[i] unlocked += 1 points += CSCA::ACHIEVEMENTS::ACHIEVEMENTS[i][7] end total_points += CSCA::ACHIEVEMENTS::ACHIEVEMENTS[i][7] end string1 = CSCA::ACHIEVEMENTS::TOTAL + unlocked.to_s + "/" + total_achieves.to_s string2 = CSCA::ACHIEVEMENTS::SCORE + points.to_s + "/" + total_points.to_s string = CSCA::ACHIEVEMENTS::USE_SCORE ? string1 + " " + string2 : string1 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[i].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 if $imported["CSCA-CurrencySystem"] sym = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0] return $game_party.get_csca_cs_currency(sym)[:amount] end 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] when :dtake return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] when :ddeal return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] when :gspend return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] when :gearn return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] when :iuse return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] when :ibuy return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] when :isell return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] when :ebes string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_bestiary*100.00) return string when :eitm string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_items*100.00) return string when :ewep string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_weapons*100.00) return string when :earm string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_armors*100.00) return string when :eskl string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_skills*100.00) return string when :esta string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_states*100.00) return string when :ecst string = sprintf("%1.2f%%",$game_party.completion_percentage_cust(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0])*100.00) return string when :etot string = sprintf("%1.2f%%",$game_party.csca_completion_percentage*100.00) return string 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 = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5] currency = $game_party.get_csca_cs_currency(reward.id) if $imported["CSCA-CurrencySystem"] case reward.type when :gold; reward_s = $imported["CSCA-CurrencySystem"] ? currency[:currency_unit] : Vocab::currency_unit when :item; reward_s = " " + $data_items[reward.id].name when :weapon; reward_s = " " + $data_weapons[reward.id].name when :armor; reward_s = " " + $data_armors[reward.id].name end draw_text(x,y,w,h,CSCA::ACHIEVEMENTS::REWARD) off_x = text_size(CSCA::ACHIEVEMENTS::REWARD).width if $imported["CSCA-CurrencySystem"] draw_icon(currency[:icon], x + off_x, y) off_x += 24 change_color(currency[:color]) end draw_text(x+off_x,y,w,h,reward.amount.to_s+reward_s) change_color(normal_color) 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 = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5] currency = $game_party.get_csca_cs_currency(reward.id) if $imported["CSCA-CurrencySystem"] case reward.type when :gold; reward_s = $imported["CSCA-CurrencySystem"] ? currency[:currency_unit] : reward_s = Vocab::currency_unit when :item; reward_s = " " + $data_items[reward.id].name when :weapon; reward_s = " " + $data_weapons[reward.id].name when :armor; reward_s = " " + $data_armors[reward.id].name end draw_text(0,line_height*2,contents.width,line_height,CSCA::ACHIEVEMENTS::REWARD+reward.amount.to_s+reward_s,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.type when :gold; $imported["CSCA-CurrencySystem"] ? gain_currency(get_csca_cs_currency(reward.id), reward.amount) : gain_gold(reward.amount) when :item; gain_item($data_items[reward.id], reward.amount) when :weapon; gain_item($data_weapons[reward.id], reward.amount) when :armor; gain_item($data_armors[reward.id], reward.amount) 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) csca_update_achievements csca_ach_update(main) 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[i] if csca_get_progress_completion(data[i]) $game_achievements[i] = 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($data_items[achievement[4][0]]) when :weapon return $game_party.item_number($data_weapons[achievement[4][0]]) when :armor return $game_party.item_number($data_armors[achievement[4][0]]) when :gold if $imported["CSCA-CurrencySystem"] return $game_party.get_csca_cs_currency(achievement[4][0])[:amount] end 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] when :dtake return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] when :ddeal return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] when :gspend return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] when :gearn return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] when :iuse return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] when :ibuy return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] when :isell return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] when :ebes return $game_party.csca_completion_percentage_bestiary*100.00 when :eitm return $game_party.csca_completion_percentage_items*100.00 when :ewep return $game_party.csca_completion_percentage_weapons*100.00 when :earm return $game_party.csca_completion_percentage_armors*100.00 when :eskl return $game_party.csca_completion_percentage_skills*100.00 when :esta return $game_party.csca_completion_percentage_states*100.00 when :ecst return $game_party.completion_percentage_cust(achievement[4][0])*100.00 when :etot return $game_party.csca_completion_percentage*100.00 end return 0 end #--------------------------------------------------------------------------# # new method; determine rate denominator # #--------------------------------------------------------------------------# def csca_ach_denominator(achievement) return achievement[4][1] end end Edited April 7, 2013 by Tatsuki Share this post Link to post Share on other sites
Tatsuki 1 Posted April 8, 2013 Okay so I managed to fix the lag. Turned out that yes, it was too many things being actively progress tracked. I got rid of all the tracking on the things which only had a value of 1 to be tracked and the lag disappeared. ...But there's a new problem! Before, I could open the Achievement menu with no problems, browse the Achievements and complete them. The ONLY thing I changed is putting "nil" in the progress area of the script on those achievements. But now the game crashes when opening the Achievement scene. Help? Share this post Link to post Share on other sites
casper667 131 Posted April 9, 2013 ACHIEVEMENT[10] in your screenshot has an extra argument in there. Sorry I have not been so quick to fix your other problem, I really only have time to work on scripts on days that I don't have work. 2 Share this post Link to post Share on other sites
Tatsuki 1 Posted April 9, 2013 ACHIEVEMENT[10] in your screenshot has an extra argument in there. Sorry I have not been so quick to fix your other problem, I really only have time to work on scripts on days that I don't have work. Wow, I'm such an idiot XD Thanks again. Share this post Link to post Share on other sites
Tatsuki 1 Posted April 10, 2013 ...Well, I have another problem now =/ First of all, I figured out what achievements were causing the lag. It was the ones used to track the Encyclopedia completion. But without the Progress enabled for those achievements, it doesn't trigger them as completed. Is there any way to get it to track the completion of the Encyclopedia without using the Progress field? That seems to be the culprit. Progress + Encyclopedia = Lag. Share this post Link to post Share on other sites
Tigerbite 36 Posted April 10, 2013 Encyclopedia likes doing that when there are a lot of entries. Even blank entries. For example, I changed the maximum amount of weapons in my game to 500 (so I could organize them neatly and leave room to add more weapons if desired at a later point.) With nearly 300 of those spaces being blank, whenever I view the weapons tab in encyclopedia it lags (or hangs) for a couple seconds when swapping to that tab. Seeing as how your achievements is trying to track it constantly...well...yeah. Not really a scripting guy, but it almost seems like it would be better to find a way to cause less lag in the encyclopedia script (which may be impossible, I don't know.) Share this post Link to post Share on other sites
casper667 131 Posted April 10, 2013 (edited) ...Well, I have another problem now =/ First of all, I figured out what achievements were causing the lag. It was the ones used to track the Encyclopedia completion. But without the Progress enabled for those achievements, it doesn't trigger them as completed. Is there any way to get it to track the completion of the Encyclopedia without using the Progress field? That seems to be the culprit. Progress + Encyclopedia = Lag. There's not an easy way to do it. If you're familiar with scripting, the methods for determining completion % in the encyclopedia are found in lines 1530 - 1557. You could use those in a script call in a common event to track it manually, and add a wait time so it checks it less often. Also @tigerbite, the reason the encyclopedia lags when switching tabs and the reason why the achievement script is lagging are 2 different causes. Edited April 10, 2013 by casper667 Share this post Link to post Share on other sites
Tatsuki 1 Posted April 10, 2013 ...Well, I have another problem now =/ First of all, I figured out what achievements were causing the lag. It was the ones used to track the Encyclopedia completion. But without the Progress enabled for those achievements, it doesn't trigger them as completed. Is there any way to get it to track the completion of the Encyclopedia without using the Progress field? That seems to be the culprit. Progress + Encyclopedia = Lag. There's not an easy way to do it. If you're familiar with scripting, the methods for determining completion % in the encyclopedia are found in lines 1530 - 1557. You could use those in a script call in a common event to track it manually, and add a wait time so it checks it less often. Also @tigerbite, the reason the encyclopedia lags when switching tabs and the reason why the achievement script is lagging are 2 different causes. Well.... I'm not familiar with scripting >_> It's all greek to me. I have no idea how I would go about doing that... Maybe I'll just leave those achievements out for now, until I can figure out some way to fix it. Share this post Link to post Share on other sites
Coolie 148 Posted April 30, 2013 For some reason, when I'm scrolling through the list of achievements, the font size in the description window changes to a bigger font size (24 when I have mine set to 20) and color (index 16) once I get to a certain achievement, which stays permanent until I back out of the menu and re-enter it. It then happens again. This always occurs when scrolling to achievements index 23. So weird. Share this post Link to post Share on other sites
casper667 131 Posted April 30, 2013 (edited) For some reason, when I'm scrolling through the list of achievements, the font size in the description window changes to a bigger font size (24 when I have mine set to 20) and color (index 16) once I get to a certain achievement, which stays permanent until I back out of the menu and re-enter it. It then happens again. This always occurs when scrolling to achievements index 23. So weird. That is definitely odd, have you tested it in a clean project(no other scripts)? If it's not a script conflict, could you please PM me an example game where the problem is easily reproduced? @Tatsuki I just want to let you know I have not forgotten about your problem, if everything goes to plan this achievement script should be getting a huge update in the next few months to address not just your issue but also add some stuff and make the setup a whole lot less confusing. Edited April 30, 2013 by casper667 Share this post Link to post Share on other sites
Amber 1 Posted May 6, 2013 (edited) It appears CSCA Currency isn't compatible with achievement system I try to put for currency #2 (diamond), but I still keep getting this error. Is there a way to fix it Edited May 6, 2013 by Amber Share this post Link to post Share on other sites
casper667 131 Posted May 6, 2013 Show me the whole achievement, progress, reward, and description set up you have. Share this post Link to post Share on other sites
Amber 1 Posted May 6, 2013 (edited) Nevermind, I got it working. But the problem the new version won't let me use item/weapon/armor as reward =begin CSCA Achievements version: 1.2.3 Created by: Casper Gaming (http://www.caspergaming.com/) Compatibility: Made for RPGVXAce IMPORTANT: ALL CSCA Scripts should be compatible with each other unless otherwise noted. REQUIRES CSCA Core Script. ================================================================================ UPDATES: version 1.1(September 6th, 2012): - Optimized & Made more compatible version 1.2(September 19th, 2012): - Added support for encyclopedia completion % achievements version 1.2.1(November 25th, 2012): - Added score to achievements. version 1.2.2(November 26th, 2012): - Fixed bug with progress not tracking items, armors, and weapons properly. - Added the ability to use different icons for each achievement. version 1.2.3(March 18, 2013): - Added support for CSCA Currency System ================================================================================ INTRODUCTION: This script creates an achievement system in your game. FEATURES: -Achievements! -Score system similar to gamerscore. -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: Free to use in noncommercial games if credit is given to: Casper Gaming (http://www.caspergaming.com/) To use in a commercial game, please purchase a license here: http://www.caspergaming.com/licenses.html TERMS: http://www.caspergaming.com/terms_of_use.html =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 15 Towns Treasure"] DESCRIPTION[1] = ["Open 50 treasure chest"] DESCRIPTION[2] = ["Dealt 300.000 damage"] #=======================================================================# # 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 # ** :ebes = % of bestiary completed, ignores id value # ** :eitm = % of items completed, ignores id value # ** :ewep = % of weapons completed, ignores id value # ** :earm = % of armors completed, ignores id value # ** :eskl = % of skills completed, ignores id value # ** :esta = % of states completed, ignores id value # ** :etot = % of total encyclopedia completed, ignores id value # ** :ecst = % of custom encyclopedia category completed, use id value for # the custom category's key value. # * Requires CSCA Extra Stats(1.1+) Get it here: # http://www.rpgmakervxace.net/topic/2030-csca-extra-stats/ # ** Requires CSCA Encyclopedia(3.0+) Get it here: # http://www.rpgmakervxace.net/topic/2775-csca-encyclopedia-w-bestiary/ # *** If using CSCA Currency System(http://www.rpgmakervxace.net/topic/13153-csca-currency-system/) # the ID value for gold will be the currency symbol. PROGRESS[0] = [3,15,"Chest in Town",:var] PROGRESS[1] = [6,50,"Treasure Opened",:var] PROGRESS[2] = [0,300000,"Damage Dealt",:ddeal] #=======================================================================# # 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* # * If using CSCA Currency System(http://www.rpgmakervxace.net/topic/13153-csca-currency-system/) # the ID value for gold will be the currency symbol. REWARDS[0] = CSCA_Item.new(1,1,:item) REWARDS[1] = CSCA_Item.new(250,0,:gold) REWARDS[2] = CSCA_Item.new(1000,0,:gold) #=======================================================================# # Achievement Setup # #=======================================================================# #ACHIEVEMENT[x] = ["Name After Unlock","Name Before Unlock"(optional), #Description, Description after unlock(optional),progress tracking(optional), #reward(optional),popup graphic(optional), points worth, completion icon, #incomplete icon] # If you are not using an optional feature, write: nil ACHIEVEMENTS[0] = ["Town Treasures",nil,DESCRIPTION[0],nil, PROGRESS[0],REWARDS[0],nil, 10, 621, 622] ACHIEVEMENTS[1] = ["Kicking the Booty",nil,DESCRIPTION[1],nil, PROGRESS[1],REWARDS[1],nil, 25, 621, 622] ACHIEVEMENTS[2] = ["300K",nil,DESCRIPTION[2],nil, PROGRESS[2],REWARDS[2],nil, 30, 621, 622] #=======================================================================# # Misc. Setup # #=======================================================================# HEADER = "Achievements" # Text shown in the head window. TOTAL = "Total Achievements Unlocked: " # Text shown before total numbers. SCORE = "Score: " # Text shown before score numbers. USE_SCORE = true # Use the score system? PROGRESS = "Progress:" # Text above progress bar REWARD = "Reward: " # Text shown before the reward amount/name. UNLOCKED = "Achievement Unlocked!" # Text shown when achievement unlocked. 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 msgbox('Missing Script: CSCA Core Script! CSCA Achievements requires this script to work properly.') if !$imported["CSCA-Core"] #============================================================================== # ** DataManager #------------------------------------------------------------------------------ # Handles achievement data. # Aliases: make_save_contents, 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. # #--------------------------------------------------------------------------# class <<self; alias csca_ach_save_contents make_save_contents; end def self.make_save_contents contents = csca_ach_save_contents 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_Header.new(0, 0, CSCA::ACHIEVEMENTS::HEADER) @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_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::ACHIEVEMENTS[index][8],rect.x+5,rect.y) : draw_icon(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[index][9],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 total_points = 0 points = 0 unlocked = 0 for i in 0...CSCA::ACHIEVEMENTS::ACHIEVEMENTS.size if $game_achievements[i] unlocked += 1 points += CSCA::ACHIEVEMENTS::ACHIEVEMENTS[i][7] end total_points += CSCA::ACHIEVEMENTS::ACHIEVEMENTS[i][7] end string1 = CSCA::ACHIEVEMENTS::TOTAL + unlocked.to_s + "/" + total_achieves.to_s string2 = CSCA::ACHIEVEMENTS::SCORE + points.to_s + "/" + total_points.to_s string = CSCA::ACHIEVEMENTS::USE_SCORE ? string1 + " " + string2 : string1 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[i].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 if $imported["CSCA-CurrencySystem"] sym = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0] return $game_party.get_csca_cs_currency(sym)[:amount] end 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] when :dtake return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] when :ddeal return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] when :gspend return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] when :gearn return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] when :iuse return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] when :ibuy return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] when :isell return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] when :ebes string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_bestiary*100.00) return string when :eitm string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_items*100.00) return string when :ewep string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_weapons*100.00) return string when :earm string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_armors*100.00) return string when :eskl string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_skills*100.00) return string when :esta string = sprintf("%1.2f%%",$game_party.csca_completion_percentage_states*100.00) return string when :ecst string = sprintf("%1.2f%%",$game_party.completion_percentage_cust(CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][4][0])*100.00) return string when :etot string = sprintf("%1.2f%%",$game_party.csca_completion_percentage*100.00) return string 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 = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5] currency = $game_party.get_csca_cs_currency(reward.id) if $imported["CSCA-CurrencySystem"] case reward.type when :gold; reward_s = $imported["CSCA-CurrencySystem"] ? currency[:currency_unit] : Vocab::currency_unit when :item; reward_s = " " + $data_items[reward.id].name when :weapon; reward_s = " " + $data_weapons[reward.id].name when :armor; reward_s = " " + $data_armors[reward.id].name end draw_text(x,y,w,h,CSCA::ACHIEVEMENTS::REWARD) off_x = text_size(CSCA::ACHIEVEMENTS::REWARD).width if $imported["CSCA-CurrencySystem"] draw_icon(currency[:icon], x + off_x, y) off_x += 24 change_color(currency[:color]) end draw_text(x+off_x,y,w,h,reward.amount.to_s+reward_s) change_color(normal_color) 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 = CSCA::ACHIEVEMENTS::ACHIEVEMENTS[achievement][5] currency = $game_party.get_csca_cs_currency(reward.id) if $imported["CSCA-CurrencySystem"] case reward.type when :gold; reward_s = $imported["CSCA-CurrencySystem"] ? currency[:currency_unit] : reward_s = Vocab::currency_unit when :item; reward_s = " " + $data_items[reward.id].name when :weapon; reward_s = " " + $data_weapons[reward.id].name when :armor; reward_s = " " + $data_armors[reward.id].name end draw_text(0,line_height*2,contents.width,line_height,CSCA::ACHIEVEMENTS::REWARD+reward.amount.to_s+reward_s,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.type when :gold; $imported["CSCA-CurrencySystem"] ? gain_currency(get_csca_cs_currency(reward.id), reward.amount) : gain_gold(reward.amount) when :item; gain_item($data_items[reward.id], reward.amount) when :weapon; gain_item($data_weapons[reward.id], reward.amount) when :armor; gain_item($data_armors[reward.id], reward.amount) 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) csca_update_achievements csca_ach_update(main) 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[i] if csca_get_progress_completion(data[i]) $game_achievements[i] = 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($data_items[achievement[4][0]]) when :weapon return $game_party.item_number($data_weapons[achievement[4][0]]) when :armor return $game_party.item_number($data_armors[achievement[4][0]]) when :gold if $imported["CSCA-CurrencySystem"] return $game_party.get_csca_cs_currency(achievement[4][0])[:amount] end 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] when :dtake return $game_variables[CSCA_EXTRA_STATS::DAMAGE_TAKEN] when :ddeal return $game_variables[CSCA_EXTRA_STATS::DAMAGE_DEALT] when :gspend return $game_variables[CSCA_EXTRA_STATS::GOLDSPENT] when :gearn return $game_variables[CSCA_EXTRA_STATS::GOLDGAINED] when :iuse return $game_variables[CSCA_EXTRA_STATS::ITEMS_USED] when :ibuy return $game_variables[CSCA_EXTRA_STATS::ITEMSBOUGHT] when :isell return $game_variables[CSCA_EXTRA_STATS::ITEMSSOLD] when :ebes return $game_party.csca_completion_percentage_bestiary*100.00 when :eitm return $game_party.csca_completion_percentage_items*100.00 when :ewep return $game_party.csca_completion_percentage_weapons*100.00 when :earm return $game_party.csca_completion_percentage_armors*100.00 when :eskl return $game_party.csca_completion_percentage_skills*100.00 when :esta return $game_party.csca_completion_percentage_states*100.00 when :ecst return $game_party.completion_percentage_cust(achievement[4][0])*100.00 when :etot return $game_party.csca_completion_percentage*100.00 end return 0 end #--------------------------------------------------------------------------# # new method; determine rate denominator # #--------------------------------------------------------------------------# def csca_ach_denominator(achievement) return achievement[4][1] end end on REWARDS[0] = CSCA_Item.new(1,1,:item) [Trying to add potion, I just got an error and it won't let me add and shown me an error stating can't convert symbol into integer if $imported["CSCA-CurrencySystem] draw_icon(currency[:icon], x + off_x, y) off_x += 24 change_color(currency[:color]) end draw_text(x+off_x,y,w,h,reward.amount.to_s+reward_s) change_color(normal_color) end end and it pointed draw_icon. Anyway to fix this Edit; I use CSCA Currency System. I think that's the problem only CURRENCIES are allowed and the script won't let me use item Edited May 6, 2013 by Amber Share this post Link to post Share on other sites
casper667 131 Posted May 6, 2013 I updated the script, re download it and let me know if that works for you now. Share this post Link to post Share on other sites
Amber 1 Posted May 6, 2013 I don't see you updated the script, I still got that error message Share this post Link to post Share on other sites
Amber 1 Posted May 12, 2013 Also I pointed isn't save-game friendly and you might wanna check that again Share this post Link to post Share on other sites
Virus 24 Posted May 13, 2013 For some reason the whole script comes out green Share this post Link to post Share on other sites
Amber 1 Posted May 13, 2013 I think you need to fix the script. Whenever a player trying to save a game and later they want to continue from where they left out, they got an error instead Share this post Link to post Share on other sites
casper667 131 Posted May 13, 2013 For some reason the whole script comes out green It seems when I updated it I left in the =begin and =end wrapper I use so the whole script was commented out XD My bad, it's fixed now. I didn't change the version number though since that was such a small change. I think you need to fix the script. Whenever a player trying to save a game and later they want to continue from where they left out, they got an error instead I can't seem to reproduce your first error (the one with the item for a reward) anymore, are you still having that? As for the saved game error, you're using another script that includes data in the save file but doesn't alias DataManager#make_save_contents properly. 1 Share this post Link to post Share on other sites
Amber 1 Posted May 13, 2013 I'm not talking about item reward. I'm talking about when player saves the game, then trying to load. They got ERRORED instead and yes, I do use other script Share this post Link to post Share on other sites
casper667 131 Posted May 13, 2013 I know the player gets an error when the game loads. I'm trying to tell you that it is because the other script you use that adds data to the save file is not aliasing the method used to add data to the save file properly (or at all). I can't fix other people's scripts. Share this post Link to post Share on other sites
Amber 1 Posted May 13, 2013 Oh well, thanks for trying anyway. Share this post Link to post Share on other sites
CT Bolt 23 Posted May 13, 2013 (edited) Oh well, thanks for trying anyway. I recommend asking here & upload a demo of your problem with all the scripts your currently using. Also be as descriptive as possible. Edited May 13, 2013 by CT Bolt Share this post Link to post Share on other sites