Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Simple Title Script

Status
Not open for further replies.
Hi guys. This is pretty simple, and it makes me look stupid because I know nothing about scripting (I've tried, trust me).
Anyway, what I'm trying to do is trying to customize the title screen and remove the window and just use a cursor. Pretty simple, I don't know how else to put it. Take your time, I'm in no rush if you're willing to do this.
Title:
http://www.freewebs.com/heavensbreach/Title.png[/IMG]
Cursor:
http://www.videogamesprites.net/FinalFantasy4/Objects/Hand%20Cursor.gif[/img]

I'll give credit if you wish.
Thanks in advance.
 
Ok...you can try this.

Code:
#==============================================================================
# Custom Title Screen ver. 1.01
# Script by Paradog Rewritten By Trickster
# http://rpg.para.s3p.net/
#==============================================================================
#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log("Custom Title Screen", "Paradog/Trickster", 1.01, "3.5.07")

#--------------------------------------------------------------------------
# * Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1,2,3,4])

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?("Custom Title Screen")
  
module Para_Title
  #--------------------------------------------------------------------------
  # * Image Menu
  #   - Use Images Instead of a Command Window
  #--------------------------------------------------------------------------
  Image_Menu = true
  #--------------------------------------------------------------------------
  # * Transparent Command Window
  #--------------------------------------------------------------------------
  Transparent = false
  #--------------------------------------------------------------------------
  # * Window Background Opacity
  #--------------------------------------------------------------------------
  Opacity = 160
  #--------------------------------------------------------------------------
  # * Horizontal Command Window Alignment
  #   - set to 0 to override with Position Value
  #   - 1 left 2 center 3 right
  #--------------------------------------------------------------------------
  Horizontal_Align = 2
  #--------------------------------------------------------------------------
  # * Vertical Alignment
  #   - set to 0 to override with Position Value 
  #   - 1 left 2 center 3 right
  #--------------------------------------------------------------------------
  Vertical_Align = 0
  #--------------------------------------------------------------------------
  # * Command Window Position
  #   - x, y
  #--------------------------------------------------------------------------
  Position = 0, 288
  #--------------------------------------------------------------------------
  # * New Game Image Sprite
  #   - Located in Graphics/Titles
  #--------------------------------------------------------------------------
  NewGame = 'newgame', 'newgame_active'
  #--------------------------------------------------------------------------
  # * New Game Position
  #--------------------------------------------------------------------------
  NewGame_Position = 210, 260
  #--------------------------------------------------------------------------
  # * Load Image Sprite
  #   - Located in Graphics/Titles
  #--------------------------------------------------------------------------
  Load = 'continue', 'continue_active'
  #--------------------------------------------------------------------------
  # * Load Position
  #--------------------------------------------------------------------------
  Load_Position = 250, 300
  #--------------------------------------------------------------------------
  # * End Game Image Sprite
  #   - Located in Graphics/Titles
  #--------------------------------------------------------------------------
  End  = 'shutdown', 'shutdown_active'
  #--------------------------------------------------------------------------
  # * End Position
  #--------------------------------------------------------------------------
  End_Position = 290, 340
  #--------------------------------------------------------------------------
  # * Blend Type for Sprites
  #   - 0 normal 1 add 2 subtract
  #--------------------------------------------------------------------------
  Blend_Type = 0
end

class Scene_Title
  #--------------------------------------------------------------------------
  # * Main Sprite
  #--------------------------------------------------------------------------
  alias_method :para_custom_title_main_sprite, :main_sprite
  def main_sprite
    # The Usual
    para_custom_title_main_sprite
    # New Game Sprite
    @sprite_newgame = Sprite.new
    @sprite_newgame.blend_type = Para_Title::Blend_Type
    @sprite_newgame.bitmap = RPG::Cache.title(Para_Title::NewGame[0])
    @sprite_newgame.x, @sprite_newgame.y = Para_Title::NewGame_Position
    # Load Sprite
    @sprite_load = Sprite.new
    @sprite_load.blend_type = Para_Title::Blend_Type
    @sprite_load.bitmap = RPG::Cache.title(Para_Title::Load[0])
    @sprite_load.x, @sprite_load.y = Para_Title::Load_Position
    # End Sprite
    @sprite_end = Sprite.new
    @sprite_end.blend_type = Para_Title::Blend_Type
    @sprite_end.bitmap = RPG::Cache.title(Para_Title::End[0])
    @sprite_end.x, @sprite_end.y = Para_Title::End_Position
  end
  #--------------------------------------------------------------------------
  # * Main Window
  #--------------------------------------------------------------------------
  alias_method :para_custom_title_main_window, :main_window
  def main_window
    # The Usual
    para_custom_title_main_window
    # If Transparent Window Option
    if Para_Title::Transparent
      # Window Transparent
      @command_window.opacity = 0
    else
      # Set Back Opacity to Defined Value
      @command_window.back_opacity = Para_Title::Opacity
    end
    # Branch By Window Align
    case Para_Title::Horizontal_Align
    when 0
      @command_window.x = Para_Title::Position[0]
    when 1
      @command_window.x = 0
    when 2
      @command_window.x = (640 - @command_window.width) / 2
    when 3
      @command_window.x = 640 - @command_window.width
    end
    # Branch By Window Vertical Align
    case Para_Title::Vertical_Align
    when 0
      @command_window.y = Para_Title::Position[1]
    when 1
      @command_window.y = 0
    when 2
      @command_window.y = (480 - @command_window.height) / 2
    when 3
      @command_window.y = 480 - @command_window.height
    end
    # Return if not image menu
    return if not Para_Title::Image_Menu
    # Set Command Window Invisible
    @command_window.visible = false
    # If Continue Enabled
    if @continue_enabled
      # Load Bitmap
      @sprite_load.bitmap = RPG::Cache.title(Para_Title::Load[1])
    else
      # Set Load Opacity
      @sprite_load.opacity = 160
      @sprite_newgame.bitmap = RPG::Cache.title(Para_Title::NewGame[1])
    end
  end
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------
  alias_method :para_custom_title_update, :update
  def update
    # The Usual
    para_custom_title_update
    # Return if not image menu
    return if not Para_Title::Image_Menu
    # If Input
    if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
      # Reset All
      @sprite_newgame.bitmap = RPG::Cache.title(Para_Title::NewGame[0])
      @sprite_load.bitmap = RPG::Cache.title(Para_Title::Load[0])
      @sprite_end.bitmap = RPG::Cache.title(Para_Title::End[0])
      # Brach by command window
      case @command_window.index
      when 0 # new game
        @sprite_newgame.bitmap = RPG::Cache.title(Para_Title::NewGame[1])
      when 1 # load
        @sprite_load.bitmap = RPG::Cache.title(Para_Title::Load[1])
      when 2 # exit
        @sprite_end.bitmap = RPG::Cache.title(Para_Title::End[1])
      end
    end
  end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

But you have to create 6 images: the 3 options and the 3 option selected.

This is the result.
View attachment 1978

For the cursor, simply create the three "_active" pictures with the cursor. :)
 
