FANDOM


Adding ghosts
This tutorial was written by Desbrina. Please give credit.
Click here for more tutorials!


Ghost2
Ghost3

This tutorial shows you how to add pokemon that you can't fight/catch like those ghosts that are found in Lavendar Town's pokemon tower.

In PokeBattle_Battle, find the following code and add in the indicated lines. You can replace the switch number with another switch/item :

if cmd==0 # Fight
  if $game_switches[170]                                                          # THIS LINE
    pbDisplay(_INTL("{1} is too scared to move!",@battlers[i].pbThis))            # THIS LINE
    return                                                                        # THIS LINE
  end                                                                             # THIS LINE
  if pbCanShowFightMenu?(i)
    commandDone=true if pbAutoFightMenu(i)
    until commandDone
      index=@scene.pbFightMenu(i)
      break if index<0
      next if !pbRegisterMove(i,index)
      if @doublebattle
        thismove=@battlers[i].moves[index]
        target=@battlers[i].pbTarget(thismove)
        if target==PBTargets::SingleNonUser # single non-user
          target=@scene.pbChooseTarget(i)
          next if target<0
          pbRegisterTarget(i,target)
        end
      end
      commandDone=true
    end
  else
    pbAutoChooseMove(i)
    commandDone=true
  end

then in the def pbThrowPokeBall(idxPokemon,ball,rareness=nil) function, at the top below the def line add the following:

 if $game_switches[170] # if your using the changing encounters mid game to add ghosts, then you need to use if $game_switches[170] || $game_switches[169] - switch 169 is the one defined as the switch that changes the encounters 
   pbDisplay(_INTL("It dodged the thrown BALL! This POKEMON can't be caught!"))
   return
 end


If you wish to stop ghosts from attacking, then in pokebattle_AI you need to find the following code

if wildbattle # If wild battle

then after it add

 if $game_switches[170] # if your using the changing encounters mid game to add ghosts, then you need to use if $game_switches[170] || $game_switches[169] - switch 169 is the one defined as the switch that changes the encounters 
   pbDisplay(_INTL("Get out... Get out..."))         
   return                                                                        
 end

To change the wild pokemon appears, find in PokeBattle_Battle the following code

 pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))

change this line to

 if $game_switches[170]
   pbDisplayPaused(_INTL("GHOST appeared! Darn! The GHOST can't be ID'd!"))
 else
   pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
 end


Edit by dbzfanatic:

To show a ghost without using an alternate encounter open the PokeBattle_Scene (Pokemon_ActualScene prior to v16) and find this code

if @battler.name.split().last=="♂" || @battler.name.split().last=="♀" pokename=@battler.name[0..-2]
     end

and change it to

   if $game_switches[170]
     pokename = "Ghost"
   else
     if @battler.name.split().last=="♂" || @battler.name.split().last=="♀"
       pokename=@battler.name[0..-2]
     end
   end

Then find

  @sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)

and replace it with

         if $game_switches[170]
           ghost=@battle.party2[0]
           ghost.species = 650
           @sprites["pokemon1"].setPokemonBitmap(ghost,false)
         else
           @sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
         end

Then simply have an event that turns on switch 170 when you no longer wish to see ghosts.

In order for this edit to work you MUST create a new pokemon with the name "Ghost" and internal name "GHOST", what you set the rest of the required information to does not matter but the number in the script (here it is 650) MUST match the number of the created species.

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.