Multiple Starting Points

View previous topic View next topic Go down

Multiple Starting Points

Post  Fantasist on Tue Jan 22, 2008 8:06 pm

Multiple Starting Points
Version: 1.0
Type: Game mode enhancement



Introduction

When 'New Game' option is selected, a new sub-menu is opened, where the player can choose from different modes. Each mode starts in a different map.


Features


  • Different modes allow the player to start the game from different locations/maps
  • Smooth fade effect when switching to modes window



Screenshots

Just try it out, It comes with example config (starts the game in the same map at 2 differet positions).


Demo

On demand. (please respect my laziness )


Script

Place this script above 'Main'. If you're using any other scripts, all of them should come BELOW this script.
Code:

#============================================================================
# ** Multiple Starting Points
#----------------------------------------------------------------------------
# by Fantasist
# Version 1.0
# 4-Jan-2008
#----------------------------------------------------------------------------
#Version History:
#
# 1.0 - The first release
#----------------------------------------------------------------------------
#Description:
#          When 'New Game' option is selected, a new sub-menu is
# opened, where the player can chose from different modes. Each
# mode starts in a different map.
#----------------------------------------------------------------------------
#Compatibility:
#          There might be issues with other scripts which tamper
# Scene_Title. This script should be placed ABOVE any other
# custom scripts if used.
#----------------------------------------------------------------------------
#Instructions:
#          Place this script above 'Main'. If you're using any other
# scripts, all of them should come BELOW this script.
#----------------------------------------------------------------------------
# Configuration:
# You should include all the required modes in the array GameModes.
# For example, if you want 2 modes, it would look like this:
#          GameModes = ['Mode1', 'Mode2']
# where Mode1 and Mode2 are the names of the modes.
#
# For each mode, you should specify the IDs of the maps in which
# they start. For the above example,
#          MapIDs = [2, 3]
# would start Mode1 in map 2 and Mode2 in map 3.
#
# For each mode, you should set the starting point on the map.
# This is similar to 'Set Start Position' command. To know the
# coordinates, go to the required map and use the event command
# 'Teleport'. After chosing the start position on the required map,
# two numbers will be displayed on the top-right corner of the
# window. These numbers are your starting positions. In our
# example, if the starting position of Mode1 is 6, 7 and starting
# position for Mode2 is 0, 1, it would be like this:
#        MapPos = [ [6, 7], [0, 1] ]
#
GameModes = ['Mode1', 'Mode2']
MapIDs = [1, 1]
MapPos = [ [6, 7], [0, 1] ]
#----------------------------------------------------------------------------
#Issues:
# - DO NOT leave the above three arrays empty (none should be []).
#  Just don't use this script if you want to disable it, this won't work
#  with 0 modes.
# - Number of allowed modes is unlimited, but the commamd
#  window will extend beyond the screen, so the player can't see
#  some modes. This will be corrected in the next version
#----------------------------------------------------------------------------
#Credits and Thanks:
#  Credit me (Fantasist) for making this, IF you want to. Credit is
#  not a cumpulsion.
#----------------------------------------------------------------------------
#Notes:
#    If you have a problem or suggestion, you can find me at
#    www.chaosproject.co.nr
#    Enjoy ^_^
#============================================================================

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title
 
 def main
  if $BTEST
    battle_test
    return
  end
  $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')
  $game_system = Game_System.new
  @sprite = Sprite.new
  @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  s1 = 'New Game'
  s2 = 'Continue'
  s3 = 'Shutdown'
  @command_window = Window_Command.new(192, [s1, s2, s3])
  @command_window.back_opacity = 160
  @command_window.x = 320 - @command_window.width / 2
  @command_window.y = 288
  @continue_enabled = (0..3).any? {|i| FileTest.exist?("Save#{i + 1}.rxdata")}
  if @continue_enabled
    @command_window.index = 1
  else
    @command_window.disable_item(1)
  end
  @mode_win = Window_Command.new(192, GameModes)
  @mode_win.back_opacity = 160
  @mode_win.x, @mode_win.y = 320 - @mode_win.width / 2, 288
  @mode_win.active = @mode_win.visible = false
  $game_system.bgm_play($data_system.title_bgm)
  Audio.me_stop
  Audio.bgs_stop
  Graphics.transition
  loop {
    Graphics.update
    Input.update
    update
    if $scene != self
      break
    end
  }
  Graphics.freeze
  @command_window.dispose
  @mode_win.dispose
  @sprite.bitmap.dispose
  @sprite.dispose
 end
 
 def update
  if @command_window.active
    update_command
    return
  end
  if @mode_win.active
    update_mode
    return
  end
 end
 
 def update_command
  @command_window.update
  if Input.trigger?(Input::C)
    case @command_window.index
    when 0
      Graphics.freeze
      @command_window.visible = @command_window.active = false
      @mode_win.active = @mode_win.visible = true
      Graphics.transition(5)
    when 1
      command_continue
    when 2
      command_shutdown
    end
  end
 end
 
 def update_mode
  @mode_win.update
  if Input.trigger?(Input::C)
    i = @mode_win.index
    start(MapIDs[i], MapPos[i][0], MapPos[i][1])
  elsif Input.trigger?(Input::B)
    Graphics.freeze
    @mode_win.visible = @mode_win.active = false
    @command_window.active = @command_window.visible = true
    Graphics.transition(5)
  end
 end
 
 def start(id, x, y)
  $game_system.se_play($data_system.decision_se)
  Audio.bgm_stop
  Graphics.frame_count = 0
  $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
  $game_party.setup_starting_members
  $game_map.setup(id)
  $game_player.moveto(x, y)
  $game_player.refresh
  $game_map.autoplay
  $game_map.update
  $scene = Scene_Map.new
 end
 
end


Instructions

You should include all the required modes in the array GameModes.
For example, if you want 2 modes, it would look like this:
GameModes = ['Mode1', 'Mode2']
where Mode1 and Mode2 are the names of the modes.

For each mode, you should specify the IDs of the maps in which
they start. For the above example,
MapIDs = [2, 3]
would start Mode1 in map 2 and Mode2 in map 3.

For each mode, you should set the starting point on the map.
This is similar to 'Set Start Position' command. To know the
coordinates, go to the required map and use the event command
'Teleport'. After chosing the start position on the required map,
two numbers will be displayed on the top-right corner of the
window. These numbers are your starting positions. In our
example, if the starting position of Mode1 is 6, 7 and starting
position for Mode2 is 0, 1, it would be like this:
MapPos = [ [6, 7], [0, 1] ]


Issues

  • DO NOT leave the above three arrays empty (none should be []). Just don't use this script if you want to disable it, this won't work with 0 modes.
  • Number of allowed modes is unlimited, but the commamd window will extend beyond the screen, so the player can't see some modes. This will be corrected in the next version.



Compatibility

There might be issues with other scripts which tamper Scene_Title. This script should be placed ABOVE any other custom scripts if used.


Credits and Thanks

Credit me (Fantasist) for making this, IF you want to. Credit is not a cumpulsion.



Author's Notes

This can be very easily done with events, but for those who wanted the mode selection in the title screen, this is the script. If you have suggestions or problems, you can find me at the forums in my website
http://quantumcore.110mb.com

Enjoy ^_^

Fantasist
Admin

Posts : 53
Join date : 2008-01-13

View user profile http://quantumcore.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum