Jump to content
UncannyBoots

Any way to change how autotiles behave within the default scripts?

Recommended Posts

Essentially I'd like to make it so that if an autotile has a certain terrain tag, it will behave like a "star" tile, aka you can walk behind/under it. This will be useful for buildings, and it won't force me to have to make separate B-E tiles and take up precious tile space; instead I'll be able to just use the building autotiles I have created. I already have a solution for making the bottom of the building impassible.

Share this post


Link to post
Share on other sites

Essentially, replicating RM2000/2003's tileset system.

I don't really know if there is a way to do this, closest I would think is to replicate XP layers, but I'm not sure how to do so...

Share this post


Link to post
Share on other sites

I am pretty sure you can manually set and unset any flag for any tile in a tileset with scripts, including the one that makes it display over characters. I think that would be enough to do it?

Share this post


Link to post
Share on other sites
17 hours ago, Kayzee said:

I am pretty sure you can manually set and unset any flag for any tile in a tileset with scripts, including the one that makes it display over characters. I think that would be enough to do it?

 

That could be true, and if I were to guess it'd be in the Game_Map script, but I just have no idea where to go next.

It might have something to do with this part but it's above my skill level.

 #--------------------------------------------------------------------------
  # * Check Passage
  #     bit:  Inhibit passage check bit
  #--------------------------------------------------------------------------
  def check_passage(x, y, bit)
    all_tiles(x, y).each do |tile_id|
      flag = tileset.flags[tile_id]
      next if flag & 0x10 != 0            # [☆]: No effect on passage
      return true  if flag & bit == 0     # [○] : Passable
      return false if flag & bit == bit   # [×] : Impassable
    end
    return false                          # Impassable
  end
  #--------------------------------------------------------------------------
  # * Get Tile ID at Specified Coordinates
  #--------------------------------------------------------------------------
  def tile_id(x, y, z)
    @map.data[x, y, z] || 0
  end
  #--------------------------------------------------------------------------
  # * Get Array of All Layer Tiles (Top to Bottom) at Specified Coordinates
  #--------------------------------------------------------------------------
  def layered_tiles(x, y)
    [2, 1, 0].collect {|z| tile_id(x, y, z) }
  end
  #--------------------------------------------------------------------------
  # * Get Array of All Tiles (Including Events) at Specified Coordinates
  #--------------------------------------------------------------------------
  def all_tiles(x, y)
    tile_events_xy(x, y).collect {|ev| ev.tile_id } + layered_tiles(x, y)
  end
  #--------------------------------------------------------------------------
  # * Get Type of Auto Tile at Specified Coordinates
  #--------------------------------------------------------------------------
  def autotile_type(x, y, z)
    tile_id(x, y, z) >= 2048 ? (tile_id(x, y, z) - 2048) / 48 : -1
  end
  #--------------------------------------------------------------------------
  # * Determine Passability of Normal Character
  #     d:  direction (2,4,6,8)
  #    Determines whether the tile at the specified coordinates is passable
  #    in the specified direction.
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    check_passage(x, y, (1 << (d / 2 - 1)) & 0x0f)
  end

 

 

EDIT:

I found this script which is exactly the kind of thing I was looking for. However, it doesn't work in my project lmao. My character just walks over the autotile. I tested it in a new project and it worked, so it has to be in conflict with one of my scripts. Considering I have probably hundreds of scripts, this'll be very fun to figure out... Sigh lol

Edited by UncannyBoots

Share this post


Link to post
Share on other sites
1 hour ago, UncannyBoots said:

Considering I have probably hundreds of scripts,

I feel your pain. It could also be a script order. One script overwriting another. Usually placing it at the bottom works unless it overwrites something else that then breaks your game.

Share this post


Link to post
Share on other sites

That script looks pretty complected! I was trying to do it a simpler way but haven't had that much luck yet. Still neat!

 

Edit: Oh dear. It doesn't seem like it renders things above the player except for the B-E tile layer regardless of the tile's flag. >_<

So yeah, won't work for autotiles... unless the script makes a new whole new tilemap. I have done that before, but In was hoping it was simpler.

Edited by Kayzee

Share this post


Link to post
Share on other sites
1 hour ago, roninator2 said:

I feel your pain. It could also be a script order. One script overwriting another. Usually placing it at the bottom works unless it overwrites something else that then breaks your game.

