Map Infos
#1
Map Infos
Version: 1.2


Introduction
This mini-script, loads data from RPG::Map into RPG::MapInfo. I wasn't pleased to see that you have to load a file just to get data that should have been in RPG::MapInfo, so I scripted this up pretty quickly to load all information (except event data and tileset data, I may add event data in a future update)


Screenshots
ok visualize the copying of data to one memory location to another memory location there is your screenshot


Demo
See next topic by me for a demo


Script
I despise the families...

Code:
=begin
=============================================================================
? Map Info
=============================================================================
Trickster
Version 1.2
3.21.07
=============================================================================
=end

#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Map Info', 'Trickster', 1.2, '3.21.07')
#--------------------------------------------------------------------------
# Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1, 2, 3])
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?('Map Info')
  
#--------------------------------------------------------------------------
# * Save RPG::MapInfo Data
#   Set to To True to Save MapInfo Data this moves the RPG::Map stuff to
#   RPG::MapInfo so maps will not be loaded frequently to get the map info.
#   Set it to True run project at least once then set to false, set to
#   true again if you changed any of your maps
#--------------------------------------------------------------------------
Save_MapInfoData = false

#--------------------------------------------------------------------------
# * Update RPG::MapInfo Data
#   Set this to true if you changed any of your maps
#--------------------------------------------------------------------------
Update_MapInfoData = false

  
class RPG::MapInfo
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :tileset_id
  attr_accessor :width
  attr_accessor :height
  attr_accessor :autoplay_bgm
  attr_accessor :bgm
  attr_accessor :autoplay_bgs
  attr_accessor :bgs
  attr_accessor :encounter_list
  attr_accessor :encounter_step
end

class Scene_Title
  #--------------------------------------------------------------------------
  # * Main Database
  #--------------------------------------------------------------------------
  alias_method :trick_mapinfo_title_main_database, :main_database
  def main_database
    # The Usual
    trick_mapinfo_title_main_database
    # Create $data_mapinfos object
    $data_mapinfos = load_data("Data/MapInfos.rxdata")
    # Setup encounter info
    setup_map_info
  end
  #--------------------------------------------------------------------------
  # * Battle Test Database
  #--------------------------------------------------------------------------
  alias_method :trick_mapinfo_title_battletest_database, :battletest_database
  def battletest_database
    # The Usual
    trick_mapinfo_title_battletest_database
    # Create $data_mapinfos object
    $data_mapinfos = load_data("Data/MapInfos.rxdata")
    # Setup encounter info
    setup_map_info
  end
  #--------------------------------------------------------------------------
  # * Setup Map Info
  #--------------------------------------------------------------------------
  def setup_map_info
    # Return if test value is not nil or updating info
    return if $data_mapinfos[1].width != nil and !Update_MapInfoData
    # Begin
    begin
      # Do from 1 to 999 (Maximum number of maps)
      1.upto(999) do |map_id|
        # Load Map
        map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
        # Set Map Info Object
        $data_mapinfos[map_id].tileset_id = map.tileset_id
        $data_mapinfos[map_id].width = map.width
        $data_mapinfos[map_id].height = map.height
        $data_mapinfos[map_id].autoplay_bgm = map.autoplay_bgm
        $data_mapinfos[map_id].bgm = map.bgm
        $data_mapinfos[map_id].autoplay_bgs = map.autoplay_bgs
        $data_mapinfos[map_id].bgs = map.bgs
        $data_mapinfos[map_id].encounter_list = map.encounter_list
        $data_mapinfos[map_id].encounter_step = map.encounter_step
      end
    rescue Errno::ENOENT
      # If Save Map Info Data Save Data
      save_data($data_mapinfos, "Data/MapInfos.rxdata") if Save_MapInfoData
    end
  end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end


Instructions
Add above main that's it, It also has a save data feature so you will only have to set it to true once, load your project and set it to false. you will have to set it to true again if you edit your maps or else...


FAQ
Note: Permission granted by Trickster to post:
Quote:And if you post what you have now of my stuff then you don't have the latest versions. I'm too lazy/busy to post stuff.
As this is his material, it is deletable upon his request. Due to his current absense, no support is available. Please do not PM or eMail him for support.


Compatibility
Requires SDK Part 3


Author's Notes
The first person who posts "What does this script do?" will get a surprise from me (and it won't be a good surprise) if you don't know what this does then you won't have a use for it


Terms and Conditions
Hey, I posted this publicly. You can use it. What do you expect? But if you do use it, I do expect you to spell my name correctly in your game. And yes you can use it in commercial games too.
Reply }
#2
Question. As we now know, by directing a person to go to map 1001 hand having actually 1001 maps in your system, your character WILL go, but that 1001 map will not show up in the map editor. While other aspects of the Database can be broken with simple scripts, does this, by adding those extra maps to mapinfos.rxdata allow someone to store over 999 maps and in essence, have those extra maps show up in the game editor?
[Image: yy7iKKb.png]

ITCH: jayray.itch.io
Currently working on Goblin Gulch (MV)
Currently working on JayVinci Resurrection
Currently working on Bakin ABS (BAKIN)
Reply }




Users browsing this thread: 3 Guest(s)