Já viram qual a arte dessa semana?Exposição dos Artistas #8
8 Respostas   3462 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
=begin╔══════════════════════════════════════════════════════════════════════════════╗║ ____ _____________ ║║ \ \/ /\______ \ ║║ \ / | ___/ ║║ / \ | | ║║ /___/\ \ |____| ║║ \_/ ║╟──────────────────────────────────────────────────────────────────────────────╢║ Sistema de Achievements Simples ║╚══════════════════════════════════════════════════════════════════════════════╝ ┌────────────┐ │ Instruções │┌─┴────────────┴───────────────────────────────────────────────────────────────┐│ Como criar achievements: ││ - Crie um novo item simples, e mude seu nome, seu ícone e seu preço. ││ O preço será a quantidade de pontos recebidos do achievement. ││ ││ Como dar achievements: ││ - Utilize Chamar Script com o comando "$ac.give(ID)" e no lugar de ID, ││ coloque o id do item equivalente ao seu achievement. ││ ││ Como remover achievements: ││ - Utilize Chamar Script com o comando "$ac.take(ID)" e no lugar de ID, ││ coloque o id do item relativo ao achievement que quiser remover. ││ ││ Como ver os achievements atuais: ││ - Utilize Chamar Script com o comando "$ac.show" e janela de achievements ││ aparecerá. ││ ││ Como usar o número de pontos em no jogo: ││ - Crie uma variável e no campo "Script" ponha "$ac.points". Lembre-se de ││ atualizar esta variável caso o número de pontos tenha mudado. │└──────────────────────────────────────────────────────────────────────────────┘=endmodule XP Icon_size = 24 # Tamanho dos ícones Text_give = " recebido!" # Texto ao receber achievement Text_take = " perdido!" # Texto ao perder achievement Text_points = "Pontos: " # Texto da janela de pontos Key = :C # Tecla para sair da janela de achievement Normal_color = 0 # Cor normal Name_color = 3 # Cor do nome do achievement Points_up = 3 # Cor dos pontos positivos Points_down = 2 # Cor dos pontos negativos SE_give = RPG::SE.new("Chime1", 70, 80) # SE ao receber achievement SE_take = RPG::SE.new("Down1", 70, 80) # SE ao perder achievement endclass Achievements attr_accessor :achievements attr_accessor :points def initialize @achievements = [] @points = 0 end def give(id) if @achievements.include?(id) == false XP::SE_give.play @achievements[@achievements.length] = id @achievements.sort @points += $data_items[id].price @a = Window_Achieved.new($data_items[id].icon_index, "\ec[#{XP::Name_color}]#{$data_items[id].name}\ec[#{XP::Normal_color}]#{XP::Text_give} \ec[#{XP::Points_up}]+#{$data_items[id].price}") @a.openness = 0 @a.open update until @a.open? loop do update if Input.trigger?(XP::Key) break end end @a.close update until @a.close? end end def take(id) if @achievements.include?(id) == true XP::SE_take.play @achievements.delete(id) @achievements.sort @points -= $data_items[id].price @a = Window_Achieved.new($data_items[id].icon_index, "\ec[#{XP::Name_color}]#{$data_items[id].name}\ec[#{XP::Normal_color}]#{XP::Text_take} \ec[#{XP::Points_down}]-#{$data_items[id].price}") @a.openness = 0 @a.open update until @a.open? loop do update if Input.trigger?(XP::Key) break end end @a.close update until @a.close? end end def show SceneManager.call(Scene_Achievements) end def update Graphics.update Input.update instance_variables.each do |varname| ivar = instance_variable_get(varname) ivar.update if ivar.is_a?(Window) end endendclass Window_Achieved < Window_Base def initialize(icon_index, text) super(0, 0, (standard_padding * 2) + Bitmap.new(1,1).text_size(text.gsub(/\ec\[[0-9]*\]/) {|s| ""}).width + 4 + XP::Icon_size,fitting_height(1)) @icon_index = icon_index @text = text refresh end def set_text(text) if text != @text @text = text refresh end end def clear set_text("") end def refresh self.x = (Graphics.width / 2) - (self.width / 2) self.y = (Graphics.height / 2) - (self.height / 2) contents.clear draw_text_ex(4 + XP::Icon_size, 0, @text) draw_icon(@icon_index, 0, (fitting_height(1) - XP::Icon_size) / fitting_height(1)) end endclass Window_Achievements < Window_ItemList def initialize(x, y, width, height) super @category = :none @data = [] end def col_max return 1 end def make_item_list for i in $ac.achievements do @data[@data.length] = $data_items[i] end end def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, true) end end def select_last select(0) end endclass Window_Desc < Window_Base def initialize(text, line_number = 1) super(0, 0, (standard_padding * 2) + Bitmap.new(1,1).text_size(text.gsub(/\ec\[[0-9]*\]/) {|s| ""}).width + 4, fitting_height(line_number)) @text = text refresh end def clear set_text("") end def refresh contents.clear draw_text_ex(4, 0, @text) endendclass Scene_Achievements < Scene_ItemBase def start super create_help_window create_item_window end def create_item_window w = Graphics.width / 2 h = Graphics.height / 2 @help_window.x = Graphics.width / 2 - @help_window.width / 2 @help_window.y = Graphics.height / 2 - h / 2 - @help_window.height / 2 @item_window = Window_Achievements.new(Graphics.width / 2 - w / 2, Graphics.height / 2 - h / 2 + @help_window.height / 2, w, h) @item_window.viewport = @viewport @item_window.category = :item @item_window.activate @item_window.select_last @item_window.set_handler(:cancel, method(:cancel)) end def create_help_window @help_window = Window_Desc.new("#{XP::Text_points}#{$ac.points}") end def cancel SceneManager.call(Scene_Map) endendclass Scene_Title < Scene_Base alias n_command_new_game command_new_game def command_new_game $ac = Achievements.new n_command_new_game endend
Parece bem bacaninha o script. Eu que não curto muito usar scriptnesses sistemas, mas dando pra colocar ícones assim, sonzinhos,e bem feitinho até anima.Bom achado, man!
Oi! Agradeço pelo Script e aliás sou novo aqui ^^ O problema é que deu um erro aqui :/"Script 'Game_Interpreter' line 1414: NoMethodError ocurred. undefined method 'give' for nil:NilClassAlguém pode me ajudar? Desde já, agradeço ^^'
Sistema de Achievements SimplesPor XP Esse script adiciona um sistema simples pelo qual o jogador pode desbloquear achievements criados por você. Os achievements são, na verdade, itens, mas se usa apenas o seu nome, seu ícone e seu preço, que equivale aos pontos. Pode-se tanto adicionar quanto remover achievements. O script é bem simples, e é instalado normalmente.Screenshots[info float=left][/info][info float=left][/info][info float=left][/info]InstruçõesComo criar achievements: Crie um novo item simples, e mude seu nome, seu ícone e seu preço. O preço será a quantidade de pontos recebidos do achievement. Como dar achievements: Utilize Chamar Script com o comando $ac.give(ID) e no lugar de ID, coloque o id do item equivalente ao seu achievement. Como remover achievements: Utilize Chamar Script com o comando $ac.take(ID) e no lugar de ID, coloque o id do item relativo ao achievement que quiser remover. Como ver os achievements atuais: Utilize Chamar Script com o comando $ac.show e janela de achievements aparecerá. Como usar o número de pontos em no jogo: Crie uma variável e no campo "Script" ponha $ac.points. Lembre-se de atualizar esta variável caso o número de pontos tenha mudado. ScriptCódigo: [Selecionar]=begin╔══════════════════════════════════════════════════════════════════════════════╗║ ____ _____________ ║║ \ \/ /\______ \ ║║ \ / | ___/ ║║ / \ | | ║║ /___/\ \ |____| ║║ \_/ ║╟──────────────────────────────────────────────────────────────────────────────╢║ Sistema de Achievements Simples ║╚══════════════════════════════════════════════════════════════════════════════╝ ┌────────────┐ │ Instruções │┌─┴────────────┴───────────────────────────────────────────────────────────────┐│ Como criar achievements: ││ - Crie um novo item simples, e mude seu nome, seu ícone e seu preço. ││ O preço será a quantidade de pontos recebidos do achievement. ││ ││ Como dar achievements: ││ - Utilize Chamar Script com o comando "$ac.give(ID)" e no lugar de ID, ││ coloque o id do item equivalente ao seu achievement. ││ ││ Como remover achievements: ││ - Utilize Chamar Script com o comando "$ac.take(ID)" e no lugar de ID, ││ coloque o id do item relativo ao achievement que quiser remover. ││ ││ Como ver os achievements atuais: ││ - Utilize Chamar Script com o comando "$ac.show" e janela de achievements ││ aparecerá. ││ ││ Como usar o número de pontos em no jogo: ││ - Crie uma variável e no campo "Script" ponha "$ac.points". Lembre-se de ││ atualizar esta variável caso o número de pontos tenha mudado. │└──────────────────────────────────────────────────────────────────────────────┘=endmodule XP Icon_size = 24 # Tamanho dos ícones Text_give = " recebido!" # Texto ao receber achievement Text_take = " perdido!" # Texto ao perder achievement Text_points = "Pontos: " # Texto da janela de pontos Key = :C # Tecla para sair da janela de achievement Normal_color = 0 # Cor normal Name_color = 3 # Cor do nome do achievement Points_up = 3 # Cor dos pontos positivos Points_down = 2 # Cor dos pontos negativos SE_give = RPG::SE.new("Chime1", 70, 80) # SE ao receber achievement SE_take = RPG::SE.new("Down1", 70, 80) # SE ao perder achievement endclass Achievements attr_accessor :achievements attr_accessor :points def initialize @achievements = [] @points = 0 end def give(id) if @achievements.include?(id) == false XP::SE_give.play @achievements[@achievements.length] = id @achievements.sort @points += $data_items[id].price @a = Window_Achieved.new($data_items[id].icon_index, "\ec[#{XP::Name_color}]#{$data_items[id].name}\ec[#{XP::Normal_color}]#{XP::Text_give} \ec[#{XP::Points_up}]+#{$data_items[id].price}") @a.openness = 0 @a.open update until @a.open? loop do update if Input.trigger?(XP::Key) break end end @a.close update until @a.close? end end def take(id) if @achievements.include?(id) == true XP::SE_take.play @achievements.delete(id) @achievements.sort @points -= $data_items[id].price @a = Window_Achieved.new($data_items[id].icon_index, "\ec[#{XP::Name_color}]#{$data_items[id].name}\ec[#{XP::Normal_color}]#{XP::Text_take} \ec[#{XP::Points_down}]-#{$data_items[id].price}") @a.openness = 0 @a.open update until @a.open? loop do update if Input.trigger?(XP::Key) break end end @a.close update until @a.close? end end def show SceneManager.call(Scene_Achievements) end def update Graphics.update Input.update instance_variables.each do |varname| ivar = instance_variable_get(varname) ivar.update if ivar.is_a?(Window) end endendclass Window_Achieved < Window_Base def initialize(icon_index, text) super(0, 0, (standard_padding * 2) + Bitmap.new(1,1).text_size(text.gsub(/\ec\[[0-9]*\]/) {|s| ""}).width + 4 + XP::Icon_size,fitting_height(1)) @icon_index = icon_index @text = text refresh end def set_text(text) if text != @text @text = text refresh end end def clear set_text("") end def refresh self.x = (Graphics.width / 2) - (self.width / 2) self.y = (Graphics.height / 2) - (self.height / 2) contents.clear draw_text_ex(4 + XP::Icon_size, 0, @text) draw_icon(@icon_index, 0, (fitting_height(1) - XP::Icon_size) / fitting_height(1)) end endclass Window_Achievements < Window_ItemList def initialize(x, y, width, height) super @category = :none @data = [] end def col_max return 1 end def make_item_list for i in $ac.achievements do @data[@data.length] = $data_items[i] end end def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, true) end end def select_last select(0) end endclass Window_Desc < Window_Base def initialize(text, line_number = 1) super(0, 0, (standard_padding * 2) + Bitmap.new(1,1).text_size(text.gsub(/\ec\[[0-9]*\]/) {|s| ""}).width + 4, fitting_height(line_number)) @text = text refresh end def clear set_text("") end def refresh contents.clear draw_text_ex(4, 0, @text) endendclass Scene_Achievements < Scene_ItemBase def start super create_help_window create_item_window end def create_item_window w = Graphics.width / 2 h = Graphics.height / 2 @help_window.x = Graphics.width / 2 - @help_window.width / 2 @help_window.y = Graphics.height / 2 - h / 2 - @help_window.height / 2 @item_window = Window_Achievements.new(Graphics.width / 2 - w / 2, Graphics.height / 2 - h / 2 + @help_window.height / 2, w, h) @item_window.viewport = @viewport @item_window.category = :item @item_window.activate @item_window.select_last @item_window.set_handler(:cancel, method(:cancel)) end def create_help_window @help_window = Window_Desc.new("#{XP::Text_points}#{$ac.points}") end def cancel SceneManager.call(Scene_Map) endendclass Scene_Title < Scene_Base alias n_command_new_game command_new_game def command_new_game $ac = Achievements.new n_command_new_game endendDemoDownload da Demo
Tu tá usando algum script que pule a tela de títulos? Pelo que vi no código, a variável "$ac" é criada ao apertar o comandoNovo Jogo, portanto, se estiver skippando atela de títulos, ela não é criada, daí dá o erro.