Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] No map transferring?

I have been working on a new game, and I only have 2 or 3 custom scripts.

I can't transfer between maps if I go into the menu first, it freezes and says that 'Game.exe' has to close.

This is what is causing it:
Code:
 

################################################################################

# "Prodtos Menu" CMS by Prodtos ################################################

################################################################################

#                                                                              #

#This is a Custom Menu Script with a lot of stuff                              #

#You will find the instruccions below                                          #

#                                                                              #

#This Menu is designed to be used whit non animated Battlers                   #

#                                                                              #

#I want to thank Anemus And Dubealex and RPG RPG Revolution                    # 

#because they did the tutorials that                                           #

#introduced me into scripting in RGSS                                          #

#                                                                              #

#Thanks to Khrono for being my Bug and Beta Tester                             #

#                                                                              #

#If you use it please give credit                                              #

#Si lo usas favor damer credito                                                #

#                                                                              #

#Any Bug or problem info Plese send it to [email=prodtos@hotmail.com]prodtos@hotmail.com[/email]                  #

################################################################################

 

# Instruccions / Instrucciones

 

#Place all this text in a new page above Main

#Coloca todo este texto en una nueva pagina arriba de Main

 

#Enjoy / Disfrutenlo

 

#You can put your Tittle and Subtittle between the double quote marks

#Puedes poner tu Titulo y Subtitulo en medio de las comillas

 

    $tittle = "God of Thunder"

    $sbtittle = "Main Menu"

    $menu_opac = 225

    $titlefont = "Ruritania"

    

#This text will be shown on your menu

#Este texto sera mostrado en tu menu

 