umm...
damn...he won...
well..you can use mine if you want, just use the one you preffer.
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#==============================================================================

class Scene_Title
def cursor_move(cursor, cursor_x, cursor_y, speed, op_speed, max_opacity)
if cursor.x <= cursor_x
cursor.x += cursor.x + speed > cursor_x ? cursor_x - cursor.x : speed
else
cursor.x -= cursor.x - speed < cursor_x ? cursor.x - cursor_x : speed
end
if cursor.y <= cursor_y
cursor.y += cursor.y + speed > cursor_y ? cursor_y - cursor.y : speed
else
cursor.y -= cursor.y - speed < cursor_y ? cursor.y - cursor_y : speed
end

if cursor.opacity < max_opacity
cursor.opacity += cursor.opacity + op_speed < max_opacity ? op_speed : max_opacity - cursor.opacity
elsif cursor.opacity > max_opacity
cursor.opacity -= cursor.opacity - op_speed > max_opacity ? op_speed : cursor.opacity - max_opacity
end
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
@cursor = Sprite.new
@cursor.bitmap = RPG::Cache.title("Hand Cursor")
@cursor.y = 90
@cursor.x = 275
s1 = ""
s2 = ""
s3 = ""
@command_window = Window_Command.new(180, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
@command_window.windowskin = nil
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
@cursor.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@cursor_x = @cursor.x
if @cursor.y != 300 + (@command_window.index * 32)#350
@cursor_y = 300 + (@command_window.index * 32)
@cursor_x = 275 + (@command_window.index * 32)
cursor_move(@cursor, @cursor_x, @cursor_y, (@cursor_y - @cursor.y).abs / 2.5, 0, 255)
end
@cursor.z= 110
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 2 # Shutdown
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
end
it works just as you wanted, the only thing is that you must use a PNG image instead of a GIF. so use this:
http://i21.photobucket.com/albums/b295/ ... Cursor.png[/IMG]
o yeah...the cursor must be in titles folder

the one that WeissRaben posted works with SDK, mine doesn't
if you want to change the cursor speed movement
change this line
cursor_move(@cursor, @cursor_x, @cursor_y, (@cursor_y - @cursor.y).abs / 2.5, 0, 255)
the 2.5 change it, i fyou want it faster, move it to a lower number, and if you want itslower, change it a higher number

hope you like it
 
Thanks for taking the time for posting you guys. Both are great, but I use SDK so I'll stick with Weiss', but if you ever need anything Takneo, just let me know. ^^ Thank you.
Credit will be given.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top