#==============================================================================# Diablo 2 Waypoints v. 1.1# by evil arev# Mar 1st 2007### To call the Waypoint scene use the "Call script" event command:# $scene = Scene_Waypoint.new(parameter)# where 'parameter' is the index of the waypoint you're using.## If you want to activate a waypoint without "touching" it# call a script like this:# $game_system.waypoints_active << index# where 'index' is the index of the waypoint you want to activate.## See the comments in the Game_System section (right below)# for informations on how to customize.##==============================================================================class Game_System #-------------------------------------------------------------------------- attr_accessor :acts attr_accessor :act_names attr_accessor :waypoints_active attr_accessor :waypoint_sound #-------------------------------------------------------------------------- alias game_system_initialize initialize #-------------------------------------------------------------------------- def initialize #-------------------------------------------------------------------------- # Here you can change the sound played while teleporting #-------------------------------------------------------------------------- @waypoint_sound = "Audio/SE/020-Teleport03" #-------------------------------------------------------------------------- @acts = [] @act_names = [] @waypoints_active = [] #-------------------------------------------------------------------------- # Here you add the names for the acts. The number of acts will be equal # to the number of names you added. #-------------------------------------------------------------------------- @act_names << "Act I" @act_names << "Act II" @act_names << "Act III" @act_names << "Act IV" #-------------------------------------------------------------------------- for i in 0..@act_names.size - 1 @acts << [] @waypoints_active << [] end #-------------------------------------------------------------------------- # Here you add new waypoints. The formula is like this # ["Name", map_id, player_x, player_y]. The number in [] of @acts is # the index of the act you're adding a waypoint to. #-------------------------------------------------------------------------- @acts[0] << ["Forest I", 2, 13, 9] # This is the first waypoint. Its added to act 1 (with index 0) and its act index is 0. @acts[0] << ["Forest II", 4, 5, 11] # This is the second waypoint added to act 1. Its act index is 1. @acts[0] << ["Forest III", 3, 15, 11] @acts[0] << ["Forest IV", 1, 11, 2] @acts[0] << ["Forest V", 5, 17, 6] @acts[1] << ["Desert I", 9, 6, 7] @acts[1] << ["Desert II", 10, 12, 6] @acts[1] << ["Desert II", 11, 8, 3] @acts[1] << ["Desert IV", 12, 19, 17] @acts[2] << ["Swamp I", 13, 3, 5] @acts[2] << ["Swamp II", 14, 3, 9] @acts[2] << ["Swamp III", 15, 19, 15] @acts[2] << ["Swamp IV", 16, 3, 12] @acts[3] << ["Mountain I", 18, 20, 4] @acts[3] << ["Mountain II", 19, 3, 14] @acts[3] << ["Mountain III", 20, 6, 17] @acts[3] << ["Mountain IV", 21, 3, 11] @acts[3] << ["Mountain V", 22, 2, 20] #-------------------------------------------------------------------------- game_system_initialize end #--------------------------------------------------------------------------end#==============================================================================#==============================================================================class Window_Waypoint_Name < Window_Base #-------------------------------------------------------------------------- def initialize(act=0) super(0,0,320,64) self.contents = Bitmap.new(288,32) self.back_opacity = 160 @act = act refresh end #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0..$game_system.act_names.size - 1 self.contents.font.color = (@act == i ? normal_color : disabled_color) cell = 288/$game_system.act_names.size self.contents.draw_text(i * cell,0,cell,32,$game_system.act_names[i],1) end end #--------------------------------------------------------------------------end#==============================================================================#==============================================================================class Window_Waypoint_List < Window_Selectable #-------------------------------------------------------------------------- def initialize(act, target_act, waypoint) super(0, 64, 320, 416) self.back_opacity = 160 @act = act @target_act = target_act @waypoint = waypoint refresh self.index = 0 end #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @item_max = $game_system.acts[@target_act].size self.contents = Bitmap.new(288, @item_max * 32) for i in 0..@item_max - 1 draw_item(i) end end #-------------------------------------------------------------------------- def draw_item(index) x = 0 y = (index) * 32 if $game_system.waypoints_active[@target_act].include?(index) self.contents.font.color = normal_color text = $game_system.acts[@target_act][index][0].to_s else self.contents.font.color = disabled_color text = ". . ." end self.contents.draw_text(x, y, 288, 32, text, 1) end #--------------------------------------------------------------------------end#==============================================================================#==============================================================================class Scene_Waypoint attr_reader :act #-------------------------------------------------------------------------- def initialize(act, waypoint) @waypoint = waypoint @act = act @target_act = act $game_system.waypoints_active[@act] << @waypoint unless $game_system.waypoints_active.include?(@waypoint) end #-------------------------------------------------------------------------- def main @spriteset = Spriteset_Map.new @name_window = Window_Waypoint_Name.new(@act) @list = Window_Waypoint_List.new(@act, @target_act, @waypoint) @list.index = @waypoint if $game_player.screen_x < 320 @name_window.x = 320 @list.x = 320 end Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @spriteset.dispose @name_window.dispose @list.dispose end #-------------------------------------------------------------------------- def update @list.update if Input.trigger?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @list.dispose @list = Window_Waypoint_List.new(@act, (@target_act - 1) % $game_system.acts.size, @waypoint) @name_window.dispose @name_window = Window_Waypoint_Name.new((@target_act - 1) % $game_system.acts.size) @target_act -= 1 @target_act %= $game_system.acts.size if $game_player.screen_x < 320 @name_window.x = 320 @list.x = 320 end end if Input.trigger?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @list.dispose @list = Window_Waypoint_List.new(@act, (@target_act + 1) % $game_system.acts.size, @waypoint) @name_window.dispose @name_window = Window_Waypoint_Name.new((@target_act + 1) % $game_system.acts.size) @target_act += 1 @target_act %= $game_system.acts.size if $game_player.screen_x < 320 @name_window.x = 320 @list.x = 320 end end if Input.trigger?(Input::C) if $game_system.waypoints_active[@target_act].include?(@list.index) Audio.se_play($game_system.waypoint_sound) $game_screen.start_flash(Color.new(255,255,255,160), 5) $game_map.setup($game_system.acts[@target_act][@list.index][1]) $game_player.moveto($game_system.acts[@target_act][@list.index][2], $game_system.acts[@target_act][@list.index][3]) $game_player.straighten $game_map.update $game_map.autoplay $scene = Scene_Map.new Graphics.transition(20) else $game_system.se_play($data_system.buzzer_se) end end if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end end #--------------------------------------------------------------------------end