Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2015-10-24 01:00:53

Schattenjäger
Member
Registered: 2015-10-21
Post 4/25

A Tutorial for Adding New Pokémon in Pokered

Hey,

The search function on this forum has been a big help for me while working with first gen hacking, so I thought I'd make a small contribution myself, instead of just mooching. This is for some new people who may stumble upon this place and may want to work with pokered. I've been working on my pokémon roster a lot as of late, and since I have a day off, I will try to make a tutorial on adding a new pokémon in pokered. More experienced people are welcome to chime in, if I made a mistake, or didn't explain a function properly enough, since this is pretty much a "layman's understanding" of how things work. I hope this helps someone out.

Before you begin, you have to move Mew's base stats data from main.asm to your data/base_stats file after Mewtwo. It has to be after Mewtwo, I will explain this later. You accomplish this by searching for "Mew" in main.asm, and you should come across an "INCLUDE" that has "baseStats/mew.asm" in it. Copy the INCLUDE, and move it to your base_stats file located in data. And, like I said, after "data/baseStats/mewtwo.asm".

So, in data/base_satst it should look like this:

INCLUDE "data/baseStats/dratini.asm"
INCLUDE "data/baseStats/dragonair.asm"
INCLUDE "data/baseStats/dragonite.asm"
INCLUDE "data/baseStats/mewtwo.asm"
INCLUDE "data/baseStats/mew.asm"

So.

First off, in Pokémon Red and Blue, there are 39 "Missingnos", as in pokémon slots that are in the code, but aren't in "use". This is a big advantage that Red and Blue have. It is possible to add Pokémon past the last "indexed" pokémon, which is Victreebel, but since the game, by default, can only handle 255 pokémon, 39 of which are the Missingnos, it's recommended to at least use the Missingno slots first.

Now, this is the way I do it, but obviously there are more than one way to add a new pokémon, I'll just try to include all the steps needed.

First, you want to add your new pokémon's base stats. Pokémon's base stats are included in data/baseStats as individual .asm files. bulbasaur.asm includes Bulbasaur, ivysaur.asm includes Ivysaur, and so forth. You start by creating a new .asm file with your chosen text editor. Actually, the way I've done is I have a text file called "basestats" that includes the slots that need to billed, but everything else is left empty, so when I create a new pokémon, I just fill in the appropriate data. Here's what the blank base stats file I have looks like:

BaseStats:
db DEX_ ; pokedex id
db  ; base hp
db  ; base attack
db  ; base defense
db  ; base speed
db  ; base special
db  ; species type 1
db  ; species type 2
db  ; catch rate
db  ; base exp yield
INCBIN "pic/bmon/.pic",0,1 ; 55, sprite dimensions
dw PicFront
dw PicBack
; attacks known at lvl 0
db 0
db 0
db 0
db 0
db  ; growth rate
; learnset
db %00100000
db %00000000
db %00000000
db %00000000
db %00000000
db %00000000
db %00000000
db BANK(PicFront)

These things are pretty self-explanatory since they are commented on. You can obviously just check out the existing pokémon's base stats, but I will now show my Lanturn here, since Lanturn is my favourite pokémon - seriously, run a combination of Stockpile, Ice Beam, Charge Beam/Thunderbolt and Surf and you get mad coverage and sweep through almost any of the gam.. Wow, offtopic.

LanturnBaseStats:
db DEX_LANTURN ; pokedex id
db 125 ; base hp
db 58 ; base attack
db 58 ; base defense
db 67 ; base speed
db 76 ; base special
db WATER ; species type 1
db ELECTRIC ; species type 2
db 75 ; catch rate
db 156 ; base exp yield
INCBIN "pic/bmon/lanturn.pic",0,1 ; 77 sprite dimensions
dw LanturnPicFront
dw LanturnPicBack
; attacks known at lvl 0
db BUBBLE
db THUNDER_WAVE
db SUPERSONIC
db 0
db 5 ; growth rate
; learnset
db %00100000
db %01111100
db %10110000
db %00010001
db %01000000
db %00011000
db %00010000
db BANK(LanturnPicFront)

The one thing here that I would like to emphasize is the "learnset" section. This is for TMs, as in what TMs the pokémon can learn. This can be a bit confusing. The bitmap for TMs is as follows:

TM 08: Body Slam, TM07: Horn Drill, TM 06: Toxic, TM 05: Mega Kick, TM 04: Whirlwind, TM 03: Swords Dance, TM 02: Razor Wind, TM 01: Mega Punch
TM 16: Pay Day, TM 15: Hyper Beam, TM 14: Blizzard, TM 13: Ice Beam, TM 12: Water Gun, TM 11: Bubblebeam, TM 10: Double Edge, TM 09: Take Down
TM 24: Thunderbolt, TM 23: Dragon Rage, TM 22: Solar Beam, TM 21: Mega Drain, TM 20: Rage, TM 19: Seismic Toss, TM 18: Counter, TM 17: Submission
TM 32: Double Team, TM 31: Mimic, TM 30: Teleport, TM 29: Psychic, TM 28: Dig, TM 27: Fissure, TM 26: Earthquake, TM 25: Thunder
TM 40: Skull Bash, TM 39: Swift, TM 38: Fire Blast, TM 37: Egg Bomb, TM 36: Selfdestruct, TM 35: Metronome, TM 34: Bide, TM 33: Reflect
TM 48: Rock Slide, TM 47: Explosion, TM 46: Psywave, TM 45: Thunder Wave, TM 44: Rest, TM 43: Sky Attack, TM 42: Dream Eater, TM 41: Softboiled
[0] HM 05: Flash, HM 04: Strength, HM 03: Surf, HM 02: Fly, HM 01: Cut, TM 50: Substitute, TM 49: Tri Attack

