# ============================================================================ # TheoAllen - Fast Travel # Author : TheoAllen # Version : 1.1 # Contact : www.rpgmakerid.com # =-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Requested by : Rusty # Requires : Theo - Core Movement # ============================================================================ $imported = {} if $imported.nil? if $imported[:Theo_Movement] $imported[:Theo_Travel] = true # ============================================================================ # CHANGE LOGS: # ---------------------------------------------------------------------------- # - 2013.05.07 - Add custom picture in maplists # - 2013.05.01 - Started and finished script # ============================================================================ =begin =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= PENGENALAN: Script ini ngebikin kamu bisa bikin fast travel sendiri. Map-map yg bisa dipake buat transfer dicatet dalam konfigurasi =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= CARA PEMAKAIAN: Pasang script ini dibawah Theo - Core Movement. Panggil dalam script call seperti ini: ------------------------------------- map = [1,2,3] travel(map) (atau-->) travel([1,2,3]) ------------------------------------- Angka2 itu adalah id map yg bisa ditransfer yg u database sendiri di kofigurasi ntar. Kalo semisal u pengen kasi gambar background, u bisa bikin kek gini: ------------------------------------- travel([1,2,3],"peta") ------------------------------------- "peta" adalah nama file gambar yg harus ada di folder Graphics/system =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= TERMS OF USE : Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau dipake buat komersil, jangan lupa, gw dibagi gratisannya. =end # ============================================================================ # KONFIGURASI ~ # ============================================================================ module THEO module TRAVEL # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # MAP DATABASE : # ----------------------------------------------------------------------- # id => ["nama",map_id,x,y], # id ntar buat dipanggil di script call # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= MAPLIST = { 1 => ["Alumnea", 1, 1, 1], # <-- kalo mo nambahin jgn lupa koma 2 => ["Eremidia", 2, 1, 1], 3 => ["Westerland", 3, 1, 1], 4 => ["Aldonia", 1, 1, 1], 5 => ["Vandaria", 2, 1, 1], 6 => ["Nirbhumi", 3, 1, 1], # Tambahin sendiri disini } # <-- jangan diilangin # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Settingan Window (kalo dirasa g perlu g usah diedit) # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= WINDOW_PIC = "test2" # picture pengganti window. tulis "nil" (tanpa petik) kalo g perlu # --------------------------------------------------------- TEXT_X = 0 # pergeseran text ke kanan (kalo pake pic) TEXT_Y = 0 # pergeseran text ke bawah (kalo pake pic) # --------------------------------------------------------- LEBAR_WINDOW = 200 # --------------------------------------------------------- # Lebar window untuk nampilin nama petanya (kalo g pake pic) # --------------------------------------------------------- WINDOW_OFFSET = 4 # --------------------------------------------------------- # Jarak antar window # --------------------------------------------------------- MOVE_DURATION = 5 # --------------------------------------------------------- # Kecepatan window ngegeser dalam satuan frame # Misalnya kalo u nulis 60 maka window butuh waktu 1 detik # buat sampe tujuan # default : 5 # --------------------------------------------------------- POSISI_X = 4 POSISI_Y = 4 # --------------------------------------------------------- # Untuk ngatur posisi x ama y window # --------------------------------------------------------- UKURAN_FONT = 24 # --------------------------------------------------------- # Untuk ukuran font yg ditampilin di maplist ntar # Default : 24 # --------------------------------------------------------- TEXT_ALIGN = 1 # --------------------------------------------------------- # Untuk ngatur letak text # 0 = ditulis dari kiri # 1 = ditulis di tengah # 2 = ditulis dari kanan # --------------------------------------------------------- end end # ============================================================================ # Do not edit pass this line ~ # ============================================================================ class Window_TravelList < Window_Base attr_accessor :id def initialize(x,y,text) super(x,y,width,height) contents.font.size = THEO::TRAVEL::UKURAN_FONT @text = text refresh end def refresh contents.clear draw_text(0,0,contents.width,contents.font.size,@text,THEO::TRAVEL::TEXT_ALIGN) end def width THEO::TRAVEL::LEBAR_WINDOW end def height 24 + THEO::TRAVEL::UKURAN_FONT end end class Sprite_Maplist < Sprite attr_accessor :id end class Scene_Traveling < Scene_MenuBase def initialize(maplists_id, snapshot = nil) @maps = [] maplists_id.each do |key| @maps.push(THEO::TRAVEL::MAPLIST[key]) end @snapshot = snapshot @index = 0 end def start super create_maplist_window update_windows end def create_background if @snapshot @background_sprite = Sprite.new @background_sprite.bitmap = Cache.system(@snapshot) else super end end def create_maplist_window y_pos = THEO::TRAVEL::POSISI_Y x_pos = THEO::TRAVEL::POSISI_X @window_maplists = [] for i in 0..@maps.size-1 unless THEO::TRAVEL::WINDOW_PIC.is_a?(String) make_window_maplists(x_pos,y_pos,i) y_pos += THEO::TRAVEL::UKURAN_FONT + 24 + THEO::TRAVEL::WINDOW_OFFSET else window_sprite = Sprite_Maplist.new(@viewport) window_sprite.y = y_pos window_sprite.x = x_pos window_sprite.bitmap = create_window_sprite_bitmap(i) y_pos += window_sprite.bitmap.height + THEO::TRAVEL::WINDOW_OFFSET make_sprite_maplist(window_sprite,i) end end end def make_window_maplists(x,y,i) @window_maplists.push(Window_TravelList.new(x,y,@maps[i][0])) @window_maplists[i].id = i end def create_window_sprite_bitmap(i) bitmap = Bitmap.new("Graphics/System/" + THEO::TRAVEL::WINDOW_PIC) x = THEO::TRAVEL::TEXT_X y = THEO::TRAVEL::TEXT_Y width = bitmap.width - x bitmap.draw_text(x,y,width,THEO::TRAVEL::UKURAN_FONT,@maps[i][0],THEO::TRAVEL::TEXT_ALIGN) return bitmap end def make_sprite_maplist(window_sprite,i) @window_maplists.push(window_sprite) @window_maplists[i].id = i end def update super update_cursor @window_maplists.each {|window| window.update} transfer_player if confirm? return_scene if return? end def update_cursor if Input.repeat?(:DOWN) @index += 1 correct_index update_windows elsif Input.repeat?(:UP) @index -= 1 correct_index update_windows end end def correct_index @index = max_index if @index < 0 @index = 0 if @index > max_index end def max_index @maps.size - 1 end def update_windows @window_maplists.each do |window| if window.id == @index window.goto(THEO::TRAVEL::POSISI_X+20,window.y,THEO::TRAVEL::MOVE_DURATION) else window.goto(THEO::TRAVEL::POSISI_X,window.y,THEO::TRAVEL::MOVE_DURATION) end end end def transfer_player map = @maps[@index] id = map[1] x = map[2] y = map[3] $game_player.reserve_transfer(id,x,y) return_scene end def confirm? Input.trigger?(:C) end def return_scene SceneManager.return end def return? Input.trigger?(:B) end end class Game_Interpreter def travel(maplist,snapshot = nil) SceneManager.call_travel(maplist,snapshot) end end module SceneManager def self.call_travel(maplist,snapshot = nil) @stack.push(@scene) @scene = Scene_Traveling.new(maplist,snapshot) end end end