• 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

68
Posts
11
Years
  • Seen Jan 17, 2017
i have this error :S , i cant run my game
Spoiler:


and if i erase this line
Spoiler:



i have this error when i wan to see the family tree
Spoiler:


you can help me TT_TT please
 

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen yesterday
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.
1. Yes! After line 'attr_reader :form' add 'attr_reader :shiny'. After line '@form=pokemon.form' add '@shiny=pokemon.isShiny?'. Change

Code:
	iconParentParam = parent ? [parent.species,
          parent.gender==1,false,parent.form,false] : [0,0,false,0,false]'
Into
Code:
	iconParentParam = parent ? [parent.species,
          parent.gender==1,parent.shiny,parent.form,false] : [0,0,false,0,false]'

Change

Code:
        iconGrandParam = parent && parent[j] ? [parent[j].species,
            parent[j].gender==1,false,parent[j].form,false] : 
            [0,0,false,0,false]

Into

Code:
        iconGrandParam = parent && parent[j] ? [parent[j].species,
            parent[j].gender==1,parent.shiny,parent[j].form,false] : 
            [0,0,false,0,false]

2. Before line 'applyGenerationLimit(MAXGENERATIONS)' add

Code:
    # switch the parent position in Ditto case.
    if @mother && @mother.gender==0 # male
      temporary = @mother
      @mother = @father
      @father = temporary
    end
    if @father && @father.gender==1 # female
      temporary = @mother
      @mother = @father
      @father = temporary
    end

3. The sprite class has the variables zoom_x and zoom_y, so you only need to make it as zoom_x=0.5 and you have a half zoom. However, the icons are drawed by an AnimatedBitmap class that consist of several BitmapWrapper, a class that extends from Bitmap, so none have the zoom property. But we can use stretch_blt when copying the bitmap. Change:

Code:
         overlay.blt(
            grandX[j],68+parentsY[i],iconGrand.bitmap,Rect.new(0,0,64,64))

Into

Code:
        overlay.stretch_blt(Rect.new(grandX[j],68+parentsY[i],32,32),
           iconGrand.bitmap,Rect.new(0,0,64,64))

i have this error :S , i cant run my game
Spoiler:


and if i erase this line
Spoiler:



i have this error when i wan to see the family tree
Spoiler:


you can help me TT_TT please
PokéCommunity is breaking codes. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.
 
1,399
Posts
10
Years
  • Age 35
  • Online now
Nice! Thanks a lot, everything works exactly how I want now! It's really starting to come together.

One last thing though, if you don't mind...

I'm thinking it would be cool if you could display the Pokemon's Egg Groups on this page, since it's relevant information to go along with this. I've been trying to figure out how to implement this (I made a thread asking for help in the Essentials forum, but I'm not expecting a response anytime soon).

By working off existing scripts that I've found, this is what I've come up with so far:

Code:
 dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,@pokemon,31)
    compat10=dexdata.fgetb
    compat11=dexdata.fgetb
    eggGroupArray=[
        nil,_INTL("Monster"),_INTL("Water1"),_INTL("Bug"),_INTL("Flying"),
        _INTL("Ground"),_INTL("Fairy"),_INTL("Plant"),_INTL("Humanshape"),
        _INTL("Water3"),_INTL("Mineral"),_INTL("Indeterminate"),
        _INTL("Water2"),_INTL("Ditto"),_INTL("Dragon"),_INTL("No Eggs")
    ]
    eggGroups = compat10==compat11 ? eggGroupArray[compat10] : 
        _INTL("{1}, {2}",eggGroupArray[compat10],eggGroupArray[compat11])
    textpos=[
       [_INTL("Group: {1}",eggGroups),200,354,0,base,shadow],
    ]
   dexdata.close

But I'm not sure how to implement it, or if I'm even on the right track. I'd appreciate it if you could point me in the right direction!

The attached screenshot is just to show where I'm thinking I could display the information (also showing off all your fixes!)
 

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen yesterday
Nice! Thanks a lot, everything works exactly how I want now! It's really starting to come together.

One last thing though, if you don't mind...