The reason I have the lone "1" as the third entry of the first line of the learnset data in my blank base stats file is because it contains Toxic, and with only a few exceptions, most pokémon can learn Toxic in every game. Obviously "1" stands for pokémon being able to learn said TM, while "0" means that it can't learn it. I have changed the TMs in my game where the Lanturn is from, so that's why the learnset data my seem confusing when compared to the TMs.

The reason I have "db BANK(LanturnPicFront)" as the last entry is because of a code that allows the inclusion of more and bigger backsprites to the game, since I'm using GSC style backsprites. You don't have to care about it for now.
So, now you need to include your added pokémon to your base_stats.asm. If you remember, this where we moved Mew to earlier. You add your pokémon after Mew. These entries need to sync with your pokédex order. So, Mew is 151, and your new pokémon is 152. This is how mine looks:

INCLUDE "data/baseStats/mewtwo.asm"
INCLUDE "data/baseStats/mew.asm"
INCLUDE "data/baseStats/chikorita.asm"

Chikorita is #152 in my pokédex, so it's included after the #151 Mew. This is the reason we moved Mew out main.asm earlier. If Mew is not included here, and you don't do any other changes to the ROM, the added pokémon won't work. I believe the sprites at least are not going to function properly.
Okay, so next up is cries. But before we get to that, this is also where the Missingno slots come into play. They are all commented on in pokered, so they are easy to find just by using a search. Any slot that says Missingno is free to use for a new pokémon. It's also good to memorize the slot that you used for your pokémon, since you will be using that information later.
The pokémon cries consist of their base cry, pitch of the cry and the length of the cry. This has been mostly trial and error for me. It helps to study the existing pokémon cries. Is there a pokémon that has a cry that could work with your new monster? You could pick its base cry. For example, this is my Lanturn, which I'm somewhat happy with, not perfect but ok:

db $1E, $00, $80; Lanturn

Actually, if better documentation exists, someone should let me know, and it could be added to this tutorial. Cry is mostly fine tuning your pokémon, anyway, so right now it's more important to actually insert a functioning pokémon to the game.
evos_moves.asm is up next. This contains the data that determines the evolution and naturally - as in not through TMs/HMs - learned moves. If you memorized the Missingno slot you used to put your cry in, find that same slot for your evolution and moveset data.
Again, here is my trusty friend Lanturn

Mon187_EvosMoves:
;Lanturn
;Evolutions
db 0
;Learnset
db 6,THUNDER_WAVE
db 9,ELECTRO_BALL
db 12,WATER_GUN
db 17,CONFUSE_RAY
db 20,BUBBLEBEAM
db 23,SPARK
db 33,SIGNAL_BEAM
db 37,DISCHARGE
db 42,TAKE_DOWN
db 45,RECOVER
db 50,HYDRO_PUMP
db 0

The first data is for evolutions. Since Lanturn doesn't evolve, there's nothing there. If it was a Chinchou, it would say:

db EV_LEVEL,27,LANTURN
db  0

You always need to include the "db 0" after the evolution and move set data respectively. That's how the game knows that one "set" of information ends before another begins.
The evolution methods are:
-EV_LEVEL
-EV_ITEM
-EV_TRADE
The latter two used in examples:
EV_ITEM,FIRE_STONE,1,FLAREON (Eevee)
EV_TRADE,1,ALAKAZAM (Kadabra)

So, in short, find the Missingno slot you used for the cry and enter your pokémon's evolution and moveset data. This is obviously really easy since you have 151 examples of how the information is typed in already.

Continuing down in alphetical order in the "data" file,  we have mon_palettes. This is the information that determines the color palette your pokémon uses. In a vanilla pokered, you'll see palettes for the basic colors, such as PAL_BLUEMON, PAL_REDMON, PAL_YELLOWMON, etc. Pretty straightforward. One thing to note is that the palettes follow the pokédex order, as in the order you have your baseStats.asm files in base_stats. Remember that your custom pokémon is after Mew, so place your data after Mew again. My pokered uses custom palettes, but if I were working with a vanilla pokered, and adding Lanturn, I would probably enter

db PAL_BLUEMON ; Lanturn

It's useful to make a comment after the palette with ";" so that it's easier for you find stuff and edit later on if such a need arises. So, pick a color palette you think best suits your pokémon and enter it below the color palette for Mew.

Okay, so next up is mon_party_sprites. These determine the mini sprites that are displayed in your party menu next to the mons' hp bars and whatnot. They are pretty obvious for the most part, SPRITE_MON is the Rhydon sprite.

Party icons are added in pairs of two, and a "0" for padding is the last entry. The end of my list looks like this:

"dn SPRITE_MON, SPRITE_QUADRUPED  ; ZOROARK/SUICUNE
dn 0                                                                     ; padding

Again, here it's especially helpful to comment on the pokémon pairs for future editing purposes, since the data can be a bit hard to follow.
Let's say you're adding your first pokémon. Once again, pokédex order, new mons go after Mew. One thing to note is that the last entry after Mew is "0", so you need to move that out of the way before entering your own data. In other words, it should end up looking like this:

dn SPRITE_MON, SPRITE_WHATEVER ; Mew/New
dn 0                                                          ; padding

Now we get to pokédex entries. Unlike the the last few areas, pokédex entries uses the index numbered list for pokémon. So, you need to insert your data in Missingno slot again. So, find your slot and insert "dw NewMonDexEntry". You can probably tell the format from the other entries. First up is the "name" of the pokémon's "type". Not the elemental type, but the type that shows up in the pokédex data. Lanturn is the "light" pokémon. Actually, Ampharos is also "light" pokémon, and I feel they missed a boat by not naming it the "Lighthouse" pokémon, but I digress. The second part is height, after which comes weight and then the entry that tells the game where the actual text part of the entry is located. Height uses a comma, weight doesn't. Screw Ampharos, here's Lanturn again:

LanturnDexEntry
db "LIGHT@"
db 3,11
dw 496
TX_FAR _LanturnDexEntry
db "@"

And the "@" ends the entry. Make sure you remember to add it after every pokédex entry, I always forget.

The very next file is "pokédex order", which, unlike the name would suggest, is not about the order of pokémon in your pokédex, but rather the index numbered list of the mons in the game. Rhydon is first entry in a vanilla pokémon Red, since the mons are listed in the order they were created, or at least that's what's been speculated. All you really need to here is find your Missingno you're replacing and place "DEX_NEWMON" on top of it.

And that is actually it for "data". Next up, we move to "constants". This is as straightforward as it gets. You edit two files: pokedex_constants and pokemon_constants. In the first one, you simply add your new pokémon to the list after Mew and give it an EQU value of 152. Then, you once again find your Missingno slot in pokemon_constants and replace it with the name of your new pokémon. That's it for constants.
"Text" is where we are headed next. And in said "text", we edit two files: monster_names.asm and pokedex.asm. Monster_names, as you might have guessed, contains the names of the pokémon. The index numbered, so find your Missingno and type in the name of the mon. Note that the mon names are 10 characters long, and if the name of poké is less than 10 characters, you fill in the remaining characters using "@". Lanturn is "LANTURN@@@", whereas Victreebel is just "VICTREEBEL".

Then we get to what I feel is the most annoying part of adding new pokémon: the text portion of the pokédex entry. Someone could actually let me know if they know what the character limit is per line without the text overflowing, because I haven't checked that out myself. However, the game seems to use three words per line for the most part for the entries, so that's what I've tried to do. The actual inserting of the entries is easy, and you can easily just copy the format from an existing entry. Three lines per page, two pages. Initiated with "text", then "next", "next", "page" for second page, and again "next", "next". "dex" ends the entry. It may take a few tries to get it right without the text overflowing all over the place, and it can be annoying, but you shouldn't have too much trouble with it. Just study the existing entries. And obviously name the entry "_NewMonDexEntry", since that is what we wrote in the main pokédex entry. This is where TX_FAR points to.

Now all that is left is going to main.asm, and finding the banks that contain your pokémon sprites, and adding the path of your new pokémon's front and backsprite to the bank section.

LanturnPicFront::      INCBIN "pic/bmon/lanturn.pic"
LanturnPicBack::       INCBIN "pic/monback/lanturnb.pic"

Where the section after INCBIN is where you have saved your sprites. I follow the original format myself, but obviously you can do whatever you want. The point is that the path exists and contains the sprites.

I actually wrote this twice, since I accidently closed my browser the first time I was making this, so I hope I didn't skip something important, or lose track of what I was supposed to do or say. If someone notices errors, or has something, anything, to add, please do. This is all easy once you get the idea of what you're doing and why. I may make some additions to this, but honestly, since  I already made this twice, I'll just let this be for now.

If you followed my steps - and I didn't forget anything important - you should now have a new functioning pokémon in your rom hack project.

I really hope that if someone new - I'm still new myself - wants to get started, sees this and maybe finds this helpful. Not only is this the way to add new pokémon, but it also kind of shows the way pokered works and how it handles data.

I'm Finnish, so English is not my native language, but I hope this was all clear enough for everybody. :)

Last edited by Schattenjäger (2015-10-25 14:53:18)

Offline

#2 2015-10-24 22:32:31

Miksy91
Member
Registered: 2010-10-16
Post 2,195/2,339

Re: A Tutorial for Adding New Pokémon in Pokered

A pretty handy tutorial you've got here :)
Someone will most likely find this really useful and can also learn quite a lot from doing this.

Schattenjäger wrote:

