FANDOM


Adding Dream World abilities
This tutorial is deprecated. It is no longer relevant to the latest version of Pokémon Essentials.

This tutorial was written by Tai Mao. Please give credit.

Click here for more tutorials!


This tutorial has not yet been completed.

This tutorial shows how to add Dream World abilities to Essentials. Pokémon marked as Dream World are allowed abilities they could never possibly get in the wild. This tutorial uses May 7, 2010 version of Essentials; if you have an earlier version of Essentials, this cannot be guaranteed to work.

New text file

A new text file should be placed in the "PBS" folder named "dreamworldabilities.txt". Each line in the text file should contain:

  • A Pokémon's internal species name, followed by an equal sign, then the internal name of an ability existing in your game.

Here's an example of the text file:

 BULBASAUR=CHLOROPHYLL
 IVYSAUR=CHLOROPHYLL
 VENUSAUR=CHLOROPHYLL
 CHARMANDER=SOLARPOWER
 CHARMELEON=SOLARPOWER
 CHARIZARD=SOLARPOWER
 SQUIRTLE=RAINDISH
 WARTORTLE=RAINDISH
 BLASTOISE=RAINDISH
 CATERPIE=RUNAWAY
 BUTTERFREE=TINTEDLENS
 WEEDLE=RUNAWAY
 BEEDRILL=SNIPER
 PIDGEY=BIGPECKS
 PIDGEOTTO=BIGPECKS

This is only an example of the text file, as some of these abilities are not in Pokémon Essentials.

Pokémon species may be listed in any order in this text file (For my project "dreamworldabilities.txt" has species listed by evolutionary families i.e. Pichu, Pikachu, Raichu). Notice above Metapod is missing between Caterpie and Butterfree. Leaving Pokémon species out of this text file will not cause any problems in compilation or application. A Pokémon left out of the text file can only have the ability/abilities listed in "pokemon.txt" even when marked as Dream World. If a species is listed more than once in this text file, only the last entry of the species will be relevant.

Script changes

Compiler

Find the def parseItem, and add the following def directly after it:

 def parseAbility(item)
   clonitem=item.upcase
   clonitem.gsub!(/^[\s\n]*/){}
   clonitem.gsub!(/[\s\n]*$/){}
   return pbGetConst(PBAbilities,clonitem,_INTL("Undefined ability constant name: [%s]\r\nName must consist only of letters, numbers, and\r\nunderscores and can't begin with a number.\r\nMake sure the name is defined in\r\nPBS/abilities.txt.\r\n{1}",FileLineData.linereport))
 end

Find the def pbCompileAbilities, and add the following def directly after it:

def pbCompileDreamWorldAbilities
 sections=[]
  if File.exists?("PBS/dreamworldabilities.txt")
    pbCompilerEachCommentedLine("PBS/dreamworldabilities.txt"){|line,lineno|
     if line[ /^([^=]+)=(.*)$/ ]
       key=$1
       value=$2
       species=parseSpecies(key)
       ability=parseAbility(value)
       sections[species]=ability
     end
   }
  end
  save_data(sections,"Data/dreamworldabilities.dat")
 end

Next, find the arrays datafiles and textfiles. They will found after the long def pbCompilePokemonData. Add the highlighted sections to the array below.

 datafiles=[
 "encounters.dat",
 "trainernames.dat",
 "connections.dat",
 "items.dat",
 "metadata.dat",
 "townmap.dat",
 "trainers.dat",
 "attacksRS.dat",
 "dexdata.dat",
 "eggEmerald.dat",
 "evolutions.dat",
 "regionals.dat",
 "types.dat",
 "tm.dat",
 "phone.dat",
 "trainerlists.dat",
 "shadowmoves.dat",
 "dreamworldabilities.dat",
 "Constants.rxdata"
 ]
 textfiles=[
 "moves.txt",
 "abilities.txt",
 "encounters.txt",
 "trainers.txt",
 "trainernames.txt",
 "items.txt",
 "connections.txt",
 "metadata.txt",
 "townmap.txt",
 "pokemon.txt",
 "phone.txt",
 "trainerlists.txt",
 "shadowmoves.txt",
 "dreamworldabilities.txt",
 "tm.txt",
 "types.txt"
 ]

