• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!
Resource icon

Wild Battles that can result in Double Battles 2017-04-24

Pokémon Essentials Version
v16.2 ➖
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 Pokemon Essentials-based Project. It's a minor modification to an already existing script, and is a simple copy and paste procedure.

Open the Script Editor and go to the Script Section called PField_Field. In here, look for the following lines, starting around line 1372 in an unmodified version of Essentials:
Code:
Expand Collapse Copy
	if $PokemonGlobal.partner
		encounter2=$PokemonEncounters.pbEncounteredPokemon(encounterType)
		 pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])

What we're going to do here is make it so you can engage in Wild Double Battles in a certain terrain type; In this case, really tall grass. To make this work, you will need to paste the following code in next to "if $PokemonGlobal.partner":
Code:
Expand Collapse Copy
|| ( 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:

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.

In the end, your code should look like this:
Code:
Expand Collapse Copy
	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])

And that is how you add Wild Double Battles to your Pokemon Fangame in Essentials! I do not take credit for the code, Maralis 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.
Credits
Maralis made the code initially, but I have permission to post it since it was initially for my project.
Author
DerxwnaKapsyla
Views
2,200
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from DerxwnaKapsyla

Back
Top