Eli_RevealDarkCovers(Mrts extension)

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,378
Reaction score
629
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi!
I have sent an email for MRTS a long time ago, but I never get an answer. Although I think it's okay to release an extension of his plugin, because of his terms of use.
Here is the email:


Here are his terms of use.


Author: Eliaquim
*Not supported anymore*

Requirements
You need to use the Dark Room Covers plugin from MR. Trivel above this plugin.

Download it here.

Introduction

Inspired by the Fatal Labirinty game I tried in so many ways to make a system where the player walks and reveals the map as it moves. Using images to make this progression, depending on the size of the map can get very lag. Using events too, plus a lot of work.
It was then that I found the Mr. trivel plugin (Mrts) that makes the tiles that have regions become dark. Through a plugin command, the tiles of a specific region can be revealed. However, doing this by events can become tiresome and repetitive.
Finally, I had an idea that made this process viable and easy!
So this plugin came up!

Features

This plugin offers the following:

• Enable or disable tile disclosure.
• Two ways to reveal the map: Progressive and Unique
• A variable that determines the range of the view, in tiles, to reveal the dark regions.

How to use

To use it, you need to understand how the Mrts plugin works.
By default, once activated in your project, it will make all regions placed on the map darken the tiles where they are and will be in a layer above the player.
You can use plugin commands to make regions revealed. As well as to make them dark again. It is important to know that the plugin works on all maps. That is if you reveal a region on map 1, it will also be revealed on map 2 (unless that you execute the command to darken them before reaching map 2).

Now we can talk about this plugin!

• There are two modes:

• Unique - Reveals only the region the player is in and deletes all others.
It means that only one region will be revealed at a time.

• Progressive - Reveal regions as the player moves, and keep them revealed.
More details below about Progressive mode.

It is possible to store a value in a variable that is responsible for the range of the player's vision. The greater this reach, the more regions will be revealed around you.
If the reach is 1, all regions that are within the distance of a tile will be revealed. Now we must remember the MRTS plugin: If a region is revealed, it will be for the entire current and later map. So if that same region is elsewhere on the map, even if away from the player, it will have been revealed. The way to avoid this is to put the regions on the map progressively and not spread regions of the same number across places different from the map.
The numerical order of the regions is not important.
If the value of the range variable is equal to zero, only the region that the player is stepping on will be revealed.

• Plugin commands

You can use the commands to enable or disable the above modes:

ENABLE_REVEAL
DISABLE_REVEAL

Terms of Use

1. It is mandatory to give the credits to Mr. Trivel (Mrts) in the credits section of your game. Credit for me is optional (Eliaquim or Rakuen Zero).
2. It can be used in free and commercial games.
3. Do not sell or say that you made this plugin.
4. Do not redistribute this plugin. Instead, give this link to the download.

JavaScript:
//============================================================================
// Eli_RevealDarkCovers.js
//============================================================================