After hours of trying everything I could think of (deleting every other script, deleting all common events, changing all tilesets and trying different tilesets, removing dlls) I discovered that it has something to do with the way RGD handles things. (I'm using RGD instead of the default RGSS).

It works perfectly in default RGSS as far as I can tell.

With RGD, it doesn't work after you transfer to another map containing the *same tileset* as the previous map. When the map you are transferred to has a different tileset to the previous one, the effect works just fine.

 

I have a theory that maybe RGD handles map transfers in a way that it doesn't completely 'reset' the tileset info when transferring unless it changes to another tileset. So this script might only insert its effects when changing the tileset, but not on a map change; perhaps in RGSS, map changing automatically triggered a tileset change and therefore "refreshes" the script, but in RGD, it is possible that changing the map does not register a tileset change if the tileset was not actually changed. And therefore, the script doesn't get completely called and the effect doesn't work.

^ That sounds complicated and it could be completely wrong but it's one possibility. How to fix it, I don't exactly know, but maybe if the script could be refreshed from the beginning every time a map transfer occurs, it could work.

I'll admit that I can't find anything supporting my theory within the script but it's the only thing I can think of

Edited by UncannyBoots

Share this post


Link to post
Share on other sites
1 hour ago, Kayzee said:

That script looks pretty complected! I was trying to do it a simpler way but haven't had that much luck yet. Still neat!

 

Edit: Oh dear. It doesn't seem like it renders things above the player except for the B-E tile layer regardless of the tile's flag. >_<

So yeah, won't work for autotiles... unless the script makes a new whole new tilemap. I have done that before, but In was hoping it was simpler.

 

It works with autotiles for me. Are you using region ids, or terrain tags? The script uses those terms interchangeably at times, but you actually need to mark the tiles with region ids.

Share this post


Link to post
Share on other sites
1 minute ago, Kayzee said:

I was fiddling with trying to make my own script actually, if that script works for you that's great!

 

 

 

 

 

 

 

Well it doesn't work for my project lol. It works with the default RGSS player but not with RGD, like I wrote above

 

I have the messy solution of creating a new tileset for every map but if I could get it to work without having to do that, I would be much more relieved

Edited by UncannyBoots

Share this post


Link to post
Share on other sites

Lol I was making an RGD demo and an RGSS demo to showcase what I was saying, and then while testing the RGD demo, I transferred to another map with the same tileset, and the thing worked. ARRRGH hahaha

I just don't know now.

 

RGD allows for "nearest neighbor" upscaling and that makes the game much prettier. That's literally the only reason I use it lol. But I do also like its configuration menu which I have implemented into my title menu and my main menu. Oh and also it isn't connected to other RGSS3 games with the F1 menu which is another bonus. On default RGSS3 games, if you disable audio in the F1 menu, it will disable it on every other RGSS3 game on your computer. So it makes the game feel more "independent" from other VX Ace games

 

I plan to implement mkxp in the future but it is beyond my skill level at the moment.

 

Well honestly I would prefer to walk behind autotiles over having prettier upscaling and a neat config menu, so for now I'm switching back to RGSS player unless anyone has any solution

Edited by UncannyBoots

Share this post


Link to post
Share on other sites

I see! I know very little about RGD really. RGD seems to have more features then mkxp anyway, though mkxp is more portable I think.

 

Sadly I don't have any other solution at the moment. I know a way it could be done, but it would be kinda a pain. Not even sure RGD would support it even.

Edited by Kayzee

Share this post


Link to post
Share on other sites
On 1/29/2020 at 8:44 PM, UncannyBoots said:

useful for buildings

I use a script for that. Didn't think about what you were trying to do.

Neon Black

CP Terrain Tags script

Set the region ID to use for cover. makes that tile above player.

Not sure about autotiles though.

Share this post


Link to post
Share on other sites
2 hours ago, roninator2 said:

I use a script for that. Didn't think about what you were trying to do.

Neon Black

CP Terrain Tags script

Set the region ID to use for cover. makes that tile above player.

Not sure about autotiles though.

It works for autotiles, and I've tried using it but as I said doesn't properly work in RGD.

I asked about it on the official forums but no response yet. For now I'm just going back to using RGSS Player until maybe later in my development if people get interested in my game, someone more tech proficient than I can solve the issue

Edited by UncannyBoots

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×