Basically, before I open the Achievement screen from the menu (using the common event option from Yanfly's Main Menu Melody), I use the script call $lights.on, which reverts the screen back to normal, so I can see the Achievement Menu without the dark circle in the middle. I then call the Achievement screen, but when I place the script call
It is immediately called, placing a transparent circle in the middle while the rest of it is black. I am assuming that this is because it is a mainly picture-showing script, and not actually a menu. Now, I think there are two ways of going about this: 1) Make it so when the viewer is on "NONE" and presses "B", or presses "C" on "EXIT", if a particular switch is on, then it will initiate the script call. If not, then it would continue on to the map without calling any script. 2) I notice that the information menu of an achievemnet actually covers the lighting picture, and would I be right in assuming that this is because the "priority" of that menu is higher than the lighting picture? Because if so, is there any way to bring up the priority of the initial menu so it covers the lighting screen?
Achievements. Why not? Your players might extend their gameplay time just to get these interesting challenges. Well, today I bring you an Achievements script! A bit inspired in XBox live. Script & instructions in the demo.
Group: Member
Posts: 17
Type: Developer
RM Skill: Masterful
i will find a way to add achievement to the menu just give me a few hours or later...
Don't necropost. ~Kread
__________________________
jomarcenter games. we beveled that games never put a price on... link to the jomarcenter games forums : jomarcenter forums site User suspended until their 13th birthday -Staff
Group: Member
Posts: 3
Type: Artist
RM Skill: Skilled
EDIT: Sorry, I did it, I just forgot the comma! =D ______________________________________________________________ I've got a little problem! Didn't I understand something? if I add an achievement, the bar doesn't appear.
This is the part in my script-base:
CODE
Achievements = [] Descriptions = []
Achievements[0] = ["Ein verfressenes Vieh!","Trophy0_JuMade",481] Descriptions[0] = ["Besiege die Waldmampfe!"]
Achievements[1] = ["Der große Zinh","Trophy1_JuMade",482] Descriptions[1] = ["Finde den versteckten Ort auf Hunyr!"]
Achievements[2] = ["Der erste große Kampf","Trophy2_JuMade",483] Descriptions[2] = ["Besiege den Fliegenfänger."]
Achievements[3] = ["Ein Kristall für alle Fälle","TrophyThree_JuMade",484] Descriptions[3] = ["Schaue dir das Erfolgs-Tutorial an."] end
The first three are accepted and the Bar appears - like in your Demoversion. But if I add an achievement, the Bar does NOT appear. In the achievementmenu, there is the completed achievement. Yeah, I got it! But where was the achievementbar? WHERE?!
I don't understand, if i made something wrong. Please help me!
This post has been edited by Pizzajazz: Jul 28 2011, 09:57 AM
Group: Member
Posts: 2
Type: Artist
RM Skill: Beginner
I Using RMVX platformer , LV Up Recovery and Save plus script Here is the error: When i Control Switched the SwitchID of the achievement,that error appear
Group: +Gold Member
Posts: 1,520
Type: Scripter
RM Skill: Undisclosed
Yes, yes it is
code
CODE
# ============================================================================= # Game Achievements # Version: 1.1 # Author: Omegas7 & tweaked by: Night_Runner # Site: http://omegas7.blogspot.com || http://omegadev.biz # & http://www.rpgrevolution.com/forums/index.php?showtopic=45809 # ----------------------------------------------------------------------------- # Features: # > 1.1 # > Achievements linked to game switches # > Achievement Bar appears when achievement switch activated # > Menu showing achievements separated by All, Unlocked and Locked. # > Achievements descriptions # > Achievements descriptions can have a background image # > Each achievement is represented by a 90x90 image # > Menu background image # > Locked achievement image (90x90) # > Achievements menu cursor is an image (90x90) # > Achievement bar image # > Achievement complete & incomplete graphic for description screen # ----------------------------------------------------------------------------- # Instructions # First, this will be the basic template for your achievement: # # Achievements[ID] = ["Name","GaphicName",SwitchID] # Descriptions[ID] = ["Line1","Line2","Line3"] # # ID = ID of achievement for the script to use. Each achievement has one # unique ID number. Starting from 0. # "Name" => Name displayed for the achievement. Inside quotes " " # "GraphicnName" => 90x90 graphic name located in [Pictures] folder # inside quotes " " # SwitchID => ID of game switch you want to link this achievement to. # You can add as many Description lines as you want. # Each line is inside quotes " ", and each line is separated by a comma. # =============================================================================
module AchievementsDATA FileName = "Data/Achievements.rvdata" # Save game achievements ShowInTitle = true # Show Achievements in title (true/false) MenuBackground = "AchievementBG" # [Pictures] folder LockedTrohyGraphic = "LockedTrophy" # [Pictures] folder 90x90 TrophyCursorGraphic = "TrophyCursor" # [Pictures] folder 90x90 DescriptionScreenGraphic = "DescriptionScreen" # [Pictures] folder AchievementBarGraphic = "AchievementBar" # [Pictures] folder
AchievementIsCompleteGraphic = "AchievementCompleted" # [Pictures] folder AchievementIsIncompleteGraphic = "AchievementIncomplete" # [Pictures] folder # That last two graphics will appear at the bottom right of the screen # when used *
Achievements = [] Descriptions = []
Achievements[0] = ["Greedy Ralph","Trophy",1] Descriptions[0] = ["Open 5 chests!","Commonly known as a noob-level achievement."]
Achievements[1] = ["Defeat Gary","Trophy",2] Descriptions[1] = ["Beat evil Gary at the garden!"]
Achievements[2] = ["LOVE OMEGAS7","Trophy",3] Descriptions[2] = ["Show your love for Omegas7 to a stranger."] end
if $TEST and not FileTest.exist?(AchievementsDATA::FileName) save_data([],AchievementsDATA::FileName) end
class Achievements < Scene_Base include AchievementsDATA def initialize(achievement_ids = nil) if achievement_ids == nil @achievement_ids = [] for achievement in $game_party.achievements if achievement[1] == true for achdata in AchievementsDATA::Achievements if achdata[2] == achievement[0] @achievement_ids << AchievementsDATA::Achievements.index(achdata) end end end end else @achievement_ids = achievement_ids end @return_class = $scene.class create_background create_menu create_trohpies @view = 'NONE' @chosen = false @locked = 0 @unlocked = 0 for i in 0...Achievements.size if @achievement_ids.include?(i) @unlocked += 1 else @locked += 1 end end end def update updateInput updateMenus if !@chosen @chosen = false end def updateMenus case @view when 'NONE' @menu.update when 'TROPHIES' @trophyMenu.update end end def updateInput if Input.trigger?(Input::C) && @view == 'NONE' case @menu.index when 0 # All @view = 'TROPHIES' @trophyMenu.setView('all') @trophyMenu.setOpacity(255) Sound.play_decision @chosen = true return when 1 # Unlocked if @unlocked <= 0 Sound.play_buzzer return end @view = 'TROPHIES' @trophyMenu.setView('unlocked') @trophyMenu.setOpacity(255) Sound.play_decision @chosen = true return when 2 # Locked if @locked <= 0 Sound.play_buzzer return end @view = 'TROPHIES' @trophyMenu.setView('locked') @trophyMenu.setOpacity(255) Sound.play_decision @chosen = true return when 3 # Exit @trophyMenu.finish @bg.dispose @menu.dispose $scene = @return_class.new @chosen = true return end end if Input.trigger?(Input::B) && @view == 'NONE' @trophyMenu.finish @bg.dispose @menu.dispose $scene = @return_class.new @chosen = true return end if Input.trigger?(Input::B) && @view == 'TROPHIES' && !@trophyMenu.description? @view = 'NONE' @trophyMenu.setOpacity(0) Sound.play_cancel end end def create_background @bg = Sprite_Base.new @bg.bitmap = Cache.picture(MenuBackground) @bg.z = 0 end def create_menu commands = ['All','Unlocked','Locked','Back'] @menu = Window_Command.new(130,commands) @menu.contents.font.size = 20 @menu.refresh @menu.opacity = 0 @menu.z = 9 end def create_trohpies @trophyMenu = AchievementTrophyMenuManager.new(@achievement_ids) @trophyMenu.setOpacity(0) end end
class AchievementTrophyMenuManager include AchievementsDATA def initialize(achievement_ids) @achievement_ids = achievement_ids @trophies = [] draw_trophies('all') @moved_y = 0 if !@trophies.empty? @cursor = Sprite_Base.new @cursor.bitmap = Cache.picture(TrophyCursorGraphic) @cursor.z = 2 @cursor.x,@cursor.y = @trophies[0].sprite.x,@trophies[0].sprite.y end @cursorIndex = 0 @toBeY = 0 @viewingDescription = false @description = Sprite_Base.new @description.bitmap = Cache.picture(DescriptionScreenGraphic) @description.z = 100 @description.opacity = 0 @descriptionwindow = Window_Base.new(30,90,544 - 60,270) @descriptionwindow.opacity = 0 @name = Window_Base.new(12,-12,300,90) @name.contents.font.size = 18 @name.opacity = 0 @block = false end def draw_trophies(view) @trophies = [] @chart = [] trueIndex = 0 for i in 0...Achievements.size if @achievement_ids.include?(i) if view == 'all' || view == 'unlocked' @trophies.push(AchievementTrophy.new(trueIndex,true,Achievements[i][0])) @chart.push(Descriptions[i]) trueIndex += 1 end else if view == 'all' || view == 'locked' @trophies.push(AchievementTrophy.new(trueIndex,false,Achievements[i][0])) @chart.push(Descriptions[i]) trueIndex += 1 end end end end def update if !@viewingDescription if Input.trigger?(Input::DOWN) Sound.play_cursor @cursorIndex += 4 end if Input.trigger?(Input::UP) Sound.play_cursor @cursorIndex -= 4 end if Input.trigger?(Input::RIGHT) Sound.play_cursor @cursorIndex += 1 end if Input.trigger?(Input::LEFT) Sound.play_cursor @cursorIndex -= 1 end checkCursorPosition if Input.trigger?(Input::C) @descriptionwindow.contents.clear @name.contents.clear @description.opacity = 255 for i in 0...@chart[@cursorIndex].size @descriptionwindow.contents.draw_text(0,(20 * i),500,20,@chart[@cursorIndex][i].to_s) end @viewingDescription = true @block = true @name.contents.draw_text(0,0,300,20,@trophies[@cursorIndex].name) @completed = Sprite_Base.new if @trophies[@cursorIndex].obtained @completed.bitmap = Cache.picture(AchievementIsCompleteGraphic) else @completed.bitmap = Cache.picture(AchievementIsIncompleteGraphic) end @completed.x = 544 - @completed.width @completed.y = 416 - @completed.height @completed.z = 300 return end else if (Input.trigger?(Input::C) || Input.trigger?(Input::B)) && !@block Sound.play_cancel @descriptionwindow.contents.clear @name.contents.clear @description.opacity = 0 @viewingDescription = false @completed.dispose @completed = nil return end end @block = false if Input.trigger?(Input::L) print @description.opacity end end def description? return @viewingDescription end def checkCursorPosition if @cursorIndex < 0 @cursorIndex = 0 end if @cursorIndex > @trophies.size - 1 @cursorIndex = @trophies.size - 1 end @toBeY = @trophies[@cursorIndex].sprite.y a = false while @toBeY >= 10 + (90 * 4) moveY(-90) a = true end if !a while @toBeY < 10 moveY(90) end end @cursor.x = @trophies[@cursorIndex].sprite.x @cursor.y = @trophies[@cursorIndex].sprite.y end def moveY(y) for i in 0...@trophies.size @trophies[i].sprite.y += y @toBeY += y end end def setOpacity(n) for i in 0...@trophies.size @trophies[i].sprite.opacity = n end @cursor.opacity = n end def setView(view) for i in 0...@trophies.size @trophies[i].sprite.dispose @trophies[i] = nil end @cursorIndex = 0 @trophies.compact! @chart = [] draw_trophies(view) end def finish @cursor.dispose for i in 0...@trophies.size @trophies[i].sprite.dispose @trophies[i] = nil end @trophies.compact! @description.dispose @descriptionwindow.dispose @name.dispose end end
class AchievementTrophy include AchievementsDATA attr_accessor :sprite attr_reader :obtained attr_reader :name def initialize(index,obtained,name) @sprite = Sprite_Base.new if obtained @sprite.bitmap = Cache.picture(Achievements[index][1]) else @sprite.bitmap = Cache.picture(LockedTrohyGraphic) end @sprite.z = 1 @sprite.x = 180 + (90 * (index % 4)) @sprite.y = 10 + (90 * (index / 4)) @obtained = obtained @name = name end end
class Game_Party alias omega_achievements_initialize initialize attr_accessor :achievements def initialize omega_achievements_initialize @achievements = [] for i in 0...AchievementsDATA::Achievements.size @achievements.push([AchievementsDATA::Achievements[i][2], $game_switches[AchievementsDATA::Achievements[i][2]]]) end end end
class AchievementBar include AchievementsDATA attr_reader :finished def initialize(id) @sprite = Sprite_Base.new @sprite.bitmap = Cache.picture(AchievementBarGraphic) @sprite.z = 300 @sprite.x = 272 - (@sprite.width/2) @sprite.y = 416 - @sprite.height @sprite.zoom_x = 0.1 @sprite.zoom_y = 0.1 @timer = -1 @leaving = false @finished = false end def update if @sprite.zoom_x < 1.0 @sprite.zoom_x += 0.05 @sprite.zoom_y += 0.05 if @sprite.zoom_x >= 1.0 @timer = 140 end end if @timer > 0 @timer -= 1 else if !@leaving && @sprite.zoom_x >= 1.0 @leaving = true end end if @leaving @sprite.opacity -= 3 if (@sprite.opacity <= 0) && (!@finished) finish end end end def finish @sprite.dispose @finished = true end end
class Scene_Map alias omegaAchievementInitialize initialize unless $@ alias omegaAchievementUpdate update unless $@ alias omegaAachievementTerminate terminate unless $@ def initialize omegaAchievementInitialize @achievements = [] end def update omegaAchievementUpdate for i in 0...@achievements.size @achievements[i].update if @achievements[i].finished @achievements[i] = nil end end @achievements.compact! end def terminate omegaAachievementTerminate for i in 0...@achievements.size @achievements[i].finish end end def addAchievementBar(id) @achievements.push(AchievementBar.new(id)) end end
class Game_Interpreter alias omegaAchievementsSwitch command_121 def command_121 omegaAchievementsSwitch if $scene.is_a?(Scene_Map) for i in 0...$game_party.achievements.size if $game_party.achievements[i][1] != $game_switches[$game_party.achievements[i][0]] if $game_switches[$game_party.achievements[i][0].to_i] $game_party.achievements[i][1] = $game_switches[$game_party.achievements[i][0]] $scene.addAchievementBar(i) $achievements << i $achievements.uniq! save_data($achievements, AchievementsDATA::FileName) break end end end end end end
class Scene_Title alias nr_achievements_load_database load_database unless $@ alias nr_achievements_update update unless $@ def load_database(*args) $achievements = load_data(AchievementsDATA::FileName) return nr_achievements_load_database(*args) end if AchievementsDATA::ShowInTitle def create_command_window s1 = Vocab::new_game s2 = Vocab::continue s3 = Vocab::shutdown s4 = "Achievements" @command_window = Window_Command.new(172, [s1, s2, s3, s4]) @command_window.x = (544 - @command_window.width) / 2 @command_window.y = 256 if @continue_enabled @command_window.index = 1 else @command_window.draw_item(1, false) end @command_window.openness = 0 @command_window.open end def update(*args) nr_achievements_update(*args) if Input.trigger?(Input::C) and @command_window.index == 3 Graphics.freeze $scene = Achievements.new($achievements) end end end end
If you call the Achievement script as shown in the demo
CODE
$scene = Achievements.new
Then it will just show the local achievements for that save file, but to call it for all achievements by the party then I've used
CODE
$scene = Achievements.new($achievements)
You probably won't have to deal with it, but just letting you know
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.
Group: Member
Posts: 10
Type: Event Designer
RM Skill: Beginner
QUOTE (Night_Runner @ Nov 9 2011, 03:24 PM)
Yes, yes it is
code
CODE
# ============================================================================= # Game Achievements # Version: 1.1 # Author: Omegas7 & tweaked by: Night_Runner # Site: http://omegas7.blogspot.com || http://omegadev.biz # & http://www.rpgrevolution.com/forums/index.php?showtopic=45809 # ----------------------------------------------------------------------------- # Features: # > 1.1 # > Achievements linked to game switches # > Achievement Bar appears when achievement switch activated # > Menu showing achievements separated by All, Unlocked and Locked. # > Achievements descriptions # > Achievements descriptions can have a background image # > Each achievement is represented by a 90x90 image # > Menu background image # > Locked achievement image (90x90) # > Achievements menu cursor is an image (90x90) # > Achievement bar image # > Achievement complete & incomplete graphic for description screen # ----------------------------------------------------------------------------- # Instructions # First, this will be the basic template for your achievement: # # Achievements[ID] = ["Name","GaphicName",SwitchID] # Descriptions[ID] = ["Line1","Line2","Line3"] # # ID = ID of achievement for the script to use. Each achievement has one # unique ID number. Starting from 0. # "Name" => Name displayed for the achievement. Inside quotes " " # "GraphicnName" => 90x90 graphic name located in [Pictures] folder # inside quotes " " # SwitchID => ID of game switch you want to link this achievement to. # You can add as many Description lines as you want. # Each line is inside quotes " ", and each line is separated by a comma. # =============================================================================
module AchievementsDATA FileName = "Data/Achievements.rvdata" # Save game achievements ShowInTitle = true # Show Achievements in title (true/false) MenuBackground = "AchievementBG" # [Pictures] folder LockedTrohyGraphic = "LockedTrophy" # [Pictures] folder 90x90 TrophyCursorGraphic = "TrophyCursor" # [Pictures] folder 90x90 DescriptionScreenGraphic = "DescriptionScreen" # [Pictures] folder AchievementBarGraphic = "AchievementBar" # [Pictures] folder
AchievementIsCompleteGraphic = "AchievementCompleted" # [Pictures] folder AchievementIsIncompleteGraphic = "AchievementIncomplete" # [Pictures] folder # That last two graphics will appear at the bottom right of the screen # when used *
Achievements = [] Descriptions = []
Achievements[0] = ["Greedy Ralph","Trophy",1] Descriptions[0] = ["Open 5 chests!","Commonly known as a noob-level achievement."]
Achievements[1] = ["Defeat Gary","Trophy",2] Descriptions[1] = ["Beat evil Gary at the garden!"]
Achievements[2] = ["LOVE OMEGAS7","Trophy",3] Descriptions[2] = ["Show your love for Omegas7 to a stranger."] end
if $TEST and not FileTest.exist?(AchievementsDATA::FileName) save_data([],AchievementsDATA::FileName) end
class Achievements < Scene_Base include AchievementsDATA def initialize(achievement_ids = nil) if achievement_ids == nil @achievement_ids = [] for achievement in $game_party.achievements if achievement[1] == true for achdata in AchievementsDATA::Achievements if achdata[2] == achievement[0] @achievement_ids << AchievementsDATA::Achievements.index(achdata) end end end end else @achievement_ids = achievement_ids end @return_class = $scene.class create_background create_menu create_trohpies @view = 'NONE' @chosen = false @locked = 0 @unlocked = 0 for i in 0...Achievements.size if @achievement_ids.include?(i) @unlocked += 1 else @locked += 1 end end end def update updateInput updateMenus if !@chosen @chosen = false end def updateMenus case @view when 'NONE' @menu.update when 'TROPHIES' @trophyMenu.update end end def updateInput if Input.trigger?(Input::C) && @view == 'NONE' case @menu.index when 0 # All @view = 'TROPHIES' @trophyMenu.setView('all') @trophyMenu.setOpacity(255) Sound.play_decision @chosen = true return when 1 # Unlocked if @unlocked <= 0 Sound.play_buzzer return end @view = 'TROPHIES' @trophyMenu.setView('unlocked') @trophyMenu.setOpacity(255) Sound.play_decision @chosen = true return when 2 # Locked if @locked <= 0 Sound.play_buzzer return end @view = 'TROPHIES' @trophyMenu.setView('locked') @trophyMenu.setOpacity(255) Sound.play_decision @chosen = true return when 3 # Exit @trophyMenu.finish @bg.dispose @menu.dispose $scene = @return_class.new @chosen = true return end end if Input.trigger?(Input::B) && @view == 'NONE' @trophyMenu.finish @bg.dispose @menu.dispose $scene = @return_class.new @chosen = true return end if Input.trigger?(Input::B) && @view == 'TROPHIES' && !@trophyMenu.description? @view = 'NONE' @trophyMenu.setOpacity(0) Sound.play_cancel end end def create_background @bg = Sprite_Base.new @bg.bitmap = Cache.picture(MenuBackground) @bg.z = 0 end def create_menu commands = ['All','Unlocked','Locked','Back'] @menu = Window_Command.new(130,commands) @menu.contents.font.size = 20 @menu.refresh @menu.opacity = 0 @menu.z = 9 end def create_trohpies @trophyMenu = AchievementTrophyMenuManager.new(@achievement_ids) @trophyMenu.setOpacity(0) end end
class AchievementTrophyMenuManager include AchievementsDATA def initialize(achievement_ids) @achievement_ids = achievement_ids @trophies = [] draw_trophies('all') @moved_y = 0 if !@trophies.empty? @cursor = Sprite_Base.new @cursor.bitmap = Cache.picture(TrophyCursorGraphic) @cursor.z = 2 @cursor.x,@cursor.y = @trophies[0].sprite.x,@trophies[0].sprite.y end @cursorIndex = 0 @toBeY = 0 @viewingDescription = false @description = Sprite_Base.new @description.bitmap = Cache.picture(DescriptionScreenGraphic) @description.z = 100 @description.opacity = 0 @descriptionWindow = Window_Base.new(30,90,544 - 60,270) @descriptionwindow.opacity = 0 @name = Window_Base.new(12,-12,300,90) @name.contents.font.size = 18 @name.opacity = 0 @block = false end def draw_trophies(view) @trophies = [] @chart = [] trueIndex = 0 for i in 0...Achievements.size if @achievement_ids.include?(i) if view == 'all' || view == 'unlocked' @trophies.push(AchievementTrophy.new(trueIndex,true,Achievements[i][0])) @chart.push(Descriptions[i]) trueIndex += 1 end else if view == 'all' || view == 'locked' @trophies.push(AchievementTrophy.new(trueIndex,false,Achievements[i][0])) @chart.push(Descriptions[i]) trueIndex += 1 end end end end def update if !@viewingDescription if Input.trigger?(Input::DOWN) Sound.play_cursor @cursorIndex += 4 end if Input.trigger?(Input::UP) Sound.play_cursor @cursorIndex -= 4 end if Input.trigger?(Input::RIGHT) Sound.play_cursor @cursorIndex += 1 end if Input.trigger?(Input::LEFT) Sound.play_cursor @cursorIndex -= 1 end checkCursorPosition if Input.trigger?(Input::C) @descriptionwindow.contents.clear @name.contents.clear @description.opacity = 255 for i in 0...@chart[@cursorIndex].size @descriptionwindow.contents.draw_text(0,(20 * i),500,20,@chart[@cursorIndex][i].to_s) end @viewingDescription = true @block = true @name.contents.draw_text(0,0,300,20,@trophies[@cursorIndex].name) @completed = Sprite_Base.new if @trophies[@cursorIndex].obtained @completed.bitmap = Cache.picture(AchievementIsCompleteGraphic) else @completed.bitmap = Cache.picture(AchievementIsIncompleteGraphic) end @completed.x = 544 - @completed.width @completed.y = 416 - @completed.height @completed.z = 300 return end else if (Input.trigger?(Input::C) || Input.trigger?(Input::B)) && !@block Sound.play_cancel @descriptionwindow.contents.clear @name.contents.clear @description.opacity = 0 @viewingDescription = false @completed.dispose @completed = nil return end end @block = false if Input.trigger?(Input::L) print @description.opacity end end def description? return @viewingDescription end def checkCursorPosition if @cursorIndex < 0 @cursorIndex = 0 end if @cursorIndex > @trophies.size - 1 @cursorIndex = @trophies.size - 1 end @toBeY = @trophies[@cursorIndex].sprite.y a = false while @toBeY >= 10 + (90 * 4) moveY(-90) a = true end if !a while @toBeY < 10 moveY(90) end end @cursor.x = @trophies[@cursorIndex].sprite.x @cursor.y = @trophies[@cursorIndex].sprite.y end def moveY(y) for i in 0...@trophies.size @trophies[i].sprite.y += y @toBeY += y end end def setOpacity(n) for i in 0...@trophies.size @trophies[i].sprite.opacity = n end @cursor.opacity = n end def setView(view) for i in 0...@trophies.size @trophies[i].sprite.dispose @trophies[i] = nil end @cursorIndex = 0 @trophies.compact! @chart = [] draw_trophies(view) end def finish @cursor.dispose for i in 0...@trophies.size @trophies[i].sprite.dispose @trophies[i] = nil end @trophies.compact! @description.dispose @descriptionwindow.dispose @name.dispose end end
class AchievementTrophy include AchievementsDATA attr_accessor :sprite attr_reader :obtained attr_reader :name def initialize(index,obtained,name) @sprite = Sprite_Base.new if obtained @sprite.bitmap = Cache.picture(Achievements[index][1]) else @sprite.bitmap = Cache.picture(LockedTrohyGraphic) end @sprite.z = 1 @sprite.x = 180 + (90 * (index % 4)) @sprite.y = 10 + (90 * (index / 4)) @obtained = obtained @name = name end end
class Game_Party alias omega_achievements_initialize initialize attr_accessor :achievements def initialize omega_achievements_initialize @achievements = [] for i in 0...AchievementsDATA::Achievements.size @achievements.push([AchievementsDATA::Achievements[i][2], $game_switches[AchievementsDATA::Achievements[i][2]]]) end end end
class AchievementBar include AchievementsDATA attr_reader :finished def initialize(id) @sprite = Sprite_Base.new @sprite.bitmap = Cache.picture(AchievementBarGraphic) @sprite.z = 300 @sprite.x = 272 - (@sprite.width/2) @sprite.y = 416 - @sprite.height @sprite.zoom_x = 0.1 @sprite.zoom_y = 0.1 @timer = -1 @leaving = false @finished = false end def update if @sprite.zoom_x < 1.0 @sprite.zoom_x += 0.05 @sprite.zoom_y += 0.05 if @sprite.zoom_x >= 1.0 @timer = 140 end end if @timer > 0 @timer -= 1 else if !@leaving && @sprite.zoom_x >= 1.0 @leaving = true end end if @leaving @sprite.opacity -= 3 if (@sprite.opacity <= 0) && (!@finished) finish end end end def finish @sprite.dispose @finished = true end end
class Scene_Map alias omegaAchievementInitialize initialize unless $@ alias omegaAchievementUpdate update unless $@ alias omegaAachievementTerminate terminate unless $@ def initialize omegaAchievementInitialize @achievements = [] end def update omegaAchievementUpdate for i in 0...@achievements.size @achievements[i].update if @achievements[i].finished @achievements[i] = nil end end @achievements.compact! end def terminate omegaAachievementTerminate for i in 0...@achievements.size @achievements[i].finish end end def addAchievementBar(id) @achievements.push(AchievementBar.new(id)) end end
class Game_Interpreter alias omegaAchievementsSwitch command_121 def command_121 omegaAchievementsSwitch if $scene.is_a?(Scene_Map) for i in 0...$game_party.achievements.size if $game_party.achievements[i][1] != $game_switches[$game_party.achievements[i][0]] if $game_switches[$game_party.achievements[i][0].to_i] $game_party.achievements[i][1] = $game_switches[$game_party.achievements[i][0]] $scene.addAchievementBar(i) $achievements << i $achievements.uniq! save_data($achievements, AchievementsDATA::FileName) break end end end end end end
class Scene_Title alias nr_achievements_load_database load_database unless $@ alias nr_achievements_update update unless $@ def load_database(*args) $achievements = load_data(AchievementsDATA::FileName) return nr_achievements_load_database(*args) end if AchievementsDATA::ShowInTitle def create_command_window s1 = Vocab::new_game s2 = Vocab::continue s3 = Vocab::shutdown s4 = "Achievements" @command_window = Window_Command.new(172, [s1, s2, s3, s4]) @command_window.x = (544 - @command_window.width) / 2 @command_window.y = 256 if @continue_enabled @command_window.index = 1 else @command_window.draw_item(1, false) end @command_window.openness = 0 @command_window.open end def update(*args) nr_achievements_update(*args) if Input.trigger?(Input::C) and @command_window.index == 3 Graphics.freeze $scene = Achievements.new($achievements) end end end end
If you call the Achievement script as shown in the demo
CODE
$scene = Achievements.new
Then it will just show the local achievements for that save file, but to call it for all achievements by the party then I've used
CODE
$scene = Achievements.new($achievements)
You probably won't have to deal with it, but just letting you know
wow,, it works.. but u put it wrong in this code @descriptionwindow.dispose and the others..,, it need to change the W to capital,, so thanks for ur tweak,,hhooo
Group: Member
Posts: 16
Type: None
RM Skill: Undisclosed
This is a beautiful script! I love it a lot, it's simple to use and attractive to the eye! The fact that there is no menu option is actually perfect for me, since in my game the NPC's control everything XD