Variable Encounter Rate - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Archives (https://www.save-point.org/forum-105.html) +--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html) +---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html) +----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html) +----- Thread: Variable Encounter Rate (/thread-6832.html) |
Variable Encounter Rate - Mystinar - 10-03-2005 This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss. No support is given. If you are the owner of the thread, please contact administration. Normally, when RMXP selects an enemy troop for you to fight, it just selects a random troop. However, under this system modification, each troop has a different chance of being fought. To implement this system, do the following: Add this method to the end of Game_Map: Code: def rand_encounter After that, goto the Update method in Scene_Map, and find this if...then nest: Code: if $game_player.encounter_count == 0 and $game_map.encounter_list != [] and replace it with this: Code: if $game_player.encounter_count == 0 and $game_map.encounter_list != [] And then your done, sort of. To get each enemy troop a different encounter rate, place a two-digit number, from 01 to 99, in front of each troop's name. This number will determine how frequently the troop will be fought. Example: 04 Ghost 02 Ghost*2 01 Ghost*3 In this example, the ghost troops have encounter rates of 4, 2, and 1, respectively. The troop with a single ghost is the most likely to appear, while the troop with 3 ghosts is the least likely to appear. The system adds those numbers up, generates a random number within that range, and then determines which troop to fight by comparing the number to a table with the selection range of each troop: Troop 1: 1~4 Troop 2: 5~6 Trppp 3: 7 If the script generated a three, then troop one would be fought. But a 7 would mean troop 3 would be fought. Hopefully, you find it useful. Let me know if you find any bugs. |