[XP] Maps before title

Started by Valdred, April 02, 2010, 12:35:08 pm

Previous topic - Next topic

Valdred

April 02, 2010, 12:35:08 pm Last Edit: April 08, 2010, 05:09:04 pm by game_guy
Pre-title map(s)
Authors: Valdred
Version: 2.0
Type: Execute selected maps before the title screen
Key Term: Misc add-on



Introduction
Many people have requested a way to have one or more maps executed before the title screen so I decided to make this.
I guess it's mainly for cutscenes and stuff but it can be used for gameplay as well.


Features


  • Fully featured maps before the title screen, made and set up just like other maps.
  • Easy to use, I guess



Screenshots
The maps would look just like ordinary maps, no need for screenshots.




Script

Spoiler: ShowHide

#==============================================================================
# ** Maps before title
#------------------------------------------------------------------------------
#  By Valdred
#------------------------------------------------------------------------------
# Having problems? Go to chaos-project.org or rmvxp.com
#==============================================================================
module Starting_Config  #Set up players starting position BEFORE the title screen

 Starting_map = 6   # id of starting map.  
 Starting_x   = 7    # x-starting cordinate.
 Starting_y   = 7    # y-starting cordinate.
 
 First_time_Only        = true # Takes you to title if save file exist
 
end
#===============================================================================
# * Main Script
#===============================================================================


class Interpreter
 
 def finish
$scene = Scene_Title.new
 end
end