class Scene_Menu

  Opacity = 225

  def initialize(menu_index = 0)

    @menu_index = menu_index

  end

    def main

     @spriteset = Spriteset_Map.new

     i = $game_temp.last_file_index

     @savefile_window = Window_SaveFile.new(i, "Save#{i+1}.rxdata")

     @savefile_window.x = 0

     @savefile_window.y = 492

     @Window_Item = Window_Item.new

     @Window_Item.y = 484

     @Window_Item.index = -1

     @Tittle = Tittle_Prodtos.new

     @Tittle.y = -60*4

     @Realt = RealTime_Prodtos.new

     @Realt.x = 820

     @Realt.y = 284

     @Map = Map_Prodtos.new

     @Map.x = 760

     @Map.y = 184

     @Playt = PlayTime_Prodtos.new

     @Playt.x = -380

     @Playt.y = 284

     @Gold = Gold_Prodtos.new

     @Gold.x = -320

     @Gold.y = 184

     @Menu_Commands = Commands_Prodtos.new

     @Menu_Commands.y = 480

     @Menu_Commands.index = @menu_index

     @Menu_Commands.active

     @status = Window_Target_Prodtos.new

     @status.y = -276

     @status.opacity = $menu_opac

     @status.index = -1

     @status.active = false

     if $game_party.actors.size == 0

       @Menu_Commands.disable_item(1)

       @Menu_Commands.disable_item(2)

       @Menu_Commands.disable_item(3)

       @Menu_Commands.disable_item(4)

     end

     if $game_system.save_disabled

       @Menu_Commands.disable_item(5)

     end

     @Menu_Commands.update_windows

    s1 = "To Title"

    s2 = "Shutdown"

    s3 = "Cancel"

    @end_window = Window_Command.new(192, [s1, s2, s3])

    @end_window.index = -1

    @end_window.x = 224

    @end_window.y = -218

    @end_window.opacity = $menu_opac

     Graphics.transition

     loop do

       Graphics.update

       Input.update

       update

       if $scene != self

         break

       end

     end

     Graphics.freeze

     @status.dispose

     @savefile_window.dispose

     @Menu_Commands.dispose

     @Gold.dispose

     @Playt.dispose

     @Map.dispose

     @Realt.dispose

     @Tittle.dispose

     @Window_Item.dispose

     @end_window.dispose

    end

   def update

     if @Menu_Commands.y != 480-(32+32+32)

       @Menu_Commands.y -= 8

     end

     if @Gold.x != 0 and $g_a == true

       @Gold.x += 20

     end

     if @Gold.x != -320 and $g_a == false

       @Gold.x -= 20

     end

     if @Playt.x != 0 and $p_a == true

       @Playt.x += 20

     end

     if @Playt.x != -380 and $p_a == false

       @Playt.x -= 20

     end

     if @Map.x != 320 and $m_a == true

       @Map.x -= 20

     end

     if @Map.x != 760 and $m_a == false

       @Map.x += 20

     end

     if @Realt.x != 320 and $r_a == true

       @Realt.x -= 20

     end

     if @Realt.x != 820 and $r_a == false

       @Realt.x += 20

     end

     if $t2_a == false 

       if @Tittle.y != -60*4 and $t_a == false

         @Tittle.y -= 10

       end

       if @Tittle.y != 0 and $t_a == true

       @Tittle.y += 10

       end

     else

     if @Tittle.y <= -40

       if @Tittle.y != -40 and $t_a == false

         @Tittle.y += 10

       end

     else

         @Tittle.y -= 10

       end

     end

     if @Window_Item.y != 144 and $i_a == true

       @Window_Item.y -= 20

     end

     if @Window_Item.y !=484 and $i_a == false

       @Window_Item.y += 20

     end

     if @savefile_window.y != 212 and $s_a == true

       @savefile_window.y -= 20

     end

     if @savefile_window.y != 492 and $s_a == false

       @savefile_window.y += 20

     end

     if @end_window.y != 202 and $e_a == true

       @end_window.y += 20

     end

     if @end_window.y != -218 and $e_a == false

       @end_window.y -= 20

     end

     if @status.y != 144 and $st_a == true

       @status.y += 20

     end

     if @status.y != -276 and $st_a == false

       @status.y -= 20

     end

     @status.update

     @Realt.update

     @Playt.update

     @Menu_Commands.update

     @Menu_Commands.update_windows

     if @Menu_Commands.active == true

       update_command

       return

     end

     if @status.active == true

       update_status

       return

     end

   end

  def update_status

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      @Menu_Commands.active = true

      @status.active = false

      @status.index = -1

      return

    end

    if Input.trigger?(Input::C)

      case @Menu_Commands.index

      when 2  

        if $game_party.actors[@status.index].restriction >= 2

          $game_system.se_play($data_system.buzzer_se)

          return

        end

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_Skill.new(@status.index)

      when 3  

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_Equip.new(@status.index)

      when 4 

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_Status.new(@status.index)

      end

      return

    end

  end

   def update_command

     if Input.trigger?(Input::B)

       $game_system.se_play($data_system.cancel_se)

       $scene = Scene_Map.new

      end

    if Input.trigger?(Input::C)

       if $game_party.actors.size == 0 and (@Menu_Commands.index < 5)

          $game_system.se_play($data_system.buzzer_se)

          return

       end

       case @Menu_Commands.index

           when 0

             #juego

           when 1  

             $game_system.se_play($data_system.decision_se)

             $scene = Scene_Item.new

           when 2  

             $game_system.se_play($data_system.decision_se)

             #skill

             @status.active = true

             @Menu_Commands.active = false

             @status.index = 0

           when 3  

             $game_system.se_play($data_system.decision_se)

             #equip

             @status.active = true

             @Menu_Commands.active = false

             @status.index = 0

           when 4 

             $game_system.se_play($data_system.decision_se)

             #status

             @status.active = true

             @Menu_Commands.active = false

             @status.index = 0

           when 5  

             if $game_system.save_disabled

               $game_system.se_play($data_system.buzzer_se)

               return

             end

             $game_system.se_play($data_system.decision_se)

             #save

             $scene = Scene_Save.new

           when 6 

             #exit

             $game_system.se_play($data_system.decision_se)

             $scene = Scene_End.new

          end

          return

       end

     end

   end

 