I actually wrote this twice, since I accidently closed my browser the first time I was making this, so I hope I didn't skip something important, or lose track of what I was supposed to do or say. If someone notices errors, or has something, anything, to add, please do. This is all easy once you get the idea of what you're doing and why. I may make some additions to this, but honestly, since  I already made this twice, I'll just let this be for now.

Know that feeling... :D
Either the browser closes by accident, blue screen error pops up on Windows OS when you have done some unsaved work (on anything really) etc.

Schattenjäger wrote:

I'm Finnish, so English is not my native language, but I hope this was all clear enough for everybody. :)

That's cool :) I'm a Finn too. You can write more fluently than I can though, but not like I would have ever been that great at English.
Mistä päin oot muuten kotoisin?

Offline

#3 2015-10-25 04:20:25

Danny-E 33
Administrator
Registered: 2012-06-09
Post 919/1,119

Re: A Tutorial for Adding New Pokémon in Pokered

This is very useful. My only comment is that your way of representing tm learn sets is out dated.
You may also be interested in this tutorial I made.

Offline

#4 2015-10-25 18:21:24

Schattenjäger
Member
Registered: 2015-10-21
Post 5/25

Re: A Tutorial for Adding New Pokémon in Pokered

Miksy91 wrote:

A pretty handy tutorial you've got here :)
Someone will most likely find this really useful and can also learn quite a lot from doing this.

Schattenjäger wrote:

I actually wrote this twice, since I accidently closed my browser the first time I was making this, so I hope I didn't skip something important, or lose track of what I was supposed to do or say. If someone notices errors, or has something, anything, to add, please do. This is all easy once you get the idea of what you're doing and why. I may make some additions to this, but honestly, since  I already made this twice, I'll just let this be for now.

Know that feeling... :D
Either the browser closes by accident, blue screen error pops up on Windows OS when you have done some unsaved work (on anything really) etc.

Schattenjäger wrote:

I'm Finnish, so English is not my native language, but I hope this was all clear enough for everybody. :)

That's cool :) I'm a Finn too. You can write more fluently than I can though, but not like I would have ever been that great at English.
Mistä päin oot muuten kotoisin?

Riihimäeltä. Ja ihan hyvin ymmärrettävää sun englannin kielesi on. Jotain sanajärjestysvirheitä, mutta ihan hyvin ymmärtää aina mitä tarkoitat. Itse asiassa törmäsin sun tutoriaaleihin YouTubessa aikoinaan, ja ne auttoi paljon varsinkin HEX-editoinnin ymmärtämisessä. :) Suomalaisena tiedän miten vaikeaa voi olla "julkisesti" mikrofoniin puhuminen, joten arvostan. :D Missä itse asut?

Danny-E 33 wrote:

This is very useful. My only comment is that your way of representing tm learn sets is out dated.
You may also be interested in this tutorial I made.

Whoa, that new format is so much better than the old one. I wasn't even aware. Thanks for letting me now. And it's good that you posted your tutorial, since these two together should make it pretty easy for everybody to understand how this works.

Last edited by Schattenjäger (2015-10-25 18:21:49)

Offline

#5 2015-10-26 00:25:16

Danny-E 33
Administrator
Registered: 2012-06-09
Post 920/1,119

Re: A Tutorial for Adding New Pokémon in Pokered

I agree. My tutorial has the benefit of showing exactly what needs to be edited in which files, but neglects to explain why certain changes are being made.
Yours does a good job at explaining why each change has to be made, but doesn't explicitly demonstrate the changes.

Offline

#6 2015-12-05 10:39:13

KeiTaRo
Member
Registered: 2015-12-05
Post 1/56
Website

Re: A Tutorial for Adding New Pokémon in Pokered

These were both awesome tutorials! Thank you! I want to say, though, that I followed Danny-E 33's tutorial exactly, but am encountering some weirdness, perhaps someone can shed some light?

Basically, I tried to add Chikorita, Bayleef and Meganium to my game. Instead of replacing Missingno (as I intend to use those slots for different Pokemon), I inserted them after Victreebel, effectively making them index number BF, C0 and C1. So far so good. in evos_moves, I replaced the Missingnos defined as Mon152, Mon153 and Mon154 by changing their number to 191, 192, and 193. They are still Missingnos. I did this so that my Chikorita line could use the numbers 152, 153 and 154. Again, so far so good. I followed all the additional steps and the game did compile and even play without a hitch, other than the female NPC in Pallet town now being able to walk on top of my house door (or did she always do that? Probably irrelevant to this, anyway)

The main weird thing is that my new Chikorita for some reason will always start out with an additional move (Horn Drill), which is not defined anywhere for it in neither chikorita.asm nor evos_moves.asm ... further more, none of the level up moves seem to be working for ANY of the three added Pokemon, despite them being defined and compiling with no errors. Chikorita is still able to evolve, so obviously its not an error with evos_moves.asm....right? The only problem is that when they reach the level they are supposed to learn a move at, nothing happens.

Additionally, their pallets show up correctly in battle and in the Pokedex (I used greenmon) but checking the stats screen changes the pallet to that weird purpley pallet Mew and Mewtwo use. This only happens in the status screen.

