Advertisement
DaxSoft

count event map

Sep 19th, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1.  
  2.  
  3. # Verifica o total de eventos num mapa. Chame: $game_temp.totally_event(id)
  4. # id do mapa. Caso não especificar o id, dará o total de eventos do jogo inteiro.
  5.  
  6. class Game_Temp
  7.  
  8. def totally_event(id=nil)
  9. totally = 0
  10. glob = Dir.glob("./Data/Map*").collect! { |i| i.split("/").last.match(/Map(\d+)/).to_s << ".rvdata2" rescue next }.select(&:to_s)
  11. glob.delete_at(glob.size.pred)
  12. if id.nil?
  13. glob.each { |i| totally += load_data(sprintf("./Data/#{i}")).events.size }
  14. else
  15. totally += load_data(sprintf("./Data/Map%03d.rvdata2", id)).events.size rescue 0
  16. end
  17. return totally
  18. end
  19.  
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement