SCRIPTING HELP FOR A BIOGRAPHY SCENE

Posts

Pages: 1
Hello everyone,

Edit: Forgot to mention this is for RMVX Ace

I am new to scripting, only just starting to learn recently. I have been following DiamondandPlatinum3's tutorials on YouTube and they have been very helpful. This script I am currently working on was derived from watching his synopsis journal scene tutorial and a few others.
The scene I am trying to create is a menu window command biography scene. What I want is for each window in the scene to be filled with data from the the array. The array itself holds data from each character that I plan to introduce into the story. Things like name, age, date of birth, etc. will be used but I also put image names for the characters picture and a background so that way the images will also change for each character. The problem I am having is writing into the windows using the array. When I try I get an error reading "NoMethodError undefined method '' for nil:NilClass". So far I have only tried the Name window.
I could really use some help figuring out how to get it to access the array when drawing text.

Here is the script I am working on: Note: I removed the brackets and replaced it with B so the array will show up...

class Scene_Biography < Scene_Base
#-----------------------------------------------------------------------------
# * Start Processing
#-----------------------------------------------------------------------------
def start
super()

#===========================================================================
# Character Database Array
#---------------------------------------------------------------------------

@biography_chararray = B # Don't touch this line
#---------------------------------------------------------------------------
# Editable Region
#---------------------------------------------------------------------------
# Name: Age: DOB: Height: Class: Mortality: CGS
B "name1, 54, "5'9", "class", "mortal", "" , "image name", "background name" B,
B "name2, 54, "5'9", "class", "mortal", "" , "image name", "background name" B,
B "name3", 54, "5'9", "class", "mortal", "" , "image name", "background name" B,,
#---------------------------------------------------------------------------
B# End of Character Database Array \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
#===========================================================================
msgbox_p(@biography_chararray)

#------------------------------------------------------------------------
# Background Image
#------------------------------------------------------------------------
@background_sprite = Sprite.new()
@background_sprite.bitmap = Cache.picture("questionmark")#background_image)
@background_sprite.x = 0
@background_sprite.y = 0
@background_sprite.z = 0
@background_sprite.zoom_x = Graphics.width.to_f / @background_sprite.bitmap.width
@background_sprite.zoom_y = Graphics.height.to_f / @background_sprite.bitmap.height
@background_sprite.opacity = 255
@background_sprite.visible = true
#------------------------------------------------------------------------

#------------------------------------------------------------------------
# Character Image
#------------------------------------------------------------------------
@character_sprite = Sprite.new()
@character_sprite.bitmap = Cache.picture("People3-1_locked")#background_image)
@character_sprite.x = 40
@character_sprite.y = 40
@character_sprite.z = 150
@character_sprite.zoom_x = 272.0 * 0.75 / @character_sprite.bitmap.width
@character_sprite.zoom_y = 288.0 * 0.75 / @character_sprite.bitmap.height
@character_sprite.opacity = 255
@character_sprite.visible = false
#------------------------------------------------------------------------

#------------------------------------------------------------------------
# Windows
#------------------------------------------------------------------------
@window_biography_name = Window_Biography_Name.new()
@window_biography_image = Window_Biography_image.new()
@window_biography_bios = Window_Biography_Bios.new()
@window_biography_cgs = Window_Biography_CGS.new()
#------------------------------------------------------------------------

end
#--------------------------------------------------------------------------
# * Post-Start Processing
#--------------------------------------------------------------------------
def post_start
super()
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super()
return_scene() if Input.trigger?(:B)
cancel_se() if Input.trigger?(:B)
scroll_right() if Input.trigger?(:RIGHT)
scroll_left() if Input.trigger?(:LEFT)
end
end

def cancel_se
cancel_sound = "Cancel2"
RPG::SE.new(cancel_sound, 70, 100).play
end

def scroll_right
scroll_se = "Decision3"
RPG::SE::new(scroll_se, 70, 100).play

end

def scroll_left
scroll_se = "Decision3"
RPG::SE::new(scroll_se, 70, 100).play

end
#--------------------------------------------------------------------------
# * Pre-Termination Processing
#--------------------------------------------------------------------------
def pre_terminate
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super()
if @background_image
@custom_sprite.bitmap.dispose()
@custom_sprite.dispose()
end

@window_biography_name.dispose()
@window_biography_image.dispose()
@window_biography_bios.dispose()
@window_biography_cgs.dispose()
end

#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================

class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * For Adding Original Commands
#--------------------------------------------------------------------------
alias vg14_custscene_winmencmmd_addorigcmmd_74yrth add_original_commands
#--------------------------------------------------------------------------
def add_original_commands
vg14_custscene_winmencmmd_addorigcmmd_74yrth() # Call original method
add_command("Biography", :biography_scene, true)
end
end



#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
alias vg14_custscene_scenemenu_createcmmdwindow_74yrth create_command_window
#--------------------------------------------------------------------------
def create_command_window
vg14_custscene_scenemenu_createcmmdwindow_74yrth() # Call original method
@command_window.set_handler(:biography_scene, method(:command_scenebiography))
end

def command_scenebiography
SceneManager.call(Scene_Biography)
end
end

#==============================================================================
# ** Window_Biography_Name
#------------------------------------------------------------------------------
# This message window is used to display text
#==============================================================================

class Window_Biography_Name < Window_Base
def initialize()
super(0, 0, (Graphics.width * 0.5) , (Graphics.height * 0.13))

draw_name()
end

def draw_name()
text = @biography_chararray
draw_text_ex(0, 0, text)
end
end

#==============================================================================
# ** Window_Biography_image.
#------------------------------------------------------------------------------
# This message window is used to display text for the quest Desription.
#==============================================================================

class Window_Biography_image < Window_Base
def initialize()
super((Graphics.width * 0.05), (Graphics.height * 0.2), (Graphics.width * 0.4), (Graphics.height * 0.4))
draw_image()
end

def draw_image()

end
end

#==============================================================================
# ** Window_Biography_Bios
#------------------------------------------------------------------------------
# This message window is used to display text
#==============================================================================

class Window_Biography_Bios < Window_Base
def initialize()
super((Graphics.width * 0.5), 0, (Graphics.width * 0.5), (Graphics.height * 0.7))
draw_bios()
end

def draw_bios()

end
end

#==============================================================================
# ** Window_Biography_CGS
#------------------------------------------------------------------------------
# This message window is used to display text
#==============================================================================

class Window_Biography_CGS < Window_Base
def initialize()
super(0, (Graphics.height * 0.7), Graphics.width, (Graphics.height * 0.3))
draw_bios()
end

def draw_bios()

end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system data. It saves the disable state of saving and
# menus. Instances of this class are referenced by $game_system.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :yukia
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias vg14_gamesystem_biography_initialize_435r initialize
#--------------------------------------------------------------------------
def initialize
vg14_gamesystem_biography_initialize_435r # Call original method


end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter

end


VianoceGames
Pages: 1