Help with formula for encounter rate.

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
209
Reaction score
36
First Language
English Spanish
Primarily Uses
Hi all!

I know that I can find the formula for the encounter rate at the function Game_Player.prototype.makeEncounterCount() located on the rpg_objects. Now, i want to modify the formula so I always get 3 more steps or 3 less steps than the specified Enc. Steps.
Ex: If I specify 10 for a certain map, I can get the number 7 through 13.

Thanks!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,781
Reaction score
12,209
First Language
English
Primarily Uses
RMMV
Try this ...

Code:
Game_Player.prototype.makeEncounterCount = function() {
  var n = $gameMap.encounterStep();
  this._encounterCount = n - 3 + Math.randomInt(7);
}
Save this code into a new file with a .js extension into your Plugins folder, and add it as a plugin, rather than modifying rpg_objects.js - that way, if you update your project, you won't have to reapply the changes.
 

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
209
Reaction score
36
First Language
English Spanish
Primarily Uses
Thanks Shaz! Now, there should be something about how the steps are calculated that I dont get. To be honest, I tried different formulas on a sandbox that should work but didnt on the MV. And the same happened with the formula you pasted. It works on a sandbox, but on the MV it gets an encounter on steps 4,5,6 and 7. mostly on 5 and 6 and never past 7. (the encounter step is specified at 10).

EDIT: Yeah, there is something else that gets factored in. I used this formula :
Code:
var n = $gameMap.encounterStep();
  this._encounterCount = n ;
With the number at 10 and I get an encounter every 5 steps. So maybe after the formula something like divided by 2 takes place? Any way, ill play with those numbers and let you know.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,781
Reaction score
12,209
First Language
English
Primarily Uses
RMMV
Interesting ... here:

Code:
Game_Player.prototype.updateEncounterCount = function() {
    if (this.canEncounter()) {
        this._encounterCount -= this.encounterProgressValue();
    }
};

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;
};
could have something to do with it? Do you have any of those conditions (half encounter rate provided by any feature/state/etc, on terrain designated with the bush tag, or in a ship?

Maybe you could change that function to always return 1 (by adding it to your script and removing all the logic and just returning 1 as the value), or change your encounter formula to multiply the result by 2.
 

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
209
Reaction score
36
First Language
English Spanish
Primarily Uses
Yeah, makes sense. The value of 0.5 is the one cutting our steps by half. I´m certainly I dont have the the condition of EncounterfHalf. So maybe my grass has the bush condition, which i didn't know it existed. Now I know more. I just tested in plain dust tile and it doesnt get cut by half. So, There we go.

Thanks Shaz, as always, appreciated!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,781
Reaction score
12,209
First Language
English
Primarily Uses
RMMV
I think bush is meant to double the rate. Try the long grass and see if it does.
 

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
209
Reaction score
36
First Language
English Spanish
Primarily Uses
I just removed the flag of bush in all my tiles, i dont expect the ecounter rate to vary from tile to tile. And now your formula works.
Thanks!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,781
Reaction score
12,209
First Language
English
Primarily Uses
RMMV
The bush flag also makes the characters' lower halves semi-transparent to add to the effect of walking through long grass. So you'll notice a difference in the appearance when that happens.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I posted a funny gag reel of Drifty's video's here, but realized it was probably too riskay, so I deleted it, oops, lol.
Another room (actually other half of previous room)
What should I focus on today?

Character Portraits?
OR
Mapping?
Alright, I think I've got tired of VXAce. I guess I will jump to MV.
Just had a stranger SPRINT away from me in the grocery store. Talk about overreaction...
...I don't think I'm that ugly! ^-^

Forum statistics

Threads
95,512
Messages
929,735
Members
125,776
Latest member
FrogScholar
Top