FANDOM


Mystery Gift
This tutorial is deprecated. It is no longer relevant to the latest version of Pokémon Essentials.

This tutorial was written by GameNox (scripts by Crazyninjaguy, Pokemon Platnum and Wichu). Please give credit.

Click here for more tutorials!


This tutorial shows how to create a mystery gift event in Pokémon Essentials. This will give the player an item (Or Pokémon). Usually a special sprite in the Pokémon Center is used. One minor thing though, you can use the code as much as you want. There needs to be a switch where if you already used the code you cannot use it again.

To call this script use:

Class_MysteryGift.new

Put this code above Main:

#######################################################################
# Mystery Gift System 2.0                                             #
# For Pokemon Essentials                                              #
# By PokemonPlatnum and Crazyninjaguy(Most by him :L)                 #
# Using ALOT of help from Wichu                                       #
# Slightly edited by GameNox and Maruno                               #
# http://www.planetdev.net                                            #
# 12/05/2010                                                          #
# If you are having trouble with this script contact me on my         #
# profile, by pm or on the thread, thanks                             #
#---------------------------------------------------------------------#
# To use this script, use the single following line:                  #
#       MysteryGift.new                                               #
#######################################################################

class MysteryGift
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @sprites={}
    @sprites["spriteset"]=Spriteset_Map.new
  end
 
  def main
    commands=[
      _INTL("Potion"),
      _INTL("Elixir"),
      _INTL("Ether"),
      _INTL("Exit")
    ]
    @command = Window_CommandPokemon.new(commands, 160)
    @text = Window_UnformattedTextPokemon.new("Which gift would you like?")
    @text.y = Graphics.height - @text.height
    @command.x = Graphics.width - @command.width
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    pbDisposeSpriteHash(@sprites)
  end
 
  def update
    @command.update
    if @command.active
      update_command
    end
  end
 
  def update_command
    if Input.trigger?(Input::B)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
      case @command.index
        when 0
          password=pbEnterText(_INTL("Enter the code."),8,8)
          if password=="PASSWORD"
            Kernel.pbMessage(_INTL("Correct code!"))
            Kernel.pbReceiveItem(PBItems::POTION)
          else
            Kernel.pbMessage(_INTL("Incorrect code..."))
          end
        when 1
          password=pbEnterText(_INTL("Enter the code."),8,8)
          if password=="adhosdgf"
            Kernel.pbMessage(_INTL("Correct code!"))
            Kernel.pbReceiveItem(PBItems::ELIXIR)
          else
            Kernel.pbMessage(_INTL("Incorrect code..."))
          end
        when 2
          password=pbEnterText(_INTL("Enter the code."),8,8)
          if password=="pwnage91"
            Kernel.pbMessage(_INTL("Correct code!"))
            Kernel.pbReceiveItem(PBItems::ETHER)
          else
            Kernel.pbMessage(_INTL("Incorrect code..."))
          end
        when 3
          $scene = Scene_Map.new
      end
    end
  end
end

Editing code

_INTL("Item") The choices for the gift that the player chooses.
Kernel.pbReciveItem(PBItems::ITEM) The item that the player receives.
pbAddPokemon(PBSpecies::POKEMON,level) The Pokémon that the player receives. (Replace for the receive items code.)

Adding more options

To add more options simply add this under commands=[:

_INTL("Item")

And this above when 3:

        when 3
          password=pbEnterText(_INTL("Enter the code."),8,8)
          if password=="yourpassword"
            Kernel.pbMessage(_INTL("Correct code!"))
            Kernel.pbReceiveItem(PBItems::YOURITEM)
          else
            Kernel.pbMessage(_INTL("Incorrect code..."))
          end

Also, you must change when 3 in the original code to when 4 (or whichever is the next available number - that last section must have the last number).

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.