class Scene_Title
 alias maps_before_title main
 def main
   # call battle test
   if $BTEST
       battle_test
       return
     end
   if Starting_Config::First_time_Only
     (0..3).each { |i|
     if FileTest.exist?("Save#{i+1}.rxdata")
       @continue_enabled = true
     end}
   end
   if @continue_enabled
     maps_before_title
   elsif $maps_before_title_switch
     maps_before_title
   else
   # 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 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(Starting_Config::Starting_map)
   # Move player to initial position
   $game_player.moveto(Starting_Config::Starting_x, Starting_Config::Starting_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
   # Turns swith on
   $maps_before_title_switch = true
   # Sends you to the map
   $scene = Scene_Map.new
   end
 end
end

   


Insert above main.


Instructions
1. Put player starting position (you know, the square with an 's' inside) where you want the player to start after the title screen.

2. Near the top of the script, you will find a configuration section.
  Change '$starting_map' to the ID of the map you want the player to start at before the title. (the upper one of your maps got ID 1, the one bellow is ID 2 etc.) then change $starting_x and $starting_y
  to the players starting position on the map. (to find out the cordinates of a spot, go to events-layer and click the spot. The cordinates    will be in the bottom right of the editor)

3. When you want to proceed to the title screen. Use a 'script' event with this code:
finish





Compatibility

Will probably not work with some scripts editing the title screen. That's all, I think.


Credits and Thanks


  • Valdred for writing it
  • Nathmatt for optimizing the code and adding a nice feature.
  • Skaraflame and others for requesting it



Author's Notes
If you need help just tell, also if anyone feels like optimizing the script, just do it.

skaraflame

Awesome Script, now Masamune will make sense XD

Tyril132

Nice work, quick, simple and easy to use.

I just have one question... is "finnish" misspelled intentionally in both the script and instructions, or was that an accidental oversight? I noticed it actually defines "finnish" in the script. It might be better to clear this up now to avoid potential confusion.
Lv. 7 Writer | Lv. 7 Composer | Lv. 7 Mapper | Lv. 4 Eventer | Lv. 0 Scripter | Lv. 1 Spriter
DSC Project Soundtrack
Personality Index:: ShowHide

Subsonic_Noise

This script is just what I needed, thanks + level up!
Just one flaw.. 'finnish' (I don't know what the finnish have to do with this) somehow doesn't send me to the menu, but to the first map. I'll be able to fix that if you don't, though.

Jackolas

I'm sure I made something like this (and probably some other persons also made it) in the script request section.

anyway. nice simple and short script:P

Valdred

April 02, 2010, 02:34:26 pm #5 Last Edit: April 02, 2010, 02:39:53 pm by Valdred
Just my bad spelling, sorry guys. I'll fix it. I'll fix the other bug too. It's just me being stupid  :^_^':

EDIT: Fixed. Something that sucks with the current version is that no matter what you do, the starting map will be executed every time you open the game, most people will probably prefer if it's only executing first time. Next version, which will be coming up soon, will include an option to switch between "always" and "First time"

Subsonic_Noise

Quote from: Valdred on April 02, 2010, 02:34:26 pm
Just my bad spelling, sorry guys. I'll fix it. I'll fix the other bug too. It's just me being stupid  :^_^':

EDIT: Fixed. Something that sucks with the current version is that no matter what you do, the starting map will be executed every time you open the game, most people will probably prefer if it's only executing first time. Next version, which will be coming up soon, will include an option to switch between "always" and "First time"

Well, I'd suggest just to have a paralell process that checks if the enter button / any other button is pressed, and if it is, it will execute "finish" and thus skip the intro.

Valdred

For now, that's a good idea. But I still think I'll add the feature in the next version. (and also a skip feature, thanks for the idea  :))
In my opinion. The less the user has to do, the better.

Subsonic_Noise

Quote from: Valdred on April 02, 2010, 03:09:30 pm
In my opinion. The less the user has to do, the better.

Absolutely!

nathmatt

was bored so here added the option for title to be called if there is a save file and where you call title through normal event call

if you alias Scene_Title there is no need to make a Scene_Title2

also if you have any questions on what i did feel free to pm me

Spoiler: ShowHide
module Valdred_Config

  Starting_map = 1    # id of starting map.
  Starting_x   = 7    # x-starting cordinate.
  Starting_y   = 7    # y-starting cordinate.
  Title        = true # Takes you to title if save file exist
 
end



class Scene_Title
  alias maps_before_title main
  def main
    # call battle test
    if $BTEST
        battle_test
        return
      end
    if Valdred_Config::Title
      (0..3).each { |i|
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end}
    end
    if @continue_enabled
      maps_before_title
    elsif $maps_before_title_switch
      maps_before_title
    else
    # 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 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(Valdred_Config::Starting_map)
    # Move player to initial position
    $game_player.moveto(Valdred_Config::Starting_x, Valdred_Config::Starting_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
    # Turns swith on
    $maps_before_title_switch = true
    # Sends you to the map
    $scene = Scene_Map.new
    end
  end
end
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Ganstaquay5000

This is great because I wanted to have a quick scene occur before the title and now I can.


Come see the revival of a 2 year old project become the next big Rpg game.
Project Destiny Calls
Project: Destiny Calls Youtube Channel

Alton Wyte

After I put this in I made a map for a scene and it uses switches in it but everywhere a switch is used the game acts like the switch is always on.

Valdred

If you turn on a switch, it will stay on until you turn it off. No matter what map they were used in.

Alton Wyte

No I know that I mean that the switches start out on on that map only; BEFORE I turn it on.

Valdred

The switches is on by default? strange, but it can't be this script I think. This script doesn't do anything with $game_switches.
What other scripts are you using?

ForeverZer0

Not really my place to tell you, but the [XP] tag is on the wrong side of the subject title. That has to be right before it can be moved to the database.

Good job on the script, though.  :naughty:
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Valdred


Graton

January 14, 2017, 08:24:46 am #17 Last Edit: January 14, 2017, 03:18:30 pm by ForeverZer0
Hey It is Not Working!!! :\'( :\'( :\'( :\'( :\'( :\'(

EDIT: Please do not double-post within a 24 hour period, thank you.  - Staff
||            ||______)||               ||-----\           
||______||______  ||               ||        |
||______||______) ||              ||____/
||            ||______   ||_______||
||            ||______)  ||______)||