03-09-2005, 01:00 PM
New Game + Script
by Deke
Mar 9 2005
Download the demo here:
New_Game__.exe (Size: 374.52 KB / Downloads: 3)
This script is by Deke. I only added one little feature and changed the title screen to something more normal.
I asked Deke if I could post his script here, and he said yes, so here goes this old but cool script !
This script allows you to do a new game + as in Chrono Trigger...
Instruction on how to use it will follow. First thing first, create a new script page just above MAIN (call it New_Game+) and paste that code in it (You will have to add another one after that.)
Now you need to completely replace your Scene_Title by this new code. If you have modified your scene_title already, back-up your scene, and re-add your modification into this new script. It will be a good scripting practice...
Code to add replacing the old Scene_Title:
Okay, to use this, you need to free up the game variable ID#1 and the switch ID#1. If you really cannot free them for the script, you will have to replace the ID# from within the script. To do so, search the following lines in the script:
And replace the ID# between [ ] by the ID# you wish to be using for the script.
Ok, now, in order to use this, all you need to do is when your game ends, whether during the ending story or after the boss is defeated, you must turn your switch TRUE and add 1 (+1) to your variable. After that, you must ask the player to save the game, it is recommended to open the save menu for him and tell him to save.
Then, after the game was completed, he can use the New Game + option from the title menu and continue a saved game from the beggining with all his items and powers, as in Chrono Trigger.
Have Fun !
by Deke
Mar 9 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Download the demo here:
New_Game__.exe (Size: 374.52 KB / Downloads: 3)
This script is by Deke. I only added one little feature and changed the title screen to something more normal.
I asked Deke if I could post his script here, and he said yes, so here goes this old but cool script !
This script allows you to do a new game + as in Chrono Trigger...
Instruction on how to use it will follow. First thing first, create a new script page just above MAIN (call it New_Game+) and paste that code in it (You will have to add another one after that.)
Code:
#==============================================================================
# ¦ Scene_New_Game_Plus (coded by Deke)
# This purpose of this class is to allow the player to restart the game using saved characters if
# they have completed the game with that party.
#---------------------------------------------------------------------------------------------------------------------------------------------
# A new feature (small one) was added by myself (Dubealex) to enable a
# count of the number of times you finished the game.
# Copy the lines between my comments and paste them in your original script,
# or simply use that full one.
class Scene_New_Game_Plus<Scene_Load
#--------------------------------------------------------------------
def initialize
#You need to add the following line:
@game_completion_count=0
#ENd of the line to copy.
$game_temp = Game_Temp.new
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
@help_text="Which adventure would you like to begin again"
end
#-----------------------------------------------------------------------------
#This method checks to see if the selected game file has completed the game.
# (A completed game is indicated by turning switch 1 ON.)
def game_completed(filename)
file = File.open(filename, "rb")
read_save_data(file)
file.close
return($game_switches[1])
end
#------------------------------------------------------------------------------
#This method is identical to the one of the same name in the Scene_Load class, with the
#the added effect of reseting the maps, switches,...
def on_decision(filename)
unless FileTest.exist?(filename)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.load_se)
file = File.open(filename, "rb")
read_save_data(file)
file.close
if ! game_completed(filename)
$scene=Scene_New_Game_Plus.new
return
end
#New code to copy for the "Game Completion Count" feature.
#Begin copying here, and stop at my other comments.
#You also need to copy line #15, shown by a comment also.
@game_completion_count=$game_variables[1]
$game_variables = Game_Variables.new
$game_temp = Game_Temp.new
#$game_system = Game_System.new
$game_switches = Game_Switches.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($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.autoplay
$scene = Scene_Map.new
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
$game_map.update
$game_switches[1]=true #Since the switches were all reset, this one need to
#be turned back on to indicate the game was completed.
$game_variables[1]=@game_completion_count
#Stop copying new "Game Completion Count" here.
end
end
Now you need to completely replace your Scene_Title by this new code. If you have modified your scene_title already, back-up your scene, and re-add your modification into this new script. It will be a good scripting practice...
Code to add replacing the old Scene_Title:
Code:
#==============================================================================
# ¦ Scene_Title
#------------------------------------------------------------------------------
# New Game + EDITION
#==============================================================================
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"
s4="New Game+"
@command_window = Window_Command.new(192, [s1, s2, s3,s4])
@command_window.opacity = 255
@continue_enabled = false
@new_game_plus_enabled=false
#The next block of code allows some added customization to the title screen.
#---------------------------------------------------------------------------------------------------------------------------------------------
@command_window.x = 250 # distance in pixels from left side of scrren to upper left side of window
@command_window.y = 250 # distance in pixels from top of screen to top of window
@command_window.contents.font.size=22 #Font size for items in the window
#(if letters are cropped increase window width at line 36)
@command_window.contents.font.name="Tahoma" #font face for window items
@command_text_color=Color.new(255,255,255,255) #custom 32 bit color for the SELECTABLE window items
#(disabled items displayed in the systmes "disabled" color
#---------------------------------------------------------------------------------------------
for i in 0..3
dummy_var=Scene_New_Game_Plus.new
filename = "Save#{i+1}.sav"
if FileTest.exist?(filename)
@continue_enabled = true
if dummy_var.game_completed(filename)
@new_game_plus_enabled=true
end
end
end
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@sprite.bitmap.dispose
@sprite.dispose
end
#-----------------------------------------------------------
def update
@command_window.update
if @continue_enabled==true
@command_window.draw_item(1,@command_text_color )
end
if @new_game_plus_enabled==true
@command_window.draw_item(3,@command_text_color )
else
@command_window.disable_item(3)
end
@command_window.draw_item(0,@command_text_color )
@command_window.draw_item(2,@command_text_color)
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_new_game
when 1
command_continue
when 2
command_shutdown
when 3
command_new_game_plus
end
end
end
# ------------------------------------
def command_new_game
$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($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end
# ------------------------------------
def command_new_game_plus
unless @new_game_plus_enabled==true
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_New_Game_Plus.new
end
#---------------------------------------------------------------
def command_continue
unless @continue_enabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Load.new
end
# ------------------------------------
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
# ------------------------------------
def 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")
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_battle_test_members
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)
$scene = Scene_Battle.new
end
end
Okay, to use this, you need to free up the game variable ID#1 and the switch ID#1. If you really cannot free them for the script, you will have to replace the ID# from within the script. To do so, search the following lines in the script:
Code:
$game_switches[1]
$game_variables[1]
And replace the ID# between [ ] by the ID# you wish to be using for the script.
Ok, now, in order to use this, all you need to do is when your game ends, whether during the ending story or after the boss is defeated, you must turn your switch TRUE and add 1 (+1) to your variable. After that, you must ask the player to save the game, it is recommended to open the save menu for him and tell him to save.
Then, after the game was completed, he can use the New Game + option from the title menu and continue a saved game from the beggining with all his items and powers, as in Chrono Trigger.
Have Fun !