Skip to content

Instantly share code, notes, and snippets.

@zh99998
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zh99998/9779955 to your computer and use it in GitHub Desktop.
Save zh99998/9779955 to your computer and use it in GitHub Desktop.
maotama for rpg maker
module Maotama
Achievements = [
21..28
]
def self.unlock_achievement(type, id)
STDOUT.write("<maotama><achievement type='#{type}' id='#{id}'/></maotama>")
STDOUT.flush
end
end
class Game_Switches
alias maotama_old_set []=
def []=(switch_id, value)
if value and !self[switch_id]
Maotama::Achievements.each_with_index do |achievement_range, type|
if achievement_range.include? switch_id
Maotama.unlock_achievement(type, switch_id - achievement_range.first)
end
end
end
maotama_old_set(switch_id, value)
end
end
#测试
#unlock_achievement(0, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment