Thread: [Essentials Script] Pokemon Birthsigns
View Single Post
  #48    
Old September 17th, 2015 (9:04 PM). Edited September 29th, 2015 by Lucidious89.
Lucidious89 Lucidious89 is offline
     
    Join Date: Apr 2014
    Gender: Male
    Posts: 208
    Minor update 9/17/15 : 'The Eternal' Update
    (This has already been updated in the main scripts.)
    I've overhauled the coding for the sign 'The Eternal', to fix some holes and inconsistencies; as well as giving it some polish overall. It's not necessary to add this if you've already installed a previous version, but if you want to update it yourself you can just paste the new code below in place of the old one.

    Changes:
    • Pokemon who were manually given 'The Eternal' Birthsign will now properly inherit a new Birthsign when using Reincarnate. Previously, only hatched Pokemon were able to do this.

    • Pokemon are no longer able to infinitely use Reincarnate during the month of December. Previously, there was nothing stopping this since 'The Eternal' Birthsign would just replace itself, and allow you to continuously Reincarnate. Now you will simply get a message telling you that you must wait for a different month before you can use Reincarnate.

    • A jingle will play whenever you successfully Reincarnate a Pokemon, making the process feel a little more polished.

    • Rearranged the order of some of the text and prompts so that the process flows better.

    • Made it so that the message prompt for attaching the Second Step Ribbon will only display if the Pokemon doesn't have the ribbon. Previously, the message would play even if the Pokemon already had the ribbon.

    New Code
    Code:
    #===============================================================================
    # Birthsigns - The Eternal
    # Reincarnate Skill effect:
    # Resets the Pokemon as if it was hatched again, allowing it to inherit
    # a new birthsign.
    #===============================================================================
    elsif cmdReincarnate>=0 && command==cmdReincarnate
      if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
        if true
          if Time.now.mon==12 &&
          (pkmn.birthsign==_INTL("'The Eternal'") || pkmn.birthsign==PBBirthsigns::ETERNAL)
            pbDisplay(_INTL("You must wait for a new month before you can do that."))
            break
          end
          pbDisplay(_INTL("Activating this birthsign will reset {1}'s level and birthsign, and any affected attributes.",pkmn.name))
          if Kernel.pbConfirmMessage(_INTL("Are you sure you want to activate this birthsign?"))
            if true
              pkmn.level=EGGINITIALLEVEL
              pkmn.ev[0]=0
              pkmn.ev[1]=0
              pkmn.ev[2]=0
              pkmn.ev[3]=0
              pkmn.ev[4]=0
              pkmn.ev[5]=0
              pkmn.happiness=120
              pkmn.pokerus=0
              pkmn.timeEggHatched=pbGetTimeNow
              pkmn.obtainText=_INTL("From a previous life.")
              if pkmn.obtainMode!=1
                if Time.now.mon==1
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:APPRENTICE)
                  else
                    pkmn.setBirthsign(:PHOENIX)
                  end
                elsif Time.now.mon==2
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:COMPANION)
                  else
                    pkmn.setBirthsign(:SCHOLAR)
                  end
                elsif Time.now.mon==3
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:BEACON)
                  else
                    pkmn.setBirthsign(:FUGITIVE)
                  end
                elsif Time.now.mon==4
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:SAVAGE)
                  else
                    pkmn.setBirthsign(:ARISTOCRAT)
                  end
                elsif Time.now.mon==5
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:PRODIGY)
                  else
                    pkmn.setBirthsign(:CLERIC)
                  end
                elsif Time.now.mon==6
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:MARTYR)
                  else
                    pkmn.setBirthsign(:MONK)
                  end
                elsif Time.now.mon==7
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:MAIDEN)
                  else
                    pkmn.setBirthsign(:ANCESTOR)
                  end
                elsif Time.now.mon==8
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:GLADIATOR)
                  else
                    pkmn.setBirthsign(:SPECIALIST)
                  end
                elsif Time.now.mon==9
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:VOYAGER)
                  else
                    pkmn.setBirthsign(:ASSASSIN)
                  end
                elsif Time.now.mon==10
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:THIEF)
                  else
                    pkmn.setBirthsign(:PARENT)
                  end
                elsif Time.now.mon==11
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:GLUTTON)
                  else
                    pkmn.setBirthsign(:HUNTER)
                  end
                elsif Time.now.mon==12
                  if !USENEWBIRTHSIGNS
                    pkmn.setBirthsign(:WISHMAKER)
                  else
                    pkmn.setBirthsign(:ETERNAL)
                  end
                end
              end
              pbRefresh
              pbDisplay(_INTL("{1} was reincarnated by the power of The Eternal!",pkmn.name))
              pbDisplay(_INTL("And..."))
              #=======================================================================================
              #Birthsigns
              #=======================================================================================
              if Time.now.mon==1
                if !USENEWBIRTHSIGNS
                  pkmn.pokerus=16
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Apprentice!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Phoenix!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==2
                if !USENEWBIRTHSIGNS
                  pkmn.happiness=255
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Companion!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Scholar!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==3
                if !USENEWBIRTHSIGNS
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Beacon!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Fugitive!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==4
                if !USENEWBIRTHSIGNS
                  pkmn.iv[0]=0
                  pkmn.iv[1]=31
                  pkmn.iv[3]=31
                  pkmn.iv[4]=31
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Savage!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Aristocrat!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==5
                if !USENEWBIRTHSIGNS
                  pkmn.abilityflag=2
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Prodigy!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Cleric!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==6
                if !USENEWBIRTHSIGNS
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Martyr!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Monk!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==7
                if !USENEWBIRTHSIGNS
                  pkmn.setGender(1)
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Maiden!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Ancestor!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==8 
                if !USENEWBIRTHSIGNS
                  pkmn.ev[1]=100
                  pkmn.ev[4]=100
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Gladiator!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Specialist!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==9
                if !USENEWBIRTHSIGNS
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Voyager!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Assassin!",pkmn.name)) 
                end
                pbRefresh
              end
              if Time.now.mon==10
                if !USENEWBIRTHSIGNS
                  pkmn.ev[3]=252
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Thief!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Parent!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==11
                if !USENEWBIRTHSIGNS
                  pkmn.iv[0]=31
                  pkmn.iv[2]=31
                  pkmn.iv[3]=0
                  pkmn.iv[5]=31
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Glutton!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Hunter!",pkmn.name))
                end
                pbRefresh
              end
              if Time.now.mon==12
                if !USENEWBIRTHSIGNS
                  pkmn.shinyflag=true
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Wishmaker!",pkmn.name))
                else
                  pbSEPlay("itemlevel")
                  pbDisplay(_INTL("{1} gained the power of The Eternal!",pkmn.name))
                end
                pbRefresh
              end
              #=======================================================================================
              pkmn.calcStats
              if Kernel.pbConfirmMessage(_INTL("Would you like to rename the reincarnated Pokémon?"))
                species=PBSpecies.getName(pkmn.species)
                nickname=pbEnterPokemonName(_INTL("{1}'s new name?",pkmn.name),0,10,"",pkmn)
                pkmn.name=nickname if nickname!=""
                pbRefresh
              end
              if !pkmn.hasRibbon?(:SECONDSTEP)
                pkmn.giveRibbon(:SECONDSTEP)
                pbDisplay(_INTL("You put the Second Step Ribbon on {1} to commemorate new life.",pkmn.name))
                pbRefreshSingle(pkmnid)
              end
            end
            pbRefresh
          end
        end
        pbRefresh
      end
      #=======================================================================================
    Old Code
    Spoiler:
    Code:
    #===============================================================================
    # Birthsigns - The Eternal
    # Reincarnate Skill effect:
    # Resets the Pokemon as if it was hatched again, allowing it to inherit
    # a new birthsign.
    #===============================================================================
    elsif cmdReincarnate>=0 && command==cmdReincarnate
      if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
        if true
          pbDisplay(_INTL("Activating this birthsign will reset {1}'s level and birthsign, and any affected attributes.",pkmn.name))
          if Kernel.pbConfirmMessage(_INTL("Are you sure you want to activate this birthsign?"))
            if true
              pkmn.giveRibbon(:SECONDSTEP)
              pkmn.level=EGGINITIALLEVEL
              pkmn.ev[0]=0
              pkmn.ev[1]=0
              pkmn.ev[2]=0
              pkmn.ev[3]=0
              pkmn.ev[4]=0
              pkmn.ev[5]=0
              pkmn.happiness=120
              pkmn.pokerus=0
              pkmn.timeEggHatched=pbGetTimeNow
              pkmn.obtainText=_INTL("From a previous life.")
              pbRefresh
              pbRefreshSingle(pkmnid)
              pbDisplay(_INTL("{1} was reincarnated by the power of The Eternal!",pkmn.name))
              if pkmn.birthsign==_INTL("'The Apprentice'")
                pkmn.pokerus=16
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Apprentice!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Companion'")
                pkmn.happiness=255
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Companion!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Beacon'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Beacon!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Savage'")
                pkmn.iv[0]=0
                pkmn.iv[1]=31
                pkmn.iv[3]=31
                pkmn.iv[4]=31
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Savage!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Prodigy'")
                pkmn.abilityflag=2
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Prodigy!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Martyr'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Martyr!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Maiden'")
                pkmn.setGender(1)
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Maiden!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Gladiator'")
                pkmn.ev[1]=100
                pkmn.ev[4]=100
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Gladiator!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Voyager'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Voyager!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Thief'")
                pkmn.ev[3]=252
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Thief!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Glutton'")
                pkmn.iv[0]=31
                pkmn.iv[2]=31
                pkmn.iv[3]=0
                pkmn.iv[5]=31
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Glutton!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Wishmaker'")
                pkmn.shinyflag=true
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Wishmaker!",pkmn.name))
              end
              #New Birthsigns
              if pkmn.birthsign==_INTL("'The Phoenix'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Phoenix!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Scholar'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Scholar!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Fugitive'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Fugitive!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Aristocrat'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Aristocrat!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Cleric'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Cleric!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Monk'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Monk!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Ancestor'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Ancestor!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Specialist'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Specialist!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Assassin'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Assassin!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Parent'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Parent!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Hunter'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Hunter!",pkmn.name))
              end
              if pkmn.birthsign==_INTL("'The Eternal'")
                pbRefresh
                pbDisplay(_INTL("{1} gained the power of The Eternal!",pkmn.name))
              end
              if Kernel.pbConfirmMessage(_INTL("Would you like to rename the reincarnated Pokémon?"))
                species=PBSpecies.getName(pkmn.species)
                nickname=pbEnterPokemonName(_INTL("{1}'s new name?",pkmn.name),0,10,"",pkmn)
                pkmn.name=nickname if nickname!=""
                pbRefresh
              end
              pbDisplay(_INTL("You put the Second Step Ribbon on {1} to commemorate new life.",pkmn.name))
              pkmn.calcStats
              pbRefreshSingle(pkmnid)
            end
            pbRefresh
          end
        end
        pbRefresh
      end
    Reply With Quote