Okay, I'm trying to make a plugin for Scene_Waypoints script...
#==============================================================================
# Diablo 2 Waypoints
# by arevulopapo
# Feb 9th 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 :waypoints
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"
#--------------------------------------------------------------------------
@waypoints = []
#--------------------------------------------------------------------------
# Here you add new waypoints. The formula is like this
# ["Name", map_id, player_x, player_y]
#--------------------------------------------------------------------------
@waypoints << ["Drasgora", 5, 143, 76] # This is the first waypoint. Its index is 0
@waypoints << ["Admin Hideout", 4, 13, 14] # This is the second waypoint. Its index is 1
@waypoints << ["Train Ground", 14, 24, 18] # 2, monster testing zone
#--------------------------------------------------------------------------
@waypoints_active = []
game_system_initialize
end
#--------------------------------------------------------------------------
end
#==============================================================================
#==============================================================================
class Window_Waypoint_Name < Window_Base
#--------------------------------------------------------------------------
def initialize(waypoint_name)
super(0,0,320,64)
self.contents = Bitmap.new(288,32)
self.back_opacity = 160
@waypoint_name = waypoint_name
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0,0,288,32,@waypoint_name.to_s,1)
end
#--------------------------------------------------------------------------
end
#==============================================================================
#==============================================================================
class Window_Waypoint_List < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
self.back_opacity = 160
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = $game_system.waypoints.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.include?(index)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x, y, 288, 32, $game_system.waypoints[index][0].to_s, 1)
end
#--------------------------------------------------------------------------
end
#==============================================================================
#==============================================================================
class Scene_Waypoint
#--------------------------------------------------------------------------
def initialize(waypoint)
@waypoint = waypoint
$game_system.waypoints_active << @waypoint unless $game_system.waypoints_active.include?(@waypoint)
end
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@name_window = Window_Waypoint_Name.new($game_system.waypoints[@waypoint][0])
@list = Window_Waypoint_List.new
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::C)
if $game_system.waypoints_active.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.waypoints[@list.index][1])
$game_player.moveto($game_system.waypoints[@list.index][2], $game_system.waypoints[@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
Script works fine, nut doesn;t save visited waypoints.
The variable which saves visited waypoints is $game_system.waypoints_active, so I thought it will be enough to make this plugin for RMX-OS:
module RMXOS
module Options
SAVE_DATA[Game_System].push('@waypoints_active')
end
end
Of course the plugin is BELOW RMX-OS script.
Unfortunately, it raises an error whenever I call Scene_Waypoint...
Script 'Waypoints'line 107: NoMethodError occured.
undefined method 'include?' for nil:NilClass
Looks like I screwed something up.