Not sure if this is the right place to ask, but what controls the random encounter rate formula in MV?
Encounter Rate formula
Learning Javascriptrandom encounters by steps? or custom?
because the steps can be done in the map properties.
other random encounters can be done differently, so far there are 3 ways to
control encounters.
1) through events.
2) though map properties
3) through enemy encounters (leaving out the random on map)
because the steps can be done in the map properties.
other random encounters can be done differently, so far there are 3 ways to
control encounters.
1) through events.
2) though map properties
3) through enemy encounters (leaving out the random on map)
I mean by steps.
But in general the formula used by RM isn't too good and I'd like to change it.
For instance if you put encounter steps = 50, what's the encounter formula involving this information?
But in general the formula used by RM isn't too good and I'd like to change it.
For instance if you put encounter steps = 50, what's the encounter formula involving this information?
https://forums.rpgmakerweb.com/index.php?threads/encounter-rates-in-mv.49284/
I have no way to confirm what was written by @Shaz , but it's still very interesting info.
I have no way to confirm what was written by @Shaz , but it's still very interesting info.
Moved to: Learning JavascriptIn general, questions about details of MV's base code are best suited for the Learning JS subforum.
Most or all of the relevant methods are found in the rpg_objects file. Here is the most important one:
What this means is that when the Encounter Count is reset (for example after battle), a random number is chosen between 1 and (approximately) twice the map's "Steps" value. If you set the average Steps per Encounter to 40 in your map settings, then a random number between 1 and 80 will be chosen, and once you have walked that many steps, an Encounter will begin.
There are a few different ways Encounter Count can be reset. Do a search through this file (might want to also search rpg_scenes) for EncounterCount and you'll find most of them.
A few things can modify the way that the Encounter Rate ticks down. For example, if the player walks through a tile marked as a Bush, it ticks twice as fast, and if they're in a Ship or someone in the party has the Encounter Half property, it ticks half as fast:
Most or all of the relevant methods are found in the rpg_objects file. Here is the most important one:
Code:
Game_Player.prototype.makeEncounterCount = function() {
var n = $gameMap.encounterStep();
this._encounterCount = Math.randomInt(n) + Math.randomInt(n) + 1;
};
What this means is that when the Encounter Count is reset (for example after battle), a random number is chosen between 1 and (approximately) twice the map's "Steps" value. If you set the average Steps per Encounter to 40 in your map settings, then a random number between 1 and 80 will be chosen, and once you have walked that many steps, an Encounter will begin.
- (Note that because two random integers are being chosen and added together, numbers in the middle will be favored. In this example, "40" is the most likely number of steps to be chosen, whereas 1 and 80 will only be chosen very very rarely.)
There are a few different ways Encounter Count can be reset. Do a search through this file (might want to also search rpg_scenes) for EncounterCount and you'll find most of them.
A few things can modify the way that the Encounter Rate ticks down. For example, if the player walks through a tile marked as a Bush, it ticks twice as fast, and if they're in a Ship or someone in the party has the Encounter Half property, it ticks half as fast:
Code:
Game_Player.prototype.encounterProgressValue = function() {
var value = $gameMap.isBush(this.x, this.y) ? 2 : 1;
if ($gameParty.hasEncounterHalf()) {
value *= 0.5;
}
if (this.isInShip()) {
value *= 0.5;
}
return value;
};
Great explanation, thank you. 😎👍
EDIT: just one last thing, how is it possible to involve a variable in the formula?
eg
this._encounterCount = Math.randomInt(n) + Math.randomInt(n) + VARIABLE;
EDIT: just one last thing, how is it possible to involve a variable in the formula?
eg
this._encounterCount = Math.randomInt(n) + Math.randomInt(n) + VARIABLE;
$gameVariables.value(n)
Replace n with the index of the variable you want to get the value of - for example, if you type $gameVariables.value(28) and the value of Variable #28 is 16 when the Encounter Count is set, then 16 will be added to the sum of the two random values picked. Note that if the value of Var #28 changes while you're on the map, it won't do anything until the Encounter Count is reset (for example after completing a random encounter).
I've also updated my explanation of the random number selection a bit in my post above. Nothing I said was incorrect, but it's worth mention that choosing two random numbers tends to favor "middle" results.
Replace n with the index of the variable you want to get the value of - for example, if you type $gameVariables.value(28) and the value of Variable #28 is 16 when the Encounter Count is set, then 16 will be added to the sum of the two random values picked. Note that if the value of Var #28 changes while you're on the map, it won't do anything until the Encounter Count is reset (for example after completing a random encounter).
I've also updated my explanation of the random number selection a bit in my post above. Nothing I said was incorrect, but it's worth mention that choosing two random numbers tends to favor "middle" results.
I use variables to control the encounter rate for my game. The player can control these values to battle fast or slow depending on what they feel they need to help with grinding or exploring older low-level areas.
By default I have variable 13 set to 25, so the normal encounter rate would be every 25-49 steps using my above formula. I have it bottom out at 1 (every 1-1 steps) and it caps at 50 (50-99 steps). (I use 2 variables because I use them both to draw a gauge in the HUD so you know when an encounter is going to occur)
I also removed the changes mentioned about about the 2x or 0.5x rate changes from being in bush area and vehicles... that always annoyed me a wee bit, lol
edit: Oh, and I also removed the encounter count resetting on map change as well, some areas in my game has locations with battles that you can cross within 25+ steps, so with some encounter rolls you could possibly bypass battles in that area completely and abuse it to regen MP since I have perma-regen when walking as part of the major mechanics in my game.
Code:
$gameVariables.setValue(14, $gameVariables.value(13) + Math.randomInt($gameVariables.value(13)));
this._encounterCount = $gameVariables.value(14)
By default I have variable 13 set to 25, so the normal encounter rate would be every 25-49 steps using my above formula. I have it bottom out at 1 (every 1-1 steps) and it caps at 50 (50-99 steps). (I use 2 variables because I use them both to draw a gauge in the HUD so you know when an encounter is going to occur)
I also removed the changes mentioned about about the 2x or 0.5x rate changes from being in bush area and vehicles... that always annoyed me a wee bit, lol
edit: Oh, and I also removed the encounter count resetting on map change as well, some areas in my game has locations with battles that you can cross within 25+ steps, so with some encounter rolls you could possibly bypass battles in that area completely and abuse it to regen MP since I have perma-regen when walking as part of the major mechanics in my game.
Original thread: https://forums.rpgmakerweb.com/threads/encounter-rate-formula.114936/