I'm thinking it would be cool if you could display the Pokemon's Egg Groups on this page, since it's relevant information to go along with this. I've been trying to figure out how to implement this (I made a thread asking for help in the Essentials forum, but I'm not expecting a response anytime soon).

By working off existing scripts that I've found, this is what I've come up with so far:

Code:
 dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,@pokemon,31)
    compat10=dexdata.fgetb
    compat11=dexdata.fgetb
    eggGroupArray=[
        nil,_INTL("Monster"),_INTL("Water1"),_INTL("Bug"),_INTL("Flying"),
        _INTL("Ground"),_INTL("Fairy"),_INTL("Plant"),_INTL("Humanshape"),
        _INTL("Water3"),_INTL("Mineral"),_INTL("Indeterminate"),
        _INTL("Water2"),_INTL("Ditto"),_INTL("Dragon"),_INTL("No Eggs")
    ]
    eggGroups = compat10==compat11 ? eggGroupArray[compat10] : 
        _INTL("{1}, {2}",eggGroupArray[compat10],eggGroupArray[compat11])
    textpos=[
       [_INTL("Group: {1}",eggGroups),200,354,0,base,shadow],
    ]
   dexdata.close

But I'm not sure how to implement it, or if I'm even on the right track. I'd appreciate it if you could point me in the right direction!

The attached screenshot is just to show where I'm thinking I could display the information (also showing off all your fixes!)
I guess that you biggest problem is that pbDexDataOffset second paramether must be the Pokémon index number (species) and you are passing a PokeBattle_Pokemon instance.

Add this def on your script.

Code:
  def getEggGroupString(species)
  dexdata=pbOpenDexData
  pbDexDataOffset(dexdata,species,31)
  compat10=dexdata.fgetb
  compat11=dexdata.fgetb
  eggGroupArray=[
      nil,_INTL("Monster"),_INTL("Water1"),_INTL("Bug"),_INTL("Flying"),
      _INTL("Ground"),_INTL("Fairy"),_INTL("Plant"),_INTL("Humanshape"),
      _INTL("Water3"),_INTL("Mineral"),_INTL("Indeterminate"),
      _INTL("Water2"),_INTL("Ditto"),_INTL("Dragon"),_INTL("No Eggs")
  ]
  ret = compat10==compat11 ? eggGroupArray[compat10] : 
      _INTL("{1}, {2}",eggGroupArray[compat10],eggGroupArray[compat11])
  dexdata.close
  return ret
end

So, if you call 'getEggGroupString(parent[j].species)' (on the right spot where 'parent' and 'j' exist, of course), this will return you the Egg Group formatted.
 
1,399
Posts
10
Years
  • Age 35
  • Online now
I guess that you biggest problem is that pbDexDataOffset second paramether must be the Pokémon index number (species) and you are passing a PokeBattle_Pokemon instance.

Add this def on your script.

Code:
  def getEggGroupString(species)
  dexdata=pbOpenDexData
  pbDexDataOffset(dexdata,species,31)
  compat10=dexdata.fgetb
  compat11=dexdata.fgetb
  eggGroupArray=[
      nil,_INTL("Monster"),_INTL("Water1"),_INTL("Bug"),_INTL("Flying"),
      _INTL("Ground"),_INTL("Fairy"),_INTL("Plant"),_INTL("Humanshape"),
      _INTL("Water3"),_INTL("Mineral"),_INTL("Indeterminate"),
      _INTL("Water2"),_INTL("Ditto"),_INTL("Dragon"),_INTL("No Eggs")
  ]
  ret = compat10==compat11 ? eggGroupArray[compat10] : 
      _INTL("{1}, {2}",eggGroupArray[compat10],eggGroupArray[compat11])
  dexdata.close
  return ret
end

So, if you call 'getEggGroupString(parent[j].species)' (on the right spot where 'parent' and 'j' exist, of course), this will return you the Egg Group formatted.

Thanks, this helped. I think I've got it working how I want it now.
 
40
Posts
8
Years
  • Age 33
  • Seen Apr 11, 2024
I'm having a problem with this script. When it comes to loading the game, it reads the line on 677 and throws an error. Syntax Error occurred.

Here's what I have in that area.

676 def drawPageFive(pokemon)
677 when 5
678 drawPageSix(@pokemon)
679 overlay=@sprites["overlay"].bitmap
680 overlay.clear
 
