Respon kills me

Started by tech williams, March 12, 2011, 07:53:47 pm

Previous topic - Next topic

tech williams

Im trying to make my first script by editing scene_gameover so that I can respon to another place if the player chooses, but it seems I made a mistake somewhere and now whenever you die it shows the game over screen over and over. I don't really know why and I thought the script worked, and I couldn't find a similar script here

This is my script:
Spoiler: ShowHide

#==============================================================================
# ** Scene_Gameover
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @transferring = false
    # Make game over graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
    # Make choice window
  #--------------------------------------------------------------------------
  # Here are the choices that will be displayed in the box that is shown on
  # the gameover screen.
  #--------------------------------------------------------------------------
    s1 = "Wake up"
    s2 = "Return to title"
    s3 = "End game"
    @choice_window = Window_Command.new(392, [s1, s2, s3])
    @choice_window.back_opacity = 160
    @choice_window.x = 320 - @choice_window.width / 2
    @choice_window.y = 308
    # Stop BGM and BGS
    $game_system.bgm_play(nil)
    $game_system.bgs_play(nil)
    # Play game over ME
    $game_system.me_play($data_system.gameover_me)
    # Execute transition
    Graphics.transition(120)
    # 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 choice window
    @choice_window.dispose
    # Dispose of game over graphic
    @sprite.bitmap.dispose
    @sprite.dispose
    # Execute transition
    Graphics.transition(20)
    # Prepare for transition
    Graphics.freeze
    # If battle test
    if $BTEST
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update command window
    @choice_window.update
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @choice_window.index
      when 0  # New game
        command_respawn
      when 1  # Continue
        command_title
      when 2  # End game
        command_shutdown
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # * Command: Respawn (TO SPECIFIED LOCATION)
  #--------------------------------------------------------------------------
  # This command respawns to a location specified by three game variables.
  # You can change which variables it looks at by modifying the numbers in
  # the square brackets below.
  #--------------------------------------------------------------------------
  def command_respawn
    #------------------------------------------------------------------------
    respawn_map_id = $game_variables[1]
    respawn_map_x = $game_variables[2]
    respawn_map_y = $game_variables[3]
    #------------------------------------------------------------------------
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Fade ME
    Audio.me_stop
    # Recover party
    for actor in $game_party.actors
      actor.recover_all
    end
    $game_map.setup(respawn_map_id)
    # Move player to initial position
    $game_player.moveto(respawn_map_x, respawn_map_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: Return to title
  #--------------------------------------------------------------------------
  def command_title
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Fade out BGM, BGS, and ME
    Audio.me_fade(800)
    # Shutdown
    $scene = Scene_Title.new
  end

  #--------------------------------------------------------------------------
  # * Command: Shutdown
  #--------------------------------------------------------------------------
  def command_shutdown
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Fade out BGM, BGS, and ME
    Audio.me_fade(800)
    # Shutdown
    $scene = nil
  end
end
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

ForeverZer0

March 12, 2011, 08:09:14 pm #1 Last Edit: March 12, 2011, 08:13:34 pm by ForeverZer0
That works fine in an empty project. (I simply hard-coded the respawn variables)
What other scripts are you using?

EDIT:
I found the problem. On my first test I had just made a script call to make it Scene_Gameover, but I thought it may be an Interpreter problem. Sure enough, when I used the "Gameover" event command I got your error.
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.

tech williams

So uh, How do I fix it?  :^_^':
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

ForeverZer0

I can't remember off the top of my head to be quite honest.
You can always just substitute the event command in the editor, with this simple script call:

$scene = Scene_Gameover.new


They both do the exact same thing. I didn't look real close, but it seems like the Interpreter is simply calling the command again. You could try $game_system.map_interpreter.clear

I think that's what it is.... :hm:
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.

tech williams

I hate being new at things, I have no idea what your talking about  :shy:
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

ForeverZer0

lol, don't worry about it. You'll learn like everyone else who knows had to. It takes time.

For now, just use the script call from my above post instead of the the "Game Over" event command to call the menu.
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.

tech williams

Hopefully it's just because I'm sick, but replace what with what where?  :???:
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

Wizered67

Instead of using the Game over command in eventing, use a script event that is what ForeverZero said.

tech williams

I have it set up so that I go to game over after death. I don't have anything evented except for the variables. How do I change it?
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

ForeverZer0

How were you calling the scene to test it?
Were you using an event, or did you keep having your party killed off?
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.

tech williams

I had them killed off. I tryed figuring it out and changed the game over flag to $scene = Scene_Gameover.new and it worked, but then none of my events worked so thats out the window
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

brewmeister

In Command_Respawn, somewhere before $scene = Scene_Map.new, insert

$game_temp.gameover = false

tech williams

March 21, 2011, 08:09:39 am #12 Last Edit: March 21, 2011, 08:30:41 am by tech williams
I tried this, but now Im having a problem with the transfer player command. It wont let the game load any other maps. Man, I thought this would be a simple code  :^_^':

EDIT: One thing I just realized. When the game gets the game over command does it tell the game your out of a battle? Like, if I add a command that ends a battle in scene_gameover would that work, because I notice that healing and text work just like they would in a battle, but transfer and other commands that arn't battle friendly wont.

EDIT 2:Nevermind
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

brewmeister

Yep, also add...

    $game_temp.in_battle = false

8)

tech williams

Yes. I love you now. I was trying to give it an abort battle command, I forgot about this one. Now I can post my first script. Now to work  on making it less laggy, or maybe its just my game. Anyway, thanks alot.
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here