• 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

v20.1 Mystery Codes 2022-12-05

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
This script is incompatible with: Mr. Gela's Portrait Namebox windows. Use https://eeveeexpo.com/resources/1078/ instead.

Paste in a new script section above Main, or turn into a plugin.
Script:
Expand Collapse Copy
class CustomGifts
  def self.AAAAAAAAAA
    if $game_switches[98] == false
      #The pichu from Lerucean Town
      pkmn = Pokemon.new(:PICHU, 30)
      pkmn.item = :ZAPPLATE
      pkmn.form = 2           # Spiky-eared
      pkmn.makeFemale
      pkmn.shiny = false
      pkmn.learn_move(:VOLTTACKLE)
      pkmn.learn_move(:HELPINGHAND)
      pkmn.learn_move(:SWAGGER)
      pkmn.learn_move(:PAINSPLIT)
      pkmn.cannot_release = true
      pkmn.cannot_trade = true
      pkmn.calc_stats
      pbAddPokemon(pkmn)
      $game_switches[98] = true
    else
      pbMessage(_INTL("You have already redeemed this code."))
    end
  end
  def self.BBBBBBBBBB
    if $game_switches[99] == false
      # 99 Master Balls
      pbReceiveItem(:MASTERBALL,99)
      $game_switches[99] == true
    else
      pbMessage(_INTL("You have already redeemed this code."))
    end
  end
end
class MysteryCodes
  def self.enterCode
    if pbConfirmMessage(_INTL("Would you like to enter a code?"))
      code = pbMessageFreeText("Enter Code",_INTL(""),false,10)
      if code == "AAAAAAAAAA"
        CustomGifts.AAAAAAAAAA
      elsif code == "BBBBBBBBBB"
        CustomGifts.BBBBBBBBBB
      end
    else
      pbMessage(_INTL("Please come again soon!"))
    end
  end
end

Create an event that looks like this:
1.png

You can modify it in any way as long as it has MysteryCodes.enterCode somewhere in the list of event command for that event.

Additionally you can put MysteryCodes.enterCode in another script, which could allow the player to access it from the menu or pokegear.
As the default codes are only examples you will need to make your own. Here is how:
We will use the code CCCCCCCCCC as an example, you should do something different as CCCCCCCCCC is easy to guess. The code can be a minimum on one and a maximum of ten letters and numbers long, just remember that the longer the code is the harder it is to guess it.
after
Ruby:
Expand Collapse Copy
def self.BBBBBBBBBB
    if $game_switches[99] == false
      # 99 Master Balls
      pbReceiveItem(:MASTERBALL,99)
      $game_switches[99] == true
    else
      pbMessage(_INTL("You have already redeemed this code."))
    end
  end
add
Ruby:
Expand Collapse Copy
def self.CCCCCCCCCC
    if $game_switches[XXX] == false
      *Your Code Here*
      $game_switches[XXX] == true
    else
      pbMessage(_INTL("You have already redeemed this code."))
    end
  end
Where XXX is the number of the switch you want.
In that your code here section put the scrip commands you want to trigger when the mystery code is redeemed.
Next after
Ruby:
Expand Collapse Copy
elsif code == "BBBBBBBBBB"
  CustomGifts.BBBBBBBBBB
and finally add
Ruby:
Expand Collapse Copy
elsif code == "CCCCCCCCCC"
  CustomGifts.CCCCCCCCCC
And boom! You have added a mystery code.


If you want to remove the default mystery codes this is how:
First make sure you have at least a placeholder mystery code (i will use CCCCCCCCCC for the example placeholder code.),
then remove
Ruby:
Expand Collapse Copy
def self.AAAAAAAAAA
  if $game_switches[98] == false
    #The pichu from Lerucean Town
    pkmn = Pokemon.new(:PICHU, 30)
    pkmn.item = :ZAPPLATE
    pkmn.form = 2           # Spiky-eared
    pkmn.makeFemale
    pkmn.shiny = false
    pkmn.learn_move(:VOLTTACKLE)
    pkmn.learn_move(:HELPINGHAND)
    pkmn.learn_move(:SWAGGER)
    pkmn.learn_move(:PAINSPLIT)
    pkmn.cannot_release = true
    pkmn.cannot_trade = true
    pkmn.calc_stats
    pbAddPokemon(pkmn)
    $game_switches[98] = true
  else
    pbMessage(_INTL("You have already redeemed this code."))
  end
end
def self.BBBBBBBBBB
  if $game_switches[99] == false
    # 99 Master Balls
    pbReceiveItem(:MASTERBALL,99)
    $game_switches[99] == true
  else
    pbMessage(_INTL("You have already redeemed this code."))
  end
end
and
Ruby:
Expand Collapse Copy
if code == "AAAAAAAAAA"
  CustomGifts.AAAAAAAAAA
elsif code == "BBBBBBBBBB"
  CustomGifts.BBBBBBBBBB
then change
Ruby:
Expand Collapse Copy
elsif code == "CCCCCCCCCC"
  CustomGifts.CCCCCCCCCC
to
Ruby:
Expand Collapse Copy
if code == "CCCCCCCCCC"
  CustomGifts.CCCCCCCCCC
and boom! You have removed the default mystery codes from the script.


sorry for the complex methods for adding and removing mystery codes, it is mostly because i cannot script.
Credits
Credit if used:
@tilles111
Author
tilles111
Views
2,125
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from tilles111

Back
Top