Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-10-01 13:24:53

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

Naming another character

Compatibility: Gold (U), Silver (U)

I figured out a way to make use of "name your mother" code making it possible to give a name to another main character! After implementing this "hack" in your game, the game still asks what should your mother's name be and display her walking sprite there but those can be easily dealt with. Anyway, let's begin!

First of all, we're dealing with rom bank 0x4 ($10000 - $13FFF) here so you're going to have to use some space in that rom bank for adding this new code in. I'm going to use my own code as an example which isn't in implemented in the most logical way but whatever - you can do the stuff in a different way if you want to.

I'm not going to explain here throughly, why you do things I've told you to do but in case you're interested to know, you might as well ask in this thread. Anyway, following, is a step-by-step tutorial in making this work:

Write the following code in 0x13EE0.

06 03 11 C0 DE CD F5 7E 21 C0 DE 11 00 7F CD B9 2F C9

and this in 0x13EF5.

CD 93 2F CD 70 7E C9

Next, copy all the data from 0x11AAD - 0x11AF8 to 0x13E70.

Write this code to offset 0x13EBC (following all that copied data).

3E 03 CD 0E 5B CD 4C 34 CD A9 14 CD 46 35 CD AD 5F C9

Almost done!
Finally, replace these bytes with the ones following them in offset 0x13E8F.

E4 5A --> A7 7E

Now, the routine is complete but one thing you still wanna do would be writing the name game chooses for this character by default if (s)he isn't given a name. Write this name in 0x13F00 and put "50" after the name.


Finally, after finishing all these steps, this is practically how to put your code in use:

1) Make a script which calls an assembly code in offset 0x13EE0 (0E 04 E0 7E). This executes the assembly routine you just wrote (in "byte-form"), and in game, you'll notice you're able to rename your mother. After you give her a name, her name is stored in ram address $DEC0 (which is supposed to be unused part of ram). You can choose the ram address yourself by changing the two pairs of bytes in the code starting at 0x13EE0. It's recommended that you actually use ram address $D1A3 instead (look for more info below related to what Tauwasser explained there).

2) To be able to refer to this character in text, you'll have to use text-in-code "01". A text sentence with an example of the usage of this code is for example located in 0x10167F. In this code, F6 CA is the ram address rotated backwards so if you wanted to say instead, "Wild [$DEC0] is eating!", you'd replace those F6 CA with C0 DE.


Original routine (Silver (U))

03:43F7
ld b, $02 (Which picture to show?)
ld de, $D1B9 (Ram address to write the name of the rival)
ld a, $04
ld hl, $5AA3
rst $8 (Continue executing code at 04:5AA3)
ld hl, $D1B9 (Ram address to write the name of the rival)
ld de, $440C (Pointer to default name of rival)
call $2FB9
ret

04:5AA3
call $2F93
call $5AAD
call $2C53
ret

04:5AAD
ld hl, $C5D0
....
call $5AE4
...
ret

04:5AE4
call $3449
...
ld a, $E3
ld $FF40, a
call $5B09
call $344C
call $14A9
call $3546
call $5FAD
ret

04:5B09
ld a, $C5D4
and a, $07
ld e, a
ld d, $00
ld hl, $5B1A
add hl, de (=add hl, a)
add hl, de (= add hl, a)
ldi a, [hl]
ld h, [hl]
ld l, a
jp hl

04:5B1A
2A 5B
79 5B (Pointer to asm related to naming Hiro)
97 5B (Pointer to asm related to naming Rival)
B8 5B (Pointer to asm related to naming Mom)

And this is what you're calling with code 0E 04 E0 7E through a script.


04:7EE0
ld b, $03 (Which picture to show?)
ld de, $DEC0 (Ram address to write the name of mom)
call $7EF5
ld hl, $DEC0 (Ram address to write the name of mom)
ld de, $7F00 (Pointer to default name of mom)
call $2FB9
ret

04:7EF5
call $2F93
call $7E70
ret

04:7E70
ld hl, $C5D0
....
call $7EA7
...
ret

04:7EA7
call $3449
...
ld a, $E3
ld $FF40, a
ld a, $03
call $5B0E
call $344C
call $14A9
call $3546
call $5FAD
ret

04:5B0E
ld e, a
ld d, $00
ld hl, $5B1A
add hl, de (=add hl, a)
add hl, de (= add hl, a)
ldi a, [hl]
ld h, [hl]
ld l, a
jp hl

04:5B1A
2A 5B
79 5B (Pointer to asm related to naming Hiro)
97 5B (Pointer to asm related to naming Rival)
B8 5B (Pointer to asm related to naming Mom)

As you can see, the codes are very similar with one another. Compare for yourself:

03:43F7 --> 04:7EE0
04:5AA3 --> 04:7EF5
04:5AAD --> 04:7E70
04:5AE4 --> 04:7EA7

Last edited by Miksy91 (2012-10-23 16:06:00)

Offline

#2 2012-10-01 14:16:54

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,611/3,578

