• 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

FL

Pokémon Island Creator
2,449
Posts
13
Years
    • Seen Apr 30, 2024
    screen.png
    screen2.png

    Displays an extra page at summary showing a little info about the mother, father, grandmothers and grandfathers if it has any.

    Link

    Requires Modular UI Scenes. Tested on Essentials v21.1. More versions (v12-19.1) on link. If this script isn't working on latest Essentials version, please inform on this thread.

    Thanks Eurritimia for updating it for v21.1 and adding Modular UI Scenes script dependency.
     
    Last edited:
    119
    Posts
    10
    Years
  • 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 '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 'if @page!=0' 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.egg? ? 
            "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.egg?
          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

    very cool script. I just had to change a few things so this would work with the IV/EV screen.
     
    13
    Posts
    9
    Years
    • Seen Nov 14, 2015
    Looks like I failed implementing the script. I copied all by Show Printable Version and implemented the textblocks at the different sections in essentials. But even if I get an Egg (which should have parents :) )there are only question marks instead of pictures and infos about parents.
     
    119
    Posts
    10
    Years
  • Looks like I failed implementing the script. I copied all by Show Printable Version and implemented the textblocks at the different sections in essentials. But even if I get an Egg (which should have parents :) )there are only question marks instead of pictures and infos about parents.

    this happens to me as well
     

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Great script dude! I like it and will use it for sure in CR HD haha thank you.
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    Looks like I failed implementing the script. I copied all by Show Printable Version and implemented the textblocks at the different sections in essentials. But even if I get an Egg (which should have parents :) )there are only question marks instead of pictures and infos about parents.
    Sorry, my mistake. It's 'egg.family = PokemonFamily.new(egg, father, mother)' instead of 'PokemonFamily.new(egg, father, mother)'. I updated the thread.
     
    13
    Posts
    9
    Years
    • Seen Nov 14, 2015
    Sorry, my mistake. It's 'egg.family = PokemonFamily.new(egg, father, mother)' instead of 'PokemonFamily.new(egg, father, mother)'. I updated the thread.

    Thank You very much, now it works perfectly. I wish i could see such things on my own :(
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    i get this here:

    http: //i.gyazo.com/5d90b4df88f4f1933d3e249ae0e212b8.png

    what i have done wrong? :(
    This script won't displays the family of pokémon that hatched before this script was added. Make a test: Put two compatibles pokémon at Day Care, generate an egg (I suggest using debug options) and check the egg family.
     

    ~Angel~

    Lead developer for Pokémon Millennium
    281
    Posts
    14
    Years
  • 1
    Posts
    9
    Years
    • Seen Nov 1, 2015
    It doesn't work, there are a lot of "Syntax Error", how to fix it? (v14)
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    It gives me error on handleInputsEgg. What did I do wrong?
    Edit: Ok I fixed it and now I feel stupid. You just need to add the symbol @ for it to work (@handleInputsEgg). ������
    What? @handleInputsEgg doesn't make sense.
     
    119
    Posts
    10
    Years
  • Excuse me lord FL, I have very little coding knowledge and I pretty much messed up my entire RMXP project trying to make this work. I have managed to actually start my game without error message and access the family tree panel but there are only??? pokemons and also when I press up/down button to move between my Pokemon, it gives me an error and then shuts down.

    first, before making script changes always make a backup of your game in case you mess things up, second the ??? is probably because you have not started a new game or did something wrong, try starting a new game and then use the daycare, and third when getting errors copy and paste them so people can see the error, theres nothing someone can do to help if they cant see the error.
     
    119
    Posts
    10
    Years
  • Ok thanks for the advice kcgcrazy, from now on I will be always making a backup file. Also I kinda figured a couple of things and now I finally got it to work. I guess every experiment is meant to fail at first until it actually comes to life :p ALL HAIL FL

    trial and error, trial and error
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen Apr 30, 2024
    Excuse me lord FL, I have very little coding knowledge and I pretty much messed up my entire RMXP project trying to make this work. I have managed to actually start my game without error message and access the family tree panel but there are only??? pokemons and also when I press up/down button to move between my Pokemon, it gives me an error and then shuts down.
    I my opinion this isn't necessary, since all steps are described here, you can just reverse all steps for fixing the possible problem.

    And the new game isn't necessary, but this script only affects new eggs generated on Day Care.
     
    1,406
    Posts
    10
    Years
    • Seen today
    Man, I really love this script, thanks a lot! I've been tinkering with it and made some graphics to go with my Summary page layouts, and I really like the results. I still have to tweak them, but it's coming along.

    However, I do have a couple of questions in case you have any quick ideas for some solutions.

    1) Is it possible for this to display the icons for shiny Pokemon, if any of the parents/grandparents were shiny? I tested it, and it just shows the regular icon even if I made one of them shiny prior to breeding. It's just a small detail, but I would love it if there was a way to implement that. Other forms still display (Such as Rotom's forms), so I was wondering if this would be a simple thing to add.

    2) When breeding with Ditto, is there some way to make it so Ditto always takes the 'role' of the gender opposite it's partner (in terms of how it's displayed on the page)? I ask this because of my attached screenshot.

    You'll notice that Gardevoir's grandfather on her father's side is a Jellicent (named Majellyn here). It's a male Jellicent. However, since I bred it with a Ditto, the Ditto by default assumes the 'role' of the male (I assume?), and thus the male Jellicent now displays as a female Jellicent; despite sitting in the slot designated for the male parent. Or something like that. It's just an odd visual quirk that is slightly annoying given my layout, and if there is an easy way to resolve this, that would be great (though something tells me it's more trouble than its worth).

    3) This question isn't really specific to this script, but I was wondering if there was a way to resize certain icon sprites on the page? I just want to shrink the grandparent's sprites down so they're smaller than the parent's sprites. I assume i have to use zoom=0.5 or something like that, I'm just not sure how to implement it.
     
    Back
    Top