Help - Search - Members - Calendar
Full Version: [YERD] Variable Encounter Rates
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS2
Yanfly
Variable Encounter Rates
Last Update: 2009.04.20
By: Yanfly

Introduction
I got tired of terrible encounter rates when you would set the average rate to roughly "30" steps and every 4 steps, the game would enter a battle so I made this to augment the rate battles would appear and to give me more control over them. The control that's given are the number of times the steps are rolled before making an average, the minimum number of steps that are free of battle, the percentage rate of the encounters that is free of battle, and if used, an event variable to modify the encounter rate. In addition to affecting the rolling system, I've modified the default reduction system from walking in a "bush” autotile. From the looks of things, anything that's at the center of an autotile is considered a bush, even if it doesn't look a bush. This means that the green plains you've been using on many many maps are considered bushes and reduce the steps remaining by 2 each time. Yeah, that's been changed, too (and modifiable if you wish to change it to something else).

In addition to that, I've recreated a system similar to the Pokemon Repel item which gets rid of encounters so long as the Repel item isn't spent. Note that this isn't anything too special, but it's something extra to stick into this script. Repel is bound to an event variable so that the player doesn't have to throw in extra coding to modify the Repel value. Just modify it through the event editor. Simple as that. Also, for the opposite of Repel, there is a lure variable. Although rather than initiating a battle every step, lure will cut down the encounter count by a certain amount, which can be controlled from within the game.

Screenshots


Script
Click here.

Instructions
Using this script isn't too difficult. First off, I strongly suggest that you name your variables under the variable control menu. If you're using the default values, then the variables should be named as such:
  1. Variable 61: Encounter Addition
    This adds steps to the encounter creation and adds a control to encounter randomization. If you set this to 10 for example, it'll add 10 bonus steps to the randomization process every time.
  2. Variable 62: Steps Remaining
    This determines the steps remaining before you fight a battle. Used only for debugging.
  3. Variable 63: Repel Steps
    Used like in Pokemon. Once this is set to anything above zero, it'll prevent Steps Remaining from dropping. This lowers by 1 point every step.
  4. Variable 64: Lure Steps
    Similar to the Repel Steps except this actually alters Steps Remaining. Every step, it'll lower the Steps remaining using the following variables.
  5. Variable 65: Lure Division
    Each step taken will have Steps Remaining divided by this variable's value. If you have it set to 2 and you have 20 steps remaining, the next step will drop it to 10, then 5, then 2, then 1, then 0.
  6. Variable 66: Lure Subtraction
    Like Lure Division except this is a subtraction modifier. If this is set to 3 and you have 30 steps remaining, it'll go down to 27, then 24, then 21, etc.

And that's it for variable renaming. To actually use this, you can do it anywhere that allows you to modify variables. Primarily in the event editor.



That's an example of how it'll be used in the event editor. It's not difficult at all.

Notes
Some ideas that can expanded upon this script is an actual Repel Potion. Create an item in your item list that calls upon a specific common event. In that common event, you can create an event that'll raise Repel Steps to 100 or whatever you wish it to be. And with just that, you have an easy as pie Repel Potion made.

Compatibility Updates to Other YERD scripts
- None so far.

Terms and Conditions
Just give credit where due.

Credits and Thanks
-Pokemon. And when are they going to fix Nintendo Pokemon Wifi from trading hacked Pokemon?

Originally Found Here: Pockethouse
mega456789
seems like a nice script, good work.
Enurta
Seems that you made a mistake when that is easily fixed. From lines 164 to 173 need to be replaced.
[Show/Hide] Original Part

return if $game_variables[YF::EVENT::REPEL_VARIABLE] > 0

# The default stuff
return if $TEST and Input.press?(Input::CTRL)
return if in_vehicle?
if $game_map.bush?(@x, @y)
@encounter_count -= YF::EVENT::BUSH_REDUCTION
else
@encounter_count -= YF::EVENT::NORM_REDUCTION
end



All you have to do is replace that with this below.

[Show/Hide] New Part
return if $game_variables[YE::EVENT::VARIABLE::REPEL_VARIABLE] > 0

# The default stuff
return if $TEST and Input.press?(Input::CTRL)
return if in_vehicle?
if $game_map.bush?(@x, @y)
@encounter_count -= YE::EVENT::VARIABLE::BUSH_REDUCTION
else
@encounter_count -= YE::EVENT::VARIABLE::NORM_REDUCTION
end

Yanfly
Thanks for notifying me. I'll update it right away!
luigi400000
The download doesent work? Can you fix it?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.