/*:
@plugindesc v1.0 - Dynamically reveals regions.
@author Eliaquim || Hakuen Studio

@help

==============================================================================
Requirements
==============================================================================

You need to use the Dark Room Covers plugin from MR. Trivel above this plugin.

Link: https://forums.rpgmakerweb.com/index.php?threads/dark-room-covers.57057/

==============================================================================
Introduction
==============================================================================

Inspired by the Fatal Labirinty game I tried in so many ways to make a
system where the player walks and reveals the map as it moves. Using images
to make this progression, depending on the size of the map can get very lag.
Using events too, plus a lot of work.
It was then that I found the Mr. trivel plugin (Mrts) that makes the tiles
that have regions become dark. Through a plugin command, the tiles of a
specific region can be revealed.
However, doing this by events can become tiresome and repetitive.
Finally I had an idea that made this process viable and easy!
So this plugin came up!

==============================================================================
Features
==============================================================================

This plugin offers the following:
• Enable or disable tile disclosure.
• Two ways to reveal the map: Progressive and Unique
• A variable that determines the range of the view in tiles, to reveal the
dark regions.

==============================================================================
How to use
==============================================================================

To use it, you need to understand how the Mrts plugin works.
By default, once activated in your project, it will make all
regions placed on the map darken the tiles where they are and will be in
a layer above the player.
You can use plugin commands to make regions
revealed. As well as to make them dark again.
It is important to know that the plugin works on all maps. That is if you
reveal a region on map 1, it will also be revealed on map 2 (unless
that you execute the command to darken them before reaching map 2).

Now we can talk about this plugin!

• There are two modes:

• Unique - Reveals only the region the player is in and deletes all others.
It means that only one region will be revealed at a time.

• Progressive - Reveal regions as the player moves, and keep them
revealed.
More details below about Progressive mode.

It is possible to store a value in a variable that is responsible for
the range of the player's vision. The greater this reach, the more regions
will be revealed around you.
If the reach is 1, all regions that are within the distance of a tile will
be revealed. Now we must remember the MRTS plugin: If a region is
revealed, it will be for the entire current and later map. So if that same
region is elsewhere on the map, even if away from the player, it will have
been revealed. The way to avoid this is to put the regions on the map
progressively and not spread regions of the same number across places
different from the map.
The numerical order of the regions is not important.
If the value of the range variable is equal to zero, only the region
that the player is stepping on will be revealed.

• Plugin commands

You can use the commands to enable or disable the above modes:

ENABLE_REVEAL
DISABLE_REVEAL

==============================================================================
Terms of Use
==============================================================================

1. It is mandatory to give the credits to Mr. Trivel (Mrts) in the
credits section of your game. Credit for me is optional (Eliaquim or Rakuen
Zero).
2. Can be used in free and commercial games.
3. Do not sell or say that you made this plugin.
4. Do not redistribute this plugin. Instead, give this link to the download:

==============================================================================
Special thanks
==============================================================================

Thanks to:
Mr. Trivel (Mrts).

==============================================================================
Contact
==============================================================================

RM Web - https://forums.rpgmakerweb.com/index.php?members/eliaquim.123037/
Centro Rpg Maker - https://centrorpg.com/index.php?action=profile
Instagram - https://www.instagram.com/hakuenstudio
Twitter - https://twitter.com/hakuen_studio
Facebook - https://www.facebook.com/hakuenstudio

==============================================================================
Updatelog
==============================================================================
Version 1.0 04/19/2020
- Plugin release!


@param enable
@text Enable plugin
@type boolean
@desc Enable or disable the plugin.
@default true

@param mode
@text Select mode
@type select
@option Only on Player
@value Only on player
@option Progressively
@value Progressively
@default Only on player

@param range
@text Line of sight
@type variable
@desc Choose a variable to set the range value.
@default 0


*/

