Multi Layer Fog

Sure 🙂

All the information you need is in the Game_Interpreter class of the script. It has methods that accept arguments from your Script event command, and then calls the appropriate Fog method to do what you need. Each of those methods only has one command. So you can basically copy the command, substitute the values, and replace screen with the appropriate variable - either $game_map.screen or $game_troop.screen (the former for on a map, the latter for in battle).
Hi Shaz,

 Thanks! It worked fine for creating a new fog ($game_map.screen.fogs[1].show(...)), but I got an issue when erasing or changing a previosly created fog´s tone ($game_map.screen.fogs[0].start_opacity_change(etc) and $game_map.screen.fogs[0].erase ):

Script 'Shaz Multiple Fogs' line 219: NoMethodError ocurredundefined method '-' for nil:NilClassRight here:

 def update_move  --->  @sx2 -= @sx / 8.0        @sy2 -= @sy / 8.0If I create the new fog on the script and after that try to change it's tone/erase it, then it works fine.
Hi Shaz,

 Thanks! It worked fine for creating a new fog ($game_map.screen.fogs[1].show(...)), but I got an issue when erasing or changing a previosly created fog´s tone ($game_map.screen.fogs[0].start_opacity_change(etc) and $game_map.screen.fogs[0].erase ):
Shouldn't [0] be [1] ?
Shouldn't [0] be [1] ?
Ugh... yes. I thought the previosly created fog (inside an event) was indexed 0, but it was 1.... thank you very much. Sorry for not noticing it >.<
Where is a good place to get fog graphics? I tried the search engine on the forums, but fog is too short a word for the search engine, so it returns nothing (appears we have to use 4 letter words or bigger for it to be a valid search it says, so it deletes fog from my search). Any good public resources out there at the moment?
If you own a copy of XP, you can use the XP fogs. I'm not sure there are any available here on the site, as fogs are not something that Ace uses.


You could also use Google search but limit it to this site if you want - that'll allow you to overcome the 4-letter minimum constraint.
aww...shaz....my internet is crappy and don't allow me to open your site where the script is....how I can do for get your script? 
And, as luck would have it, I do own XP and ACE, so that just might solve my problem. Thanks! I tested the script with a dummy graphic just to display something as a layer, and it worked fine, but needed to find fog to be able to use it well.
nio, which site can't you open - my blog, or pastebin?


Here's the direct pastebin link: http://pastebin.com/bk4BKECW


If you can't open that, let me know and I'll PM it to you.
Hello,

I'm having slight difficulties understanding the method of showing a fog. As I am using this for a parallax background alternative, I want my fog to be inbetween the parallax and map, and to be full opacity. So the first thing I did was this:

show_fog(1, "Mage", -50)

Sure enough, my image appeared inbetween the map and parallax, however was zoomed in and around 25% opacity. So I tried this, and it failed:

show_fog(1, "Mage", 255, 100%, -50)

The script didn't expect this. I'm obviously doing something wrong here, so could somebody please point me in a more preferable direction?
You don't use the symbol %, just have 100.  
You don't use the symbol %, just have 100.  
 Aha! Thank you very much sir! I had a few other problems also as it turns out but I was able to resolve them.

Works perfectly now.
Just remember - you can't put in ONLY the arguments you're interested in and expect it to work. If you want to change the last argument, you MUST provide all the others.


So to show it between the map and the parallax layer by putting -50 as z for the last argument, you also have to specify the fog number, file name, hue, opacity, blend type, zoom, speed x and speed y, even if you just want to give them the default values. You can only leave an argument out and have it accept the default if you also leave out (and have it accept the default) for all the others following that one.
Just remember - you can't put in ONLY the arguments you're interested in and expect it to work. If you want to change the last argument, you MUST provide all the others.

So to show it between the map and the parallax layer by putting -50 as z for the last argument, you also have to specify the fog number, file name, hue, opacity, blend type, zoom, speed x and speed y, even if you just want to give them the default values. You can only leave an argument out and have it accept the default if you also leave out (and have it accept the default) for all the others following that one.
All good.

Just one more thing, is 100 the most zoomed out a fog can go? As my fogs are the size of a parallax, 100 only shows about 2/3 of the fog, and I tried 75 zoom but it remained the same. Or maybe my image needs to be a different size?
200 is the default.  You should be able to put in other values and see the results.  I would ask if you put it in the right place, given that you didn't enter enough arguments initially.
200 is the default.  You should be able to put in other values and see the results.  I would ask if you put it in the right place, given that you didn't enter enough arguments initially.
Sorry if my question was not worded correctly: I've always been bad at communicating. What I mean to say is that if I enter any zoom value less than 100, the fog seldom appears, and I was wondering if 100 is the lowest numeral accepted, and if so, is there a recommended size for the fog image so that the whole fog will be displayed in the game window?

Also, the format of the script call was one of the things I figured myself, so it is being used correctly now 🙂 .

Many apologies for the misunderstanding.
Ah, okay, I see it now.

In the original version (XP Fog - single layer) this would have worked. In the new version it won't go below 100 because I forgot to use floating point arithmetic.

Search for these two lines in the script:

self.zoom_x = @fog.zoom / 100 self.zoom_y = @fog.zoom / 100(they're in the Plane_Fog.initialize method)Change it to this:

self.zoom_x = @fog.zoom / 100.0 self.zoom_y = @fog.zoom / 100.0(just put .0 after each 100)Without that, it's doing 75 / 100 = 0.75 and then converting to an integer via truncation rather than rounding.
I'm having a great time using this script, but not for it's intended purpose of Fogs.  Due to all the controls and ability to use multiple pictures I've actually gotten to it preform a moving star field\nebula to simulate travel along with planetary movement for separate pictures.  I'm also trying it in cut scenes for some larger overlays to see if I can get it to simulate underwater and a few other environments.

Thank you much for this, it's immensely useful and fun.
Ah, okay, I see it now.

In the original version (XP Fog - single layer) this would have worked. In the new version it won't go below 100 because I forgot to use floating point arithmetic.

Search for these two lines in the script:

self.zoom_x = @fog.zoom / 100 self.zoom_y = @fog.zoom / 100(they're in the Plane_Fog.initialize method)Change it to this:

self.zoom_x = @fog.zoom / 100.0 self.zoom_y = @fog.zoom / 100.0(just put .0 after each 100)Without that, it's doing 75 / 100 = 0.75 and then converting to an integer via truncation rather than rounding.
Huzzah! Everything has been fixed. Thank you Shaz!
nio, which site can't you open - my blog, or pastebin?

Here's the direct pastebin link: http://pastebin.com/bk4BKECW

If you can't open that, let me know and I'll PM it to you.
than

nio, which site can't you open - my blog, or pastebin?

Here's the direct pastebin link: http://pastebin.com/bk4BKECW

If you can't open that, let me know and I'll PM it to you.
thanks but now this work fine this was the blog I don't had access 🙂  
I'm thinking about ditching the blog and just putting all the links straight to pastebin. It just means I'll need to make sure all the instructions for my scripts are complete here.

Original thread: https://forums.rpgmakerweb.com/threads/multi-layer-fog.18835/