Re: Naming another character

This is pretty cool Miksy. Aught to come in handy in the future.

Offline

#3 2012-10-01 17:05:57

Tauwasser
Member
Registered: 2010-10-16
Post 303/452

Re: Naming another character

Your way is very complicated...

First of all: There is already a text code to call your mother's name. It should be 0x49, which reads from D1AE, where the name should be stored.

Which leads to my second point: You should not need to copy half the routine to name your mother. Naming the mother is possible simply by using it 0x03 and using D1AE as destination above.

An example can be found at 03:43F7, which is the code to name the rival (0F-code 0x24). It calls the naming routine and makes sure the name is not all blanks afterwards.

As long as you disable the DUDE event that shows you how to catch a pokemon after you named your mother (before is fine), you will be alright.

cYa,

Tauwasser

Last edited by Tauwasser (2012-10-01 17:08:18)

Offline

#4 2012-10-01 17:38:28

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,613/3,578

Re: Naming another character

Couldn't you also set it so that the DUDE script stores your name somewhere else in RAM? Like the areas that default to RED and GREEN and are unused so far as I know?

Offline

#5 2012-10-01 18:01:48

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

Re: Naming another character

Mateo wrote:

This is pretty cool Miksy. Aught to come in handy in the future.

Thanks :)

Tauwasser wrote:

Your way is very complicated...

First of all: There is already a text code to call your mother's name. It should be 0x49, which reads from D1AE, where the name should be stored.

Which leads to my second point: You should not need to copy half the routine to name your mother. Naming the mother is possible simply by using it 0x03 and using D1AE as destination above.

An example can be found at 03:43F7, which is the code to name the rival (0F-code 0x24). It calls the naming routine and makes sure the name is not all blanks afterwards.

As long as you disable the DUDE event that shows you how to catch a pokemon after you named your mother (before is fine), you will be alright.

cYa,

Tauwasser

Well, I would have done it another way if I knew how. I didn't know whether ram area after D1AE would be usable or not, and besides, you've described text codes 00 - 16 in the scripting compendium and I haven't taken a look at how they work so I didn't assume there to be any more than those either. And yeah, I pretty much discovered this way by first finding the code in 03:43F7 and taking wanted parts of it to form the way I described here.

Doing it the way you explained is probably a better idea for hacks overall but I just realized myself that for instance I couldn't use it in my own hack as catching tutorial can be gone through over and over again. If I didn't do the following...

Mateo wrote:

Couldn't you also set it so that the DUDE script stores your name somewhere else in RAM? Like the areas that default to RED and GREEN and are unused so far as I know?

Sure, bytes "AE D1" can probably be found in the same bank as DUDE's name according to what Tauwasser pointed out earlier.

Last edited by Miksy91 (2012-10-01 18:05:17)

Offline

#6 2012-10-02 16:55:33

Tauwasser
Member
Registered: 2010-10-16
Post 304/452

Re: Naming another character

Sorry, with text code I meant a regular code inside a 0x00 in-text code region.

Of course you can use another RAM area for the DUDE, too. There is actually possibly space at 0xC000, which seems to be reserved for stack area. I have never seen the stack grow that far and most of the hacks I worked on used 0x30-0x40 bytes of that for other purposes without any effect.

Also, I didn't mean to belittle your work. I just found it difficult to follow overall with just the hexadecimal in there. Maybe you should have posted the code alongside it?

cYa,

Tauwasser

Offline

#7 2012-10-02 17:30:33

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

Re: Naming another character

Tauwasser wrote:

Sorry, with text code I meant a regular code inside a 0x00 in-text code region.

Wouldn't 52 and 53 also be "in-text-codes" (although they belong to 0x00 in-text-code) ?

Tauwasser wrote:

Also, I didn't mean to belittle your work. I just found it difficult to follow overall with just the hexadecimal in there. Maybe you should have posted the code alongside it?

To tell you the truth, I haven't explored it enough to say for sure that it doesn't do anything unwanted but all of the code listed above is similar to that of called within "name your rival" code (0F 24 00). It's not worth listing what the copied code between 0x11AAD - 0x11AF8 does (because I really don't know how it works) but after it, two new bytes (3E 03) have been added between the command ending at 0x11AF8 and the call command (CD 0E 5B). This is used to load register with value 03 and calling part of the same routine that is called during the script when giving a name to your rival excluding checking which person the name is being given to (loaded in a); player, rival or a box.

Replacing E4 5A with A7 7E is actually related to the same thing but I can't remember what it actually accomplishes without checking it out. It's part of a jp or a call command though. In 0x13EE0 you'll also find a "routine" similar to that of related to naming your rival. I also don't remember how this actually works but it's got the load commands to hl and de with the ram address to write the name to and the rom address where the default name is stored.

But yeah, posting a code alongside the hexadecimal changes is a good idea so I'll probably get it done soon (maybe right away).

Edit:
There is an explanation up above.

Last edited by Miksy91 (2012-10-02 18:19:49)

