Derxwna Kapsyla
Derxwna "The Badman" Kapsyla
- 437
- Posts
- 13
- Years
- Everywhere, yet Nowhere
- Seen Apr 15, 2025
With Generation Three, we were introduced to a new concept: Double Battles, trainers that would send out two Pokemon at once. Generation Four added more to this concept in an interesting way - if you had a partner with you at the time, you would get into Wild Double Battles. Generation Five expanded on this even further and allows you to get into Wild Double Battles in certain types of Tall Grass.
This script will allow players to emulate the style of Wild Double Battles in their RMXP Project. It's a minor modification to an already existing script, and is a simple copy and paste procedure. However, since I do not think that Wild Double's are presently in game (But are scripted in), it would make sense to add it in for projects that want to utilize it.
Open the Script Editor and go to the Script Section called PokemonField. In here, look for the following lines, starting around line 1468 in an unmodified version of Essentials:
What we're gonna do here is make it so you can engage in Wild Double Battles in a certain terrain type, specifically, in this case, Tall Grass. To make this work, you will need to paste the following line of code in next to "if $PokemonGlobal.partner":
Time to explain exactly what the code does, so there is no doubt left in peoples minds. the " || ( pbGetTerrainTag($game_player)==PBTerrain::TallGrass && rand(10)<3 )", as it would appear, is what allows the Wild Double Battle to be found in the TallGrass Terrain Type. Whatever you have Terrain tagged as Tall Grass (As in, Very Tall Grass), will return a Wild Double battle. The ||, aka the OR, is self explanatory: It tells the code "If condition A OR Condition B is true, return true". In this case, if the player has a partner with them OR they're in tall grass, execute a Wild double battle. That &&, aka the AND, tells the script that it needs to meet these qualifiers as well. After going over the OR, this is an additional part of Condition B, where it literally reads: "If the trainer is in tall grass AND the random number generated is less than 3, execute a wild double battle". The Rand is so you don't always get into a WDB. The value can be changed to whatever you want, rand(50)<25, rand(100)>72. So long as the syntax you use is correct, and the probability is possible, then it'll work.
Next is the " && $Trainer.ablePokemonCount>1". This part is VERY IMPORTANT. DO NOT FORGET TO ADD IT. This line ensures the game does not generate a WDB when you only have one Pokemon in your party, via in general or only one Pokemon left standing. If you do not add this code, it will make your game crash whenever you go into Double Battle Grass without a second able Pokemon. This statement also is grouped with the Condition B statement, so the full statement reads:
And that is how you add Wild Double Battles to your Pokemon Fangame in Essentials! I do not take credit for the code, Mugendai is the one who initially made the code for it, but I applied the "$Trainer.ablePokemonCount>1" fix that we forgot to add the first time we made the code.
This script will allow players to emulate the style of Wild Double Battles in their RMXP Project. It's a minor modification to an already existing script, and is a simple copy and paste procedure. However, since I do not think that Wild Double's are presently in game (But are scripted in), it would make sense to add it in for projects that want to utilize it.
Open the Script Editor and go to the Script Section called PokemonField. In here, look for the following lines, starting around line 1468 in an unmodified version of Essentials:
Code:
if $PokemonGlobal.partner
encounter2=$PokemonEncounters.pbEncounteredPokemon(encounterType)
pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])
Code:
|| ( pbGetTerrainTag($game_player)==PBTerrain::TallGrass && rand(10)<3 ) && $Trainer.ablePokemonCount>1
Time to explain exactly what the code does, so there is no doubt left in peoples minds. the " || ( pbGetTerrainTag($game_player)==PBTerrain::TallGrass && rand(10)<3 )", as it would appear, is what allows the Wild Double Battle to be found in the TallGrass Terrain Type. Whatever you have Terrain tagged as Tall Grass (As in, Very Tall Grass), will return a Wild Double battle. The ||, aka the OR, is self explanatory: It tells the code "If condition A OR Condition B is true, return true". In this case, if the player has a partner with them OR they're in tall grass, execute a Wild double battle. That &&, aka the AND, tells the script that it needs to meet these qualifiers as well. After going over the OR, this is an additional part of Condition B, where it literally reads: "If the trainer is in tall grass AND the random number generated is less than 3, execute a wild double battle". The Rand is so you don't always get into a WDB. The value can be changed to whatever you want, rand(50)<25, rand(100)>72. So long as the syntax you use is correct, and the probability is possible, then it'll work.
Next is the " && $Trainer.ablePokemonCount>1". This part is VERY IMPORTANT. DO NOT FORGET TO ADD IT. This line ensures the game does not generate a WDB when you only have one Pokemon in your party, via in general or only one Pokemon left standing. If you do not add this code, it will make your game crash whenever you go into Double Battle Grass without a second able Pokemon. This statement also is grouped with the Condition B statement, so the full statement reads:
In the end, the code should look like this:If If the Player Trainer has a Partner OR (the player trainer is walking in Very Tall Grass, AND the random number is less than 3) AND the player has more than one able Pokemon in their party, execute a Wild Double Battle.
Code:
if $PokemonGlobal.partner || ( pbGetTerrainTag($game_player)==PBTerrain::TallGrass && rand(10)<3 ) && $Trainer.ablePokemonCount>1
encounter2=$PokemonEncounters.pbEncounteredPokemon(encounterType)
pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])