I'm fairly new to all of this, but I thought it seemed straightforward enough and I really though I'd had this figured out :( can anyone possibly shed some light on this for me?

Offline

#7 2015-12-05 13:13:35

Schattenjäger
Member
Registered: 2015-10-21
Post 20/25

Re: A Tutorial for Adding New Pokémon in Pokered

Something's probably out of order.

There's actually no need to to redefine Missingnos if you wish to add non-Missingno Pokémon after the last index numbered mon. I'm not sure if I understood you correctly, but did you move around the Missingnos in evos_moves? If you did, that's something that is not necessary, and there's a chance you accidently miss something and stuff gets out of order. The pokédex order for pokémon is defined in pokedex_constants, so you can have Chikorita be, say, Mon166_EvosMoves and still have it set as 152 in the pokédex - if that's what you were wondering. Do the new pokémon learn any moves?

Anyways, the palette problem is something I recently encountered, as well. In engine/palettes, VICTREEBEL - the last indexed pokémon - is set to be the last pokémon for which a palette is loaded in the pokédex and status screen. Since you addded the Chikorita line after index 190, the game won't load the palette. Search for VICTREEBEL in engine/palettes, and set it to "MEGANIUM", and it should work.

Also, where and how do you encounter this Chikorita?

Last edited by Schattenjäger (2015-12-05 18:32:56)

Offline

#8 2015-12-07 09:36:37

KeiTaRo
Member
Registered: 2015-12-05
Post 2/56
Website

Re: A Tutorial for Adding New Pokémon in Pokered

Hey, thanks for the response and for that tip on the pallet entries, totally worked! :) I think I was getting confused with all the Mon_### stuff, I've just left Missingno as they are for now (I will reused their slots later) and added my new Pokemon following Victreebel for the time being.

To answer your question, I replaced the starter Bulbasaur with Chikorita as the means of encounter, just to test for now.

I decided to start over from scratch, adding just one at a time. Chikorita was 100% working up until I added Bayleef to the game, at which point the whole "level up moves not learning" thing happened again. This time, it at least had the correct starting moves (no Horn Drill this time!) ... the weird thing was, Bayleef's level up moves DID work. After a little playing around, I discovered that removing Chikorita's evolution all together (db EV_LEVEL,16,BAYLEEF) allowed it to learn its level-up moves again. Just to make sure this wasn't an issue with Bayleef, I set it to evolve in to Poliwhirl instead and once again, he stopped learning his level up moves (upon reaching level 8, nothing happened, when he would normally acquire Razor Leaf) ... is there a reason why having an evolution assigned to my new Pokemon would cause this to happen?? Again, for the record, I did add them both after Victreebel's slot if that matters any...so they would be index BF and C0.

Thanks for your help so far, I'm not sure where I could have gone wrong as I've made sure to check my work a few times now x_x

EDIT: forgot to mention that the evolution ITSELF does actually work; just that having one is preventing my Chikorita from learning its level up moves.

Last edited by KeiTaRo (2015-12-07 09:39:19)

Offline

#9 2015-12-07 15:00:08

Schattenjäger
Member
Registered: 2015-10-21
Post 21/25

Re: A Tutorial for Adding New Pokémon in Pokered

Send me your evos_moves.asm to teemuasikainen@icloud.com, and I'll take a look - or set up a Github repository.

Last edited by Schattenjäger (2015-12-07 15:06:06)

Offline

#10 2015-12-08 04:14:55

Danny-E 33
Administrator
Registered: 2012-06-09
Post 923/1,119

Re: A Tutorial for Adding New Pokémon in Pokered

It's possible that this is a wram-shifting issue.
As you increase NUM_POKEMON, the number of bytes reserved in ram for the dex seen/owned flags increases.
We've tried to make it so that you can increase this section of ram (shifting everything after it down) but it still is not bug free I think.
A solution to this is to keep one flag array where it originally is (and let it overlap the other original array) and move the other array to a free space in wram.
Here is what I mean. Original:

wMainDataStart::

wPokedexOwned:: ; d2f7
    flag_array NUM_POKEMON
wPokedexOwnedEnd::

wPokedexSeen:: ; d30a
    flag_array NUM_POKEMON
wPokedexSeenEnd::


wNumBagItems:: ; d31d

You could try changing this to:

wMainDataStart::

wPokedexOwned:: ; d2f7
    flag_array NUM_POKEMON
wPokedexOwnedEnd::

    flag_array 2 * 151 - NUM_POKEMON
wPokedexSeenEndOld::

wNumBagItems:: ; d31d

Then change this:

wDestinationWarpID:: ; d42f
; if $ff, the player's coordinates are not updated when entering the map
    ds 1

    ds 128

wNumSigns:: ; d4b0

To this:

wDestinationWarpID:: ; d42f
; if $ff, the player's coordinates are not updated when entering the map
    ds 1


wPokedexSeen::
    flag_array NUM_POKEMON
wPokedexSeenEnd::


    ds 128 - (wPokedexSeenEnd - wPokedexSeen)

wNumSigns:: ; d4b0

Then change the two instances of "wPokedexSeenEnd" to "wPokedexSeenEndOld" in engine/save.asm

Offline

