Multi Layer Fog

flimbo

Villager
Member
Joined
Nov 10, 2013
Messages
23
Reaction score
2
First Language
Portuguese
Primarily Uses
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.
 
Last edited by a moderator:

RaZzi

My Peculiar Brother
Veteran
Joined
Jul 19, 2013
Messages
423
Reaction score
206
First Language
Finnish
Primarily Uses
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] ?
 
Last edited by a moderator:

flimbo

Villager
Member
Joined
Nov 10, 2013
Messages
23
Reaction score
2
First Language
Portuguese
Primarily Uses
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 >.<
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,367
Reaction score
14,074
First Language
English
Primarily Uses
RMVXA
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,956
Reaction score
13,589
First Language
English
Primarily Uses
RMMV
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.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,038
First Language
French
Primarily Uses
RMMV
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? 
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,367
Reaction score
14,074
First Language
English
Primarily Uses
RMVXA
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,956
Reaction score
13,589
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Ninjaroy

Wannabe Potato
Veteran
Joined
Jul 19, 2013
Messages
54
Reaction score
1
First Language
English
Primarily Uses
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?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,279
Reaction score
11,681
First Language
English
Primarily Uses
RMVXA
You don't use the symbol %, just have 100.  
 

Ninjaroy

Wannabe Potato
Veteran
Joined
Jul 19, 2013
Messages
54
Reaction score
1
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,956
Reaction score
13,589
First Language
English
Primarily Uses
RMMV
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.
 

Ninjaroy

Wannabe Potato
Veteran
Joined
Jul 19, 2013
Messages
54
Reaction score
1
First Language
English
Primarily Uses
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,956
Reaction score
13,589
First Language
English
Primarily Uses
RMMV
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.
 

Ninjaroy

Wannabe Potato
Veteran
Joined
Jul 19, 2013
Messages
54
Reaction score
1
First Language
English
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,956
Reaction score
13,589
First Language
English
Primarily Uses
RMMV
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.
 

Bonkers

Get ready to be Wowed!
Restaff
Joined
May 26, 2013
Messages
2,941
Reaction score
2,896
First Language
English
Primarily Uses
RMMV
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.
 

Ninjaroy

Wannabe Potato
Veteran
Joined
Jul 19, 2013
Messages
54
Reaction score
1
First Language
English
Primarily Uses
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 kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,038
First Language
French
Primarily Uses
RMMV

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,956
Reaction score
13,589
First Language
English
Primarily Uses
RMMV
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts



New starting map, hope it's better than the first.
new evolutions coming soon:ewink:
Oddball wrote on The_Sarah's profile.
Today: started the Army HQ. I opted for a bulky, heavy design.
Did YOU know that "$game_switches[55] = true" and "$game_switches[055] = true" do completely different things, and you should never leave a zero in? I didn't. :p
mzActor2.png mzSF_Actor2.png, mzSchoolActor2.png added!

Forum statistics

Threads
103,415
Messages
999,141
Members
134,945
Latest member
UTfan1243
Top