[VXA] SCRIPTING PROBLEM: TITLE

Posts

Pages: 1
Adon237
if i had an allowance, i would give it to rmn
1743
Here's the deal: I am currently re-converting a script from VX to Ace because I lost data, and I have been very successful so far, and when I thought I was finished, I tested and I ran into two problems:
• The window and text that accompanies it does not disappear like I hoped it would(so there is a window hovering above where I put the graphics)
• The move order is all out of wack, it seems to randomly alternate between New Game, Continue Game, or Exit.

This script has graphics that it requires, it is very similar to the HK Advance Title screen script I posted here for VX, but you really won't be able to use trial and error as fast as you like. I think the randomly altering choice is a math error on my part, and there is possibly a lot of not needed code, but I imagine this is on the simple side to fix. (i am not really a good scripter, or even a scripter, i am editing stuff for personal use that is about it)
Here is the script as it currently stands:

#======================================================#
# Adon's Sexy Title Screen for StOnEsEaRcH.
# Feel free to steal this.
#======================================================#

$TITLE_MENU_X = 185 # Your Title Menu X Position
$TITLE_MENU_Y = 260 # Your Title Menu Y Position
$LOGO_X = 0 # Your Logo X Position
$LOGO_Y = -100 # Your Logo Y Position
$SPARK_COUNT = 350 # SPARK COUNT: Frames Before the Spark Appears again
$SPARK_SPEED = 10 # The Speed of the Sparks
$MENU_NEW = 260 # THE Y Position of the Cursor if NEW GAME
$MENU_CONTINUE = 305 # THE Y Position of the Cursor if CONTINUE
$MENU_EXIT = 345 # THE Y Position of the Cursor if EXIT
$SYMBOL_SPEED = 1
# SPEED OF VARIOUS SPARKLES
$sparklespeed1 = 0
$sparklespeed2 = 0
$sparklespeed3 = 0
$sparklespeed4 = 0
$sparklespeed5 = 0
$specspeed = 0
# END
$sparklerandom1 = 0
$sparklerandom2 = 0
$sparklerandom3 = 0
$sparklerandom4 = 0
$sparklerandom5 = 0
$specrandom = 0
$sparklefade = 0
$wavecount = 300
$waveswitch = 0
$flashcount = 0
#DONT EDIT BELOW
$titleloop = 1
$SYMBOL_RESET = false


#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================

class Scene_Title < Scene_Base