Then add highlighted area to the def pbCompileAllData:

 def pbCompileAllData(mustcompile)
  FileLineData.clear
  if mustcompile
   if (!$INEDITOR || LANGUAGES.length<2) && 
       pbRgssExists?("Data/messages.dat")
    MessageTypes.loadMessageFile("Data/messages.dat")
   end
   # No dependencies
   yield(_INTL("Compiling type data"))
   pbCompileTypes
   # No dependencies
   yield(_INTL("Compiling town map data"))
   pbCompileTownMap
   # No dependencies
   yield(_INTL("Compiling map connection data"))
   pbCompileConnections
   # No dependencies  
   yield(_INTL("Compiling ability data"))
   pbCompileAbilities
   # Depends on PBTypes
   yield(_INTL("Compiling move data"))
   pbCompileMoves
   # Depends on PBMoves
   yield(_INTL("Compiling item data"))
   pbCompileItems
   # Depends on PBMoves, PBSpecies, PBItems, PBTypes, PBAbilities
   yield(_INTL("Compiling Pokemon data"))
   pbCompilePokemonData
   #Depends on PBSpecies, PBAbilities
         yield(_INTL("Compiling Dream World Abilities data"))
         pbCompileDreamWorldAbilities
   # Depends on PBSpecies, PBMoves
   yield(_INTL("Compiling machine data"))
   pbCompileMachines

PokeBattle_Pokemon

This next section will help one gain access to the dream world abilities. We will add an attribute similar to how Pokémon may now be from the Dream World in Pokémon Black and White.

Under the attribute accessors at the top of PokeBattle_Pokemon, add the highlighted line below:

 attr_accessor(:status) # Status problem (PBStatuses)
 attr_accessor(:statusCount) # Sleep count/Toxic flag
 attr_accessor(:ev) # Effort Values
 attr_accessor(:eggsteps) # Steps to hatch egg, 0 if Pokémon is not an egg
 attr_accessor(:moves) # Moves (PBMove)
 attr_accessor(:ballused) # Ball used
 attr_accessor(:mail) # Mail
 attr_accessor(:markings) # Markings
 attr_accessor(:obtainMode) # Manner obtained: 0 - met, 1 - egg, 2 - trade
 attr_accessor(:obtainMap) # Map where obtained
 attr_accessor(:obtainLevel) # Level obtained
 attr_accessor(:otgender) # Original Trainer's gender: 0 - male, 1 - female, 2 - mixed, 3 - unknown
                               # for information only, not used to verify ownership of the Pokemon
 attr_accessor(:dreamworld)

Then find the def "ability" and add the highlighted section below:

 def ability
   abil=@abilityflag ? @abilityflag : (@personalID&1)
   dexdata=pbOpenDexData
   pbDexDataOffset(dexdata,@species,29)
   ret1=dexdata.fgetb
   ret2=dexdata.fgetb
   ret=ret1
   if abil==1
     ret=ret2
     if ret2==0
       ret=ret1
     end
   end
     if @dreamworld==true
            dreamRet=load_data("Data/dreamworldabilities.dat") rescue []
            ret=dreamRet[@species] if dreamRet[@species]
          end
   dexdata.close
   return ret
 end

Now to the def "initialize" we can add the follow highlighted sections:

 def initialize(species,level,player=nil,withMoves=true,dream=false)
   @dreamworld=dream
   @ev=[0,0,0,0,0,0]
   if species<1||species>PBSpecies.maxValue
     raise ArgumentError.new(_INTL("The species number (no. {1} of {2}) is invalid.",
     species,PBSpecies.maxValue))
     return nil
   end
   @species=species
   # Individual Values
   @hp=1
   @totalhp=1
   ...