#11 2016-03-12 22:49:35

lusentoj
Member
From: Sweden
Registered: 2016-02-29
Post 11/31

Re: A Tutorial for Adding New Pokémon in Pokered

>Someone could actually let me know if they know what the character limit is per line without the text overflowing, because I haven't checked that out myself.

I assume it's the same as normal dialogue boxes, which means:

line "12 1234567 1234567"
= 18 characters

is a perfect fit going all the way to the end of the text box, which only fits when there's no scroll arrow showing at the bottom (meaning: very top line of a paragraph, or bottom line of the last line in the dialogue). Delete one letter to get what fits in all cases.

Last edited by lusentoj (2016-03-12 22:50:41)

Offline

#12 2016-03-16 05:20:51

TotesTim
Member
Registered: 2016-03-03
Post 2/12

Re: A Tutorial for Adding New Pokémon in Pokered

Hey, thanks for the tutorial. I managed to accomplish adding a new slot fairly well for the most part, but my new Pokemon's sprite isn't working correctly, and it just shows up as a garbled mess.

goQRZVB.png

According to the first post, this problem seems to occur when "baseStats/mew.asm" inside of the "main.asm" file is not moved to the "base_stats.asm" file after Mewtwo's "mewtwo.asm" listing.  I've done that, and yet, I'm still getting a corrupted front and backsprite.

The last entries in my "base_stats.asm" file are as follows:

INCLUDE "data/baseStats/dratini.asm"
INCLUDE "data/baseStats/dragonair.asm"
INCLUDE "data/baseStats/dragonite.asm"
INCLUDE "data/baseStats/mewtwo.asm"
INCLUDE "data/baseStats/mew.asm"
INCLUDE "data/baseStats/mon152.asm"

Here's the "mon152.asm" file for reference as well. I mostly just took Charizard's to use as a base, and gave it Mew's learnset for placeholder purposes. Also took Charizard's front/backsprite for placeholders as well:

db DEX_MON152 ; pokedex id
db 5 ; base hp
db 5 ; base attack
db 5 ; base defense
db 5 ; base speed
db 5 ; base special
db NORMAL ; species type 1
db NORMAL ; species type 2
db 45 ; catch rate
db 209 ; base exp yield
INCBIN "pic/bmon/mon152.pic",0,1 ; 77, sprite dimensions
dw Mon152PicFront
dw Mon152PicBack
; attacks known at lvl 0
db TACKLE
db 0
db 0
db 0
db 3 ; growth rate
; learnset
    tmlearn 1,2,3,4,5,6,7,8
    tmlearn 9,10,11,12,13,14,15,16
    tmlearn 17,18,19,20,21,22,23,24
    tmlearn 25,26,27,28,29,30,31,32
    tmlearn 33,34,35,36,37,38,39,40
    tmlearn 41,42,43,44,45,46,47,48
    tmlearn 49,50,51,52,53,54,55,56
db 0 ; padding

Also, if it matters, I'm using the first Missingno. slot (value 1F) that appears after Tangela for this entry. I'm not really sure where to go from here. Any help would be appreciated.

Offline

#13 2016-03-16 14:40:28

ShantyTown
Member
Registered: 2013-12-04
Post 262/344

Re: A Tutorial for Adding New Pokémon in Pokered

The problem is probably that it's trying to load the mon's sprite from the wrong Bank.  You'll have to update UncompressMonSprite to address this.  Here is an example:
https://github.com/pret/pokered/blob/16 … e.asm#L720

One popular solution is to use the last byte of the baseStats data to contain the byte of the mon's front and back sprites.  Here is an example of that:
https://github.com/huderlem/pokered/com … e93dd18a4c
(Only pay attention to the changes to UncompressMonSprite, BaseStats data, and wram.asm  in that link.)

Offline

#14 2016-03-17 02:23:27

TotesTim
Member
Registered: 2016-03-03
Post 4/12

Re: A Tutorial for Adding New Pokémon in Pokered

ShantyTown wrote:

The problem is probably that it's trying to load the mon's sprite from the wrong Bank.  You'll have to update UncompressMonSprite to address this.  Here is an example:
https://github.com/pret/pokered/blob/16 … e.asm#L720

One popular solution is to use the last byte of the baseStats data to contain the byte of the mon's front and back sprites.  Here is an example of that:
https://github.com/huderlem/pokered/com … e93dd18a4c
(Only pay attention to the changes to UncompressMonSprite, BaseStats data, and wram.asm  in that link.)

Thanks for answering. So, I decided to go with the second method that you suggested to me. I made the changes to UncompressMonSprite's routine, added the "+db Bank(pokemonnameherePicFront) ; padding" line at the end of each Pokemon's asm file,  and made the changes to wram.asm. I'm now receiving a new error.

ORk1RaC.png

From what I've gathered from past error messages, the problem lies at the "bulbasaur.asm" file on line 29. I can't quite figure out what could be wrong though, since it appears nearly identical to the one in your link (disregarding the unimportant aspects such as the Pokemon stats). Here's my file for reference:

