• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Wild Ditto Disguise 1.0

Pokémon Essentials Version
v17.2 ➖
Ditto_Disguise script by Seth-Angel

This is a script that makes certain pokemon in the wild actually being a disguise of Ditto, like in Pokemon Go.

Note: This only works with pokemon EBS, it is untested with the standard battle mechanics.

Ruby:
################################################################################
#
# Ditto_Disguise script by Seth-Angel
#
# This is a script that makes certain pokemon in the wild actually being a
# disguise of Ditto, like in Pokemon Go.
#
# Note: This only works with pokemon EBS, it is untested with the standard
# battle mechanics.
#===============================================================================
#                                 INSTALLATION
#===============================================================================
#
# Just paste this script ontop of main and underneath Compiler
#
#===============================================================================
#===============================================================================
# Change the chance of Ditto appearing @ DITTOCHANCE
# It's discuised Pokemon @ DITTODISGUISES
# The Pokeballs used when catching discuised Pokemon @ DITTOBALLS
#
################################################################################

DITTOCHANCE = 5 # The Chance of Ditto appearing.
DITTODISGUISES = [:RATTATA,:WEEDLE,:PIDGEY,:RATTA] # Ditto's DISGUISES
DITTOBALLS = [:POKEBALL,:GREATBALL,:ULTRABALL,:MASTERBALL] # Balls used for this event

