• 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 that reads Pokemon data from a GB/GBC savefile to be used in a fangame

rigbycwts

Hmm, hmm.
98
Posts
11
Years
    • Seen Feb 22, 2019
    I was tremendously inspired by the latest Pokemon Bank update to write this script. Currently this reads a Gen 1 savefile that is placed inside a directory.

    Note: to avoid breaking codes, set the thread to Printable Version.

    Modify PokeBattle_Pokemon to enable the number that identifies the generated Pokemon, which explains the extra attribute.
    Add the following in the attr_accessors area of PokeBattle_Pokemon:
    Spoiler:

    Add the following methods above def timeEggHatched
    Spoiler:

    Inside def initialize, add the following line, below calcStats:
    Spoiler:


    Save the following image as Choices.png and put it in Graphics/Pictures/PokeDepot:
    https://ibin.co/3Ca07P4GmgBv.png

    Savefile reading functions:
    Spoiler:

    Gen 1 utilities:
    Spoiler:

    PokeDepot_Scene:
    Spoiler:

    PokeDepot_BoxSelection:
    Spoiler:

    PokeDepot_BoxMigrate:
    Spoiler:

    Put the scripts in this order:
    3CZwoHB6DBLl.png


    How to use:
    3CZzUgjfJ0A7.png


    Old version of this thread:
    Spoiler:

    To-do on this script:

    • Actually remove the transferred Pokemon from the Gen 1 save file (this can be made optional)
    • Reading of Gen 2 savefiles
    • and more features not yet known
     
    Last edited:
    320
    Posts
    14
    Years
    • Seen Dec 27, 2021
    Huh this is really cool, I'm definitely going to try this today!
    I would suggest making the removal from the save-game an option though, in case people want to the preserve the save game as is.
     

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • how does one use this script ?
    I have tried calling the script "Gen1Save.new" and "Gen1Save" but no luck.

    73d9e475c94b4570b06e17d1c4538e1d.png


    e00cecb6844841ba94a79e93731f0fd6.png
     

    rigbycwts

    Hmm, hmm.
    98
    Posts
    11
    Years
    • Seen Feb 22, 2019
    how does one use this script ?
    I have tried calling the script "Gen1Save.new" and "Gen1Save" but no luck.

    73d9e475c94b4570b06e17d1c4538e1d.png


    e00cecb6844841ba94a79e93731f0fd6.png
    Those are only utilities, you need to create your own "scene" for that.
    Here's a sample scene:
    Spoiler:
     

    XerneasNeeds

    PrismReverie
    11
    Posts
    10
    Years
    • Seen Mar 26, 2020
    Can somebody help me on making a sample scene for transferring, when I try to insert the scene into a script it doesn't load onto it.
     
    Last edited:
    320
    Posts
    14
    Years
    • Seen Dec 27, 2021
    Can somebody help me on making a sample scene for transferring, when I try to insert the scene into a script it doesn't load onto it.

    Do you initialize the scene somewhere?
    You have to manually call the scene if you want it to show.
     

    rigbycwts

    Hmm, hmm.
    98
    Posts
    11
    Years
    • Seen Feb 22, 2019
    Updated the first post to allow the transferred Pokemon to keep the moves it had before transfer, and allows transfer of an entire box.
    Also included a sample scene in the first post.

    EDIT: Fixed a crash when trying to transfer Pokemon with less than 4 moves. Also, can confirm that this works with Pokemon Yellow.
     
    Last edited:

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • 4o2kqeFxwB.gif


    Script Call:
    Code:
    s = PokeTransporterScene.new
    s.pbVariableScreen(26)
    v = $game_variables[26]-1
    s.pbPokeTransporterReadGen1Save
    s.pbPokeTransporterGetWholeBox(v)

    New Def for Utilities:
    Code:
      def pbVariableScreen(id)
       value=0
      if $game_variables[id].is_a?(Numeric)
        value=$game_variables[id]
      end
       params=ChooseNumberParams.new
       params.setDefaultValue(value)
       params.setMaxDigits(2)
       params.setNegativesAllowed(false)
       value=Kernel.pbMessageChooseNumber(_INTL("Set Box Number}."),params)
      $game_variables[id]=[value,99999999].min
      $game_variables[id]=[$game_variables[id],-99999999].max
      end
     
    Last edited:

    rigbycwts

    Hmm, hmm.
    98
    Posts
    11
    Years
    • Seen Feb 22, 2019
    4o2kqeFxwB.gif


    Script Call:
    Code:
    s = PokeTransporterScene.new
    s.pbVariableScreen(26)
    v = $game_variables[26]-1
    s.pbPokeTransporterReadGen1Save
    s.pbPokeTransporterGetWholeBox(v)
    New Def for Utilities:
    Code:
      def pbVariableScreen(id)
       value=0
      if $game_variables[id].is_a?(Numeric)
        value=$game_variables[id]
      end
       params=ChooseNumberParams.new
       params.setDefaultValue(value)
       params.setMaxDigits(2)
       params.setNegativesAllowed(false)
       value=Kernel.pbMessageChooseNumber(_INTL("Set Box Number}."),params)
      $game_variables[id]=[value,99999999].min
      $game_variables[id]=[$game_variables[id],-99999999].max
      end
    I was thinking of a list of boxes though, but this will also do.

    Also, for those who had an error regarding the Gen 1 Trainer name, I added a fix on the Utilities that resolves the issue. Check the first post.
     

    rigbycwts

    Hmm, hmm.
    98
    Posts
    11
    Years
    • Seen Feb 22, 2019
    Updated the first post for a major overhaul and enabled selection of one of the multiple save files in the Gen 1 saves folder.
     

    IceGod64

    In the Lost & Found bin!
    624
    Posts
    15
    Years
  • I'm getting a couple different errors:
    The line "pokemon.generated=1" is giving me an error in Essentialy v16.2 unmofidied, as is the function "retTimeFormatOne" in pbSaveAfterMigrate.

    Also, it may be silly, but I've made a "completed" Pokemon list that also brings over glitch Pokemon, converting them to their Gen II counterparts.
    Because I had a couple of glitch Pokemon in my save, and it was messing with things.

    Code:
    HEX_TO_PBSPECIES = {
        #'00' => :KANGASKHAN, #Glitch Poke Missingno
        '01' => :RHYDON,
        '02' => :KANGASKHAN,
        '03' => :NIDORANmA,
        '04' => :CLEFAIRY,
        '05' => :SPEAROW,
        '06' => :VOLTORB,
        '07' => :NIDOKING,
        '08' => :SLOWBRO,
        '09' => :IVYSAUR,
        '0a' => :EXEGGUTOR,
        '0b' => :LICKITUNG,
        '0c' => :EXEGGCUTE,
        '0d' => :GRIMER,
        '0e' => :GENGAR,
        '0f' => :NIDORANfE,
        '10' => :NIDOQUEEN,
        '11' => :CUBONE,
        '12' => :RHYHORN,
        '13' => :LAPRAS,
        '14' => :ARCANINE,
        '15' => :MEW,
        '16' => :GYARADOS,
        '17' => :SHELLDER,
        '18' => :TENTACOOL,
        '19' => :GASTLY,
        '1a' => :SCYTHER,
        '1b' => :STARYU,
        '1c' => :BLASTOISE,
        '1d' => :PINSIR,
        '1e' => :TANGELA,
        '1f' => :SCIZOR, #Glitch Poke
        '20' => :SHUCKLE,#Glitch Poke
        '21' => :GROWLITHE,
        '22' => :ONIX,
        '23' => :FEAROW,
        '24' => :PIDGEY,
        '25' => :SLOWPOKE,
        '26' => :KADABRA,
        '27' => :GRAVELER,
        '28' => :CHANSEY,
        '29' => :MACHOKE,
        '2a' => :MRMIME,
        '2b' => :HITMONLEE,
        '2c' => :HITMONCHAN,
        '2d' => :ARBOK,
        '2e' => :PARASECT,
        '2f' => :PSYDUCK,
        '30' => :DROWZEE,
        '31' => :GOLEM,
        '32' => :HERACROSS, #Glitch Poke
        '33' => :MAGMAR,
        '34' => :HOOH, #Glitch Poke
        '35' => :ELECTABUZZ,
        '36' => :MAGNETON,
        '37' => :KOFFING,
        '38' => :SNEASEL, #Glitch Poke
        '39' => :MANKEY,
        '3a' => :SEEL,
        '3b' => :DIGLETT,
        '3c' => :TAUROS,
        '3d' => :TEDDIURSA, #Glitch Poke
        '3e' => :URSARING,  #Glitch Poke
        '3f' => :SLUGMA,    #Glitch Poke
        '40' => :FARFETCHD,
        '41' => :VENONAT,
        '42' => :DRAGONITE,
        '43' => :MAGCARGO,  #Glitch Poke
        '44' => :SWINUB,    #Glitch Poke
        '45' => :PILOSWINE, #Glitch Poke
        '46' => :DODUO,
        '47' => :POLIWAG,
        '48' => :JYNX,
        '49' => :MOLTRES,
        '4a' => :ARTICUNO,
        '4b' => :ZAPDOS,
        '4c' => :DITTO,
        '4d' => :MEOWTH,
        '4e' => :KRABBY,
        '4f' => :CORSOLA,    #Glitch Poke
        '50' => :REMORAID,  #Glitch Poke
        '51' => :OCTILLERY, #Glitch Poke
        '52' => :VULPIX,
        '53' => :NINETALES,
        '54' => :PIKACHU,
        '55' => :RAICHU,
        '56' => :DELIBIRD,  #Glitch Poke
        '57' => :MANTINE,   #Glitch Poke
        '58' => :DRATINI,
        '59' => :DRAGONAIR,
        '5a' => :KABUTO,
        '5b' => :KABUTOPS,
        '5c' => :HORSEA,
        '5d' => :SEADRA,
        '5e' => :SKARMORY,  #Glitch Poke
        '5f' => :HOUNDOUR,  #Glitch Poke
        '60' => :SANDSHREW,
        '61' => :SANDSLASH,
        '62' => :OMANYTE,
        '63' => :OMASTAR,
        '64' => :JIGGLYPUFF,
        '65' => :WIGGLYTUFF,
        '66' => :EEVEE,
        '67' => :FLAREON,
        '68' => :JOLTEON,
        '69' => :VAPOREON,
        '6a' => :MACHOP,
        '6b' => :ZUBAT,
        '6c' => :EKANS,
        '6d' => :PARAS,
        '6e' => :POLIWHIRL,
        '6f' => :POLIWRATH,
        '70' => :WEEDLE,
        '71' => :KAKUNA,
        '72' => :BEEDRILL,
        '73' => :HOUNDOOOM, #Glitch Poke
        '74' => :DODRIO,
        '75' => :PRIMEAPE,
        '76' => :DUGTRIO,
        '77' => :VENOMOTH,
        '78' => :DEWGONG,
        '79' => :KINGDRA, #Glitch Poke
        '7a' => :PHANPY,  #Glitch Poke
        '7b' => :CATERPIE,
        '7c' => :METAPOD,
        '7d' => :BUTTERFREE,
        '7e' => :MACHAMP,
        '7f' => :DONPHAN, #Glitch Poke
        '80' => :GOLDUCK,
        '81' => :HYPNO,
        '82' => :GOLBAT,
        '83' => :MEWTWO,
        '84' => :SNORLAX,
        '85' => :MAGIKARP,
        '86' => :PORYGON2,  #Glitch Poke
        '87' => :STANTLER,  #Glitch Poke
        '88' => :MUK,
        '8a' => :KINGLER,
        '8b' => :CLOYSTER,
        '8c' => :TYROGUE, #Glitch Poke
        '8d' => :ELECTRODE,
        '8e' => :CLEFABLE,
        '8f' => :WEEZING,
        '90' => :PERSIAN,
        '91' => :MAROWAK,
        '92' => :HITMONTOP, #Glitch Poke
        '93' => :HAUNTER,
        '94' => :ABRA,
        '95' => :ALAKAZAM,
        '96' => :PIDGEOTTO,
        '97' => :PIDGEOT,
        '98' => :STARMIE,
        '99' => :BULBASAUR,
        '9a' => :VENUSAUR,
        '9b' => :TENTACRUEL,
        '9c' => :SMOOCHUM,  #Glitch Poke
        '9d' => :GOLDEEN,
        '9e' => :SEAKING,
        '9f' => :ELEKID,  #Glitch Poke
        'a0' => :MAGBY,   #Glitch Poke
        'a1' => :MILTANK, #Glitch Poke
        'a2' => :BLISSEY, #Glitch Poke
        'a3' => :PONYTA,
        'a4' => :RAPIDASH,
        'a5' => :RATTATA,
        'a6' => :RATICATE,
        'a7' => :NIDORINO,
        'a8' => :NIDORINA,
        'a9' => :GEODUDE,
        'aa' => :PORYGON,
        'ab' => :AERODACTYL,
        'ac' => :RAIKOU,  #Glitch Poke
        'ad' => :MAGNEMITE,
        'ae' => :ENTEI,   #Glitch Poke
        'af' => :SUICUNE, #Glitch Poke
        'b0' => :CHARMANDER,
        'b1' => :SQUIRTLE,
        'b2' => :CHARMELEON,
        'b3' => :WARTORTLE,
        'b4' => :CHARIZARD,
        'b5' => :LARVITAR,  #Glitch Poke
        'b6' => :PUPITAR,   #Glitch Poke
        'b7' => :TYRANITAR, #Glitch Poke
        'b8' => :LUGIA,     #Glitch Poke
        'b9' => :ODDISH,
        'ba' => :GLOOM,
        'bb' => :VILEPLUME,
        'bc' => :BELLSPROUT,
        'bd' => :WEEPINBELL,
        'be' => :VICTREEBEL,
        #End of legitimate roster.
        'bf' => :CHIKORITA, #Glitch Poke >A
        'c0' => :BAYLEEF,   #Glitch Poke a
        'c1' => :MEGANIUM,  #Glitch Poke 
        'c2' => :CYNDAWUIL, #Glitch Poke % .4
        'c3' => :QUILAVA,   #Glitch Poke, h POKé
        'c4' => :TYPHLOSION,#Glitch Poke PokéWTrainer
        'c5' => :TOTODILE,  #Glitch Poke PkMn
        'c6' => :CROCONAW,  #Glitch Poke %L%M 4
        'c7' => :FERALIGATR,#Glitch Poke P% %%T
        'c8' => :SENTRET,   #Glitch Poke %U?
        'c9' => :FURRET,    #Glitch Poke >% 8
        'ca' => :HOOTHOOT,  #Glitch Poke PC4SH
        'cb' => :NOCTOWL,   #Glitch Poke p
        'cc' => :LEDYBA,    #Glitch Poke PkMn>n
        'cd' => :LEDIAN,    #Glitch Poke Trainer
        'ce' => :SPINARAK,  #Glitch Poke V W G d
        'cf' => :ARIADOS,   #Glitch Poke OPlMn4X
        'd0' => :CROBAT,    #Glitch Poke PkMnPkMnT
        'd1' => :CHINCHOU,  #Glitch Poke 4B 8 4 8
        'd2' => :LANTURN,   #Glitch Poke % '
        'd3' => :PICHU,     #Glitch Poke M p'u %
        'd4' => :CLEFFA,    #Glitch Poke A% G
        'd5' => :IGGLYBUFF, #Glitch Poke P% % %
        'd6' => :TOGEPI,    #Glitch Poke 4 h
        'd7' => :TOGETIC,   #Glitch Poke
        'd8' => :NATU,      #Glitch Poke PkMnaPkMn%^fPkMn
        'd9' => :XATU,      #Glitch Poke PkMnRPkMn"
        'da' => :MAREEP,    #Glitch Poke B
        'db' => :FLAFFY,    #Glitch Poke
        'dc' => :AMPHAROS,  #Glitch Poke
        'dd' => :BELLOSSOM, #Glitch Poke 7PkMn'v
        'de' => :MARILL,    #Glitch Poke -PkMn
        'df' => :AZUMARILL, #Glitch Poke .PkMn
        'e0' => :SUDOWOODO, #Glitch Poke /PkMn V PkMn
        'e1' => :POLITOED,  #Glitch Poke 'v
        'e2' => :HOPPIP,    #Glitch Poke ......
        'e3' => :SKIPLOOM,  #Glitch Poke
        'e4' => :JUMPLUFF,  #Glitch Poke
        'e5' => :AIPOM,     #Glitch Poke C
        'e6' => :SUNKERN,   #Glitch Poke - -
        'e7' => :SUNFLORA,  #Glitch Poke P& 4$
        'e8' => :YANMA,     #Glitch Poke C X
        'e9' => :WOOPER,    #Glitch Poke c
        'ea' => :QUAGSIRE,  #Glitch Poke A
        'eb' => :ESPEON,    #Glitch Poke
        'ec' => :UMBREON,   #Glitch Poke
        'ed' => :MURKROW,   #Glitch Poke h%
        'ee' => :SLOWKING,  #Glitch Poke .g
        'ef' => :MISDREAVUS,#Glitch Poke %$'M
        'f0' => :UNOWN,     #Glitch Poke %$
        'f1' => :WOBBUFFET, #Glitch Poke 94
        'f2' => :GIRAFARIG, #Glitch Poke
        'f3' => :PINECO,    #Glitch Poke
        'f4' => :FORRETRESS,#Glitch Poke
        'f5' => :DUNSPARCE, #Glitch Poke
        'f6' => :GLIGAR,    #Glitch Poke G'Mp
        'f7' => :STEELIX,   #Glitch Poke 'Ng'Mp
        'f8' => :SNUBBULL,  #Glitch Poke 'Ng %$
        'f9' => :GRANBULL,  #Glitch Poke 94 h
        'fa' => :QWILFISH,  #Glitch Poke
        'fb' => :CELEBI,    #Glitch Poke 'M 'N g
        'fc' => :TREEKO,    #Glitch Poke O
        'fd' => :GROVYLE,   #Glitch Poke %$ 6%
        'fe' => :SCEPTILE,  #Glitch Poke 'M
        'ff' => :TORCHIC    #Glitch Poke 'M
    }
    Of course, it'll still glitch out if said Pokemon known moves beyond a4, but I just filled those in as Pound.

    However, I notice that nicknames do not carry over... I suppose that's intended for later?
     
    Last edited:

    rigbycwts

    Hmm, hmm.
    98
    Posts
    11
    Years
    • Seen Feb 22, 2019
    I'm getting a couple different errors:
    The line "pokemon.generated=1" is giving me an error in Essentialy v16.2 unmofidied, as is the function "retTimeFormatOne" in pbSaveAfterMigrate.

    ...

    However, I notice that nicknames do not carry over... I suppose that's intended for later?
    Added on how to fix the generated attribute error in the first post, since my intention with it is to make the Gameboy icon appear on the summary.
    Regarding nicknames, it is intended for later.

    EDIT: retTimeFormatOne is used in shiney570's BW2 mod. Looks like I forgot to filter that part out.
     
    Last edited:

    rigbycwts

    Hmm, hmm.
    98
    Posts
    11
    Years
    • Seen Feb 22, 2019
    Since Gold and Silver already have Virtual Console releases, Gen 2 support for this script is currently being worked on.
    Also, I need to test this if it still works on Essentials v17.
     
    10
    Posts
    5
    Years
  • Hey there! I know this thread is pretty old now, but I absolutely love this script! Thank you so much for this, and I am definitely looking forward to more features if you are planning on continuing this script. It'd be amazing to get those features you were planning! :mudkip-smilesquint:
     
    Back
    Top