I'm working on my event base Custom Title Menu.
I'm complete it's interface. button can select and push.
but I just don't know how to call script to send player to Start point ,Loading Screen or Exit from my game.
If you're not comfortable with scripting, it will get complicated.
For starters, Scene_Title already provides you with the method calls for the three options. I'm sure you could create a module with the three methods in it, like so:
module TitleCommands
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def self.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 self.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 self.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
end
command_new_game and
command_shutdown are pretty much good to go.
For
command_continue you will need to go into Scene_Load and modify the
on_cancel method to return the player back to Scene_Map.new instead of Scene_Title.new. Hopefully, your eventing can handle this brief change in scenes.
So now all you have to do is use the appropriate script calls for each action:
TitleCommands.command_new_game
TitleCommands.command_continue
TitleCommands.command_shutdown
If all else fails, I'd just use Heretic's script: http://forum.chaos-project.com/index.php/topic,12465.0.html
Thank you very much.
Actually I am now use Heretic's Title script but I made event to create picture menu rater than text menu.
It's seem he already has create that command in his script .
like this.
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
attr_reader :command_window # Window for New Game / Continue / etc
attr_accessor :message_window # Allows Closing with 'terminate_message'
attr_accessor :display_title_menu
attr_accessor :fade_out_title_menu
attr_accessor :hide_title_menu
alias map_title_update update
def update
# Run Original
map_title_update
# Map Update - Only makes Title Map available during Title
if $title_scene
if Scene_Map::MAP_IDS_TO_ALLOW_WINDOW.include?($game_map.map_id)
# If Player pressed Enter or Inactive Time
if @display_title_menu and
not @command_window and
not @hide_title_menu
# Prevent the window from disappearing
@display_title_menu = false
@fade_out_title_menu = false
# Make command window
s1 = "New Game"
s2 = "Continue"
s3 = "Shutdown"
@command_window = Window_Command_Center.new(192, [s1, s2, s3])
@command_window.opacity = TITLE_MAP_WINDOW_OPACITY
@command_window.contents_opacity = TITLE_MAP_WINDOW_CONTENTS_OPACITY
@command_window.back_opacity = TITLE_MAP_WINDOW_BACK_OPACITY
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Custom Title Skin
if TITLE_SKIN
@command_window.windowskin = RPG::Cache.windowskin(TITLE_SKIN)
end
@command_window.active = true
@command_window.visible = true
# 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
# Store the Frame Counter for when this window was Displayed
@title_frames = Graphics.frame_count
# Show Window called by Script... display_title_menu
elsif @command_window and
@display_title_menu and
not @hide_title_menu and
not @command_window.disposed? and
not @command_window.active
# Set Command Window as Active and Visible, dont recreate
@command_window.active = true
@command_window.visible = true
@command_window.opacity = TITLE_MAP_WINDOW_OPACITY
@command_window.contents_opacity = TITLE_MAP_WINDOW_CONTENTS_OPACITY
@command_window.back_opacity = TITLE_MAP_WINDOW_BACK_OPACITY
# Prevent Hiding
@display_title_menu = false
@fade_out_title_menu = false
# Prevents Triggering Inactive Timeout
@title_frames = Graphics.frame_count
# If Command Window Inactive, and Player hits a Key
elsif @command_window and
not @command_window.disposed? and
not @command_window.active and
not @hide_title_menu and
not @display_title_menu and
$game_system.map_interpreter.title_escape_keys?
# Set Command Window as Active and Visible, dont recreate
@command_window.active = true
@command_window.visible = true
@command_window.opacity = TITLE_MAP_WINDOW_OPACITY
@command_window.contents_opacity = TITLE_MAP_WINDOW_CONTENTS_OPACITY
@command_window.back_opacity = TITLE_MAP_WINDOW_BACK_OPACITY
# Prevent Hiding
@display_title_menu = false
@fade_out_title_menu = false
# Prevents Triggering Inactive Timeout
@title_frames = Graphics.frame_count
# Window not created, and Player hits a Key when allowed to display menu
elsif not @hide_title_menu and
not @command_window and not @display_title_menu and
$game_system.map_interpreter.title_escape_keys?
# Force Title Menu to be Created - Above
@display_title_menu = true
# Prevent Hiding
@fade_out_title_menu = false
# Prevents Triggering Inactive Timeout
@title_frames = Graphics.frame_count
# If we need to Hide the Menu or Force it off the Screen
elsif @fade_out_title_menu or @hide_title_menu
# If the Command Window exists and has not been disposed
if @command_window and not @command_window.disposed?
# If Window is Visible
if @command_window.opacity > 0 or
@command_window.contents_opacity > 0 or
@command_window.back_opacity > 0
# Fade Out the Window
@command_window.opacity -= TITLE_MAP_WINDOW_FADE_RATE
@command_window.contents_opacity -= TITLE_MAP_WINDOW_FADE_RATE
@command_window.back_opacity -= TITLE_MAP_WINDOW_FADE_RATE
@command_window.active = false
else
# End the Hiding Procedure
@fade_out_title_menu = false
end
end
# Window is Active, Update for Player Input
elsif @command_window and
not @command_window.disposed? and
@command_window.active
# Update the Title Window
title_window_update
end
elsif $game_system.map_interpreter.title_escape_keys? and
$game_map.map_id != TITLE_MAP_ID
# Prepare for transition
Graphics.freeze
# If New Game / Continue Window exists...
if @command_window
# Dispose of command window
@command_window.dispose
end
# Restart the whole thing
$scene = Scene_Title.new
end
end
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
alias title_transfer_player transfer_player
def transfer_player
# If this is a Title Scene, Hide Window when transferring maps
if $title_scene
# If Window has been created
if @command_window
# Set Opacity to 0
@command_window.opacity = 0
@command_window.back_opacity = 0
@command_window.contents_opacity = 0
# Prevent Selection
@command_window.active = false
end
end
# Call Original
title_transfer_player
end
#--------------------------------------------------------------------------
# * Title Command Window Timeout
#--------------------------------------------------------------------------
def title_timeout
# 40 is used for the Framerate
if Graphics.frame_count > TITLE_MAP_INACTIVE_TIMEOUT * 40 + @title_frames
return true
end
end
#--------------------------------------------------------------------------
# * Update Title Window
#--------------------------------------------------------------------------
def title_window_update
# If Command Window isnt being Hidden
if @command_window.active
# If Key was pressed, reset Inactivity Frame Counter
if $game_system.map_interpreter.title_escape_keys?
# Store the Frame Counter for when this window was Displayed
# This prevents the Window from Fading out from Inactivity
@title_frames = Graphics.frame_count
else
if title_timeout
# Hide the Title Menu
@fade_out_title_menu = true
# Reset Frame Inactivity Counter
@title_frames = Graphics.frame_count
end
end
end
# 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
title_new_game
when 1 # Continue
title_continue
when 2 # Shutdown
title_shutdown
end
end
end
#--------------------------------------------------------------------------
# * Title: New Game
#--------------------------------------------------------------------------
def title_new_game
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Declare that Gameplay is NOT a Title Scene
$title_scene = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Stop BGS
Audio.bgs_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
# Re-enable Menu Access since it was Disabled for Demo Titles
$game_system.menu_disabled = false
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def title_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def title_shutdown
# Dispose of command window
@command_window.dispose
# 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 Call - Alias hides the Command Window
#--------------------------------------------------------------------------
alias title_scene_call_battle call_battle
def call_battle
# If in a Title Scene Demo Battle
if $title_scene
# Hide the Command Window
$scene.hide_title_menu = true
end
# Call Original
title_scene_call_battle
end
end
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
alias map_title_decision on_decision
def on_decision(filename)
# Prevent Title Menu from Displaying
$title_scene = false
# Stop BGS
Audio.bgs_stop
# Call Original
map_title_decision(filename)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If Map Displayed is the one we want the Title to be on...
if Scene_Map::MAP_IDS_TO_ALLOW_WINDOW.include?($game_map.map_id)
# Switch back to the Map
$scene = Scene_Map.new
else
# Start the Scene all over again
$scene = Scene_Title.new
end
# Make sure the Title Menu comes up
$scene.display_title_menu = true
end
end
class Game_Switches
# Enables @data to be accessed and changed
attr_accessor :data
end
class Game_Player < Game_Character
# Enable @direction to be accessed and changed
attr_accessor :direction
end
Then I try to call script from my event like this
Quotetitle_new_game
āļībut i get errors. I try
Quote
Scene_Title.title_new_game
and
Quote
Scene_Map.title_new_game
Sorry for bothering you so much. But I'm really bad at Scripting.
Try doing
$scene is a global variable that keeps track of what scene your game is currently showing, which in this case would be Scene_Map. So now you can call any Scene_Map method.
title_new_game by itself won't work in a script call as it is not an Interpreter method:
class Interpreter
def title_new_game
# CODE
end
end
And Scene_Title is a class, not a module, so
Scene_Title.title_new_game is invalid in this case. It'd only be valid if it was structured as
module Scene_Title
def self.title_new_game
# CODE
end
end
but you would be destroying your game if you actually did this.
Thank you very much. You help me understanding Script a lot better.
but look like it's still not work it show an errors like this
(https://dl.dropboxusercontent.com/u/25175131/IMG/Problem/SNAG-0217.jpg)
Can we still solve this... or it's the time i should give up on picture title menu?
By the way thank you very much. You helping me a lot.
That line is referring to disposing a command window that doesn't exist. I take it that you modified the script a bit to remove the creation of the command window, particularly at line 498
@command_window = Window_Command_Center.new(192, [s1, s2, s3])
If you plan on commenting out/removing the variable @command_window, be sure to do so throughout the entire script.
I would suggest trying this instead:
Place this script anywhere above Main in your project (could even stick it all the way at the bottom of Heretic's)
class Empty_Command_Window < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
# Compute window height from command quantity
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(1,1)
@index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
end
def index
return -1
end
#--------------------------------------------------------------------------
# * Draw Shadow Text
#--------------------------------------------------------------------------
def draw_shadow_text(x, y, width, height, string, align = 0)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
end
end
class Interpreter
def command_new_game
$scene.customtitle_command_index = 0
end
def command_continue_game
$scene.customtitle_command_index = 1
end
def command_shutdown
$scene.customtitle_command_index = 2
end
end
class Scene_Map
attr_accessor :customtitle_command_index
def title_window_update
# If Command Window isnt being Hidden
if @command_window.active
# If Key was pressed, reset Inactivity Frame Counter
if $game_system.map_interpreter.title_escape_keys?
# Store the Frame Counter for when this window was Displayed
# This prevents the Window from Fading out from Inactivity
@title_frames = Graphics.frame_count
else
if title_timeout
# Hide the Title Menu
@fade_out_title_menu = true
# Reset Frame Inactivity Counter
@title_frames = Graphics.frame_count
end
end
end
case @customtitle_command_index
when 0 # New game
title_new_game
when 1 # Continue
title_continue
when 2 # Shutdown
title_shutdown
end
@customtitle_command_index = -1
end
end
And at line 498 as I pointed out earlier, change it to
@command_window = Empty_Command_Window.new(192, [s1, s2, s3])
The command window will no longer show up but the game will still function properly. You can now use these as script calls
command_new_game
command_continue_game
command_shutdown
Thank for helping me again .But I still get the same errors. :^_^':
This is my Scripts List
(https://dl.dropboxusercontent.com/u/25175131/IMG/Problem/SNAG-0225.jpg)
Put Empty Command under Animated Title but Above Main right?
Did i do something wrong? :???:
I try do add it to bottom part of Animated Title Script but still same.
Quote from: KK20 on August 14, 2015, 04:33:44 pm
And at line 498 as I pointed out earlier, change it to
@command_window = Empty_Command_Window.new(192, [s1, s2, s3])
I already change it but still error on line 688 (@command_window.dispose).
Did I need to change this line too?
This is my Scripts.rxdata (http://puu.sh/jEgnt/b64bab4716.rxdata) file from Heretic's demo with the modifications. It works fine in the demo on my end.
It's don't work on my game
When I try it on my game it's show these errors.
(I Backup my Scripts file and replace it with this)
(https://dl.dropboxusercontent.com/u/25175131/IMG/Problem/0.jpg)
And the weird thing is it's don't work on demo in my PC too.
It's show these errors when I try use it on Demo.
(https://dl.dropboxusercontent.com/u/25175131/IMG/Problem/1.jpg)
Can it be problem with my RMXP version or something like that?
My RMXP is 1.05 a I buy it on Steam but don't know if I needed to updated it or how to updated it.
Zipping the entire demo over. Click Me (http://puu.sh/jHOpw/cde359a357.zip)
In this image, you can see I made an event right below the tree with the following button commands.
(http://puu.sh/jHO9j/184d3a268d.png)
Pressing Z should start a new game
X should register a continue game (if you have a save file)
C should shutdown the game
This project is using the exact same scripts file I sent you. I tested it on my end just before sending this and it works perfectly fine.
The errors you pointed out look like script calls inside map events. As such, there's no way for me to figure out the cause of the error without seeing those script calls.
If you still are receiving errors, I need a demo of your project.
Thanks again .This is my project files.
https://dl.dropboxusercontent.com/u/25175131/Anna%20-%20Demo.zip
I try to edited Call Script after you.
Now it not show any errors but just noting happen when I push the button
(It's Work with just "Show Message" but noting happen when "Script Call").
Sorry about the button's language I forgot to translated it to English before upload the files
but the left one is for New Game 2nd for Continues and Right one is for Shutdown.
You didn't use Heretic's script properly.
First off, under the configurations part of the script, you need to do
MAP_IDS_TO_ALLOW_WINDOW = [1] # Map ID's allowed to display Window
Your title scene takes place on Map ID 001, so you need the 1 in there. Heretic's demo used Map ID 002 as his title screen.
Secondly, you forgot to add the script call
when appropriate. These were the two spots where I put them:
(http://puu.sh/jIqS8/b8f911d716.png)
Pressing C on the left button started the game for me.
It's Work !! Thank you very much !!