• 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

87
Posts
4
Years
  • 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.

    I now it, but if you want I can give you where I added codes in PField_DayCare:
    Line 622,623,624,1018,1019,1020:
    Code:
    egg.family = PokemonFamily.new(egg, father, mother)
      $Trainer.party[$Trainer.party.length]=egg
      end
    Did I do them right?
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    I now it, but if you want I can give you where I added codes in PField_DayCare:
    Line 622,623,624,1018,1019,1020:
    Code:
    egg.family = PokemonFamily.new(egg, father, mother)
      $Trainer.party[$Trainer.party.length]=egg
      end
    Did I do them right?

    Looks perfectly fine.
     

    Emeril126

    Wannabe Psychic
    8
    Posts
    6
    Years
  • I seem to keep getting a SyntaxError on line 1315 in the PScreen_Summary, im not sure what i need to fix since all it says on the line is class PokemonSummeryScreen.
     

    FL

    Pokémon Island Creator
    2,453
    Posts
    13
    Years
    • Seen May 10, 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.

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

    p.p.s: I'm using the 17.2
    If you picks an egg AFTER adding the script and hatch it, the question marks are still on summary screen?

    I seem to keep getting a SyntaxError on line 1315 in the PScreen_Summary, im not sure what i need to fix since all it says on the line is class PokemonSummeryScreen.
    Very likely you make some mistake when doing the steps. Did you follow the step "At PScreen_Summary, change both lines '@page = 5 if @page>5' to '@page=6 if @page>6'" correctly? If yes, redo all the steps. If the error persists, post here your PScreen_Summary script.
     

    FL

    Pokémon Island Creator
    2,453
    Posts
    13
    Years
    • Seen May 10, 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.
    Strange, I tested your script and it was working. I suggest you redoing the instructions (specially the first one).
     

    FL

    Pokémon Island Creator
    2,453
    Posts
    13
    Years
    • Seen May 10, 2024
    Updated to v18.1. Here the old version, tested on v17.2 (actually, only instructions change between versions):
    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 PSystem_System. Put a 512x384 background
    # for this screen in "Graphics/Pictures/Summary/" as "bg_6" and as "bg_6_egg".
    # This last one is only necessary if SHOWFAMILYEGG is true. You also need to
    # update the below pictures on same folder in order to reflect the summary
    # icon change:
    # - bg_1
    # - bg_2
    # - bg_3
    # - bg_4
    # - bg_movedetail
    # - bg_5
    #
    # -At PField_DayCare, before line '$Trainer.party[$Trainer.party.length]=egg'
    # add line 'egg.family = PokemonFamily.new(egg, father, mother)'
    #
    # -At PScreen_Summary, change both lines '@page = 5 if @page>5'
    # to '@page=6 if @page>6'
    #
    # -Before line 'if Input.trigger?(Input::A)' add line 'handleInputsEgg'
    #
    # -After line 'when 5; drawPageFive' add 'when 6; drawPageSix'
    #
    # -Change line '_INTL("RIBBONS")][page-1]' into:
    #
    # _INTL("RIBBONS"),
    # _INTL("FAMILY TREE")][page-1]
    #
    # -Change both lines 
    # 'if @party[newindex] && (@page==1 || !@party[newindex].egg?)' into:
    #
    # if @party[newindex] && 
    #   (@page==1 || !@party[newindex].egg? || (@page==6 && SHOWFAMILYEGG))
    #
    # -Change both
    # 
    #  pbSEStop; pbPlayCry(@pokemon)
    #  @ribbonOffset = 0
    #  dorefresh = true
    #
    # into:
    #
    #  pbSEStop; pbPlayCry(@pokemon)
    #  @ribbonOffset = 0
    #  if SHOWFAMILYEGG && @pokemon.isEgg? && @page==6
    #    dorefresh = false
    #    drawPageSix
    #  else
    #    dorefresh = true
    #  end
    #
    #===============================================================================
    
    class PokemonSummary_Scene
      SHOWFAMILYEGG = true # when true, family tree is also showed in egg screen.
    
      def drawPageSix
        overlay=@sprites["overlay"].bitmap
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        textpos=[]
        if @pokemon.isEgg?
          overlay.clear
          pbSetSystemFont(overlay)
          @sprites["background"].setBitmap("Graphics/Pictures/Summary/bg_6_egg")
          imagepos = []
          ballimage = sprintf(
            "Graphics/Pictures/Summary/icon_ball_%02d",@pokemon.ballused)
          imagepos.push([ballimage,14,60,0,0,-1,-1])
          pbDrawImagePositions(overlay,imagepos)
          textpos=[
             [_INTL("TRAINER MEMO"),26,16,0,base,shadow],
             [@pokemon.name,46,62,0,base,shadow],
             [_INTL("Item"),62,318,0,base,shadow]
          ]
          if @pokemon.hasItem?
            textpos.push([PBItems.getName(@pokemon.item),16,352,0,
              Color.new(64,64,64), Color.new(176,176,176)])
          else
            textpos.push([_INTL("None"),16,352,0,
              Color.new(184,184,160),Color.new(208,208,200)])
          end
          drawMarkings(overlay,82,292)
        end  
        # 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)
      end
    
      def handleInputsEgg
        if SHOWFAMILYEGG && @pokemon.isEgg?
          Kernel.echoln("@page="[email protected]_s)
          if Input.trigger?(Input::LEFT) && @page==6
            @page=1
            pbPlayCursorSE()
            dorefresh=true
          end
          if Input.trigger?(Input::RIGHT) && @page==1
            @page=6
            pbPlayCursorSE()
            dorefresh=true
          end
        end
        if dorefresh
          case @page
            when 1; drawPageOneEgg
            when 6; drawPageSix
          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
     

    FL

    Pokémon Island Creator
    2,453
    Posts
    13
    Years
    • Seen May 10, 2024
    Updated to Essentials v19.1!
     
    15
    Posts
    6
    Years
    • Seen Nov 21, 2023
    There's been a massive rewrite of the Breeding script, it will work with replacing any $Trainer instances in the script with $player, but once v21 comes out, this script will need a proper update.

    Right now, its use will spam the console in Debug mode.

    I haven't reset up my Summary Screen to show the Page yet, so it may not work whatsoever, I haven't done anything to fully test the script yet.

    (edit: It seems to be working with those minor edits.)
     
    Last edited:

    FL

    Pokémon Island Creator
    2,453
    Posts
    13
    Years
    • Seen May 10, 2024
    There's been a massive rewrite of the Breeding script, it will work with replacing any $Trainer instances in the script with $player, but once v21 comes out, this script will need a proper update.

    Right now, its use will spam the console in Debug mode.

    I haven't reset up my Summary Screen to show the Page yet, so it may not work whatsoever, I haven't done anything to fully test the script yet.

    (edit: It seems to be working with those minor edits.)
    Thanks for the info! The $Trainer still works on v20, but I'm changing it to $player in all scripts that I edit (I edited the Pokémon Selection script in the last week).
     
    Back
    Top