class PokemonChangeScene < PokemonEvolutionScene
  def pbEvolution(cancancel=false)
    # stops BGM and displays message
    pbBGMStop()
    16.times do
      Graphics.update
      self.update
      @sprites["bar1"].y -= @sprites["bar1"].bitmap.height/16
      @sprites["bar2"].y += @sprites["bar2"].bitmap.height/16
    end
    @sprites["msgwindow"].visible = true
    Kernel.pbMessageDisplay(@sprites["msgwindow"],_INTL("\\se[]What?\r\n{1} is changing!\\^",@pokemon.name)) { self.update }
    Kernel.pbMessageWaitForInput(@sprites["msgwindow"],100,true) { self.update }
    @sprites["msgwindow"].visible = false
    # plays Pokemon's cry
    pbPlayCry(@pokemon)
    pbCryFrameLength(@pokemon.species).times do
      Graphics.update
      self.update
    end
    pbBGMPlay("evolv")
    canceled = false
    # beginning glow effect
    self.glow
    k1 = 1 # zoom factor for the Pokemon
    k2 = 1 # zoom factor for the shine
    s = 1 # speed of the animation
    @viewport.color = Color.new(255,255,255,0)
    pbSEPlay("#{SE_EXTRA_PATH}Heal4")
    # main animation loop
    for i in 0...256
      k1 *= -1 if i%(32/s) == 0
      k2 *= -1 if i%(16) == 0
      s *= 2 if i%64 == 0 && i > 0 && s < 8
      Graphics.update
      Input.update
      self.update(false)
      self.updateParticles
      self.updateRays(i)
      @sprites["poke"].zoom_x += 0.03125*k1*s
      @sprites["poke"].zoom_y += 0.03125*k1*s
      @sprites["poke"].tone.red += 16
      @sprites["poke"].tone.green += 16
      @sprites["poke"].tone.blue += 16
      @sprites["poke2"].zoom_x -= 0.03125*k1*s
      @sprites["poke2"].zoom_y -= 0.03125*k1*s
      if @sprites["shine2"].opacity < 255
        @sprites["shine2"].opacity += 16
        @sprites["shine2"].zoom_x += 0.08
        @sprites["shine2"].zoom_y += 0.08
      else
        @sprites["shine2"].zoom_x += 0.01*k2
        @sprites["shine2"].zoom_y += 0.01*k2
        @sprites["shine2"].tone.red += 0.5
        @sprites["shine2"].tone.green += 0.5
        @sprites["shine2"].tone.blue += 0.5
      end
      if i >= 240
        @sprites["shine3"].opacity += 16
        @sprites["shine3"].zoom_x += 0.1
        @sprites["shine3"].zoom_y += 0.1
      end
      @viewport.color.alpha += 32 if i >= 248
      if Input.trigger?(Input::B) && cancancel
        pbBGMStop()
        canceled = true
        break
      end
    end
    @viewport.color = Color.new(255,255,255)
    self.flash(canceled)
    if canceled
      # prints message when evolution is cancelled
      @sprites["msgwindow"].visible = true
      Kernel.pbMessageDisplay(@sprites["msgwindow"],_INTL("Huh?\r\n{1} stopped evolving!",@pokemon.name)) { self.update }
    else
      # creates the actual evolved Pokemon
      self.createEvolved
    end
  end
  # function used to create the newly evolved Pokemon
  def createEvolved
    frames = pbCryFrameLength(@newspecies)
    # plays Pokemon's cry
    pbBGMStop()
    pbPlayCry(@newspecies)
    frames.times do
      Graphics.update
      self.update
    end
    pbMEPlay("EvolutionSuccess")
    # gets info of the new species
    newspeciesname = PBSpecies.getName(@newspecies)
    oldspeciesname = PBSpecies.getName(@pokemon.species)
    @sprites["msgwindow"].visible = true
    Kernel.pbMessageDisplay(@sprites["msgwindow"],_INTL("\\se[]OH WOW!\nIt was a Ditto disguised as {1}!\\wt[80]",@pokemon.name,newspeciesname)) { self.update }
    @sprites["msgwindow"].text = ""
    removeItem = false
    createSpecies = pbCheckEvolutionEx(@pokemon){|pokemon,evonib,level,poke|
      if evonib == PBEvolution::Shedinja
        # checks if a Pokeball is available for Shedinja
        next poke if $PokemonBag.pbQuantity(getConst(PBItems,:POKEBALL))>0
      elsif evonib == PBEvolution::TradeItem || evonib == PBEvolution::DayHoldItem || evonib == PBEvolution::NightHoldItem
        # consumes evolutionary item
        removeItem = true if poke == @newspecies
      end
      next -1
    }
    @pokemon.setItem(0) if removeItem
    @pokemon.species = @newspecies
    $Trainer.seen[@newspecies] = true
    $Trainer.owned[@newspecies] = true
    pbSeenForm(@pokemon)
    @pokemon.name = newspeciesname if @pokemon.name == oldspeciesname
    @pokemon.calcStats
    # checking moves for new species
    movelist = @pokemon.getMoveList
    for i in movelist
      if i[0] == @pokemon.level
        # learning new moves
        pbLearnMove(@pokemon,i[1],true) { self.update }
      end
    end
    # adding new species of Pokemon to the party
    if createSpecies>0 && $Trainer.party.length<6
      newpokemon = @pokemon.clone
      newpokemon.iv = @pokemon.iv.clone
      newpokemon.ev = @pokemon.ev.clone
      newpokemon.species = createSpecies
      newpokemon.name = PBSpecies.getName(createSpecies)
      newpokemon.setItem(0)
      newpokemon.clearAllRibbons
      newpokemon.markings = 0
      newpokemon.ballused = 0
      newpokemon.calcStats
      newpokemon.heal
      $Trainer.party.push(newpokemon)
      $Trainer.seen[createSpecies] = true
      $Trainer.owned[createSpecies] = true
      pbSeenForm(newpokemon)
      $PokemonBag.pbDeleteItem(getConst(PBItems,:POKEBALL))
    end
  end
end


for j in (0...DITTOBALLS.length)
  BallHandlers::OnCatch.add(DITTOBALLS[j],proc{|ball,battle,pokemon|
  for i in (0...DITTODISGUISES.length)
    if (isConst?(pokemon.species,PBSpecies,DITTODISGUISES[i]))
      if rand(100)<DITTOCHANCE
        battle.pbDisplay(_INTL("Wait! Something is happening to {1}",pokemon.name))
        evo=PokemonChangeScene.new
        newspecies = PBSpecies::DITTO
        evo.pbStartScreen(pokemon,newspecies)
        evo.pbEvolution
        evo.pbEndScreen
        pokemon.resetMoves
        pokemon.calcStats
        $DittoDisguise = false
      end
    end
  end
  })
end
Credits
Seth-Angel
  • Like
Reactions: TechSkylander1518
Author
Seth_Angel
Views
1,253
First release
Last update
Rating
0.00 star(s) 0 ratings
Back
Top