Community

The PokéCommunity

We are still working on a better slogan!

Visit Index



Advertise here

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Notices

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Post Reply
 
Thread Tools
  #1    
Old June 11th, 2013, 10:26 PM
UnderMybrella's Avatar
UnderMybrella
Some Game Developer
 
Join Date: Jan 2011
Location: Atlantis
Gender: Male
Nature: Calm

Advertise here
Note: You can find the tutorial here.
Summary:
For anyone that doesn't know, the Masuda Method is a method that makes it 6 times as likely for an egg to hatch shiny. That is, if the two parents come from different languages. In this tutorial, I'll show you how to add a method that gives eggs a 1/2048 (So 4x more likely) chance of hatching shiny if both parent's "obtain" text is the same.
Implementing
So. First of all, let's open up to this script, PokemonDayCare. This script has pretty much, if not all, of the egg-related scripts. Now, the method we want is pbDayCareGenerateEgg. This is called when the game decided to generate an egg (It's on line 170).
The next thing you want to do is go down a bit until you see this: # Masuda method

This means that the next trickle of code is the Masuda method. This is it:

Code:
if father.language!=mother.language
  if getConst(PBItems,:SHINYCHARM) && $PokemonBag.pbQuantity(PBItems::SHINYCHARM)>0
    egg.makeNotShiny
    egg.makeShiny if rand(1024)==0
  else
    for i in 0...5   # 6 times as likely
      if !egg.isShiny?
        egg.personalID=rand(65536)|(rand(65536)<<16)
      end
    end
  end
end
Doesn't make sense? Well, first off, it gets the father's language and the mother's language. if they are NOT equal, continue. Then, it tries to see if you have a shiny charm in your bag. If you do, it makes the egg not shiny, then makes it shiny IF the game randomly generates a number between 0 and 1024 and gets a 0. Now, if you didn't have a shiny charm, then the game tries to redetermine the Pokemon's personalID 5 times, each time checking if the Pokemon is shiny.
Well, that was a lot of explanation. Now, onto what we're adding!

Just below that, add this:

Code:
if father.obtainMap==mother.obtainMap
  egg.makeNotShiny
  egg.makeShiny if rand(2048)==0
end
What does that do? First, it compares the father's obtain text to the mother's. If they are the same (ie, caught same place, both daycare Pokemon) the game makes the egg not shiny. Then, the game generates a number between 0 and 2048 and checks if it is 0. If it is, then the egg is shiny.
Well, there you have it! Your own <Insert Name Here> method!

Suggestions
1. Make more methods - Maybe based off natures, IV's, EV's or even the names!
2. Make a second daycare that makes it easier to hatch shiny Pokemon
3. Maybe give shiny Pokemon a special move too?
The Monoball Challenge - Have you got what it takes to catch 'em all, but with only one type of Pokéball? http://www.pokecommunity.com/showthread.php?p=7889482
Post Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 12:40 PM.

About Us
© 2002 - 2014 The PokéCommunity™, pokecommunity.com. Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.

Copyright
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com. PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator. Header artwork by Jordanice of deviantART.

Social Media
If you would like to stay up-to-date with us on the go, when we're down, or other such things, follow us on social media sites--most notibly Twitter, Facebook, and Google Plus--by clicking on the links provided.

Design presented by Peitharchia. Special thanks to Hiroshi Sotomura and Ausaudriel.