/*:pt
@plugindesc v1.0 - Revela regiões dinâmicamente.

@author Eliaquim || Rakuen Zero

@help

==============================================================================
Requerimentos
==============================================================================

É necessário usar o plugin Dark Room Covers da Mr. Trivel.
Coloque esse plugin abaixo do Mrts.

Link: https://forums.rpgmakerweb.com/index.php?threads/dark-room-covers.57057/

==============================================================================
Introdução
==============================================================================

Inspirado no jogo Fatal Labirinty eu tentei de muitas formas fazer um
sistema onde o player anda e revela o mapa conforme avança.
Usar imagens para fazer essa progressão, dependendo do tamanho do mapa, pode
ficar muito lag. Usar eventos também, além de muito trabalhoso.
Foi então que encontrei o plugin de Mr. trivel (Mrts) que faz os tiles que
tem regiões ficarem escuros. Através de um comando de plugin, os tiles de
uma região específica podem ser revelados. Entretanto, fazer isso por eventos
pode se tornar cansativo e repetitivo.
Finalmente tive uma ideia que tornasse esse processo viável e fácil!
Assim surgiu esse plugin!

==============================================================================
Funcionalidades
==============================================================================

Esse plugin oferece o seguinte:
• Ativar ou desativar a revelação dos tiles.
• Dois modos de revelar o mapa: Progressivo e Único
• Uma variável que determina o alcance da visão em tiles, para revelar as
regiões escuras.

==============================================================================
Como usar
==============================================================================

Para usá-lo é necessário entender como o plugin do Mrts funciona.
Por padrão, assim que ativado em seu projeto, ele fará com que todas as
regiões colocadas no mapa escureçam os tiles onde se encontram e ficarão em
uma camada acima do jogador.
Você pode usar comandos de plugin para fazer com que as regiões sejam
reveladas. Como também para torná-las escuras de novo.
É importante saber que o plugin funciona em todos os mapas. Ou seja, se você
revelar uma região no mapa 1, ela também estará revelada no mapa 2(a não ser
que você execute o comando de escurecê-las antes de chegar ao mapa 2).

A partir disso podemos falar desse plugin!

• Existem dois modos:

• Único - Revela somente a região que o player está, e apaga todas as outras.
Quer dizer que somente uma região ficará revelada por vez.

• Progressivo - Revela as regiões conforme o jogador se move, e as mantém
reveladas.
Mais detalhes abaixo sobre o modo Progressivo.

É possível armazenar um valor em uma variável a qual é responsável pelo
alcance da visão do jogador. Quanto maior esse alcance, mais regiões serão
reveladas ao seu redor.
Se o alcance for 1, todas as regiões que estão na distância de um tile serão
reveladas. Agora devemos lembrar do plugin do MRTS: Se uma região é revelada,
ela será para todo o mapa atual e posterior. Portanto se essa mesma região
está em outro lugar do mapa, mesmo que longe do player, ela terá sido
revelada. A maneira de evitar isso é você colocar as regiões no mapa
progressivamente e não espalhar regiões do mesmo número por lugares
diferentes do mapa.
A ordem numérica das regiões não é importante.
Se o valor da variável do alcance for igual a zero, somente a região que o
player estiver pisando será revelada.

• Comandos de plugin

Você pode usar os comandos para ativar ou desativar os modos acima:

ENABLE_REVEAL
DISABLE_REVEAL

==============================================================================
Termos de uso
==============================================================================

1. É obrigatório dar os créditos para Mr. Trivel (Mrts) na seção
de créditos do seu jogo. O crédito para mim é opcional (Eliaquim ou Rakuen
Zero).
2. Pode ser usado em jogos gratuitos e comerciais.
3. Não venda e nem diga que foi você que fez esse plugin.
4. Não redistribua esse plugin. Ao invés disso, dê este link para o download:

==============================================================================
Agradecimentos especiais
==============================================================================

Agradecimentos a:
Mr. Trivel (Mrts).

==============================================================================
Contato
==============================================================================

RM Web - https://forums.rpgmakerweb.com/index.php?members/eliaquim.123037/
Centro Rpg Maker - https://centrorpg.com/index.php?action=profile
Instagram - https://www.instagram.com/hakuenstudio
Twitter - https://twitter.com/hakuen_studio
Facebook - https://www.facebook.com/hakuenstudio

==============================================================================
Log de atualizações
==============================================================================
Versão 1.0 19/04/2020
- Plugin lançado!


@param enable
@text Ativa o plugin
@type boolean
@desc Ativa ou desativa o plugin.
@default true

@param mode
@text Seleção de modo
@type select
@option Único
@value Only player
@option Progressivamente
@value Progressively
@default Only player

@param range
@text Campo de visão
@type variable
@desc Escolha uma variável para determinar o campo de visão em tiles.
@default 0

*/

"use strict";

var Imported = Imported || {};
Imported.Eli_RevealDarkCovers = true;

var Eli = Eli || {};
Eli.RevealDarkCovers = Eli.RevealDarkCovers || {};

Eli.RevealDarkCovers.checkMrts = function(){
    for(let l = $plugins.length - 1;l--;){
        console.log($plugins[l].name)
        if($plugins[l].name === "MrTS_DarkRoomCovers" && $plugins[l].status){
            return true;
        }
    }
};

Eli.RevealDarkCovers.needMrts = function() {
        window.alert(`MrTS_DarkRoomCovers.js was not found.
Please download the mrts plugin`);
        if(confirm) {
            window.open('https://forums.rpgmakerweb.com/index.php?threads/dark-room-covers.57057/');
        }
};

if(!Eli.RevealDarkCovers.checkMrts()) {
    Eli.RevealDarkCovers.needMrts();
};

