Darken rooms in the same map

Hello everybody

I’ve searched the forums and found helpful information, but not exactly what I need at this moment.

My question is: how to temporarily darken a room in the same map ?

Here’s the thing: so you walk down a hallway, with rooms left and right. The rooms are all dark because the doors are closed, but when you enter a room, the room becomes visible.

When you leave the room, back to the hallway, the room goes dark again.

Like I said, everything happens on the same map.

Theoretically, I know how to do it to a certain extent. I made with Gimp a black square and positioned it on the right place. Using events such as show picture and erase picture only work, but not the way I want.

I guess I am looking for a parallel process that keeps the black picture over the room, and automatically removes it temporarily when I enter a room. When you leave the room, the black picture appears again over the now empty room, and I can leave and enter the room as many times as I want with always the same effect.

I use some VS-plugins, but I’d rather not use too many plugins.

Any help would be appreciated !
You can use a switches and show/hide images which is half-transparent black for example. That's the "easiest" way, but you probably need a separate image for every room, so you can also use a plugin for this.

What comes in my mind...



I guess I am looking for a parallel process that keeps the black picture over the room, and automatically removes it temporarily when I enter a room. When you leave the room, the black picture appears again
Just put that show/hide picture on the "door event", and it'll be automated when you enter or leave the room?
Eliaquim aka Hakuen Studio also has something for that: https://hakuenstudio.itch.io/eli-reveal-map-rpg-maker-mv

While you said you'd rather not use too many plugins (For whatever reason), a plugin is just the easiest, best working solution in this case.
I don't have an easy answer. Just wanna say: I love the idea. 🙂 You got an interesting concept there, if that is the core of your game. Gives me a munchkin feeling, a card-game where you kick in a new door every turn, not knowing what lies behind: Monsters, curses or treasure. Is that a bit the go-to for this game?

I did a similar thing, where you went from 1 room to another, and each room had several doors leading to different next rooms. So the player never knew what would happen next. Even if they played before, because I randomized the order of the doors. But I simply did it by making every room a new map. I like your idea of putting them all in a single map and connect them by a hallway, but if that is the core of your game, I'm not sure how practical that would be. But it would be prettier. I see upsides, but also downsides to both methods... And that makes it just the more interesting.

Anyhow, let us know how it turns out. Good luck
Personally, I used Community Lighting for the kind of line-of-sight you are describing.
I don't have an easy answer. Just wanna say: I love the idea. 🙂 You got an interesting concept there, if that is the core of your game. Gives me a munchkin feeling, a card-game where you kick in a new door every turn, not knowing what lies behind: Monsters, curses or treasure. Is that a bit the go-to for this game?

I did a similar thing, where you went from 1 room to another, and each room had several doors leading to different next rooms. So the player never knew what would happen next. Even if they played before, because I randomized the order of the doors. But I simply did it by making every room a new map. I like your idea of putting them all in a single map and connect them by a hallway, but if that is the core of your game, I'm not sure how practical that would be. But it would be prettier. I see upsides, but also downsides to both methods... And that makes it just the more interesting.

Anyhow, let us know how it turns out. Good luck
You give me too much credit 😉. I was more like "it makes sense that the rooms are dark when the doors are closed", but it's not a game mechanic or so.

This being said, thanks everybody for the, as usual, quick answers. I will definitely give it a try.
for me i use Galv layer graphics....the concept is use a dark picture to layer on top of the room, when the player opens the door, the layer will fade to transparent revealing the room map below the layer graphic
for me i use Galv layer graphics....the concept is use a dark picture to layer on top of the room, when the player opens the door, the layer will fade to transparent revealing the room map below the layer graphic
That sounds way more user friendly than CommunityLighting.
That sounds way more user friendly than CommunityLighting.
try it, it take sometime to learn Galv's script, but when you do, you can do a lot with layer graphic
Oh, and please record the result, and show us how it turns out. I'm really curious.

Edit: I realize this is some request. 😛 Don't feel pressured. But if you like showing off, I'd love to see.
Yeah there seems to be some tricks or plugins can do that.
For example, you can use an event that displays a black square, use a event scale plugin to make it big enough to cover the room.
Or you can use normal show picture and a paralell script to update its position.
if you don't use regions for map, CTB_RegionTintOverlay can do that trick
what you seek exactly.

some even use pictures for that and set opacity to 0 when inside and 80 when
outside.

so eventing or plugin is possible.
Oh, and please record the result, and show us how it turns out. I'm really curious.

Edit: I realize this is some request. 😛 Don't feel pressured. But if you like showing off, I'd love to see.
That's okay, I sometimes need some pressure, without it I'll probably never finish my game.

if you don't use regions for map, CTB_RegionTintOverlay can do that trick
what you seek exactly.
That's a good tip !

For example, you can use an event that displays a black square, use a event scale plugin to make it big enough to cover the room.
I'll give it a try.
If you are up for it, you can draw the graphic with PIXI/Canvas using a script call:
Spoiler
v3gif.gif
If you are up for it, you can draw the graphic with PIXI/Canvas using a script call:
how did you do that though, its smoother though 😛
but can it also do custom shapes without doing fix rectangles or multiple
events for them?

it's seems way cleaner though.
how did you do that though, its smoother though 😛
but can it also do custom shapes without doing fix rectangles or multiple
events for them?

it's seems way cleaner though.
I'm still learning of course, but a lot of it can be done. Rectangle, circle, ellipse, star, and rounded rectangle are presets and you can do curves, arcs, and some custom polygons.

I am tying the fade-in and fade-out to a common event that runs in parallel so it doesn't stop/delay the player (or if the player tries to spam moving back and forth really quick, it will keep up with the changes). I am also using a pixi filter to soften the edges.

Once I get the flow I want, I just move everything over to a function and control it from there instead of convoluted script calls (like how I usually have lol)

I'll post some code below when I get the chance. There are blend mode limitations with webgl (stated on the official site) so I'm trying to work around that as well.

Edit: Here is a bit of code to start off with - you can make it appear on player touch, autorun it at map loading, delete it/hide it, etc.
JavaScript:
// find the event currently running the code in spriteset
const layer = SceneManager._scene._spriteset._characterSprites.find(
  c => c._character === this.character(0));
// make sure to only run the code below if there isn't already
// a layer by the same name
if (!layer.getChildByName('shade')) {
  // set tile size to current game tile
  const tileSize = $gameMap.tileHeight();
  // set filter to blur stength to 2, quality to 1
  const filter = new PIXI.filters.BlurFilter(2, 1);
  // create new pixi graphic rectangle
  const graphic = new PIXI.Graphics()
    .beginFill(0x000000) // Fill with black
    .drawRect((-tileSize / 2), -(tileSize * 4 - 6), 
      8 * tileSize, 9 * tileSize) // draw rectangle (x, y, width, height) format in pixels
    .endFill(); // stop the fill color
  // name the child layer for easier reference and finding
  graphic.name = 'shade';
  // add blur filter
  graphic.filters = [filter];
  // add the graphic to the scene
  layer.addChild(graphic);
}

To can adjust the .alpha (you'll have to reference the graphic first if you are using a new script call), clear the graphic with .clear(), or remove it completely with .destroy().

My event runs once and sets the alpha to 0 when the player touches the event (revealing the room), goes to a new page via self switch, and waits until the player exits the room to set the alpha back to 1 with a parallel event. You can also make it just a player touch to save on resources by using two events or using regions as Shadow suggested.
back and forth is more, step on region to show, and a step off region.
or events, so it would be avoided as safeguard =)

Original thread: https://forums.rpgmakerweb.com/threads/darken-rooms-in-the-same-map.175730/