PokemonUtilities

The major def's that allow one to add Pokemon are found in this section. The following changes will allow one to add Pokemon who possibly know dream world abilities.

The def "pbAddForeignPokemon" needs the following highlighted changes

 def pbAddForeignPokemon(species,level,ownerName,nickname=nil,dream=false)
   if $Trainer.party.length==6
     return false
   end
   speciesname=PBSpecies.getName(species)
   Kernel.pbMessage(_INTL("{1} received a Pokémon from {2}.\1",$Trainer.name,ownerName))
   pokemon=PokeBattle_Pokemon.new(species,level,$Trainer,true,dream)
   ...

The def's "pbAddPokemon2", "pbAddPokemonToParty", and "pbAddPokemonSilent" need the highlighted changes:

 def pbAddPokemon2(pokemon,dream=false)
   return pbAddPokemon(pokemon,nil,dream)
 end
 def pbAddPokemonToParty(species,level,dream=false)
   return pbAddToParty(species,level,dream)
 end
 def pbAddPokemonSilent(pokemon,level=nil,dream=false)
  return false if !pokemon || pbBoxesFull? || !$Trainer
  if pokemon.is_a?(Integer) && level.is_a?(Integer)
    pokemon=PokeBattle_Pokemon.new(pokemon,level,$Trainer,true,dream)
  end
 ...

The def's "pbAddToPartySilent", "pbAddToParty", "pbAddPokemon" need the highlighted changes.

 def pbAddToPartySilent(pokemon,level=nil,dream=false)
  return false if !pokemon || !$Trainer || $Trainer.party.length>=6
  if pokemon.is_a?(Integer) && level.is_a?(Integer)
   pokemon=PokeBattle_Pokemon.new(pokemon,level,$Trainer,true,dream)
  end
  $Trainer.seen[pokemon.species]=true
  $Trainer.owned[pokemon.species]=true
  $Trainer.party[$Trainer.party.length]=pokemon
  return true
 end
 def pbAddToParty(pokemon,level=nil,dream=false)
   return false if !pokemon || !$Trainer 
   return false if $Trainer.party.length>=6
   if pokemon.is_a?(Integer) && level.is_a?(Integer)
    pokemon=PokeBattle_Pokemon.new(pokemon,level,$Trainer,true,dream)
   end
   speciesname=PBSpecies.getName(pokemon.species)
   Kernel.pbMessage(_INTL("{1} obtained {2}!\\se[itemlevel]\1",$Trainer.name,speciesname))
   pbNicknameAndStore(pokemon)
   return true
 end
 def pbAddPokemon(pokemon,level=nil,dream=false)
   return if !pokemon || !$Trainer 
   if pbBoxesFull?
     Kernel.pbMessage(_INTL("There's no more room for Pokémon!\1"))
     Kernel.pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
     return false
   end
   if pokemon.is_a?(Integer) && level.is_a?(Integer)
     pokemon=PokeBattle_Pokemon.new(pokemon,level,$Trainer,true,dream)
   end
   speciesname=PBSpecies.getName(pokemon.species)
   Kernel.pbMessage(_INTL("{1} obtained {2}!\\se[itemlevel]\1",$Trainer.name,speciesname))
   pbNicknameAndStore(pokemon)
   return true
 end

PokemonTrading

Add the following highlighted areas to the def "pbStartTrade"

  def pbStartTrade(pokemonIndex,species,nickname,trainerName,dream=false)
   myPokemon=$Trainer.party[pokemonIndex]
   opponent=PokeBattle_Trainer.new(trainerName,0)
   opponent.setForeignID($Trainer)
   yourPokemon=PokeBattle_Pokemon.new(species,myPokemon.level,opponent,true,dream)
   ...

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.