[SOLVED] Two (or more) Encounter Tables per map?

Howdy, fellow developers!

There will be a vast, dungeon-like forest in my game, and in the deepest place of this forest, a boss awaits. This boss, however, is determined by previous events, before the players enther the forest.

There are 2 possible bosses:
- The Acrid Wolf
- The Burning Stag

What I'm trying to achieve is to change the forest's fauna according to which boss invaded it: If the Wolf is the Boss, Black Wolves would appear amongst the enemies. If the Stag is the Boss, Black Stags would appear amongst the enemies.

Are there any ways to "insert" these monsters in the encounter tables, or am I gonna need to make 2 different forests, each one with it's own fauna?
The easiest way would be making two different maps witch their respective enemy lists like you've said. The only other way possible would require a plugin which is capable of switching enemy groups on the fly as far as I'm aware.
The forest itself is vast, with 19 maps that measure 60x60... Seems and feels like a simple, and yet unoptimized solution... Which is sad, because I would love to have more control over Encounter Tables, to enrich the experience in more dungeons of the game.
You could post a plugin request for this. Since it's a pretty interesting idea it shouldn't be too hard to find someone to do this. I'd do it myself, but I'm currently stuck with too many projects already :<
You could probably fake it with a parallel-process event, but actually, now that you mention it, if you only need one or two enemy encounters added, you should be able to run a simple script command $dataMap.encounterList.push(encounter). This will take some manual debugging, but should do what you need:
Code:
$dataMap.encounterList.push({
  troopId: 1, weight: 5, regionSet: []
});

It's a JavaScript object, so mind the commas and colons. "troopId" is the id of the troop, obviously. "weight" is the encounter weight (see MZ's documentation), and the "regionSet" should be defined as an empty array, or an array of integers corresponding to the region IDs used on the map.

There's a certain amount of black sorcery involved here, but I'm pretty sure map data isn't cached, so running this command in a self-erasing event should be fine.

---

However, if you want these enemies mixed into other enemy encounters, your best bet is combining the the "Appear Mid-Battle" option in Troop settings with an event that reveals them on the first turn. You may even be able to do this for the other cases as well, if you add an invisible non-hidden enemy to the battle at the start to prevent victory processing.
I could make a "Push Wolves/Encoutners" event with a lot of " $gameMap.encounterList.push(encounter)", each one refering to a specific map of the forest? Or will it be needed to make a parallel process event that runs whenever the player enters each map?
19 maps? Wow that is one big dungeon.

This might be possible witht he Visu-teams BattleCore plugin. not 100% sure. But you might want to try it if you got nothing better to do.

From the help file:
----------------------------------------------------------------------------------
<Swap Enemies>
name: weight
name: weight
name: weight
</Swap Enemies>


- Used for: Enemy Notetags
- Causes this enemy database object to function as a randomizer for any of
the listed enemies inside the notetag. When the enemy is loaded into the
battle scene, the enemy is immediately replaced with one of the enemies
listed. The randomization is based off the 'weight' given to each of the
enemy 'names'.
- Replace 'name' with the database enemy of the enemy you wish to replace
the enemy with.
- Replace 'weight' with a number value representing how often the 'name'
would come up. The higher the weight, the more often. You may omit this
and the colon🙂) and just type in the 'name' instead.
- Add/remove lines as you see fit.

Example:

<Swap Enemies>
Bat: 50
Slime: 25
Orc
Minotaur
</Swap Enemies>
----------------------------------------------------------------------------------

If you can put an variable as the value
Like $game.Variablevalue, (sorry don't know exact syntax), or better yet a switch, it might be a solution to what you are after. (Honestly suggested something very much this in the MZ feedback forum.)

In your case you would need 2 variables: 1:Ice, 2:Fire. Put the variables to a value either 50 or 0
If you have a fire "biome" then set 2=50 and 1=0, reverse for ice.
and try something like this;

<Swap Enemies>
Stag: 50
FireStag: $gameVariableValue(2)*
IceStag: $gameVariableValue(1)*
</Swap Enemies>
* note that I am not sure on the syntax for the variable or if this is possible
but it is worth a shot.

In theory this would get the variable data and fill give either 1 or 2 a value of 50 and the other a value of 0. This should make it so that you would have a 50% chance to meet either a normal stag or an elemental stag. (Honestly they could be 1 and 0, but I like my % so that I can get an overview at a glance...)

Note that you will need a new enemy:"MorphStag" that can change into one of the 3, neutral, fire or ice versions.
Or will it be needed to make a parallel process event that runs whenever the player enters each map?
It will need to be run on a per-map basis, and every time the player enters that map. A self-erasing autorun event on each map will cause the encounters to be added to the table every time the map data is reloaded. Make it call a common event, even, if you're adding the same encounters to every map.

Oh, and I updated my first post with the script snippet to use. That will work with the "Script" event command, no plugins needed.
Feel free to take a look at my Conditional Map Encounters plugin to see if it fits your needs.

https://wrigty12.itch.io/tdw-conditional-map-encounters
@Lone Wolf , thanks a LOT for this, you are a life saver!
@wrigty12 , thankf for the plugin, gonna check this out!
I don't know how much this idea could work, but maybe you can have invisible events moving around your map and when they touch the player they trigger the battle? The only problems I see by doing it like this are possible lag issues and possible interference with other events.

It's just an idea.
@The Row , the forest is more like a region than a dungeon, with 2 caves (each of them with a few levels), and the whole forest can be traveled by land, or through the trees canopies and wooden bridges, hence the quasi-absurd size.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-two-or-more-encounter-tables-per-map.127246/