MonBaseStats:
db DEX_BULBASAUR ; pokedex id
db 50 ; base hp
db 72 ; base attack
db 35 ; base defense
db 65 ; base speed
db 35 ; base special
db GROUND ; species type 1
db DARK ; species type 2
db 180 ; catch rate
db 58 ; base exp yield
INCBIN "pic/bmon/bulbasaur.pic",0,1 ; 66, sprite dimensions
dw BulbasaurPicFront
dw BulbasaurPicBack
; attacks known at lvl 0
db SCRATCH
db LEER
db 0
db 0
db 3 ; growth rate
; learnset
    tmlearn 3,6,8
    tmlearn 9,10
    tmlearn 20,21,22
    tmlearn 31,32
    tmlearn 33,34
    tmlearn 44
    tmlearn 50,51
+db Bank(BulbasaurPicFront) ; padding
MonBaseStatsEnd:

Any ideas?

Offline

#15 2016-03-17 03:04:42

Fotomac
Member
Registered: 2015-10-25
Post 175/332

Re: A Tutorial for Adding New Pokémon in Pokered

Unnecessary plus sign. That's what it has to be.

Offline

#16 2016-03-17 05:46:43

TotesTim
Member
Registered: 2016-03-03
Post 5/12

Re: A Tutorial for Adding New Pokémon in Pokered

Fotomac wrote:

Unnecessary plus sign. That's what it has to be.

Well, I feel silly now. That solved my issue with compiling the ROM, thanks. However, I've run into another issue. I'm pretty sure that I screwed something up in "home.asm", because certain Pokemon will not have their sprites loaded, and the game will crash.

According to the "home.asm" file located here: https://github.com/huderlem/pokered/com … e93dd18a4c , I only pay attention to the section by the "UncompressMonSprite" function, and delete lines 727 to 761, and add in "ld a, [wMonSpritesBank]", causing my code to look like:

UncompressMonSprite:: ; 1627 (0:1627)
    ld bc,wMonHeader
    add hl,bc
    ld a,[hli]
    ld [wSpriteInputPtr],a    ; fetch sprite input pointer
    ld a,[hl]
    ld [wSpriteInputPtr+1],a
    ld a, [wMonSpritesBank]
    jp UncompressSpriteData

I get the feeling that I've done something silly again. I apologize for my incompetence.

Offline

#17 2016-03-17 06:01:28

Fotomac
Member
Registered: 2015-10-25
Post 177/332

Re: A Tutorial for Adding New Pokémon in Pokered

...Now I'm stumped.

Offline

#18 2016-03-17 15:17:38

ShantyTown
Member
Registered: 2013-12-04
Post 264/344

Re: A Tutorial for Adding New Pokémon in Pokered

Can you link us to a diff of your changes? From what you've described, it sounds and looks correct.  One thing you might have accidentally done is not defining wMonSpritesBank directly after wMonHLearnset.  Before making the change, you'll notice how there is a "ds 1" directly after wMonHLearnset.  Basically, we're labeling that "ds 1" as wMonSpritesBank.  I'm guessing you did this:

wMonHLearnset:: ; d0cc
; bit field
    flag_array 50 + 5
    ds 1

 wMonSpritesBank:: ; d0d3
      ds 1

instead of the correct thing:

wMonHLearnset:: ; d0cc
  ; bit field
      flag_array 50 + 5
 
 wMonSpritesBank:: ; d0d3
      ds 1

If that's not the case, I would try using BGB's debugger to step through the UncompressMonSprite routine, and see what value register "a" is when it gets loaded from wMonSpritesBank.

Last edited by ShantyTown (2016-03-17 15:17:54)

Offline

#19 2016-03-19 20:07:41

TotesTim
Member
Registered: 2016-03-03
Post 6/12

Re: A Tutorial for Adding New Pokémon in Pokered

ShantyTown wrote:

Can you link us to a diff of your changes? From what you've described, it sounds and looks correct.  One thing you might have accidentally done is not defining wMonSpritesBank directly after wMonHLearnset.  Before making the change, you'll notice how there is a "ds 1" directly after wMonHLearnset.  Basically, we're labeling that "ds 1" as wMonSpritesBank.  I'm guessing you did this:

wMonHLearnset:: ; d0cc
; bit field
    flag_array 50 + 5
    ds 1

 wMonSpritesBank:: ; d0d3
      ds 1

instead of the correct thing:

wMonHLearnset:: ; d0cc
  ; bit field
      flag_array 50 + 5
 
 wMonSpritesBank:: ; d0d3
      ds 1

If that's not the case, I would try using BGB's debugger to step through the UncompressMonSprite routine, and see what value register "a" is when it gets loaded from wMonSpritesBank.

Sorry if this is a dumb question, but how exactly would I go about linking a diff of my changes? I'm assuming it has something to do with GitHub?

Also, it seems that wMonHLearnset is fine. My code is:

wMonHLearnset:: ; d0cc
; bit field
    flag_array 50 + 5

wMonSpritesBank:: ; d0d3
     ds 1

Offline

#20 2016-03-19 21:42:40

ShantyTown
Member
Registered: 2013-12-04
Post 268/344

Re: A Tutorial for Adding New Pokémon in Pokered