#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
SceneManager.clear
Graphics.freeze
create_background
create_foreground
create_command_window
play_title_music
end
#--------------------------------------------------------------------------
# * Get Transition Speed
#--------------------------------------------------------------------------
def transition_speed
return 20
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
SceneManager.snapshot_for_background
dispose_background
dispose_foreground
end
#--------------------------------------------------------------------------
# * Create Background
#--------------------------------------------------------------------------
def create_background
@sprite1 = Sprite.new
@sprite1.bitmap = Cache.title1($data_system.title1_name)
@sprite2 = Sprite.new
@sprite2.bitmap = Cache.title2($data_system.title2_name)
center_sprite(@sprite1)
center_sprite(@sprite2)
@viewport1 = Viewport.new(0, 0, 1288, 891)
@viewport2 = Viewport.new(0, 0, 824, 480)
# ADON.NEW = Viewport 3-4, back, and wavetitle
@viewport3 = Viewport.new(0,0,1288,891)
@viewport4 = Viewport.new(0,0,1288,891)
@viewport5 = Viewport.new(0, 0, 544, 416)
@viewport6 = Viewport.new(0, 0, 544, 416)
@back = Plane.new(@viewport3)
@back.bitmap = Cache.system("Title")
@back.opacity = 175
@wavetitle = Sprite.new(@viewport4)
@wavetitle.bitmap = Cache.picture("FOG")
@wavetitle.oy = 371
@wavetitle.ox = 100
@wavetitle.wave_amp = 50
@wavetitle.wave_length = 440
@wavetitle.wave_speed = 1250
@wavetitle.opacity = 50
@wavetitle.z = 5
@sprite = Plane.new(@viewport1)
@sprite.bitmap = Cache.system("TitleBGLoop")
@sprite.oy = 371
@sprite.ox = 100
@sprite.z = -100
@sprite.opacity = 100
@wave = Sprite.new(@viewport1)
@wave.bitmap = Cache.system("TitleBGSprite")
@wave.oy = 371
@wave.ox = 100
@wave.wave_amp = 50
@wave.wave_length = 440
@wave.wave_speed = 1250
@wave.opacity = 125
@wave.z = 5
@logo = Sprite.new
@logo.bitmap = Cache.system("TitleLogo")
@logo.x = $LOGO_X
@logo.y = $LOGO_Y
@logo.z = 10
@dislogo = Sprite.new
@dislogo.bitmap = Cache.system("TitleLogo")
@dislogo.wave_amp = 2
@dislogo.wave_length = 5
@dislogo.wave_speed = 50
@dislogo.opacity = 155
@dislogo.x = $LOGO_X
@dislogo.y = $LOGO_Y
@dislogo.z = 5
@menu01 = Sprite.new
@menu01.bitmap = Cache.system("TitleMenu01")
@menu01.x = $TITLE_MENU_X
@menu01.y = $TITLE_MENU_Y
@menu02 = Sprite.new
@menu02.bitmap = Cache.system("TitleMenu02")
@menu02.x = $TITLE_MENU_X
@menu02.y = $TITLE_MENU_Y
@menu02.opacity = 0
@menu03 = Sprite.new
@menu03.bitmap = Cache.system("TitleMenu03")
@menu03.x = $TITLE_MENU_X
@menu03.y = $TITLE_MENU_Y
@menu03.opacity = 0
@cursor = Sprite.new
@cursor.bitmap = Cache.system("TitleCursor")
@cursor.x = $TITLE_MENU_X
@cursor.y = $TITLE_MENU_Y
@cursor.z = 12
@strike1 = Sprite.new
@strike1.bitmap = Cache.system("TitleCursorStrike01")
@strike1.x = 0
@strike1.y = 300
@strike1.z = 9
@strike2 = Sprite.new
@strike2.bitmap = Cache.system("TitleCursorStrike02")
@strike2.x = 308
@strike2.y = 300
@strike2.z = 9
@sparkle1 = Plane.new(@viewport5)
@sparkle1.bitmap = Cache.system("Title-Sparkle01")
@sparkle1.blend_type = 1
@sparkle1.opacity = 95
@sparkle2 = Plane.new(@viewport5) #Sparkles Behind
@sparkle2.bitmap = Cache.system("Title-Sparkle02")
@sparkle2.blend_type = 1
@sparkle2.opacity = 100
@sparkle3 = Plane.new(@viewport6)
@sparkle3.bitmap = Cache.system("Title-Sparkle03")
@sparkle3.blend_type = 1
@sparkle3.opacity = 215
@sparkle4 = Plane.new(@viewport5)
@sparkle4.bitmap = Cache.system("Title-Sparkle02")
@sparkle4.blend_type = 1
@sparkle4.opacity = 95
@sparkle5 = Plane.new(@viewport5)
@sparkle5.bitmap = Cache.system("Title-Sparkle04")
@sparkle5.blend_type = 1
@sparkle5.opacity = 115
@symbol = Plane.new(@viewport3)
@symbol.bitmap = Cache.system("TitleSymbol")
@symbol.oy = 403
@symbol.ox = 100
@spark01 = Sprite.new
@spark01.bitmap = Cache.system("TitleSpark01")
@spark01.y = 280
@spark01.x = -172
@spark01.z = 12
@spark02 = Sprite.new
@spark02.bitmap = Cache.system("TitleSpark02")
@spark02.y = 300
@spark02.x = 640
@spark02.z = 12
@menu01.z = @menu02.z = @menu03.z = 13
# if @continue_enabled
# @menu01.opacity = 0
# @menu02.opacity = 255
# @cursor.y = 345
# @strike1.y = 345
# @strike2.y = 345
# @symbol.oy = 358
# above: i have no idea what the hell this is even doing here
end
#--------------------------------------------------------------------------
# * Draw Game Title
#--------------------------------------------------------------------------
def draw_game_title
@background_sprite.bitmap.font.size = 48
rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
@background_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
end
#--------------------------------------------------------------------------
# * Free Background
#--------------------------------------------------------------------------
def dispose_background
@sprite1.bitmap.dispose
@sprite1.dispose
@sprite2.bitmap.dispose
@sprite2.dispose
@wave.dispose
@logo.dispose
@wavetitle.dispose
@back.dispose
@menu01.dispose
@menu02.dispose
@menu03.dispose
@sparkle1.dispose
@sparkle2.dispose
@sparkle3.dispose
@sparkle4.dispose
@sparkle5.dispose
@cursor.dispose
@strike1.dispose
@strike2.dispose
@symbol.dispose
@spark01.dispose
@spark02.dispose
@wave.bitmap.dispose
@logo.bitmap.dispose
@dislogo.bitmap.dispose
@menu01.bitmap.dispose
@menu02.bitmap.dispose
@menu03.bitmap.dispose
@cursor.bitmap.dispose
@strike1.bitmap.dispose
@strike2.bitmap.dispose
@spark01.bitmap.dispose
@spark02.bitmap.dispose
end

