Jeff_PKLight
RMXP User
- 535
- Posts
- 20
- Years
- USA
- Seen Jun 29, 2011
Well, if you wondered how to make pokemon encounters in RMXP, here's one way.
First, go to your Script Editor. Open up Game_Player, and on line 269 (or around there), you'll find this script:
Right after that code, insert this code:
That means you'll need to set the pokemon encounter tile to a terrain. Open up your database and go to the tileset with the tile that you want pokemon to only occur in (ex: grass). Set the terrain to a number, probably 1.
For the next part, you'll need to change the script numbers 10 and 34:
....to the one you assign the switches/variables below.
Now, go to the 'Common Events' section of the database. Create a new common event entitled "Battle", set to Auto Start, and then trigger the switch for 'Battlestarter'.
Create a Conditional Branch when Variable Monster Group equals 3 (Here's the trick. Take the terrain number and multiply by 3 to get the variable you need to make that pokemon appear). Under the Conditional Branch, set an 'Enemy Encounter' and choose an enemy.
That's it! Simple, huh? Well....only problem is, you can't do a lot of pokemon with this method. This should only be used if you want a pokemon encounter script temporarily.
------------Credit goes to Prexus first, and then me----------------
Enjoy
~~~Jeff
(This was my script I wrote on the BSP Forums. I just took the one I wrote there and placed it here so more people can use it.)
First, go to your Script Editor. Open up Game_Player, and on line 269 (or around there), you'll find this script:
Code:
if last_moving
Right after that code, insert this code:
Code:
# START OF EDIT
@terrainid = $game_map.terrain_tag(@x, @y) #Grabs the ID of the terrain
if @terrainid != 0 #0 means no encounters will happen, any other number and it'll make checks.
@encounterchance = rand(30) #Sets the chance to a random number between 0 and 30
if @encounterchance > 24 #If the number is 25+ an encounter will occur
@monstertype = rand(3) #Sets a variable to a random number between 1 and 3, this essentially means that there are 3 types of pokemon you can find in each type of terrain ID (if you want to change this you have to change the next 3 as well
if @terrainid > 1
@monstertype += 3*@terrainid #This sets the enemy troop based on the terrain ID.. Essentially, TerrainID 1 will pull one of the first 3 monster groups from the database, ID 2 will pull one of the next 3 (4-6) and ID 3 will pull 7-9 and so forth. Problem here occurs with the fact that there are only 8 terrain ids (0-7) so you'd have to figure out another way of doing it.
end
$game_variables[10] = @monstertype
$game_switches[34] = true
end
end
# END OF EDIT
That means you'll need to set the pokemon encounter tile to a terrain. Open up your database and go to the tileset with the tile that you want pokemon to only occur in (ex: grass). Set the terrain to a number, probably 1.
For the next part, you'll need to change the script numbers 10 and 34:
Code:
$game_variables[10] = @monstertype
$game_switches[34] = true
....to the one you assign the switches/variables below.
Now, go to the 'Common Events' section of the database. Create a new common event entitled "Battle", set to Auto Start, and then trigger the switch for 'Battlestarter'.
Create a Conditional Branch when Variable Monster Group equals 3 (Here's the trick. Take the terrain number and multiply by 3 to get the variable you need to make that pokemon appear). Under the Conditional Branch, set an 'Enemy Encounter' and choose an enemy.
That's it! Simple, huh? Well....only problem is, you can't do a lot of pokemon with this method. This should only be used if you want a pokemon encounter script temporarily.
------------Credit goes to Prexus first, and then me----------------
Enjoy
~~~Jeff
(This was my script I wrote on the BSP Forums. I just took the one I wrote there and placed it here so more people can use it.)