Save-Point
Old Map Data for GTBS - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: Old Map Data for GTBS (/thread-9000.html)



Old Map Data for GTBS - kyonides - 08-19-2024

Old Map Data for GTBS
VX ACE ONLY EDITION

by Kyonides

Introduction

There was once a forumer that wanted to keep the data used in the normal map before entering the tactical battle map when they were precisely one and the same. Well, this plug & play scriptlet seeks to accomplish this very same feat.

It heavily depends on the original GTBS script so you need to paste this patch BELOW the main GTBS one.

The Script

Code:
# * Old Map Data for GTBS * #
#  Plug & Play Script
#  Scripter : Kyonides Arkanthes
#  v0.3.0 - 2024-08-19

class Game_Map
  alias :kyon_gtbs_mod_gm_map_setup_events :setup_events
  def setup_events
    if @tactical_battle_end
      setup_old_events
    else
      kyon_gtbs_mod_gm_map_setup_events
    end
  end

  def setup_old_events
    @events = @old_events.dup
    @common_events = @old_common_events.dup
    @old_events = @old_common_events = @tactical_battle_end = nil
    refresh_tile_events
  end

  def save_map_data
    @old_bgm_pos = @map.bgm.pos unless @map.bgm.name.empty?
    @old_bgs_pos = @map.bgs.pos unless @map.bgs.name.empty?
    @old_events = @events.dup
    @old_common_events = @common_events.dup
  end

  def autoplay
    bgm_pos = @old_bgm_pos || 0
    bgs_pos = @old_bgs_pos || 0
    @old_bgm_pos = @old_bgs_pos = nil
    @map.bgm.play(bgm_pos) if @map.autoplay_bgm
    @map.bgs.play(bgs_pos) if @map.autoplay_bgs
  end
  attr_accessor :tactical_battle_end
end

class Scene_Battle_TBS
  def start
    super
    $game_map.save_map_data
    prepare_GTBS
  end

  def exit_battle
    return_to_map, mx, my, mdir = GTBS::battle_exit_info(@map_id)
    return_to_map = @map_id if !return_to_map || return_to_map == 0
    $game_map.tactical_battle_end = return_to_map == @map_id
    $game_map.setup(return_to_map)
    $game_player.moveto(mx, my) if mx != nil
    $game_player.set_direction(mdir) if mdir != nil
    $game_party.clear_summons
    $game_party.clear_neutrals
    $game_troop.clear_summons
    @map_id = nil
    SceneManager.return
    $game_map.autoplay
    $game_player.refresh
    $game_player.center($game_player.x, $game_player.y)
    Graphics.freeze
    Graphics.fadeout(30)
  end
end

Terms & Conditions

Free as in Beer beer.
Due credit is mandatory.
Mention this forum in your game credits.
That's it! Tongue sticking out