EST - RegionMapLoader

Discussion in 'JS Plugin Releases (RMMV)' started by estriole, Nov 16, 2015.

  1. estriole

    estriole Veteran Veteran

    Messages:
    1,030
    Likes Received:
    334
    First Language:
    indonesian
     ■ Information      ╒══════════════════════════╛
     EST - RegionMapLoader
     Version: 1.0
     By Estriole
     File name: EST_RegionMapLoader.js

     ■ Introduction     ╒══════════════════════════╛
        Replace map data you mark with region with other map data.
     usefull if you want to transform part of the map...

     ■ Extra Credit     ╒══════════════════════════╛
     person other than me (Estriole) that you should credit in your project
     if you use this plugin

      - Formar => for part of the idea from his REGIONMAPLOADER from ACE.
                  (i only reference some of the idea from his script. not all Idea is from his script)

     ■ Features         ╒══════════════════════════╛
     - mark your map with region then swap the data on it from other map

     ■ Changelog       ╒══════════════════════════╛
       v1.0 2015.11.16           Initial Release

     ■ Plugin Download ╒══════════════════════════╛
      Download
      Demo Use same demo with build and decor series

     ■ Screen Shot╒══════════════════════════╛

    [​IMG]

     ■ How to use       ╒══════════════════════════╛

    open spoiler... if after reading it you still confused... see the demo :D .

    or post here and ask question. i will answer as soon as i can.

    (i can guarantee fast enough though... currently power line in my town got damaged by storm. and we got

    [24h blackout 6h electricity] cycle... it will be like this for 3 weeks >.<).

     1) create your base map... (map you want to swap the data to)
     2) create your reference maps... it's better if it have the same size / layout with your first map.
        the map MUST have the coordinate you want to reference. ex: if you make base map coordinate [10,10]  
        replaced with reference map. the reference map MUST have [10,10] coordinate!!!!
     3) mark your first map (base map) with regions... example: region 21, 22, and 23.
        which you want the part to change to reference map.
     4) create your event which will change the region map data.
     using this:
     Plugin command:
       update_region_map regionId refMapId      ex: update_region_map 21 7

          will replace region 21 data with map 7 data.
          ex: update_region_map 21 null

          will revert region 21 to default map data

     or Script Call:

        this.updateRegionMap(regionId,refMapId)      ex: this.updateRegionMap(21,7)

          will replace region 21 data with map 7 data.
          ex: this.updateRegionMap(21,null)

          will revert region 21 to default map data
     
     5) AFTER you plugin command or script call from no. 4.
     you must call this to UPDATE your map (or else it won't be updated)
     Plugin command:

        process_update_region_map fadetype    ex:

    process_update_region_map 2    will update the region data and using transfer transition 2
        ex: process_update_region_map

        if you don't set parameter for fadetype. it will use what you set default on plugin parameter
        
     or Script Call:

        this.updatingRegionMap(fadetype)    ex: this.updatingRegionMap(2)

        will update the region data and using transfer transition 2
        ex: this.updatingRegionMap()

        if you don't set parameter for fadetype. it will use what you set default on plugin parameter
     fadetype -> 0 = Black, 1 = White, 2 = No Fade.

     this updating is actually teleporting to same map with same coordinate.
     (so it 'might' not compatible with plugins which call common event on transfer
     since it might call that common event when calling this update method...)
     i might change this method later to actually erase tilemap and recreate tilemap.
     but for now this is sufficient.
     ■ Dependencies     ╒══════════════════════════╛
     None Known So Far...

     ■ Compatibility    ╒══════════════════════════╛
     I'm new in JS... and MV is new engine... so i cannot say for sure.
     but it should be compatible with most things.

     ■ Parameters       ╒══════════════════════════╛
      > DefaultUpdatingRegionMapTransition
      default: 0
      desc: when updating region map. use this transitions.
            0 -> black, 1->white, 2->none

     ■ License          ╒══════════════════════════╛
     Free to use in all project (except the one containing pornography)
     as long as i credited (ESTRIOLE).

     ■ Support          ╒══════════════════════════╛
     While I'm flattered and I'm glad that people have been sharing and
     asking support for scripts in other RPG Maker communities, I would
     like to ask that you please avoid posting my scripts outside of where
     I frequent because it would make finding support and fixing bugs
     difficult for both of you and me.
       
     If you're ever looking for support, I can be reached at the following:
     [ http://forums.rpgmakerweb.com/ ]
     pm me : estriole

     ■ Author's Notes   ╒══════════════════════════╛
     Originally i want to Convert Formar Region Map Loader
     from ACE to MV. but i need to rewrite most of it because
     the difference between ACE and MV. so just credit him for
     part of the idea.

     This also part of EST - Decor And Build Series  EST - SAVE MAP EVENTS

      EST - CLONE TRANSFORM DELETE EVENT

      EST - EVENT GRAPHIC SHIFT

      EST - EVENT SIZE AND TRIGGER

      EST - BUILD AND DECOR EX

      EST - REGIONMAPLOADER
     
    Last edited by a moderator: Nov 20, 2015
    #1
  2. Makeratore

    Makeratore Veteran Veteran

    Messages:
    187
    Likes Received:
    51
    Location:
    Rome, Italy
    First Language:
    Italian
    I love it! :D

    This is so useful!
     
    #2
    estriole likes this.
  3. Ghost of Christmas Kloe

    Ghost of Christmas Kloe Ghost of a Princess Seagull Veteran

    Messages:
    1,504
    Likes Received:
    913
    Location:
    Somewhere...
    First Language:
    English
    Primarily Uses:
    N/A
    Yay! One more awesome addition to the Build And Decor Series!  :)  
     
    #3
    estriole likes this.
  4. estriole

    estriole Veteran Veteran

    Messages:
    1,030
    Likes Received:
    334
    First Language:
    indonesian
    updated plugins to v.1.1

      v1.1 2015.11.19      > Fix bug when copying / transforming / moving event using other build
                            and decor series plugin. the passability of hidden passage will revert back
                            to original map.
     
    #4
    Makeratore likes this.
  5. estriole

    estriole Veteran Veteran

    Messages:
    1,030
    Likes Received:
    334
    First Language:
    indonesian
    this few days... i encounter problem with loading map data asynchronously...

    this plugin and clone event plugin is throwing error $dataMap is null when playing the game ONLINE (if playing locally it won't have problem).

    i consult with Hudell since his custom event plugin also have same problem after i tested it... and he said that

    Quote

    thus causing the problem... i don't know does this count as MV bug or not. but i need to find a way to "wait until all asynchronous load data finished" before transferring.

    luckily... Hudell find some workaround for clone event. (sadly region map loader still not fixed).

    in summary. clone event compatible with browser online game. but region map loader is not compatible yet.

    i'm tackling this problem for few days and quite reach the roadblock. i will try fixing regionmap loader too...

    but finally decide i might do it later when my JS knowledge is better. since i also have some plugins i want to create.

    and by focusing in this issue make me unproductive.

    btw... soon released. (will post the plugin topic after posting this)

    EST - BATTLE ROYALE EVO

    want to have PLAYER + ALLIED ENEMY vs ENEMY vs ENEMY vs ENEMY vs ENEMY vs ENEMY ???

    complex battle where suddenly 3rd party join the battle. maybe some other country troop suddenly attack you and your enemy.

    or some ecosystem where tiger monster eat rabbit monster. it's up to your imagination.
     
    #5
    Makeratore likes this.
  6. mimi-min

    mimi-min Will draw for food. Member

    Messages:
    16
    Likes Received:
    8
    Location:
    Osaka, Japan
    First Language:
    English
    Primarily Uses:
    RMMV
    Is it possible to use this plugin to swap single tiles out individually? Or does it just change all tiles of that region?
     
    #6
  7. ShadowfireOmega

    ShadowfireOmega Finally found out how to change this! Veteran

    Messages:
    39
    Likes Received:
    3
    Location:
    San Antonio, Texas
    First Language:
    English
    Primarily Uses:
    N/A
    Thank you very much! After some initial problems with the plugin (which turned out to be it not getting turned on by someone >.>) this works fantastically! I had been trying to figure out how I was going to do this, which will be a big part of my game, for months now. This is literally the last piece of the puzzle I needed to start work on my game in earnest now :D
     
    #7
  8. Coras

    Coras 10 Month Old Code Baby Member

    Messages:
    8
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    N/A
    Hello, sorry for posting half a year later, but I have also encountered this $dataMap = null issue, except instead of happening online, it happens locally. Surely there can be a test to make sure that $dataMap != null and if it does = null, cycle until != null and then render? I'm a noob at JS, so I will hack at it until I give up or solve it. If I do solve this issue, I will update everyone on here as to how I did so (unless the author doesn't want me to and is still active?).


    However, if anyone who is more experienced could assist, that would be much appreciated!
     
    #8
  9. Coras

    Coras 10 Month Old Code Baby Member

    Messages:
    8
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    N/A
    SOLUTION to TypeError: cannot find width of null.


    This was easier than I thought. So, firstly, I will not repost the entire code here, but the function I have changed. What you will need to do to fix this error is go to the plugin file (EST_RegionMapLoader.js) and open it in a text editor.


    Next you will need to scroll until you see a function called: Game_Map.prototype.tileId = function(x, y, z){ //some code};


    Delete this function from the name to the "};" at the end of it.


    Now, you will need to copy and paste this in its place:


    Game_Map.prototype.tileId = function(x, y, z) {
    try{
    var width = $dataMap.width;
    var height = $dataMap.height;
    if($gameSystem._EstRegionMapData[this._mapId])
    return $gameSystem._EstRegionMapData[this._mapId][(z * height + y) * width + x] || 0;
    return est_regionmaploader_game_map_tileid.call(this,x,y,z);
    } catch(TypeError){
    setTimeout(this.tileId(), 2000);
    }
    };


    I believe that this has fixed it as I have not received any errors!


    UPDATE 1: So, for a few hours everything was working fine, however I ran into the error again! :o   It appears that while it does find the data it is looking for, when the error is found, the screen is given the alert and the controls are frozen. I believe that if this can be skipped over, then it should work. Working on it now.


    UPDATE 2: So, unfortunately I don't know a good way to test for the error, as before it took hours before it happened again. The logic in this code should solve the issue, (fingers crossed):


    Game_Map.prototype.tileId = function(x, y, z) {
    if($dataMap != null){
    var width = $dataMap.width;
    var height = $dataMap.height;
    if($gameSystem._EstRegionMapData[this._mapId])
    return $gameSystem._EstRegionMapData[this._mapId][(z * height + y) * width + x] || 0;
    return est_regionmaploader_game_map_tileid.call(this,x,y,z);
    } else{
    setTimeout(this.tileId(), 2000);
    }
    };


    UPDATE 3: Yeah, so I'm kind of annoyed now, lol. It happened again. Here's what I'm trying this time around:


    Add this code to a new plugin or an existing one:


    SceneManager.onError = function(e) {
    console.error(e.message);
    console.error(e.filename, e.lineno);
    if (e.lineno != 5659){
    try {
    this.stop();
    Graphics.printError('Error', e.message);
    AudioManager.stopAll();
    } catch (e2) {
    }
    }
    };


    As I mentioned previously, I am a noob, so I don't know if I can just declare a function that already exists? Does that override it? Because that's what I'm trying to do, lol. Now, if I'm right, this SHOULD work... hopefully.
     
    Last edited by a moderator: Jan 27, 2017
    #9
    Shinma likes this.
  10. EmboZam

    EmboZam Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    Indonesian
    Primarily Uses:
    RMMV
    Are you indonesian though?
     
    #10
  11. Xalezar

    Xalezar Villager Member

    Messages:
    8
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    This plugin is amazing and is just what I'm looking for! Just wondering if it is possible to apply autotiling on the resulting map? If not, I'd like to request this feature for the future.
     
    #11
  12. Black Mamba

    Black Mamba Veteran Veteran

    Messages:
    257
    Likes Received:
    74
    First Language:
    pt-br
    i get this error

    [​IMG]
     
    #12
  13. 1n5an1ty

    1n5an1ty Villager Member

    Messages:
    14
    Likes Received:
    6
    First Language:
    English
    Primarily Uses:
    RMMV
    This looks like the plugin I was looking for, but from the looks of it, it's dead? A shame really. Are there any known similar plugins?
     
    #13

Share This Page