Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- ALUMNEA MAGIC ACADEMY - Fast Travel
- Ver 0.7
- (written in informal indonesian language)
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Term of Service :
- Script ini pada aslinya ga w bikin buat disebar. tapi buat ojekan pribadi gw
- Jadi w minta maap kalo rada ribet makenya ato keterangannya g jelas. Yg jelas
- gw g ngelayani support kalo ada apa-apa buat script ini.
- u boleh ngedit ato minta editin scripter lain. u boleh ngeredistribusi script
- ini dengan versi editan u sendiri. Cuman gw minta satu syarat. Credit gw!
- TheoAllen!
- Komersil? boleh. Tapi u urus aja sendiri script gw kalo misalnya ada masalah
- ato g sreg :v
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Cara Penggunaan :
- AMA.new_map(a,b,c,d,e)
- a = Nama Tujuan ntar (buat ditampilin)
- b = Nama file yg jadi snapshot
- c = id peta yg jadi tujuan teleport
- d = posisi x transfer
- e = posisi y pas transfer
- AMA.set_map(a,b,c) >> Ngemasukin current map ke list map transferable
- a = File snapshot
- b = posisi x
- c = posisi y
- AMA.clear_map
- buat ngebersihin transferable map yg disimpen
- Untuk manggil Scene fast travel. Tulis :
- "SceneManager.call(Scene_Travel)"
- Panggil via script call. Ato terserah u sisipin dimana dalam script
- (kalo u ngerti scripting :v)
- =end
- module AMA
- # ============== Config ====================
- module TRAVEL
- # Pengaturan Window Title
- TITLE_WIDTH = "Graphics.width"
- TITLE_HEIGHT = "line_height + standard_padding*2"
- TITLE_X = "0"
- # Vokab ~
- TITLE = "~ Fast Travel ~"
- CURRENT_MAP = "Current Map :"
- end
- # ============== End of config =============
- def self.new_map(name,file,id,x,y)
- new_map = Game_MapList.new(name,id,file,x,y)
- $game_maplist.push(new_map)
- end
- def self.set_map(file,x,y)
- map = $game_map
- name = map.display_name
- id = map.map_id
- new_map = Game_MapList(name,id,file,x,y)
- $game_maplist.push(new_map)
- end
- def self.clear_map
- $game_maplist.clear
- end
- end
- =begin
- Game_Maplist = Buat nyatet dan ngelist map2 mana aja yg transferable
- Game_Maplist beda dengan Game_Map ato $data_mapinfos
- =end
- class Game_MapList
- attr_accessor :name # Nama map (Spesifikasikan sendiri)
- attr_accessor :id # ID map tujuan buat transfer
- attr_accessor :x # Posisi x saat transfer
- attr_accessor :y # Posisi y saat transfer
- attr_writer :complete_flag # Tanda kalo map udah komplet diexplore
- attr_reader :nth # Maplist ke-n. Otomatis nambah.
- attr_reader :file # Nama file snapshot
- @@count = 0 # Static variable ~
- def initialize(name,id,file,x,y)
- @name = name
- @id = id
- @file = file
- @complete_flag = false
- @x = x
- @y = y
- @@count += 1
- @nth = @@count
- end
- def complete?
- @complete_flag
- end
- end
- class Game_Map
- # buat lu yg mo ngembangin script ini
- def travel?
- @map.note.include?("<travel>")
- end
- def no_travel?
- @map.note.include?("<no travel>")
- end
- end
- module DataManager
- class << self
- alias fast_travel_db load_database # Aliasing load database
- end
- def self.load_database
- fast_travel_db
- make_maplist_obj
- end
- def self.make_maplist_obj
- $game_maplist = [] # Bikin object array buat nampung object2 maplist
- end
- def self.make_save_contents
- contents = {}
- contents[:system] = $game_system
- contents[:timer] = $game_timer
- contents[:message] = $game_message
- contents[:switches] = $game_switches
- contents[:variables] = $game_variables
- contents[:self_switches] = $game_self_switches
- contents[:actors] = $game_actors
- contents[:party] = $game_party
- contents[:troop] = $game_troop
- contents[:map] = $game_map
- contents[:player] = $game_player
- contents[:maplist] = $game_maplist
- contents
- end
- def self.extract_save_contents(contents)
- $game_system = contents[:system]
- $game_timer = contents[:timer]
- $game_message = contents[:message]
- $game_switches = contents[:switches]
- $game_variables = contents[:variables]
- $game_self_switches = contents[:self_switches]
- $game_actors = contents[:actors]
- $game_party = contents[:party]
- $game_troop = contents[:troop]
- $game_map = contents[:map]
- $game_player = contents[:player]
- $game_maplist = contents[:maplist]
- end
- end
- =begin
- Class ini buat nampilin window judul diatas. Panjang window ini berpengaruh
- ke window lain.
- =end
- class Window_TravelTitle < Window_Base
- def initialize
- super(0,0,window_width,window_height)
- update_placement
- refresh
- end
- def window_width
- eval(AMA::TRAVEL::TITLE_WIDTH)
- end
- def window_height
- eval(AMA::TRAVEL::TITLE_HEIGHT)
- end
- def update_placement
- self.x = eval(AMA::TRAVEL::TITLE_X)
- end
- def refresh
- contents.clear
- draw_text(0,0,contents.width,line_height,AMA::TRAVEL::TITLE,1)
- end
- end
- =begin
- Class ini buat nampilin map sekarang. Letaknya ada di paling bawah
- =end
- class Window_CurrentMap < Window_Base
- def initialize
- super(0,0,window_width,window_height)
- update_placement
- refresh
- end
- def window_width
- return eval(AMA::TRAVEL::TITLE_WIDTH)
- end
- def window_height
- return eval(AMA::TRAVEL::TITLE_HEIGHT)
- end
- def update_placement
- self.x = (Graphics.width - window_width) / 2
- self.y = Graphics.height - self.window_height
- end
- def refresh
- contents.clear
- draw_current_map
- end
- def draw_current_map
- change_color(system_color)
- draw_text(0,0,contents.width,line_height,AMA::TRAVEL::CURRENT_MAP)
- change_color(normal_color)
- draw_text(0,0,contents.width,line_height,$game_map.display_name,2)
- end
- end
- =begin
- Class ini buat nampilin list-list map yg bisa transfer. Class ini ngerefers
- ke $game_maplist. Kalo mau nambahin list map u harus ngemasukin map lewat
- modul AMA.new_map. Penjelasan dah ada di section sbelumnya
- =end
- class Window_Maplist < Window_Selectable
- # ----------------------------------------------------------
- # Inisialisasi ~
- # ----------------------------------------------------------
- def initialize(x,y,width,height)
- super(x,y,width,height)
- @width = width
- @height = height
- @data = []
- refresh
- end
- # ----------------------------------------------------------
- # Lebar window ~
- # ----------------------------------------------------------
- def window_width
- @width
- end
- # ----------------------------------------------------------
- # Tinggi window ~
- # ----------------------------------------------------------
- def window_height
- @height
- end
- # ----------------------------------------------------------
- # Kolom maksimum ~
- # ----------------------------------------------------------
- def col_max
- return 1
- end
- # ----------------------------------------------------------
- # Jumlah item maksimum. 1 jika data ngga ada
- # ----------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- # ----------------------------------------------------------
- # Buat ndapetin item / data yg lagi dipilih
- # ----------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- # ----------------------------------------------------------
- # Refresh window
- # ----------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- # ----------------------------------------------------------
- # Data diambil dari Game_Maplist
- # ----------------------------------------------------------
- def make_item_list
- @data = $game_maplist
- end
- # ----------------------------------------------------------
- # Metode ngedraw item / data
- # ----------------------------------------------------------
- def draw_item(index)
- map = @data[index] # permisalan
- if map # kalo datanya ada ~>
- rect = item_rect(index) # Pesen tempat
- rect.width -= 4 # Lebar dikecilin dikit
- draw_map_name(map,rect) # Ngedraw nama peta
- end
- end
- # ----------------------------------------------------------
- # Metode ngedraw nama peta
- # (%03d,number) >> regular expression yg ntar jadinya :
- # - 001 >> kalo number = 1
- # - 099 >> kalo number = 99
- # ----------------------------------------------------------
- def draw_map_name(map,rect)
- name = map.name # ngambil nama peta
- number = map.nth # ngambil nomor peta
- text = sprintf("%03d:%s",number,name) # bikin format nama peta
- change_color(power_up_color) if map.complete?
- draw_text(rect,text) # nulis nama peta berdasar format ^
- reset_font_settings
- end
- # ----------------------------------------------------------
- # Update help. Help window refers ke Window_Mapinfo
- # ----------------------------------------------------------
- def update_help
- @help_window.set_item(item) if @help_window
- end
- end
- =begin
- class ini buat window yg nampilin info map
- =end
- class Window_Mapinfo < Window_Base
- def initialize(x,y,width,height)
- super(x,y,width,height)
- @width = width
- @height = height
- @map = nil
- refresh
- end
- def window_height
- @height
- end
- def window_width
- @width
- end
- def refresh
- contents.clear
- draw_map_infos
- end
- def draw_map_infos
- change_color(system_color)
- draw_text(0,0,contents.width,line_height,"Map Infos :",1)
- draw_contents if @map
- end
- def draw_contents
- draw_map_name
- draw_map_snapshot(0, line_height*4)
- end
- def draw_map_name
- change_color(system_color)
- pos = line_height
- width = contents.width
- draw_text(0,pos,width,pos,"Name :")
- change_color(normal_color)
- draw_text(0,pos+line_height,width,pos,@map.name)
- change_color(system_color)
- width = window_width
- draw_text(0,pos+(line_height*2),width,pos,"Snapshot :")
- end
- def set_item(item)
- @map = item
- refresh
- end
- def draw_map_snapshot(x, y, enabled = true)
- bitmap = Cache.system(@map.file)
- rect = Rect.new(0,0, 300, 300)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- end
- end
- =begin
- Custom scene class buat travel
- =end
- class Scene_Travel < Scene_MenuBase
- def start
- super
- create_title_window
- create_current_map_window
- create_maplist_window
- create_mapinfo_window
- end
- def create_title_window
- @title_window = Window_TravelTitle.new
- @title_window.viewport = @viewport
- end
- def create_current_map_window
- @current_map_window = Window_CurrentMap.new
- @current_map_window.viewport = @viewport
- end
- def create_mapinfo_window
- wx = @maplist_window.window_width
- wy = @title_window.window_height
- ww = @title_window.window_width / 2
- p ww
- wh = Graphics.height - @title_window.window_height*2
- @mapinfo_window = Window_Mapinfo.new(wx,wy,ww,wh)
- @mapinfo_window.viewport = @viewport
- @maplist_window.help_window = @mapinfo_window
- end
- def create_maplist_window
- wx = @title_window.x
- wy = @title_window.window_height
- ww = @title_window.window_width / 2
- wh = Graphics.height - @title_window.window_height*2
- @maplist_window = Window_Maplist.new(wx,wy,ww,wh)
- @maplist_window.viewport = @viewport
- @maplist_window.set_handler(:ok, method(:on_item_ok))
- @maplist_window.set_handler(:cancel, method(:return_scene))
- @maplist_window.activate
- @maplist_window.select(0)
- end
- def on_item_ok
- map = @maplist_window.item
- $game_player.reserve_transfer(map.id,map.x,map.y)
- Audio.se_play("Audio/SE/Move",80)
- SceneManager.call_map
- end
- end
- module SceneManager
- def self.call_map
- @scene = Scene_Map.new
- clear
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment