Hey, I'm new here -- Couldn't find a solution to my problem through google or by lurking these forums, so I figured I'd give this a shot. Thanks to yuybabe for giving me an invite code so quickly in the chat.
Logical stuff isn't really my strong suit, so the solution may be staring me right in the face, I'm not sure... Here's the issue:
I'm working on a game (in XP) with a lot of objects in the environment that can be interacted with via the action button. I also don't want to use the default RPG-style menu system -- I only need 'save' and 'quit' options -- so I created a parallel processing event in my map that disables the menu and, if the player is pressing esc, brings up a multiple choice dialog box with 'save' and 'quit' options. Works well enough. However, if I'm standing in front of an object that I can interact with via the action button, and then I bring up the save screen through my minimal replacement menu and save my game -- using the action button -- as soon as it dumps me back to the game, the event I'm standing on that lets me interact with the object triggers since I just pressed the action button to confirm my save slot.
The default menu doesn't have this problem as, after saving, it dumps you back to the main in-game menu instead of the game proper. However, if I save while standing on an event that triggers an object interaction in the map, then load my game from the main menu, I have the same problem -- since I pressed the action button to confirm the game I wanted to load, that triggers the event I'm standing on as soon as I load the game.
Given that I have the problem when loading a game from the main menu, I'd imagine the solution would involve changing something in the interactive event on the map... Unless there's a script I'm not aware of that deals with problems like this.
Thanks in advance for any help you can give me!
EDIT: I did notice some similarity to this topic (http://rmrk.net/index.php/topic,47602.0.html), though it doesn't quite apply as my case involves some of the in-built menus of RPGXP (save, load) as opposed to events.
Start by editing the default script ton remove everything but save and quit. See if that does any good.
Post above main.
It's a bit of a Macgyver, but it should do the trick.
[spoiler=Screenshots]
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FncduRFY.png&hash=11b1338a7e613e1c925c7f5d06e86ef1d7e96e65)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F4ombaTG.png&hash=c38cfb4de0f0584b1b9c0939ccce6e7a6474afd6)
[/spoiler]
#-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
# Save/End Menu
# Menu with only the save and end options.
#-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
@background = Spriteset_Map.new
# Make command window
s0 = "Save Game"
s1 = "End Game"
@command_window = Window_Command.new(160, [s0, s1])
@command_window.x = 236
@command_window.y = 206
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(1)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 36
@playtime_window.y = 206
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 436
@steps_window.y = 206
# 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 windows
@background.dispose
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
end
def update
# Update windows
@background.update
@command_window.update
@playtime_window.update
@steps_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size <= 0 and @command_window.index < 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # save
# If saving is forbidden
if $game_system.save_disabled
# 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 save screen
$scene = Scene_Save.new
when 1 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
end
class Scene_Save < Scene_File
def initialize
super("Which file would you like to save to?")
end
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(0)
end
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(0)
end
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
class Scene_End
def main
@background = Spriteset_Map.new
# Make command window
s1 = "Restart"
s2 = "Shutdown"
s3 = "Continue"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# 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 window
@background.dispose
@command_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
def update
# Update command window
@background.update
@command_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
return
end
end
def command_to_title
# 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)
# Switch to title screen
$scene = Scene_Title.new
end
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
def command_cancel
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
end
end
Thank you so much for your time! I'll drop your name in the credits for the help.
Since there are probably many people that will look at this thread, I'll share a really easy way to fix this. EVENT ONLY. Note: It only works for events that dont move around. For ones that do move around, it can work, just way way way harder, but I wont mention it here.
Make an Event. Set the Autonomous Movement to Custom. Set Frequency to Highest. Click on "Move Route ..." just beow the Automous Movement type. Uncheck Repeat Action in Options. Click on "Script", then put this script snippet into the Script box.
@trigger = -1
That will STOP the player from being able to interact with that Event, period.
It doesnt need additional pages and allows graphics for that event to be displayed. What happens is with your Trigger types, the Triggers either have some form of Player interaction, or they Autorun. Setting the Trigger to -1 prevents any form of making the event do its evented stuff.
Now, to make the Non Interactive Event do everything in the list of Event Commands, it needs to be fired from another external Event Script:
$game_map.events[12].start
When that code is run from another Event, the Commands in that events List of Event Commands will fire. It works a lot like "Call Common Event", but only on that particular map. Just dont forget to change 12 to the actual Event ID of that Event you want to Trigger.