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.

Hidden Autotile Script

Hidden Autotile Script
v1.1


Introduction

This script allows the game designer to use autotiles for debugging that won't be displayed ingame. Those can be used for passability/non-passability, or simply marking paths for events or similar.
The autotiles I provide have 50% transparency and a descriptive text on them. I think that's a good way of marking the areas. Of course, you can use all autotiles you want with this script.


Script and Resources

Code:
    for i in 0..6
      autotile_name = $game_map.autotile_names[i]
      if $DEBUG
        @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
      else
        if autotile_name.include?("Overlay_") == false
          @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
        end
      end
    end


Instructions

Just replace the default for-condition inside class Spriteset_Map with the code I posted.

For rendering an Autotile to not be shown ingame, rename it to something containing "Overlay_" and copy it into the Graphics/Autotiles folder.


Screenshots

http://img122.imageshack.us/img122/1754/4384jg2.jpg[/img]


Bugs

None known.


FAQs

None so far.


Credits

BlueScope for both scripting and autotile 'spriting'.
 
Code:
unless $DEBUG and autotile_name.include?("Overlay_") 
  @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
^
Why not?
 
@Me: Try it, it won't work... ^_^ You need an else-case at least, because you need to draw autotiles in both cases ($DEBUG true and false), but while $DEBUG, the tiles with "Overlay_" should also be drawn... I haven't found a shorter way to do it, but I'm pretty sure your way doesn't work... :P (I'll try it out when I'm at home, though)

EDIT @Seph: Thanks... though I doubt you meant that serious :P
 
No, I did.

I believe this is what you are meaning?

Code:
    for i in 0..6
      autotile_name = $game_map.autotile_names[i]
      if $DEBUG || not autotile_name.include?("Overlay_")
          @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
        end
      end
    end
 
Code:
unless (not $DEBUG and autotile_name.include?("Overlay_") )
  @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
I forgot the not... It is pretty much the same as sephs, except the bitwise thing/logical thing
 
It's very cool indeed especially if your creating a dungeon map with hidden areas or covered areas that holds hidden treasures or an optional boss.
 
The usual: Test it with a new project, legal latest version, double-check the instructions, ... if it still doesn't work after those, place this directly above Main:

Code:
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Make viewports
    @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport2.z = 200
    @viewport3.z = 5000
    # Make tilemap
    @tilemap = Tilemap.new(@viewport1)
    @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
    # BlueScope's Hidden Autotile conditional
    for i in 0..6
      autotile_name = $game_map.autotile_names[i]
      if $DEBUG
        @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
      else
        if autotile_name.include?("Overlay_") == false
          @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
        end
      end
    end
    @tilemap.map_data = $game_map.data
    @tilemap.priorities = $game_map.priorities
    # Make panorama plane
    @panorama = Plane.new(@viewport1)
    @panorama.z = -1000
    # Make fog plane
    @fog = Plane.new(@viewport1)
    @fog.z = 3000
    # Make character sprites
    @character_sprites = []
    for i in $game_map.events.keys.sort
      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
      @character_sprites.push(sprite)
    end
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
    # Make weather
    @weather = RPG::Weather.new(@viewport1)
    # Make picture sprites
    @picture_sprites = []
    for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport2,
        $game_screen.pictures[i]))
    end
    # Make timer sprite
    @timer_sprite = Sprite_Timer.new
    # Frame update
    update
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Dispose of tilemap
    @tilemap.tileset.dispose
    for i in 0..6
      @tilemap.autotiles[i].dispose
    end
    @tilemap.dispose
    # Dispose of panorama plane
    @panorama.dispose
    # Dispose of fog plane
    @fog.dispose
    # Dispose of character sprites
    for sprite in @character_sprites
      sprite.dispose
    end
    # Dispose of weather
    @weather.dispose
    # Dispose of picture sprites
    for sprite in @picture_sprites
      sprite.dispose
    end
    # Dispose of timer sprite
    @timer_sprite.dispose
    # Dispose of viewports
    @viewport1.dispose
    @viewport2.dispose
    @viewport3.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If panorama is different from current one
    if @panorama_name != $game_map.panorama_name or
       @panorama_hue != $game_map.panorama_hue
      @panorama_name = $game_map.panorama_name
      @panorama_hue = $game_map.panorama_hue
      if @panorama.bitmap != nil
        @panorama.bitmap.dispose
        @panorama.bitmap = nil
      end
      if @panorama_name != ""
        @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
      end
      Graphics.frame_reset
    end
    # If fog is different than current fog
    if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
      @fog_name = $game_map.fog_name
      @fog_hue = $game_map.fog_hue
      if @fog.bitmap != nil
        @fog.bitmap.dispose
        @fog.bitmap = nil
      end
      if @fog_name != ""
        @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
      end
      Graphics.frame_reset
    end
    # Update tilemap
    @tilemap.ox = $game_map.display_x / 4
    @tilemap.oy = $game_map.display_y / 4
    @tilemap.update
    # Update panorama plane
    @panorama.ox = $game_map.display_x / 8
    @panorama.oy = $game_map.display_y / 8
    # Update fog plane
    @fog.zoom_x = $game_map.fog_zoom / 100.0
    @fog.zoom_y = $game_map.fog_zoom / 100.0
    @fog.opacity = $game_map.fog_opacity
    @fog.blend_type = $game_map.fog_blend_type
    @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
    @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
    @fog.tone = $game_map.fog_tone
    # Update character sprites
    for sprite in @character_sprites
      sprite.update
    end
    # Update weather graphic
    @weather.type = $game_screen.weather_type
    @weather.max = $game_screen.weather_max
    @weather.ox = $game_map.display_x / 4
    @weather.oy = $game_map.display_y / 4
    @weather.update
    # Update picture sprites
    for sprite in @picture_sprites
      sprite.update
    end
    # Update timer sprite
    @timer_sprite.update
    # Set screen color tone and shake position
    @viewport1.tone = $game_screen.tone
    @viewport1.ox = $game_screen.shake
    # Set screen flash color
    @viewport3.color = $game_screen.flash_color
    # Update viewports
    @viewport1.update
    @viewport3.update
  end
end
If this works, you know you did something wrong before :P
 
Works for me. In a new project but when I try it out in one I've been working one I still see the
auto-tile sets.
And I've done exactly as you had it. What could be the problem?
 

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