class Window_Selectable_Prodtos < Window_Base

  attr_reader   :index                    

  attr_reader   :help_window              

  def initialize(x, y, width, height)

    super(x, y, width, height)

    @item_max = 1

    @column_max = 1

    @index = -1

  end

  def index=(index)

    @index = index

    if self.active and @help_window != nil

      update_help

    end

    update_cursor_rect

  end

  def row_max

    return (@item_max + @column_max - 1) / @column_max

  end

  def top_row

    return self.oy / 32

  end

  def top_row=(row)

    if row < 0

      row = 0

    end

    if row > row_max - 1

      row = row_max - 1

    end

    self.oy = row * 32

  end

  def page_row_max

    return (self.height - 32) / 32

  end

  def page_item_max

    return page_row_max * @column_max

  end

  def update

    super

    if self.active and @item_max > 0 and @index >= 0

      if Input.repeat?(Input::RIGHT)

        if @index == 6

          @index = -1

          return

        end

        if @column_max >= 2 and @index < @item_max - 1

          $game_system.se_play($data_system.cursor_se)

          @index += 1

        end

      end

      if Input.repeat?(Input::LEFT)

        if @index == 0

          @index = 7

          return

        end

        if @column_max >= 2 and @index > 0

          $game_system.se_play($data_system.cursor_se)

          @index -= 1

        end

      end

    end

    if self.active and @help_window != nil

      update_help

    end

    update_windows

    update_cursor_rect

  end

   def update_windows

             $g_a = (@index == 0)

             $p_a = (@index == 0)

             $m_a = (@index == 0)

             $r_a = (@index == 0)

             $t_a = (@index == 0)

             $t2_a = (index != 0)

             $i_a = (@index == 1)

             $st_a = (@index == 2||@index == 3||@index == 4)

             $s_a = (@index == 5)

             $e_a = (@index == 6)

  end

    

end

 

class Commands_Prodtos < Window_Selectable_Prodtos

   Opacity = $menu_opac

   def initialize

     s1 = "Info"

     s2 = $data_system.words.item

     s3 = $data_system.words.skill

     s4 = $data_system.words.equip

     s5 = "Status"

     s6 = "Save"

     s7 = "Exit Game"

     commands = [s1 , s2, s3, s4, s5, s6,s7]

     super(0, 0, 640, 32+32+32)

     @item_max = 7

     @commands = commands

     self.contents = Bitmap.new(width-32, height-32)

     self.contents.font.name = $fontface

     self.contents.font.size = $fontsize

     self.opacity = $menu_opac

     refresh

   end

   def refresh

     self.contents.clear

     for i in 0...@item_max

       draw_item(i, normal_color)

     end

     rect = Rect.new(0, 0, 640-8, 32)

     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

     bitmap = [RPG::Cache.icon('049-Skill06'),RPG::Cache.icon('032-Item01'),RPG::Cache.icon('045-Skill02'),RPG::Cache.icon('013-Body01'),RPG::Cache.icon('038-Item07'),RPG::Cache.icon('030-Key02'),RPG::Cache.icon('048-Skill05')]

     opacity = $menu_opac

     self.contents.blt(30, 4, bitmap[0], Rect.new(0, 0, 24, 24), opacity)

     self.contents.blt(87+30, 4, bitmap[1], Rect.new(0, 0, 24, 24), opacity)

     self.contents.blt(2*87+30, 4, bitmap[2], Rect.new(0, 0, 24, 24), opacity)

     self.contents.blt(3*87+30, 4, bitmap[3], Rect.new(0, 0, 24, 24), opacity)

     self.contents.blt(4*87+30, 4, bitmap[4], Rect.new(0, 0, 24, 24), opacity)

     self.contents.blt(5*87+30, 4, bitmap[5], Rect.new(0, 0, 24, 24), opacity)

     self.contents.blt(6*87+30, 4, bitmap[6], Rect.new(0, 0, 24, 24), opacity)

   end

   def draw_item(index, color)

     self.contents.font.color = color

     rect = Rect.new(4+87*index,32, 87, 32)

     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

     self.contents.draw_text(rect, @commands[index].to_s,1)

   end

   def disable_item(index)

     draw_item(index, disabled_color)

   end

   def update_cursor_rect

     if @index < 0

       self.cursor_rect.empty

       return

     end

     x = 87*@index

     y = 0

     self.cursor_rect.set(x, y, 87, 32+32)

   end

   def update

     super

      if self.active

       if Input.repeat?(Input::RIGHT)

         if @index < 6

           $game_system.se_play($data_system.cursor_se)

           @index += 1

         end

       end

       if Input.repeat?(Input::LEFT)

         if @index > 0

           $game_system.se_play($data_system.cursor_se)

           @index -= 1

          end

       end

     end 

     if self.active and @help_window != nil

       update_help

     end

     update_cursor_rect

   end

 end

 