Eli.RevealDarkCovers.Parameters = PluginManager.parameters('Eli_RevealDarkCovers');
Eli.RevealDarkCovers.Param = Eli.RevealDarkCovers.Param || {};

    Eli.RevealDarkCovers.Param = {
        enable: JSON.parse(Eli.RevealDarkCovers.Parameters['enable']),
        mode: String(Eli.RevealDarkCovers.Parameters['mode']),
        range: Number(Eli.RevealDarkCovers.Parameters['range']),
    };

Eli.RevealDarkCovers.reveal = function(mode) {
    if(!Eli.RevealDarkCovers.Param.enable) return;
    if(mode === "Only on player"){
        const playerRegion = $gamePlayer.regionId();
        $gameMap._openRegionIds = [playerRegion];   
    } else if(mode === "Progressively"){
        const vision = $gamePlayer.regionId();
        const range = $gameVariables.value(Eli.RevealDarkCovers.Param.range);
            for(let i = 0; i < range; i++) {
                $gameMap.addToCurrentlyOpenRegions(vision + i);
            }
        }
};

Eli.RevealDarkCovers.Game_Player_executeMove = Game_Player.prototype.executeMove;
Game_Player.prototype.executeMove = function(direction) {
    Eli.RevealDarkCovers.Game_Player_executeMove.call(this, direction);
    Eli.RevealDarkCovers.reveal(Eli.RevealDarkCovers.Param.mode);
};

Eli.RevealDarkCovers.Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
    Eli.RevealDarkCovers.Scene_Map_start.call(this);
    Eli.RevealDarkCovers.reveal();
};

Eli.RevealDarkCovers.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
Eli.RevealDarkCovers.Game_Interpreter_pluginCommand.call(this, command, args);
let cmd = command.toUpperCase();
    if (cmd === "ENABLE_REVEAL") {
        Eli.RevealDarkCovers.Param.enable = true;
        $gameMap._openRegionIds = [$gamePlayer.regionId()]
    } else if(cmd === "DISABLE_REVEAL"){
        Eli.RevealDarkCovers.Param.enable = false;
    }
};


Update Log
Version 1.0 - 04/19/2020
- Released!
 
Last edited:

xabileug

Veteran
Veteran
Joined
Jul 1, 2014
Messages
113
Reaction score
24
great script for dungeon crawling. is this compatible with mini maps HUD?
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,378
Reaction score
629
First Language
Portuguese - Br
Primarily Uses
RMMV
great script for dungeon crawling. is this compatible with mini-maps HUD?
I don't test it, but I don't see any reason for it not to work :)
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
856
Reaction score
350
First Language
English (USA)
Primarily Uses
RMMV
This has been working very well for my purposes since you put it together. However, I now have three new feature requests to throw into the mix:
  1. Custom cover definition: When I first discussed the matter which led to the creation of this plugin, I was specifically focused on the underground sections (which are dark by necessity), but is it possible to add a definition for a custom cover tile in the case of towers, villages etc.?
  2. Exceptions to visibility control: In line with the first request where pertaining to use cases involving tower dungeons, is it possible to add a zone exceptions feature (e.g. a specific zone is always visible even when others are not)?
  3. And in combining the two prior requests, I'm also interested in having this set up to where the use of visibility exceptions can be defined per map.
EDIT: For now, I have implemented a basic visibility override on the maps in question, but unfortunately there's some flickering that occurs when moving about due to the fact that it relies on a parallel event with a plugin command to force visibility upon the intended map zone. So obviously I would like to have the visibility override handled directly by the plugin as a means to resolve this limitation.
 
Last edited:

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,378
Reaction score
629
First Language
Portuguese - Br
Primarily Uses
RMMV
This has been working very well for my purposes since you put it together. However, I now have three new feature requests to throw into the mix:
  1. Custom cover definition: When I first discussed the matter which led to the creation of this plugin, I was specifically focused on the underground sections (which are dark by necessity), but is it possible to add a definition for a custom cover tile in the case of towers, villages etc.?
  2. Exceptions to visibility control: In line with the first request where pertaining to use cases involving tower dungeons, is it possible to add a zone exceptions feature (e.g. a specific zone is always visible even when others are not)?
  3. And in combining the two prior requests, I'm also interested in having this set up to where the use of visibility exceptions can be defined per map.