40
Posts
8
Years
  • Age 33
  • Seen Apr 11, 2024
I simply went to thread tools and copied the script into the right place then did the other parts the script said in those places so I'm not really sure what I'm doing wrong. I'm not exactly fluent in this form of coding, not yet at least. I think LSL, basic PHP, basic HTML, LUA etc is enough for my brain right now.
 
220
Posts
9
Years
It's a great script, good work.

I tested it in various ways to see if i got errors. This script works fine but if i have a pokemon in the party that have parents in summary family tree page, when i close the game and open again, this errors appear before the tittle screen, after i press ok in all messages, the game runs nice.
Is that a way to fix this?

family10.png
 
32
Posts
9
Years
  • Age 29
  • Seen Nov 19, 2016
The order of your scripts matter. Please move this script somewhere above Main but also above PField_Daycare.

It'll be fine afterward.
 
220
Posts
9
Years
Thanks to answer i will check to see what happens.

It worked, i moved the script above PField_Daycare and those messages are gone. I had that script only above Main. Thanks.
 
Last edited by a moderator:

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen yesterday
I'm having a problem with this script. When it comes to loading the game, it reads the line on 677 and throws an error. Syntax Error occurred.

Here's what I have in that area.

676 def drawPageFive(pokemon)
677 when 5
678 drawPageSix(@pokemon)
679 overlay=@sprites["overlay"].bitmap
680 overlay.clear
Sorry, I didn't notice your message. Just copy the script using "Show Printable Version" option and follow the instructions.

It's a great script, good work.

I tested it in various ways to see if i got errors. This script works fine but if i have a pokemon in the party that have parents in summary family tree page, when i close the game and open again, this errors appear before the tittle screen, after i press ok in all messages, the game runs nice.
Is that a way to fix this?

family10.png
Exact as Super Dedenne said. The load script is called on pbSetUpSystem() on PokemonSystem, so, if you put any class below this section that have an instance on any part of save data, you got this error. I've warned Maruno long time ago.
 
40
Posts
8
Years
  • Age 33
  • Seen Apr 11, 2024
I managed to fix it with a fresh copy. I'm not entirely sure what use this is but it makes me feel more connected to my Pokemon. More of a personal level I guess. <3
 

PunkPhantom

"midna's a cat" -vinny, vinesauce
78
Posts
10
Years
  • Age 29
  • Seen Nov 20, 2016
I'm sorry I know this thread is old, but I tried putting in this script (using v16.1). When I go into the Pokemon Summary screen I get this error.

Code:
Exception: NoMethodError
Message: undefined method `name' for nil:NilClass
PField_Field:1695
PField_Field:1688:in `call'
Event:54:in `trigger'
Event:49:in `each'
Event:49:in `trigger'
PField_Map:617:in `setMapChanging'
PField_Map:594:in `setup'
PScreen_Load:365:in `pbStartLoadScreen'
PScreen_Load:335:in `open'
PScreen_Load:335:in `pbStartLoadScreen'
 

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen yesterday
I'm sorry I know this thread is old, but I tried putting in this script (using v16.1). When I go into the Pokemon Summary screen I get this error.

Code:
Exception: NoMethodError
Message: undefined method `name' for nil:NilClass
PField_Field:1695
PField_Field:1688:in `call'
Event:54:in `trigger'
Event:49:in `each'
Event:49:in `trigger'
PField_Map:617:in `setMapChanging'
PField_Map:594:in `setup'
PScreen_Load:365:in `pbStartLoadScreen'
PScreen_Load:335:in `open'
PScreen_Load:335:in `pbStartLoadScreen'
Updated and tested.
 
42
Posts
15
Years
  • Seen Jan 7, 2017
Hello
I put the script and I have done all the modifications but I can't access to the family tree summary page. It doesn't says any error. I am working with the 16.1 version.

Thanks!
 

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen yesterday
Hello
I put the script and I have done all the modifications but I can't access to the family tree summary page. It doesn't says any error. I am working with the 16.1 version.

Thanks!
You probably done something wrong/missed a step, since this tutorial was tested with 16.1. Redo the steps.
 
Back
Top