class Gold_Prodtos < Window_Base

   def initialize

     super(0,0,320,100)

     self.contents = Bitmap.new(width - 32, height - 32)

     self.contents.font.name = $fontface

     self.contents.font.size = $fontsize

     self.opacity = $menu_opac

     refresh

   end

   def refresh

      self.contents.clear

      self.contents.font.color = normal_color

      self.contents.draw_text(4, 0, 280, 34, $data_system.words.gold)

      yellow = Color.new(255,255,0,255)

      self.contents.font.color = yellow

      self.contents.draw_text(4, 34, 280, 34, "$#{$game_party.gold.to_s}", 2)

    end

end

  

class PlayTime_Prodtos < Window_Base

   def initialize

     super(0, 0, 320, 100)

     self.contents = Bitmap.new(width - 32, height - 32)

     self.contents.font.name = $fontface

     self.contents.font.size = $fontsize

     self.opacity = $menu_opac

   end

   def refresh

     self.contents.clear

     self.contents.font.color = normal_color

     self.contents.draw_text(4, 0, 280, 34, "In-Game Time")

     self.contents.font.color = system_color

     @total_sec = Graphics.frame_count / Graphics.frame_rate

     hour = @total_sec / 60 / 60

     min = @total_sec / 60 % 60

     sec = @total_sec % 60

     text = sprintf("%02d:%02d:%02d", hour, min, sec)

     self.contents.draw_text(4, 34, 280, 34, text, 2)

   end

   def update

     if Graphics.frame_count / Graphics.frame_rate != @total_sec

       refresh

     end

   end

 end

 

class Map_Prodtos < Window_Base

   def initialize

     super(0, 0, 320, 100)

     self.contents = Bitmap.new(width - 32, height - 32)

     self.opacity = $menu_opac

     refresh

   end

   def refresh

     self.contents.clear

     self.contents.font.name = $fontface

     self.contents.font.size = 30

     green = Color.new(9,242,62,255)

     self.contents.font.color = green

     $maps = load_data("Data/MapInfos.rxdata")

     @m_id = $game_map.map_id

     @mapname = $maps[@m_id].name

     self.contents.draw_text(4, 0, 280, 50, @mapname,1)

   end

 end

 

class RealTime_Prodtos < Window_Base

    def initialize

     super(0, 0, 320, 100)

     self.contents = Bitmap.new(width - 32, height - 32)

     self.contents.font.name = $fontface

     self.contents.font.size = $fontsize

     self.opacity = $menu_opac

     refresh

   end

   def refresh

     self.contents.clear

     self.contents.font.color = normal_color

     self.contents.font.size = 25

     self.contents.draw_text(4, 0, 280, 34, "Real Time")

     @time_string = Time.now

     text = @time_string.strftime("%A %H:%M:%S")

     self.contents.font.size = 25

     self.contents.font.color = system_color

     self.contents.draw_text(4, 34, 280, 34, text, 2)

   end

   def update

     refresh

   end

 end

 

 class Tittle_Prodtos < Window_Base

   def initialize

     super(0,0,640,184)

     self.contents = Bitmap.new(width - 32, height - 32)

     self.contents.font.name = $fontface

     self.contents.font.size = 32

     self.opacity = $menu_opac

     refresh

   end

   def refresh

     self.contents.clear

     red = Color.new(255,0,0,255)

     self.contents.font.color = red

     tittle = $tittle

     size = contents.text_size(tittle).width

     x = 120-size/2

     rect = Rect.new(x,20,size*3,64)

     self.contents.font.name = $titlefont

     self.contents.font.size = 60

     self.contents.draw_text(rect,tittle,1)

     self.contents.font.name = $fontface

     orange = Color.new(252,134,16,255)

     self.contents.font.color = orange

     self.contents.font.size = 20

     subt = $sbtittle

     ss = contents.text_size(subt).width

     sbx = x + ss*3

     rect = Rect.new(sbx,80,ss,50)

     self.contents.draw_text(rect,subt)

     batler1 = RPG::Cache.battler('010-Lancer02',0)

     batler2 = RPG::Cache.battler('012-Lancer04',0)

     bw1 = batler1.width

     bw2 = batler2.width

     bh = 184-32

     src_rect1 = Rect.new(0,10,bw1,bh)

     src_rect2 = Rect.new(0,-20,bw2,bh)

     self.contents.blt(20, 0, batler1, src_rect1, 180)

     self.contents.blt(640-bw2-20, 0, batler2, src_rect2, 180)

   end

 end

 