EDIT: For now, I have implemented a basic visibility override on the maps in question, but unfortunately there's some flickering that occurs when moving about due to the fact that it relies on a parallel event with a plugin command to force visibility upon the intended map zone. So obviously I would like to have the visibility override handled directly by the plugin as a means to resolve this limitation.
Hi there!
I don't understand the first question... Do you mean another black tile different than the default one?

For the second question, you can execute an event at the start of each map and reveal the regions you want to be always revealed. Since you want a region to be an exception right?
The Mrts plugin has these commands.
* RegionReveal [ID] - Reveals tiles of specific region
* RegionHide [ID] - Hides tiles of specific region

I'm not sure if I understand your last question, visibility exceptions mean that will be regions that will not be revealed by the player?

Also, I'm making my own plugin for this feature, so I will not update this one anymore.
Hopefully, I will release it this week :)
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
856
Reaction score
350
First Language
English (USA)
Primarily Uses
RMMV
I mean exceptions in that it's always visible. I have already done this to a degree but for reasons unknown it seems not to properly register, so maybe your new idea of a catch-all that doesn't require two plugins for the same thing may be a better match for what I'm talking about. I think as a consequence of your plugin in terms of how the region visibility changes with movement is that when you switch maps while region 13 is visible, and the destination region is region 1 of the next map, then region 13 is still visible until you move position. In other words, region 13 goes bye-bye the minute you take your next step and region 1 takes its place. And further to the point is that doing so also does away with regions that are specifically overridden with the plugin commands because you're still within a defined region and all other regions that you're not standing in are toast until you enter them, which thereby activates the region swap and moves things forward and in turn has basically defeated the purpose of what I'm trying to do.

The issue of course is that as-is the plugin quite literally affects every defined region on the map, which can get rather annoying in this particular use case. Additionally, my current workaround (which uses a parallel event to force the point) has a bit of flickering during map movement with certain colors. And speaking of colors, ceilings etc. I do in fact mean a different tile for the circumstance. (Though at least for the visibility issue in question I would rather not have to wait on the combined-function release just for one simple fix.)
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,378
Reaction score
629
First Language
Portuguese - Br
Primarily Uses
RMMV
I mean exceptions in that it's always visible. I have already done this to a degree but for reasons unknown it seems not to properly register, so maybe your new idea of a catch-all that doesn't require two plugins for the same thing may be a better match for what I'm talking about. I think as a consequence of your plugin in terms of how the region visibility changes with movement is that when you switch maps while region 13 is visible, and the destination region is region 1 of the next map, then region 13 is still visible until you move position. In other words, region 13 goes bye-bye the minute you take your next step and region 1 takes its place. And further to the point is that doing so also does away with regions that are specifically overridden with the plugin commands because you're still within a defined region and all other regions that you're not standing in are toast until you enter them, which thereby activates the region swap and moves things forward and in turn has basically defeated the purpose of what I'm trying to do.

The issue of course is that as-is the plugin quite literally affects every defined region on the map, which can get rather annoying in this particular use case. Additionally, my current workaround (which uses a parallel event to force the point) has a bit of flickering during map movement with certain colors. And speaking of colors, ceilings etc. I do in fact mean a different tile for the circumstance. (Though at least for the visibility issue in question I would rather not have to wait on the combined-function release just for one simple fix.)
I get it now!
Well, I think my plugin will cover all these issues since you will need to map regions for it to cover the tiles. But in-game, they will not be revealed by regions, it will use coordinates.
So the regions will only work for the game to know where to cover. But the reveal will be by distance, instead of per region.
And it will add to an array the revealed tiles coordinates(x,y).
I will let you know when it's done.
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,378
Reaction score
629
First Language
Portuguese - Br
Primarily Uses
RMMV
Removed this plugin from itch io and attached it in the first post. I will no longer support this one since I made one by myself.
 

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

Latest Threads

Latest Profile Posts

So I decided the best way to represent insanity was to simply make two maps fight for supremacy in front of the player. The results are everything I hoped for! :LZSexcite:


Ami
look the release date - finally!!!
look the price - (convert into Rupiah)"maybe im too forcing myself…" (wait again until Autumn or Christmas Sale)
so MZ is releasing next month :/ I still don't know if I should pick it up or not
I wish all of you have a good time in your life!

Forum statistics

Threads
99,726
Messages
968,524
Members
131,436
Latest member
Batur
Top