• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Pokemon Fan Club card that records Eeveelutions

  • 28
    Posts
    9
    Years
    • Seen May 11, 2024
    Hi Everyone,

    I'm trying to create an item that's kind of like the trainer card. The idea is that someone in the Pokeman Fan Club hands you a card that tracks your eevee evolutions and when you successfully evolve eevees they give you things like Rare candies, evolution stones, and such. It would be a Key Item that would would create a scen like your trainer card and the eevee icons would appear on it as you achieved their evolutions. I am having some serious troubles figuring this out. I basically tried copying as much of the trainer card as I could and then modifying it.

    I keep getting these errors:

    When I try to use the card from the bag:

    Code:
    Exception: NameError
    Message: uninitialized constant PFCEeveeCard
    PItem_ItemEffects:148
    PItem_ItemEffects:146:in `pbFadeOutIn'
    PItem_ItemEffects:146
    PItem_ItemEffects:145:in `call'
    Event:150:in `trigger'
    PItem_Items:197:in `triggerUseFromBag'
    PItem_Items:689:in `pbUseItem'
    PScreen_Bag:566:in `pbStartScreen'
    PScreen_Bag:544:in `loop'
    PScreen_Bag:608:in `pbStartScreen'

    and when I try to set how many eevee stamps I have from the debug menu.

    Code:
    Exception: NoMethodError
    Message: undefined method `[]' for nil:NilClass
    Debug:516:in `pbDebugMenu'
    Debug:515:in `each'
    Debug:515:in `pbDebugMenu'
    Debug:513:in `loop'
    Debug:521:in `pbDebugMenu'
    Debug:299:in `loop'
    Debug:858:in `pbDebugMenu'
    PScreen_PauseMenu:240:in `pbStartPokemonMenu'
    PScreen_PauseMenu:239:in `pbFadeOutIn'
    PScreen_PauseMenu:239:in `pbStartPokemonMenu'


    Here's what I have:

    Under a new section
    PFCEeveeCard

    Code:
    class PFCEeveeCardScene
      def update
        pbUpdateSpriteHash(@sprites)
      end
    
      def pbStartScene
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        background=pbResolveBitmap(sprintf("Graphics/Pictures/PFCEeveeCardbgf"))
        if $Trainer.isFemale? && background
          addBackgroundPlane(@sprites,"bg","PFCEeveeCardbgf",@viewport)
        else
          addBackgroundPlane(@sprites,"bg","PFCEeveeCardbg",@viewport)
        end
        cardexists=pbResolveBitmap(sprintf("Graphics/Pictures/PFCEeveeCardf"))
        @sprites["card"]=IconSprite.new(0,0,@viewport)
        if $Trainer.isFemale? && cardexists
          @sprites["card"].setBitmap("Graphics/Pictures/PFCEeveeCardf")
        else
          @sprites["card"].setBitmap("Graphics/Pictures/PFCEeveeCardb")
        end
        @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
        @sprites["trainer"]=IconSprite.new(336,112,@viewport)
        @sprites["trainer"].setBitmap(pbPlayerSpriteFile($Trainer.trainertype))
        @sprites["trainer"].x-=(@sprites["trainer"].bitmap.width-128)/2
        @sprites["trainer"].y-=(@sprites["trainer"].bitmap.height-128)
        @sprites["trainer"].z=2
        pbSetSystemFont(@sprites["overlay"].bitmap)
        pbDrawTrainerCardFront
        if $PokemonGlobal.trainerRecording
          $PokemonGlobal.trainerRecording.play
        end
        pbFadeInAndShow(@sprites) { update }
      end
    
      def pbDrawTrainerCardFront
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        totalsec = Graphics.frame_count / Graphics.frame_rate
        hour = totalsec / 60 / 60
        min = totalsec / 60 % 60
        time=_ISPRINTF("{1:02d}:{2:02d}",hour,min)
        $PokemonGlobal.startTime=pbGetTimeNow if !$PokemonGlobal.startTime
        starttime=_ISPRINTF("{1:s} {2:d}, {3:d}",
           pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
           $PokemonGlobal.startTime.day,
           $PokemonGlobal.startTime.year)
        pubid=sprintf("%05d",$Trainer.publicID($Trainer.id))
        baseColor=Color.new(72,72,72)
        shadowColor=Color.new(160,160,160)
        textPositions=[
           [_INTL("Name"),34,64,0,baseColor,shadowColor],
           [_INTL("{1}",$Trainer.name),302,64,1,baseColor,shadowColor],
           [_INTL("ID No."),332,64,0,baseColor,shadowColor],
           [_INTL("{1}",pubid),468,64,1,baseColor,shadowColor],
        ]
        pbDrawTextPositions(overlay,textPositions)
        y=293
        imagePositions=[]
        for region in 0...5 # Five rows
          x=42
          for i in 0...9
            if $Trainer.eeveestamps[i+region*9]
              imagePositions.push( ["Graphics/Pictures/eeveestamps",x,y,i*32,region*32,32,32])
            end
            x+=48
          end
          y+=32
        end
        pbDrawImagePositions(overlay,imagePositions)
      end
    
      def pbPFCEeveeCard
        loop do
          Graphics.update
          Input.update
          self.update
          if Input.trigger?(Input::B)
            break
          end
        end 
      end
    
      def pbEndScene
        pbFadeOutAndHide(@sprites) { update }
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
    end
    
    
    class PokemonPFCEeveeCard
    
    def initialize(scene)
      @scene=scene
    end
    
    def startScreen
      @scene.pbStartScene
      @scene.pbPFCEeveeCard
      @scene.pbEndScene
    end
    end

    Under PokeBattle_Trainer
    Code:
    class PokeBattle_Trainer
      attr_accessor(:name)
      attr_accessor(:id)
      attr_accessor(:metaID)
      attr_accessor(:trainertype)
      attr_accessor(:outfit)
      attr_accessor(:badges)
      attr_accessor(:eeveestamps)
      attr_accessor(:money)
      attr_accessor(:seen)
      attr_accessor(:owned)
      attr_accessor(:formseen)
      attr_accessor(:formlastseen)
      attr_accessor(:shadowcaught)
      attr_accessor(:party)
      attr_accessor(:pokedex)    # Whether the Pokédex was obtained
      attr_accessor(:pokegear)   # Whether the Pokégear was obtained
      attr_accessor(:language)
    
      def trainerTypeName   # Name of this trainer type (localized)
        return PBTrainers.getName(@trainertype) rescue _INTL("PkMn Trainer")
      end
    
      def fullname
        return _INTL("{1} {2}",self.trainerTypeName,@name)
      end
    
      def publicID(id=nil)   # Portion of the ID which is visible on the Trainer Card
        return id ? id&0xFFFF : @id&0xFFFF
      end
    
      def secretID(id=nil)   # Other portion of the ID
        return id ? id>>16 : @id>>16
      end
    
      def getForeignID   # Random ID other than this Trainer's ID
        fid=0
        loop do
          fid=rand(256)
          fid|=rand(256)<<8
          fid|=rand(256)<<16
          fid|=rand(256)<<24
          break if fid!=@id
        end
        return fid 
      end
    
      def setForeignID(other)
        @id=other.getForeignID
      end
    
      def metaID
        @metaID=$PokemonGlobal.playerID if !@metaID && $PokemonGlobal
        @metaID=0 if !@metaID
        return @metaID
      end
    
      def outfit
        @outfit=0 if !@outfit
        return @outfit
      end
    
      def language
        @language=pbGetLanguage() if !@language
        return @language
      end
    
      def money=(value)
        @money=[[value,MAXMONEY].min,0].max
      end
    
      def moneyEarned   # Money won when trainer is defeated
        ret=0
        pbRgssOpen("Data/trainertypes.dat","rb"){|f|
           trainertypes=Marshal.load(f)
           return 30 if !trainertypes[@trainertype]
           ret=trainertypes[@trainertype][3]
        }
        return ret
      end
    
      def skill   # Skill level (for AI)
        ret=0
        pbRgssOpen("Data/trainertypes.dat","rb"){|f|
           trainertypes=Marshal.load(f)
           return 30 if !trainertypes[@trainertype]
           ret=trainertypes[@trainertype][8]
        }
        return ret
      end
    
      def numbadges   # Number of badges
        ret=0
        for i in [email protected]
          ret+=1 if @badges[i]
        end
        return ret
      end
    
      def numeeveestamps   # Number of eeveestamps
        ret=0
        for i in [email protected]
          ret+=1 if @eeveestamps[i]
        end
        return ret
      end
      
      def gender
        ret=2   # 2 = gender unknown
        pbRgssOpen("Data/trainertypes.dat","rb"){|f|
           trainertypes=Marshal.load(f)
           if !trainertypes[trainertype]
             ret=2
           else
             ret=trainertypes[trainertype][7]
             ret=2 if !ret
           end
        }
        return ret
      end
    
      def isMale?; return self.gender==0; end
      def isFemale?; return self.gender==1; end
    
      def pokemonParty
        return @party.find_all {|item| item && !item.isEgg? }
      end
    
      def ablePokemonParty
        return @party.find_all {|item| item && !item.isEgg? && item.hp>0 }
      end
    
      def partyCount
        return @party.length
      end
    
      def pokemonCount
        ret=0
        for i in [email protected]
          ret+=1 if @party[i] && !@party[i].isEgg?
        end
        return ret
      end
    
      def ablePokemonCount
        ret=0
        for i in [email protected]
          ret+=1 if @party[i] && !@party[i].isEgg? && @party[i].hp>0
        end
        return ret
      end
    
      def firstParty
        return nil if @party.length==0
        return @party[0]
      end
    
      def firstPokemon
        p=self.pokemonParty
        return nil if p.length==0
        return p[0]
      end
    
      def firstAblePokemon
        p=self.ablePokemonParty
        return nil if p.length==0
        return p[0]
      end
    
      def lastParty
        return nil if @party.length==0
        return @party[@party.length-1]
      end
    
      def lastPokemon
        p=self.pokemonParty
        return nil if p.length==0
        return p[p.length-1]
      end
    
      def lastAblePokemon
        p=self.ablePokemonParty
        return nil if p.length==0
        return p[p.length-1]
      end
    
      def pokedexSeen(region=-1)   # Number of Pokémon seen
        ret=0
        if region==-1
          for i in 0..PBSpecies.maxValue
            ret+=1 if @seen[i]
          end
        else
          regionlist=pbAllRegionalSpecies(region)
          for i in regionlist
            ret+=1 if @seen[i]
          end
        end
        return ret
      end
    
      def pokedexOwned(region=-1)   # Number of Pokémon owned
        ret=0
        if region==-1
          for i in 0..PBSpecies.maxValue
            ret+=1 if @owned[i]
          end
        else
          regionlist=pbAllRegionalSpecies(region)
          for i in regionlist
            ret+=1 if @owned[i]
          end
        end
        return ret
      end
    
      def numFormsSeen(species)
        ret=0
        array=@formseen[species]
        for i in 0...[array[0].length,array[1].length].max
          ret+=1 if array[0][i] || array[1][i]
        end
        return ret
      end
    
      def hasSeen?(species)
        if species.is_a?(String) || species.is_a?(Symbol)
          species=getID(PBSpecies,species)
        end
        return species>0 ? @seen[species] : false
      end
    
      def hasOwned?(species)
        if species.is_a?(String) || species.is_a?(Symbol)
          species=getID(PBSpecies,species)
        end
        return species>0 ? @owned[species] : false
      end
    
      def setSeen(species)
        if species.is_a?(String) || species.is_a?(Symbol)
          species=getID(PBSpecies,species)
        end
        @seen[species]=true if species>0
      end
    
      def setOwned(species)
        if species.is_a?(String) || species.is_a?(Symbol)
          species=getID(PBSpecies,species)
        end
        @owned[species]=true if species>0
      end
    
      def clearPokedex
        @seen=[]
        @owned=[]
        @formseen=[]
        @formlastseen=[]
        for i in 1..PBSpecies.maxValue
          @seen[i]=false
          @owned[i]=false
          @formlastseen[i]=[]
          @formseen[i]=[[],[]]
        end
      end
    
      def initialize(name,trainertype)
        @name=name
        @language=pbGetLanguage()
        @trainertype=trainertype
        @id=rand(256)
        @id|=rand(256)<<8
        @id|=rand(256)<<16
        @id|=rand(256)<<24
        @metaID=0
        @outfit=0
        @pokegear=false
        @pokedex=false
        clearPokedex
        @shadowcaught=[]
        for i in 1..PBSpecies.maxValue
          @shadowcaught[i]=false
        end
        @badges=[]
        for i in 0...8
          @badges[i]=false
        end
        @money=INITIALMONEY
        @party=[]
      end
    end

    Under PItem_ItemEffects I added the following to the proper sections
    Code:
    ItemHandlers::UseFromBag.add(:PFCEEVEECARD, proc {|item|
       pbFadeOutIn(99999){ 
         scene=PFCEeveeCardScene.new
         screen=PFCEeveeCard.new(scene)
         screen.startScreen
       }
       next 1 # Continue
    })
    
    
    ItemHandlers::UseInField.add(:PFCEEVEECARD, proc {|item|
       pbFadeOutIn(99999){ 
         scene=PFCEeveeCardScene.new
         screen=PFCEeveeCard.new(scene)
         screen.startScreen
       }
       next 1 # Continue
    })

    Then under Debug I added

    Code:
      commands.add("setbadges",_INTL("Set Badges"))
      commands.add("seteeveestamps",_INTL("Set Eevee Stamps"))
    
    
        elsif cmd=="setbadges"
          badgecmd=0
          loop do
            badgecmds=[]
            for i in 0...32
              badgecmds.push(_INTL("{1} Badge {2}",$Trainer.badges[i] ? "[Y]" : "[  ]",i+1))
            end
            badgecmd=Kernel.pbShowCommands(nil,badgecmds,-1,badgecmd)
            break if badgecmd<0
            $Trainer.badges[badgecmd]=!$Trainer.badges[badgecmd]
          end
        elsif cmd=="seteeveestamps"
          eeveestampcmd=0
          loop do
            eeveestampcmds=[ ]
            for i in 0...32
              eeveestampcmds.push(_INTL("{1} Eeveestamp {2}",$Trainer.eeveestamps[i] ? "[Y]" : "[  ]",i+1))
            end
            eeveestampcmd=Kernel.pbShowCommands(nil,eeveestampcmds,-1,eeveestampcmd)
            break if eeveestampcmd<0
            $Trainer.eeveestamps[eeveestampcmd]=!$Trainer.eeveestamps[eeveestampcmd]
          end
     
    Hi Guys,

    Okay so I managed to get the entire thing working by piecing together various chunks of other scripts. I did away with all the code outside of the initial script, except, the item handles.

    Now I just need the card to do two things. First I want a second row to show up under the original row of Eeveelutions if the player catches or hatches a shiny version of one of the pokemon.

    Second I want to insert the "first met" information on the card somewhere, but, I don't know what the command is to call up the info, nor how to get it for a specific pokemon.

    Any Ideas??

    Thanks Guys.

    Code:
    class PFCEeveeCardScene
      def update
        pbUpdateSpriteHash(@sprites)
      end
    
      def pbStartScene (maintext,imagepath)
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites["background"]=IconSprite.new(0,0,@viewport)
        @sprites["background"].setBitmap(imagepath)
        @sprites["background"].x=(Graphics.width-@sprites["background"].bitmap.width)/2
        @sprites["background"].y=(Graphics.height-@sprites["background"].bitmap.height)/2
        @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
        @sprites["trainer"]=IconSprite.new(336,112,@viewport)
        @sprites["trainer"].setBitmap(pbPlayerSpriteFile($Trainer.trainertype))
        @sprites["trainer"].x-=(@sprites["trainer"].bitmap.width-128)/2
        @sprites["trainer"].y-=(@sprites["trainer"].bitmap.height-128)
        @sprites["trainer"].z=2
        pbSetSystemFont(@sprites["overlay"].bitmap)
        pbDrawText (maintext)
        pbFadeInAndShow(@sprites) { update }
      end
    
      def pbDrawText (maintext)
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        pubid=sprintf("%05d",$Trainer.publicID($Trainer.id))
        baseColor=Color.new(72,72,72)
        shadowColor=Color.new(160,160,160)
        textPositions=[
           [_INTL("{1}",$Trainer.name),460,100,1,baseColor,shadowColor],
           [_INTL("ID No."),332,64,0,baseColor,shadowColor],
           [_INTL("{1}",pubid),468,64,1,baseColor,shadowColor],
        ]
          
        pbDrawTextPositions(overlay,textPositions)
          eeveestamps=[
            PBSpecies::SYLVEON,PBSpecies::GLACEON,PBSpecies::LEAFEON,
            PBSpecies::UMBREON,PBSpecies::ESPEON,PBSpecies::FLAREON,
            PBSpecies::JOLTEON,PBSpecies::VAPOREON,PBSpecies::EEVEE
          ]
        y=293
        imagePositions=[]
        for region in 0...5 # Five rows
          x=42
          for i in 0...9
            if $Trainer.owned[eeveestamps[i]]
              imagePositions.push( ["Graphics/Pictures/eeveestamps",x,y,i*32,region*32,32,32])
            end
            x+=48
          end
          y+=32
        end
        pbDrawImagePositions(overlay,imagePositions)
      end
      
      def pbMain
        loop do
          Graphics.update
          Input.update
          self.update
          if Input.trigger?(Input::B) || Input.trigger?(Input::C)
            break
          end
        end 
      end
      
      def pbEndScene
        pbFadeOutAndHide(@sprites) { update }
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
    end
    
    class PFCEeveeCard
      
      def initialize(scene)
        @scene=scene
      end
    
      def pbStartScreen (maintext,imagepath)
        @scene.pbStartScene (maintext,imagepath)
        @scene.pbMain
        @scene.pbEndScene
      end
    end
    
    def pbPFCEeveeCard (maintext="",imagepath="")
      maintext=_INTL("") if maintext==""
      imagepath="Graphics/Pictures/PFCEeveeCard" if imagepath==""
      scene=PFCEeveeCardScene.new
      screen=PFCEeveeCard.new(scene)
      screen.pbStartScreen (maintext,imagepath)
    end
     
    Back
    Top