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.

Change Z Layer of Fogs via event script? (RESOLVED)

Hey folks, I'm using several pictures in one scene, and I would like the blowing sand fog that I use in the map to show above them.

Any way to change the Z layer of the fog so that it shows above my pictures?

Thanks!
 
According to RMXP's scripts, $game_map.fog.z is 3000 on @viewport1, and $game_pictures all use @viewport2 which the z value is 2000 meaning pictures should already be under the fog. Also, taking a look at Sprite_Picture, those sprites z value is @picture.number, so... your best bet would be to experiment with the $game_map.fog.z value.

Sorry if I'm rusty but also you could try experimenting with the .z settings of $game_map's @viewport1, @viewport2 and @viewport3 and see what you get.

Basically, z value determines how sprites 'n stuff are layered. Think of it in terms of map layers/priorities, something with a low Z value is going to be below something with a higher Z value, but when it comes to viewports this could vary. Sorry I couldn't help you more than that, good luck with it.
 
Kain Nobel":2452m915 said:
According to RMXP's scripts, $game_map.fog.z is 3000 on @viewport1, and $game_pictures all use @viewport2 which the z value is 2000 meaning pictures should already be under the fog. Also, taking a look at Sprite_Picture, those sprites z value is @picture.number, so... your best bet would be to experiment with the $game_map.fog.z value.

Sorry if I'm rusty but also you could try experimenting with the .z settings of $game_map's @viewport1, @viewport2 and @viewport3 and see what you get.

Basically, z value determines how sprites 'n stuff are layered. Think of it in terms of map layers/priorities, something with a low Z value is going to be below something with a higher Z value, but when it comes to viewports this could vary. Sorry I couldn't help you more than that, good luck with it.

Actually, no. They are in two different viewports. Everything in @viewport2 will display above anything in @viewport1 until you actually move @viewport2 below @viewport1, in which case the reverse it true and you won't see anything in @viewport2. (because the tileset is part of @viewport1, as is the panorama) The simple solution would be to move the pictures into @viewport1 and give the fog a higher z value.
 
Thanks guys. I understand what you are saying, however, I don't see any viewport settings (not to mention any line assigning the pictures to a certain viewport, nor a viewport.z or anything) in the game_map script.

I did a quick run through of the other scripts, only finding viewport in a few cases, but I think they were the battle screen and something else not associated with the map...

Can you point me to the right script?


BTW, if this question would now be more suited to the script help section, please feel free to move it Mods :)
 
Ok everyone, this was previously resolved, but as it turns out, I need to change the z level of weather and fogs intermittently via event scripts.

Can anyone give me a leg up? I'm not very familiar with $whatever event scripts :)

The script line is identified above, but I just dont know how to alter that mid-game.
 
Here's what I would do... (doesn't mean it's right) :scruff:

In Spriteset_Map, change line 32 to @viewport2
change line 33, @fog.z = -100 (I'm guessing, but just to get it below the pictures as a default)

After line 129, add

@fog.z = $game_map.fog_z

Now, in Game_Map, after line 22 add

attr_accessor :fog_z

and after line 64, add

@fog_z = -100

Now, from an event script command you can change:

$game_map.fog_z = 3000 # or whatever you want to set it to
 

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