class Window_Selectable_Prodtos2 < Window_Base

  attr_reader   :index                    

  attr_reader   :help_window              

  def initialize(x, y, width, height)

    super(x, y, width, height)

    @item_max = 1

    @column_max = 1

    @index = -1

  end

  def index=(index)

    @index = index

    if self.active and @help_window != nil

      update_help

    end

    update_cursor_rect

  end

  def row_max

    return (@item_max + @column_max - 1) / @column_max

  end

  def top_row

    return self.oy / 32

  end

  def top_row=(row)

    if row < 0

      row = 0

    end

    if row > row_max - 1

      row = row_max - 1

    end

    self.oy = row * 32

  end

  def page_row_max

    return (self.height - 32) / 32

  end

  def page_item_max

    return page_row_max * @column_max

  end

  def draw_battler(actor,x,y)

      battler = RPG::Cache.battler(actor.character_name, actor.character_hue)

      w = battler.width

      h = 96

      src_rect = Rect.new(3, -1, w, h)

      self.contents.blt(x, y, battler, src_rect, 200)

  end

  def update

    super

    if self.active

      if Input.repeat?(Input::UP)

        if @index > 0  

          if @index != 2

            $game_system.se_play($data_system.cursor_se)

            @index -= 1

          end

        end

      end

      if Input.repeat?(Input::DOWN)

        if @index < @item_max - 1

          if @index != 1

          $game_system.se_play($data_system.cursor_se)

          @index += 1

          end

        end

      end

      if Input.repeat?(Input::RIGHT)

        if @index < @item_max -2

          $game_system.se_play($data_system.cursor_se)

          @index += 2

        end

      end

      if Input.repeat?(Input::LEFT)

        if @index > 1 

          $game_system.se_play($data_system.cursor_se)

          @index -= 2

         end

      end

    end

    if self.active and @help_window != nil

      update_help

    end

    update_cursor_rect

  end

end

 

class Window_Target_Prodtos < Window_Selectable_Prodtos2

  def initialize

    super(0, 240, 640, 240)

    self.contents = Bitmap.new(width - 32, height - 32)

        self.contents.font.name = $fontface

    self.contents.font.size = $fontsize

    self.z += 10

    self.opacity = 180

    @item_max = $game_party.actors.size

    refresh

  end

  def refresh

    self.contents.clear

    for i in 0...$game_party.actors.size

      x = 4

      y = i * 116

      if i > 1

        x += 300

        y = (i-2) * 116

      end

      actor = $game_party.actors[i]

      draw_battler(actor,x+180,y)

      draw_actor_name(actor, x, y)

      draw_actor_class(actor, x + 144, y)

      draw_actor_level(actor, x + 8, y + 32)

      draw_actor_state(actor, x + 8, y + 64)

      draw_actor_hp(actor, x + 152, y + 32)

      draw_actor_sp(actor, x + 152, y + 64)

    end

  end

  def update_cursor_rect

    if @index < 0

      self.cursor_rect.empty

    else

      x = 0

      y = @index * 116

      if @index > 1

        x += 300

        y = (@index-2) * 116

      end

      self.cursor_rect.set(x, y, 300, 96)

    end

  end

end

 

 

What I don't know, is why. I dropped half of the useless prodtos scenes and windows, that took up like 3000 lines of code, and made sure it didn't need them, and it still didn't work. Any suggestions?
 

Jason

Awesome Bro

Hmm, are you sure it's that script ? I put it in a blank game, and I can transfer between maps, I've also tried it with a game with 20+ scripts, and it still works fine o.O
 

Jason

Awesome Bro

Ah I see what you mean, I thought you just meant using the command (I can do it fine on the same map, couldn't be arsed making a new map to try it on, lol), but yeah it crashes if I transfer to a new map.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top