• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Difficulty adding a back to the trainer card

ReVaN777

Creator of Pokemon Titanium
108
Posts
12
Years
  • Hello, pokecommunity i am having a problem with this code, im trying to add a back page to my trainer card, i have gone over multiple thread here and on other sites, i think i got it, my game with load up and run but when i go to get to the trainer card i get an error

    Exception: NameError
    Message: uninitialized constant PokemonMenu::PokemonTrainerCard
    PScreen_PauseMenu:204:in `pbStartPokemonMenu'
    PScreen_PauseMenu:144:in `loop'
    PScreen_PauseMenu:262:in `pbStartPokemonMenu'
    Scene_Map:188:in `call_menu'
    Scene_Map:159:in `update'
    Scene_Map:68:in `main'
    Scene_Map:65:in `loop'
    Scene_Map:72:in `main'
    Main:74:in `mainFunctionDebug'
    Main:52:in `mainFunction'

    and here's my script for PScreen_TrainerCard

    Code:
    class PokemonTrainerCardScene
      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/trainercardbgf"))
        if $Trainer.isFemale? && background
          addBackgroundPlane(@sprites,"bg","trainercardbgf",@viewport)
        else
          addBackgroundPlane(@sprites,"bg","trainercardbg",@viewport)
        end
        cardexists=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardf"))
        @sprites["card"]=IconSprite.new(0,0,@viewport)
        if $Trainer.isFemale? && cardexists
          @sprites["card"].setBitmap("Graphics/Pictures/trainercardf")
        else
          @sprites["card"].setBitmap("Graphics/Pictures/trainercard")
        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],
           [_INTL("Money"),34,112,0,baseColor,shadowColor],
           [_INTL("${1}",$Trainer.money),302,112,1,baseColor,shadowColor],
           [_INTL("Pokédex"),34,160,0,baseColor,shadowColor],
           [_ISPRINTF("{1:d}/{2:d}",$Trainer.pokedexOwned,$Trainer.pokedexSeen),302,160,1,baseColor,shadowColor],
           [_INTL("Time"),34,208,0,baseColor,shadowColor],
           [time,302,208,1,baseColor,shadowColor],
           [_INTL("Started"),34,256,0,baseColor,shadowColor],
           [starttime,302,256,1,baseColor,shadowColor]
        ]
       def pbBadgeScene
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        background=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardbgf"))
        if $Trainer.gender==1 && background
          addBackgroundPlane(@sprites,"bg","trainercardbgf",@viewport)
        else
          addBackgroundPlane(@sprites,"bg","trainercardbg",@viewport)
        end
        cardexists=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardbackf"))
        @sprites["card"]=IconSprite.new(0,0,@viewport)
        if $Trainer.gender==1 && cardexists
          @sprites["card"].setBitmap("Graphics/Pictures/trainercardbackf")
        else
          @sprites["card"].setBitmap("Graphics/Pictures/trainercardback")
        end
        @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
        pbSetSystemFont(@sprites["overlay"].bitmap)
        pbDrawTrainerCardBack
        pbFadeInAndShow(@sprites) { update }
        
        Kernel.pbMessage(_INTL("BadgeScene ran correctly."))
      end
        
      def pbDrawTrainerCardBack
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        baseColor=Color.new(72,72,72)
        shadowColor=Color.new(160,160,160)
        textPositions=[
           [_INTL("Test Badge"),34,64,0,baseColor,shadowColor],
           [_INTL("Test Badge"),332,64,0,baseColor,shadowColor],
           [_INTL("Test Badge"),34,112,0,baseColor,shadowColor],
           [_INTL("Test Badge"),34,160,0,baseColor,shadowColor],
           [_INTL("Test Badge"),34,208,0,baseColor,shadowColor],
           [_INTL("Test Badge"),34,256,0,baseColor,shadowColor],
        ]
        pbDrawTextPositions(overlay,textPositions)
        x=72
        region=pbGetCurrentRegion(0) # Get the current region
        imagePositions=[]
        for i in 0...8
          if $Trainer.badges[i+region*8]
            imagePositions.push(["Graphics/Pictures/badges",x,310,i*32,region*32,32,32])
          end
          x+=48
        end
        pbDrawImagePositions(overlay,imagePositions)
        
        Kernel.pbMessage(_INTL("DrawTrainerCardBack ran correctly."))
      end
      
      def pbBadgeCard
        loop do
          Graphics.update
          Input.update
          self.update
          if Input.trigger?(Input::B)
            break
          end
        end 
      end  
      
    #END CHANGE
      
      def pbTrainerCard
        loop do
          Graphics.update
          Input.update
          self.update
          if Input.trigger?(Input::B)
            break
          end
          if Input.trigger?(Input::C) 
                
             pbDisposeSpriteHash(@sprites)
             @viewport.dispose
             @pbBadgeScene
             @pbBadgeCard
             break
        
             Kernel.pbMessage(_INTL("BadgeCard call ran correctly."))
           end       
        end 
      end
    
      def pbEndScene
        pbFadeOutAndHide(@sprites) { update }
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
    end
    
    class PokemonTrainerCard
      def initialize(scene)
        @scene=scene
      end
    
       def pbStartScreen
        @pbStartScene
        @pbTrainerCard
        @scene.pbEndScene
      end
         @pbBadgeScene
         @pbBadgeCard
         @pbEndScene
      end
    end

    if i can get a little help or a skilled scriptwriter can look it over and fix my mistakes. i would be greatly appreciated
     
    1,224
    Posts
    10
    Years
  • Your error
    Code:
    PScreen_PauseMenu:204:in `pbStartPokemonMenu'
    so the problem is that it's looking for
    Code:
    scene=PokemonTrainerCardScene.new
            screen=[COLOR="Red"]PokemonTrainerCard.new(scene)[/COLOR]
    but you must have removed the class PokemonTrainerCard, so it cannot find it.
     

    ReVaN777

    Creator of Pokemon Titanium
    108
    Posts
    12
    Years
  • Your error
    Code:
    PScreen_PauseMenu:204:in `pbStartPokemonMenu'
    so the problem is that it's looking for
    Code:
    scene=PokemonTrainerCardScene.new
            screen=[COLOR="Red"]PokemonTrainerCard.new(scene)[/COLOR]
    but you must have removed the class PokemonTrainerCard, so it cannot find it.

    so what must i do.. because im stumped
     

    ReVaN777

    Creator of Pokemon Titanium
    108
    Posts
    12
    Years
  • I figured it out thank you. But now I have encountered a new problem I have 5 regions in my game starting
    Itn Kanto, then heading to Orange Islands(OI), after beating OI you make your way to Johto. I can get those sets to show on the back of
    Trainer card. Now my problem is this i can't get my last two sets of 8 badges to show. There in my badges.png but since they have to be spaced a certain way the
    Last two badge sets are to low on the picture to be seen. How can I fix this problem?
     
    59
    Posts
    8
    Years
    • Seen Aug 9, 2020
    You'd have to rearrange the positions to make room for them. You need to move the coords and how the file is cropped.
     

    ReVaN777

    Creator of Pokemon Titanium
    108
    Posts
    12
    Years
  • I've done that. To be more specific is there a way to make what whatever runs or tells the badge.png to be x height can I change it so it read the pic is longer
     

    ReVaN777

    Creator of Pokemon Titanium
    108
    Posts
    12
    Years
  • Figured it out, if anyone else has this problem, when trying to get 2nd trainer card for badges i have made it so you can have five regions of badges and be able to see all of them, but with that said theres always another problem what i have now, that i made the badges.png read longer when you get your first badge from the first region you can see the first badges for the next two regions, anyone know how to fix this problem i have a feeling its because i raised the height read on the script, because if i change it back everything works fine but now we go back to my first problem not being able to see all the sets of badges. Again i ask if anyone with more experience can help me solve this problem.
     
    Back
    Top