RPG Maker Forums

Hello all!


If this is not the right place to post this, please feel free to put it somewhere else.


I've made an extra button in my menu called "torch" and when you click this it asks if you want to use the torch. When you click "use torch" I've got my script to show a picture and when you click "put torch away" it disposes the picture.


The problem is that when I go back to my menu, not only the window of the question and the command window disposes, but also the picture. Of course, this is not what I want. I want the picture to keep showing until I go back to my menu again and click "deactivate torch".


Does somebody know how to fix this?


This is my script:

Code:
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================

class Scene_Torch
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
 def main
    # Make background transparant
    @background = Spriteset_Map.new
    # Make ask window
    @torchAsk_window = Window_TorchAsk.new
 # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Torch"
    s5 = "Status"
    s6 = "Save"
    s7 = "End Game"
    @commandInTorch_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @commandInTorch_window.y = 480 - @commandInTorch_window.height
    @commandInTorch_window.cursor_rect.set(0, 3 * 32, @commandInTorch_window.width - 32, 32)
    @commandInTorch_window.active = false
    # Make command window
    s1 = "Use Torch"
    s2 = "Put torch away"
    @torch_window = Window_Command.new(192, [s1, s2])
    @torch_window.x = 300
    @torch_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 640 - @gold_window.width
    @gold_window.y = 0
 # Make window's opacity less
    @commandInTorch_window.back_opacity = 160  
    @torch_window.back_opacity = 160
    @torchAsk_window.back_opacity = 160
    @gold_window.back_opacity = 160
 # 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
    @torch_window.dispose
    @torchAsk_window.dispose
    @background.dispose
    @commandInTorch_window.dispose
    @gold_window.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update command window
    @torch_window.update
    @torchAsk_window.update
    @background.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(3)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @torch_window.index
      when 0  # Torch
        command_torch
      when 1  # Torch Away
        command_torch_away
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Open Torch] Command
  #--------------------------------------------------------------------------
  def command_torch
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
     # Make torch graphic
    @torchPicture = Sprite.new
    @torchPicture.bitmap = RPG::Cache.picture("Torch")
  end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Close Torch] Command
  #--------------------------------------------------------------------------
  def command_torch_away
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Dispose of torch graphic
    @torchPicture.bitmap.dispose
    @torchPicture.dispose
  end
end

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,551
Members
137,837
Latest member
Dabi
Top