• 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.

Script: Family Tree

423
Posts
13
Years
    • Seen Aug 31, 2023
    how do you get the birthsign token icon on the family tree page?
     
    Last edited:
    423
    Posts
    13
    Years
    • Seen Aug 31, 2023
    ok so just upgraded to essentials 16.2 and now it wont show the parents of the hatched pokemon just remains as ? any help to get it working?
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    ok so just upgraded to essentials 16.2 and now it wont show the parents of the hatched pokemon just remains as ? any help to get it working?
    Tested right now and it's working. Did you forget the first step or did you "generate" the egg before implementing this script?
     
    423
    Posts
    13
    Years
    • Seen Aug 31, 2023
    ok tested the on a clean copy and works it appears ive missed something with the birthsigns but not quite sure what
    EDIT
    okay fixed i missed the daycare thing from the birthsigns script
     
    Last edited:
    1
    Posts
    9
    Years
    • Seen Jul 28, 2016
    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NoMethodError

    Message: undefined method `hasEgg?' for #<PokeBattle_Pokemon:0x903fea8>

    Family Tree:46:in `drawPageSeven'

    PScreen_Summary:1067:in `pbScene'

    PScreen_Summary:989:in `loop'

    PScreen_Summary:1070:in `pbScene'

    PScreen_Summary:1084:in `pbStartScreen'

    PScreen_Party:790:in `pbSummary'

    PScreen_Party:1905:in `pbPokemonScreen'

    PScreen_Party:1816:in `loop'

    PScreen_Party:1993:in `pbPokemonScreen'

    PScreen_PauseMenu:174:in `pbStartPokemonMenu'



    This exception was logged in

    C:\Users\Office\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------

    Getting this error..

    Sorry if there is a dumb mistake I'm doing somewhere.
    Using Essentials v16.1 btw and have made all Six --> Seven and other @page which have 5 --> 6

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NoMethodError

    Message: undefined method `hasEgg?' for #<PokeBattle_Pokemon:0x903fea8>

    Family Tree:46:in `drawPageSeven'

    PScreen_Summary:1067:in `pbScene'

    PScreen_Summary:989:in `loop'

    PScreen_Summary:1070:in `pbScene'

    PScreen_Summary:1084:in `pbStartScreen'

    PScreen_Party:790:in `pbSummary'

    PScreen_Party:1905:in `pbPokemonScreen'

    PScreen_Party:1816:in `loop'

    PScreen_Party:1993:in `pbPokemonScreen'

    PScreen_PauseMenu:174:in `pbStartPokemonMenu'



    This exception was logged in

    C:\Users\Office\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------

    Getting this error..

    Sorry if there is a dumb mistake I'm doing somewhere.
    Using Essentials v16.1 btw and have made all Six --> Seven and other @page which have 5 --> 6

    I solved the error on my own, it was isEgg? lol.

    One suggestion: Is it possible that for wild Pokemons / Caught Pokemons the family becomes the male and the female of the same specie? It would become a lot interesting if it becomes so.. Thanks for the script though, it's awesome!
     
    Last edited by a moderator:

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    One suggestion: Is it possible that for wild Pokemons / Caught Pokemons the family becomes the male and the female of the same specie? It would become a lot interesting if it becomes so.. Thanks for the script though, it's awesome!
    Yes, but is necessary to handle some exceptions, like when the specie have only male/female members and when it can't breed like Nidorina.
     
    170
    Posts
    7
    Years
    • Age 21
    • Seen Nov 2, 2023
    PokéCommunity is breaking codes. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.
    Code:
    #===============================================================================
    # * Family Tree - by FL (Credits will be apreciated)
    #===============================================================================
    #
    # This script is for Pokémon Essentials. It displays a sixth page at pokémon
    # summary showing a little info about the pokémon mother, father, grandmothers
    # and grandfathers if the pokémon has any.
    #
    #===============================================================================
    #
    # To this script works, put it above main, put a 512x384 background for this
    # screen in "Graphics/Pictures/summary6" and in "Graphics/Pictures/summaryEgg6".
    # This last one is only necessary if SHOWFAMILYEGG is true. You also need to
    # update the below pictures in order to reflect the summary icon change:
    # - summary1
    # - summary2
    # - summary3
    # - summary4
    # - summary4details
    # - summary5
    #
    # -At PokemonDayCare, before line '$Trainer.party[$Trainer.party.length]=egg'
    # add line 'egg.family = PokemonFamily.new(egg, father, mother)'
    #
    # -At PokemonSummary, change both lines '@page=4 if @page>4'
    # to '@page=5 if @page>5'
    #
    # -Before line 'if Input.trigger?(Input::UP) && @partyindex>0'
    # add line 'handleInputsEgg'
    #
    # -Change line '[B]if @page!=0[/B]' to 'if @page!=0 && !(SHOWFAMILYEGG && @page==5)'
    #
    # -After line 'drawPageFive(@pokemon)' add
    #
    # when 5
    #   drawPageSix(@pokemon)
    #
    #===============================================================================
    
    class PokemonSummaryScene
      SHOWFAMILYEGG = true # when true, family tree is also showed in egg screen.
      
      def drawPageSix(pokemon)
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        @sprites["background"].setBitmap(@pokemon.isEgg? ? 
            "Graphics/Pictures/summaryEgg6" : "Graphics/Pictures/summary6")
        imagepos=[]
        if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
          status=6 if pbPokerus(pokemon)==1
          [email protected] if @pokemon.status>0
          status=5 if pokemon.hp==0
          imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
        end
        if pokemon.isShiny?
          imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
        end
        if pbPokerus(pokemon)==2
          imagepos.push([
              sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
        end
        [email protected] ? @pokemon.ballused : 0
        ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
        imagepos.push([ballimage,14,60,0,0,-1,-1])
        pbDrawImagePositions(overlay,imagepos)
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        pbSetSystemFont(overlay)
        naturename=PBNatures.getName(pokemon.nature)
        itemname=pokemon.item==0 ? _INTL("None") : PBItems.getName(pokemon.item)
        [email protected]
        if @pokemon.name.split('').last=="♂" || @pokemon.name.split('').last=="♀"
          [email protected][0..-2]
        end
        textpos=[
           [_INTL("FAMILY TREE"),26,16,0,base,shadow],
           [pokename,46,62,0,base,shadow],
           [_INTL("Item"),16,320,0,base,shadow],
           [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
        ]
        textpos.push([_INTL("{1}",pokemon.level),46,92,0,
               Color.new(64,64,64),Color.new(176,176,176)]) if [email protected]?
        if [email protected]?
          if pokemon.gender==0
            textpos.push([_INTL("♂"),178,62,0,
                Color.new(24,112,216),Color.new(136,168,208)])
          elsif pokemon.gender==1
            textpos.push([_INTL("♀"),178,62,0,
                Color.new(248,56,32),Color.new(224,152,144)])
          end
        end    
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        # Draw parents
        parentsY=[78,234]
        for i in 0...2
          parent = @pokemon.family && @pokemon.family[i] ? @pokemon.family[i] : nil
          iconParentParam = parent ? [parent.species,
              parent.gender==1,false,parent.form,false] : [0,0,false,0,false]
          iconParent=AnimatedBitmap.new(pbCheckPokemonIconFiles(iconParentParam))
          overlay.blt(234,parentsY[i],iconParent.bitmap,Rect.new(0,0,64,64))
          textpos.push([parent ? parent.name : _INTL("???"),
              320,parentsY[i],0,base,shadow])
          parentSpecieName=parent ? PBSpecies.getName(parent.species) : _INTL("???")
          if (parentSpecieName.split('').last=="♂" ||
              parentSpecieName.split('').last=="♀")
            parentSpecieName=parentSpecieName[0..-2]
          end
          textpos.push([parentSpecieName,320,32+parentsY[i],0,base,shadow])
          if parent
            if parent.gender==0
              textpos.push([_INTL("♂"),500,32+parentsY[i],1,
                  Color.new(24,112,216),Color.new(136,168,208)])
            elsif parent.gender==1
              textpos.push([_INTL("♀"),500,32+parentsY[i],1,
                  Color.new(248,56,32),Color.new(224,152,144)])
            end
          end    
          grandX = [380,448]
          for j in 0...2
            iconGrandParam = parent && parent[j] ? [parent[j].species,
                parent[j].gender==1,false,parent[j].form,false] : 
                [0,0,false,0,false]
            iconGrand=AnimatedBitmap.new(pbCheckPokemonIconFiles(iconGrandParam))
            overlay.blt(
                grandX[j],68+parentsY[i],iconGrand.bitmap,Rect.new(0,0,64,64))
          end
        end
        pbDrawTextPositions(overlay,textpos)
        drawMarkings(overlay,15,291,72,20,pokemon.markings)
      end
      
      def handleInputsEgg
        if SHOWFAMILYEGG && @pokemon.isEgg?
          if Input.trigger?(Input::LEFT) && @page==5
            @page=0 
            pbPlayCursorSE()
            dorefresh=true
          end
          if Input.trigger?(Input::RIGHT) && @page==0
            @page=5 
            pbPlayCursorSE()
            dorefresh=true
          end
        end
        if dorefresh
          case @page
            when 0
              drawPageOne(@pokemon)
            when 5
              drawPageSix(@pokemon)
          end
        end
      end
    end
    
    
    class PokemonFamily
      MAXGENERATIONS = 3 # Tree stored generation limit
      
      attr_reader :mother # PokemonFamily object
      attr_reader :father # PokemonFamily object
      
      attr_reader :species
      attr_reader :gender
      attr_reader :form
      attr_reader :name # nickname
      # You can add more data here and on initialize class. Just 
      # don't store the entire pokémon object.
      
      def initialize(pokemon, father=nil,mother=nil)
        initializedAsParent = !father || !mother
        if pokemon.family && pokemon.family.father
          @father = pokemon.family.father
        elsif father 
          @father = PokemonFamily.new(father)
        end
        if pokemon.family && pokemon.family.mother
          @mother = pokemon.family.mother
        elsif mother
          @mother = PokemonFamily.new(mother)
        end
        
        # This data is only initialized as a parent in a cub.
        if initializedAsParent 
          @species=pokemon.species
          @gender=pokemon.gender
          @name=pokemon.name
          @form=pokemon.form
        end
        
        applyGenerationLimit(MAXGENERATIONS)
      end
      
      def applyGenerationLimit(generation)
        if generation>1
          father.applyGenerationLimit(generation-1) if @father
          mother.applyGenerationLimit(generation-1) if @mother
        else
          father=nil
          mother=nil
        end  
      end 
      
      def [](value) # [0] = father, [1] = mother
        if value==0
         return @father
        elsif value==1
         return @mother
        end
        return nil
      end
    end  
      
    class PokeBattle_Pokemon
      attr_accessor :family
    end
    which one? there's two,so i just changed both lines with what is bold to the new line form
     
    423
    Posts
    13
    Years
    • Seen Aug 31, 2023
    ok so i know this is an old topic but this script does not seem to work in essentials 17.2 any chance of a fix please?
     
    1,406
    Posts
    10
    Years
    • Seen today
    I hope you don't mind, but I took the liberty of updating your summary graphics so that they have the appropriate boxes to display item sprites, which was a new addition to Essentials 17.

    Enjoy!
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    I hope you don't mind, but I took the liberty of updating your summary graphics so that they have the appropriate boxes to display item sprites, which was a new addition to Essentials 17.

    Enjoy!
    No problem, but I already did this with the files on main post, few days ago.
     
    87
    Posts
    4
    Years
  • Family tree error

    Hi, I have a problem with the Family Tree summary script by FL: when I select a pokemon's summary page and go to the area of the family tree the pokemon, in place of the parents, has question marks. Please help me.

    p.s.: I copied it from the printable version of the thread.

    p.p.s: I'm using the 17.2

    Here's the script:
    Spoiler:
     
    Last edited by a moderator:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Hi, I have a problem with the Family Tree summary script by FL: when I select a pokemon's summary page and go to the area of the family tree the pokemon, in place of the parents, has question marks. Please help me.

    I've moved your question into the script's thread. Please use the existing threads when asking for help with specific resources.
     
    1,681
    Posts
    8
    Years
    • Seen yesterday
    Hi, I have a problem with the Family Tree summary script by FL: when I select a pokemon's summary page and go to the area of the family tree the pokemon, in place of the parents, has question marks. Please help me.

    The question marks are actually completely normal, for a completely newly generated pokemon, because the pokemon doesn't know what its parents are. If you created a pokemon from the daycare, it will have the properly set up parents, assuming of course that you made the changes to PField_DayCare like the script comment says.
     
    Back
    Top