Offline

#8 2012-10-02 22:46:32

Tauwasser
Member
Registered: 2010-10-16
Post 305/452

Re: Naming another character

Miksy91 wrote:

Wouldn't 52 and 53 also be "in-text-codes" (although they belong to 0x00 in-text-code) ?

Back then, all what we had as a starting point was that all "text pointers" point to 0x00 [text]... So naturally, the set of codes that starts text were called in-text codes by me (because they would appear in front and inside text, such as when using 0x01 to print a memory location). Basically, most of these codes do produce text (with exceptions such as 0x16), so it's prudent to call them that in my opinion.

The regular printing code (around 0x0F54), which is executed using in-text code 0x00 as well as when other in-text codes such as when 0x01 actually prints text, is of course using its own control characters, such as 0x49 for the name of the hero's mother or 0x56 and 57 to end text, others to do line feeds and clear the text box etc. That's how I see it anyways.

Miksy91 wrote:

But yeah, posting a code alongside the hexadecimal changes is a good idea so I'll probably get it done soon (maybe right away).

That's cool. I think the benefit is definitely there for other users.

cYa,

Tauwasser

Offline

#9 2012-10-23 16:02:52

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

Re: Naming another character

By experimenting, I noticed that the name of the main character is stored in $DE7D every time you get challenged by another trainer. So I "fixed" the tutorial a little bit. Anyway, as Tauwasser said before, if you use this code and DUDE's script cannot be activated after being able to name this third main character, use ram address D1A3 instead of DEC0 like I advised above.

Last edited by Miksy91 (2012-10-23 16:04:01)

Offline

#10 2015-02-22 11:21:32

Rocket Grunt
Member
Registered: 2014-12-27
Post 38/75

Re: Naming another character

Hey may I ask how to change the moving sprite of the box asking your mother's name?
And just to confirm: should we change the text "MOTHER'S NAME?" in 0x011BCB?


Today I won't steal Pokemon

Offline

#11 2015-02-22 13:45:04

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

Re: Naming another character

Rocket Grunt wrote:

Hey may I ask how to change the moving sprite of the box asking your mother's name?
And just to confirm: should we change the text "MOTHER'S NAME?" in 0x011BCB?

I don't know where it picks up the sprite from but unless you want to change that for some reason, you can just modify the sprite of mother by editing it with TLP.
Yep.

Offline

#12 2015-02-24 12:27:24

Rocket Grunt
Member
Registered: 2014-12-27
Post 41/75

Re: Naming another character

I have a big problem about this tutorial, after I did all the things you mentioned here, the box will immediately pop up after the game begins asking for "Mother's Name". I don't know if there's any mistake or I messed up something?

EDIT: And the box won't go away even if you have set your mother's name.

Last edited by Rocket Grunt (2015-02-24 12:44:09)


Today I won't steal Pokemon

Offline

#13 2015-02-24 13:58:41

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

Re: Naming another character

Rocket Grunt wrote:

I have a big problem about this tutorial, after I did all the things you mentioned here, the box will immediately pop up after the game begins asking for "Mother's Name". I don't know if there's any mistake or I messed up something?

EDIT: And the box won't go away even if you have set your mother's name.

Double-check that what you have written actually matches the code of mine here.
If it does, there is some bug about this but there shouldn't be. Especially since I think I have used this just the way it's described here in DE as well.

One handy tool for checking it out is Gameboy ASM editor. You can compare your code with that to the asm instructions that the byte code refers to (the asm instructions are in the main post as well inside "Code" tags).

Last edited by Miksy91 (2015-02-24 13:59:54)

Offline

#14 2015-02-25 05:29:47

Rocket Grunt
Member
Registered: 2014-12-27
Post 42/75

Re: Naming another character

I counter-checked about it several times with both hex editor and ASM editor, and I am pretty sure I did exactly the same as yours. But the problem is still there.

EDIT: I actually re-do it in a clean rom and it works fine. I figure out that Koolboyman's Running Shoes is incompatible with this tutorial. I mean, he is using the same free rom space as you, so maybe it would be better to place the codes before or after the Running Shoes code. Anyway thank you very much.

Last edited by Rocket Grunt (2015-02-25 12:18:53)


Today I won't steal Pokemon

Offline

#15 2015-02-25 20:41:46

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

Re: Naming another character

Rocket Grunt wrote:

I counter-checked about it several times with both hex editor and ASM editor, and I am pretty sure I did exactly the same as yours. But the problem is still there.

EDIT: I actually re-do it in a clean rom and it works fine. I figure out that Koolboyman's Running Shoes is incompatible with this tutorial. I mean, he is using the same free rom space as you, so maybe it would be better to place the codes before or after the Running Shoes code. Anyway thank you very much.

You're welcome.
But yeah - it's easy to make this compatible with Running Shoes hack by KBM. All you have to do is to indeed place code in free space and adjust the pointers properly.

Offline

Board footer

Powered by FluxBB