My first script isnt working(i just made it and i cant find anything wrong with it)so could some one please look at it for me and tell me wahts wrong with it
(its a party swapper)
heres the code
#==============================================================================
# ** Scene_Swapper
#==============================================================================
# ** This class performs party swapping processing.
#==============================================================================
class Scene_Swapper
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#make help window, party swapping window
@help_window = Help_Window.new
@swapper_window = Swapper_Window.new
# associate Help_Window
@swapper_window.help_window = @help_window
# make target window (invisable/ inactive
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# execute transition
Graphics.transitions
# main loop
loop do
# update game screen
Graphics.update
# update input information
Input.update
# frame update
update
# abort loop if screen changes
if $scene != self
break
end
end
# prepare for transition
Graphics.freeze
#dispose of windows
@help_windows.dispose
@swapper_window.dispose
@target_windows.dispose
end
#============================================================================
# * Frame Update
#============================================================================
def update
# update windows
@help_windows.update
@swapper_windows.update
@target_windows.update
# if swapper menu is active: call up update_swapper
if @swapper_window.active
update_swapper
return
end
# if target_windows is active: call up update_target
if @target_window.active
update_target
return
end
end
#===========================================================================
# *Frame update(if swapper window is active)
#===========================================================================
def update_swapper
# if b button was pressed
if Input.trigger?(Input::B)
#play cancel SE
$game_system.se_play(data_system.cancel_se)
#switch to menu screen
$scene = Scene_Menu.new(0)
return
end
# if c button was pressed
if Input.trigger?(Iput::C)
# get currently selected actor on the swapper window
$actor = swapper_window.actor
return
end
#activate target window
$swapper_window.active = false
$target_window.x = (swapper_window.index + 1) % 2 * 304
$target_window.visible = true
$target_window.active = true
# set curser scope
if $item.scope == 4 || $item.scope == 6
$target_window.index = -1
else
$target_window.index = 0
return
end
end
end
#-----------------------------------------------------------------------------
# frame update (when target window is active)
#------------------------------------------------------------------------------
def update_target
# if b button was pressed
if Input.trigger?(Input::B)
#Play Cncel SE
$game_system.se_play(data_system.cancel_se)
# erase target window
@swapper_window.active = true
target_window.visible = false
target_window.active = false
return
end
#if c button was used
if Input.trigger?(Input::C)
# apply target
@target_window.index >= 0
# apply party swapper
target = $game_party.actors[@target_window.index]
switch = target.actor_switch($actor)
end
#if switcher was used
if used
$game_system.se_play(item.menu_se)
end
#remake target window
@target_window.refresh
#if all party members are dead
if $game_party.all_dead?
#bring up game over menu
$scene = Scene_Gameover.new
end
end
then I add this to the scene_menu
when 6 # Switch to party swapper
# play decision SE
$game_system.se_play($data_system.decision_se)
#switch to party swapper screen
$scene = Scene_Swapper.new(@swapper_window.index)
it says "script'scene_menu' line 171 no methoderror occured
undefined method index for nil:NILClass
I really need help
(its a party swapper)
heres the code
#==============================================================================
# ** Scene_Swapper
#==============================================================================
# ** This class performs party swapping processing.
#==============================================================================
class Scene_Swapper
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#make help window, party swapping window
@help_window = Help_Window.new
@swapper_window = Swapper_Window.new
# associate Help_Window
@swapper_window.help_window = @help_window
# make target window (invisable/ inactive
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# execute transition
Graphics.transitions
# main loop
loop do
# update game screen
Graphics.update
# update input information
Input.update
# frame update
update
# abort loop if screen changes
if $scene != self
break
end
end
# prepare for transition
Graphics.freeze
#dispose of windows
@help_windows.dispose
@swapper_window.dispose
@target_windows.dispose
end
#============================================================================
# * Frame Update
#============================================================================
def update
# update windows
@help_windows.update
@swapper_windows.update
@target_windows.update
# if swapper menu is active: call up update_swapper
if @swapper_window.active
update_swapper
return
end
# if target_windows is active: call up update_target
if @target_window.active
update_target
return
end
end
#===========================================================================
# *Frame update(if swapper window is active)
#===========================================================================
def update_swapper
# if b button was pressed
if Input.trigger?(Input::B)
#play cancel SE
$game_system.se_play(data_system.cancel_se)
#switch to menu screen
$scene = Scene_Menu.new(0)
return
end
# if c button was pressed
if Input.trigger?(Iput::C)
# get currently selected actor on the swapper window
$actor = swapper_window.actor
return
end
#activate target window
$swapper_window.active = false
$target_window.x = (swapper_window.index + 1) % 2 * 304
$target_window.visible = true
$target_window.active = true
# set curser scope
if $item.scope == 4 || $item.scope == 6
$target_window.index = -1
else
$target_window.index = 0
return
end
end
end
#-----------------------------------------------------------------------------
# frame update (when target window is active)
#------------------------------------------------------------------------------
def update_target
# if b button was pressed
if Input.trigger?(Input::B)
#Play Cncel SE
$game_system.se_play(data_system.cancel_se)
# erase target window
@swapper_window.active = true
target_window.visible = false
target_window.active = false
return
end
#if c button was used
if Input.trigger?(Input::C)
# apply target
@target_window.index >= 0
# apply party swapper
target = $game_party.actors[@target_window.index]
switch = target.actor_switch($actor)
end
#if switcher was used
if used
$game_system.se_play(item.menu_se)
end
#remake target window
@target_window.refresh
#if all party members are dead
if $game_party.all_dead?
#bring up game over menu
$scene = Scene_Gameover.new
end
end
then I add this to the scene_menu
when 6 # Switch to party swapper
# play decision SE
$game_system.se_play($data_system.decision_se)
#switch to party swapper screen
$scene = Scene_Swapper.new(@swapper_window.index)
it says "script'scene_menu' line 171 no methoderror occured
undefined method index for nil:NILClass
I really need help