def update
super
# LOGO WAVE EFFECT
@dislogo.update
if $wavecount == 300
if $waveswitch == 0 && @dislogo.opacity != 155
@dislogo.opacity += 1
elsif $waveswitch == 0 && @dislogo.opacity >= 155
$waveswitch = 1
end
if $waveswitch == 1 && @dislogo.opacity != 0
@dislogo.opacity -= 1
elsif $waveswitch == 1 && @dislogo.opacity == 0
$wavecount = 0
$waveswitch = 0
end
else
$wavecount += 1
end

# SPARKLE ANIMATION
if $sparklespeed1 == 5
@sparkle1.oy += 1
$sparklespeed1 = 0
$sparklerandom1 = rand(100)
case $sparklerandom1
when 0..35
@sparkle1.ox += 1
when 36..70
@sparkle1.ox -= 1
end
else
$sparklespeed1 += 1
end
if $sparklespeed2 == 4
@sparkle2.oy += 2
$sparklespeed2 = 0
$sparklerandom2 = rand(100)
case $sparklerandom2
when 0..99
@sparkle2.ox += 1
end
else
$sparklespeed2 += 1
end
if $sparklespeed3 == 2
@sparkle3.oy += 1
$sparklespeed3 = 0
$sparklerandom3 = rand(100)
case $sparklerandom3
when 0..99
@sparkle3.ox -= 1
end
else
$sparklespeed3 += 1
end
if $sparklespeed4 == 10
@sparkle4.oy += 1
$sparklespeed4 = 0
$sparklerandom4 = rand(100)
case $sparklerandom4
when 0..99
@sparkle4.ox -= 1
end
else
$sparklespeed4 += 1
end
if $sparklespeed5 == 10
@sparkle5.oy += 1
$sparklespeed5 = 0
$sparklerandom5 = rand(100)
case $sparklerandom5
when 0..99
@sparkle5.ox -= 1
end
else
$sparklespeed5 += 1
end
if $sparklefade == 200 && $sparklefadeswitch == false
if @sparkle4.opacity != 0
@sparkle4.opacity -= 1
else
$sparklefade = 0
$sparklefadeswitch = true
end
elsif $sparklefade == 200 && $sparklefadeswitch == true
if @sparkle4.opacity != 255
@sparkle4.opacity += 1
else
$sparklefade = 0
$sparklefadeswitch = false
end
else
$sparklefade += 1
end
#=======Wave Animation=========
@wave.update
@wavetitle.update
#=======Symbol Animation=========
@symbol.ox -= $SYMBOL_SPEED
if $SYMBOL_RESET == true && @symbol.opacity == 0
$SYMBOL_RESET = false
elsif @symbol.opacity != 255
@symbol.opacity += 3
end
#=======Spark Animation========
@spark01.x += $SPARK_SPEED
@spark02.x -= $SPARK_SPEED
if $SPARK_COUNT != 0
$SPARK_COUNT -= 1
else
$SPARK_COUNT = 350
@spark01.x = -172
@spark02.x = 544
end
if @spark01.opacity != 255
@spark01.opacity += 20
@spark02.opacity += 20
end
#=======Background Animation=========
if @sprite.oy != 0
@sprite.oy -= 1
elsif @sprite.oy == 0
@sprite.ox += 1
end
if @wave.oy != 0
@wave.oy -= 1
elsif @wave.oy == 0
if $TITLE_LOOP == 1 && @wave.ox != 1289
@wave.ox += 1
else
$TITLE_LOOP == 2
end
if $TITLE_LOOP == 2 && @wave.ox != -1189
@wave.ox -= 1
else
$TITLE_LOOP == 1
end
end
if @wavetitle.oy != 0
@wavetitle.oy -= 1
elsif @wavetitle.oy == 0
if $TITLE_LOOP2 == 1 && @wavetitle.ox != 1289
@wavetitle.ox += 1
else
$TITLE_LOOP2 == 2
end
if $TITLE_LOOP2 == 2 && @wavetitle.ox != -1189
@wavetitle.ox -= 1
else
$TITLE_LOOP2 == 1
end
end
#=======Menu Animation=========
case @command_window.index
when 0
@spark01.y = $MENU_NEW - 20
@spark02.y = $MENU_NEW
@symbol.oy = $MENU_NEW + 183
@strike1.y = $MENU_NEW
@strike2.y = $MENU_NEW
if @menu01.opacity != 255
@menu01.opacity += 20
@menu02.opacity -= 20
@menu03.opacity -= 20
end
if @cursor.y != $TITLE_MENU_Y
@cursor.y -= 5
end
when 1
@spark01.y = $MENU_CONTINUE - 20
@spark02.y = $MENU_CONTINUE
@symbol.oy = $MENU_CONTINUE + 93
@strike1.y = $MENU_CONTINUE
@strike2.y = $MENU_CONTINUE
if @menu02.opacity != 255
@menu02.opacity += 20
@menu01.opacity -= 20
@menu03.opacity -= 20
end
if @cursor.y != $MENU_CONTINUE && @cursor.y < $MENU_CONTINUE
@cursor.y += 5
elsif @cursor.y != $MENU_CONTINUE && @cursor.y > $MENU_CONTINUE
@cursor.y -= 5
end
when 2
@spark01.y = $MENU_EXIT - 20
@spark02.y = $MENU_EXIT
@symbol.oy = $MENU_EXIT + 13
@strike1.y = $MENU_EXIT
@strike2.y = $MENU_EXIT
if @menu03.opacity != 255
@menu03.opacity += 20
@menu02.opacity -= 20
@menu01.opacity -= 20
end
if @cursor.y != $MENU_EXIT
@cursor.y += 5
end
end
@command_window.update
#=======Cursor Animation=========
if @strike1.x != 0
@strike1.x += 11
end
if @strike2.x != 308
@strike2.x -= 12
end
if Input.trigger?(Input::C)
case @command_window.index
when 0 #New game
command_new_game
when 1 # Continue
command_continue
when 2 # Shutdown
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# * Move Sprite to Screen Center
#--------------------------------------------------------------------------
def center_sprite(sprite)
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_TitleCommand.new
@command_window.set_handler(:new_game, method(:command_new_game))
@command_window.set_handler(:continue, method(:command_continue))
@command_window.set_handler(:shutdown, method(:command_shutdown))
end
#--------------------------------------------------------------------------
# * Close Command Window
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
update until @command_window.close?
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command_new_game
Graphics.wait(30)
Audio.se_play("Audio/SE/Justin - VA Title", 100, 100)
DataManager.setup_new_game
close_command_window
fadeout_all
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command_continue
close_command_window
SceneManager.call(Scene_Load)
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
close_command_window
fadeout_all
SceneManager.exit
end
#--------------------------------------------------------------------------
# * Play Title Screen Music
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
end


Any help on this issue is appreciated.
Adon237
if i had an allowance, i would give it to rmn
1743
Hmm, nobody wants to help with this issue?

I will bump this thread in the hopes that it will get me some help.
Does either VX or Ace support Arrays in their scripts? Because that would vastly improve this script.
Marrend
Guardian of the Description Thread
21781
author=FlyingJester
Does either VX or Ace support Arrays in their scripts? Because that would vastly improve this script.

# Snippet from a common event.
$game_variables[1] = $game_actors[1].tp * $game_actors[1].mhp / 100
$game_variables[1] = $game_variables[1].truncate

Yeah, I'm pretty sure they support arrays!
Adon237
if i had an allowance, i would give it to rmn
1743
There is a truncate function? :O

Anyway, is there a command already supported in rgss3 that deletes a window? Would that be an inefficient way to do this?
Marrend
Guardian of the Description Thread
21781
author=Adon237
There is a truncate function? :O

Anyway, is there a command already supported in rgss3 that deletes a window? Would that be an inefficient way to do this?


I would look at Window_Base's code to see if there's anything like that there. Like, I dunno, the "dispose" function? Would that work?
Pages: 1