Region Fog

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

This script allows you to control fog of war using region tiles.  Each map can assign multiple different regions of fog. Different fog regions are separate from one another.

Script calls are used to show or hide region fog.



Required: Bit Switches

You will also need this image: region_fog_tileset


Place this script below Bit Switches and above Main.
Place the “region_fog_tileset” image into your Graphics/System folder


Creating your region fog


The basic note-tag is given as follows:

<region fog>
region: x, switch: y
</region fog>

Where x and y are both numbers. You can have as many region fogs as you want on a single map. You can assign the same switch to multiple regions, across different maps as well. The basic note-tag requires you to specify the region and its corresponding switch.

If you require more advanced options, or don’t want to use all of the options
available, use the extended note-tag as follows:

<region fog: 2>
  switch: 2
  tile: 1
</region fog>

Which will designate region 2 as a region fog, whose visibility is based on
bit-switch 2, and uses fog tile 1.

Custom Fog Tiles

By default, the fog tile you get is black. If you look at the region_fog_tileset image, you will see a 32×32 black square near the top-left.


Each tile has an ID. The top-left tile is tile 0, which is no fog.
The one next to it is tile 1, which is the default black fog. You can add your
own fog tiles as well, and reference in the extended note-tag if you want
specific regions to use specific fog tiles.


Changing Fog Visibility

To show or hide the a region fog, you will need to change the value of the
switch. These are bit switches, so you won’t be able to use the “Control
Switches” event command to change them.


To hide the fog, make the script call


To show the fog, make the script call



Here’s a sample region fog setup:

<region fog>
region: 1, switch: 1
region: 2, switch: 2
region: 3, switch: 1
</region fog>

This means that the fog for regions 1 and 3 use the same bitswitch.
If you called


This would hide the fog for both region 1 and region 3.

An equivalent setup using the extended note-tag would be as follows:

<region fog: 1>
  switch: 1
</region fog>
<region fog: 2>
  switch: 2
</region fog>

<region fog: 3>
  switch: 1
</region fog>

It is more verbose, the extended note-tag provides more options and not every option is required.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

19 Responses

  1. LaganRK says:

    Exist a method to show a character upper the fog?

  2. X-Tech says:

    Hey. Nice script but hard in use. Isnt be better to just automatically set all fogs on and just switching it off when player goes on specific area ? In way like this script is is just almost the same work as making this by game variables/switches and pictures without any outer ruby scripts.

  3. Jóshua Sardinha says:

    Hey Hime!

    I was just thinking, for a little better aesthetics, would there be a way to create a slight fade on the fog's visibility?

    Thank you!

    • Hime says:

      Fade as in, making it somewhat transparent? Or an actual, fully animated fog effect? Cause transparency can be done, but if you want an actual fog with different opacities here and there, that would be out of the scope of my knowledge.

      • Jóshua Sardinha says:

        No, no sir! Haha, just the transparency thing, and it would be already awesome. This "fog of war" is exactly what I was looking for, but it should show up and disappear just a little bit more smoothly. The Nocturne Rebirth game (Echoes in the Moonlight) has something like it, and it shows how can nice things be done with it.

        • Hime says:

          I looked at the way the script was written, but unfortunately it doesn't seem like there's an easy way to change it so that each region would fade-in or out with the current design.

          A different approach would be required to provide the animations since the one I used doesn't support it.

          • Jóshua Sardinha says:

            Don't bother yourself with this request, it's ok. I mean, it's a detail and only. I confess didn't look at whole the script, I'm yet learning to program, but I can guess you replace the marked tiles with others, instead of covering the area with something else. If I'm right, to make a soft transition really wouldn't sound easy. Let me have another question, if you don't mind: to make an area covered with black, in that way, but enabling opacity managing in it would cause to much lag?
            Thank you!

          • Hime says:

            You basically have no control over tilemaps, so anything involving specific tile manipulations beyond telling it which tile you want to use is pretty much impossible.

            Ideally the fogs themselves should just be sprites, which would then be easy to manipulate. You would also be able to perform custom fade animations such as out-to-in and so on. There would not be much lag there if it were implemented that way.

  4. oliopro says:

    So I’m wondering if this idea I had would be a quick easy way to have a nice border to the fog. The idea is that you make the fog tiles larger than 32×32, say 40×40, but have them centre on the middle 32×32 section. The centre section would still be completely black but the “edges” that would overlap would be black with transperancy and the “corners” would have a higher transperancy so when they overlap with other corners it looks nice. Just an idea.

    • Hime says:

      That can be done using a smarter fog generator that uses auto-tiles. The engine would use an auto-tile to generate the fog, and you would choose an auto-tile that has a border along the edge.

      Each fog tile cannot be larger than 32×32 however, because I’m using the tilemap to generate it.

      • oliopro says:

        Could that be done by using vx aces built in tile reading capacities or does this script read the tiles straight from the .png meaning you’d have to put the auto-tiling into the script?

  5. Tsukihime says:

    Script has been updated with a new extended note-tag that allows you to choose custom fog tile. Instructions on how to use the extended note-tag as well as creating your own fog tiles have been added.

  6. RogueDeus says:

    Just an FYI. This script is causing a hard application crash on transition from battle to area map. The crash doesn’t happen when using the troop menu ‘Battle Test’ so whatever is happening it likely has to do with the process of re-loading of the area map.

    I am using a lot of disparate scripts in my current build, with over a dozen of yours, Yanfly, Kread-EX, and a few others so I am not sure if it is due to any particular one, or just an overload of some sorts; but I can sometimes make out the black tiles starting to appear over the effected regions when the crash occurs, and removing this script (it took 2 hrs of removing/replacing stuff to isolate it) stopped it.

    I do not expect you to fix it, just figured I would report on my attempt to use it. Hopefully my rambling leads you to a possible solution, if the desire strikes you. I will report if I find anything more specific.

    Thanks again for sharing what you do.

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see