Type "git diff" and paste that here, if you don't have a repo on GitHub.

Offline

#21 2016-03-20 08:22:01

TotesTim
Member
Registered: 2016-03-03
Post 7/12

Re: A Tutorial for Adding New Pokémon in Pokered

All right, here it is.

diff --git a/constants/pokedex_constants.asm b/constants/pokedex_constants.asm
index 360fbb4..cec5d1c 100644
--- a/constants/pokedex_constants.asm
+++ b/constants/pokedex_constants.asm
@@ -151,5 +151,6 @@ const_value = 1
        const DEX_DRAGONITE  ; 149
        const DEX_MEWTWO     ; 150
        const DEX_MEW        ; 151
+       const DEX_MON152     ; 152

-NUM_POKEMON    EQU 151
+NUM_POKEMON    EQU 152
diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm
index 96d44ef..ac19dc7 100644
--- a/constants/pokemon_constants.asm
+++ b/constants/pokemon_constants.asm
@@ -30,7 +30,7 @@ const_value = 1
        const BLASTOISE    ; $1C
        const PINSIR       ; $1D
        const TANGELA      ; $1E
-       const MISSINGNO_1F ; $1F
+       const MON152       ; $1F
        const MISSINGNO_20 ; $20
:...skipping...
diff --git a/constants/pokedex_constants.asm b/constants/pokedex_constants.asm
index 360fbb4..cec5d1c 100644
--- a/constants/pokedex_constants.asm
+++ b/constants/pokedex_constants.asm
@@ -151,5 +151,6 @@ const_value = 1
        const DEX_DRAGONITE  ; 149
        const DEX_MEWTWO     ; 150
        const DEX_MEW        ; 151
+       const DEX_MON152     ; 152

-NUM_POKEMON    EQU 151
+NUM_POKEMON    EQU 152
diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm
index 96d44ef..ac19dc7 100644
--- a/constants/pokemon_constants.asm
+++ b/constants/pokemon_constants.asm
@@ -30,7 +30,7 @@ const_value = 1
        const BLASTOISE    ; $1C
        const PINSIR       ; $1D
        const TANGELA      ; $1E
-       const MISSINGNO_1F ; $1F
+       const MON152       ; $1F
        const MISSINGNO_20 ; $20
        const GROWLITHE    ; $21
        const ONIX         ; $22
diff --git a/constants/starter_mons.asm b/constants/starter_mons.asm
index 16de35d..308c9d4 100755
--- a/constants/starter_mons.asm
+++ b/constants/starter_mons.asm
@@ -1,3 +1,3 @@
 STARTER1 EQU CHARMANDER
 STARTER2 EQU SQUIRTLE
-STARTER3 EQU BULBASAUR
+STARTER3 EQU MON152
diff --git a/constants/type_constants.asm b/constants/type_constants.asm
index b36dc17..36865f8 100755
--- a/constants/type_constants.asm
+++ b/constants/type_constants.asm
@@ -7,6 +7,7 @@ GROUND   EQU $04
 ROCK     EQU $05
 BUG      EQU $07
 GHOST    EQU $08
+STEEL    EQU $09
 FIRE     EQU $14
 WATER    EQU $15
 GRASS    EQU $16
@@ -14,3 +15,5 @@ ELECTRIC EQU $17
 PSYCHIC  EQU $18
 ICE      EQU $19
 DRAGON   EQU $1A
+DARK     EQU $1B
+FAIRY    EQU $1C
diff --git a/data/baseStats/abra.asm b/data/baseStats/abra.asm
index 1a41bb5..119346d 100644
--- a/data/baseStats/abra.asm
+++ b/data/baseStats/abra.asm
@@ -25,4 +25,4 @@ db 3 ; growth rate
:

Offline

#22 2016-03-20 16:24:16

ShantyTown
Member
Registered: 2013-12-04
Post 269/344

Re: A Tutorial for Adding New Pokémon in Pokered

That's not the whole diff.  That's just the first page.  You can press the spacebar to scroll through the rest of the diff when running "git diff".

Offline

#23 2016-03-20 17:07:55

Danny-E 33
Administrator
Registered: 2012-06-09
Post 941/1,119

Re: A Tutorial for Adding New Pokémon in Pokered

Or use `git diff | clip` or `git diff | pbcopy` to put the contents of git diff directly in the clipboard.

Offline

#24 2016-03-20 18:48:57

TotesTim
Member
Registered: 2016-03-03
Post 8/12

Re: A Tutorial for Adding New Pokémon in Pokered

My bad. Here, I threw it onto Pastebin due to the amount of text.

http://pastebin.com/WaeV2cFf

Offline

#25 2016-03-20 22:17:58

ShantyTown
Member
Registered: 2013-12-04
Post 270/344

Re: A Tutorial for Adding New Pokémon in Pokered

Thanks. There's quite a lot there.  Could you also give examples of which pokemon sprites load and which ones don't?

I noticed that you've only updated the Bank(FrontPic) line for 149 pokemon.  Perhaps, you forgot to do it for the two that you happened to test?

Last edited by ShantyTown (2016-03-20 22:21:27)

Offline

Board footer

Powered by FluxBB