Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Create new trainers? [And other scripts] // updated: [2013-01-24]

#26 2012-12-19 14:32:38

Miksy91
Member
Registered: 2010-10-16
Post 1,344/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

Because I looked at your picture and then wrote it exactly like it was shown on your picture. Darn it! Now I have to start it all over from the beginning! Jippie! :D

Still I'm getting paranoid about the fact that yours is showing Blue "/" while mine is showing Cyan "##"'s everywhere. Maybe I shouldn't worry too much.

If you want to post another screenshot that shows all the numbers I will try and redo it all.

You don't necessarily have to start over from the beginning (yet that is not so much to write after all). You can also copy --> paste data with GoldFinger, under Edit you can find tools for this (Mark Select Begin --> End) + Copy Select + Insert.

And there are font and color setups for the program under Options menu too. You should be able to make the program look nicer by modifying some settings there.

Offline

#27 2012-12-19 18:36:55

Skurbert
Member
Registered: 2012-12-16
Post 17/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:
Skurbert wrote:

Because I looked at your picture and then wrote it exactly like it was shown on your picture. Darn it! Now I have to start it all over from the beginning! Jippie! :D

Still I'm getting paranoid about the fact that yours is showing Blue "/" while mine is showing Cyan "##"'s everywhere. Maybe I shouldn't worry too much.

If you want to post another screenshot that shows all the numbers I will try and redo it all.

You don't necessarily have to start over from the beginning (yet that is not so much to write after all). You can also copy --> paste data with GoldFinger, under Edit you can find tools for this (Mark Select Begin --> End) + Copy Select + Insert.

And there are font and color setups for the program under Options menu too. You should be able to make the program look nicer by modifying some settings there.

Well, It would be much simple in this case to just start from the first line where the first bytes were missing. Now It's just a total mess. Trying to fill in the gaps would just be confusing and I will certainly fail again. :(

Also, two quick questions:

1. If there's so much space left in the cartridge, then why didn't they (game makers) fill out kanto with more stuff? Time schedules?

2. The case of which the game is freezing. That is entirely because the pointer is not ending at the exact bytes that you mentioned before? Or COULD there be another reason? (maybe a stupid question... "how long is a rope?")

Offline

#28 2012-12-19 20:34:16

578/700

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

If there's so much space left in the cartridge, then why didn't they (game makers) fill out kanto with more stuff? Time schedules?

Yes, G/S was plagued by delays and rushed for release.

#29 2012-12-19 22:11:38

Miksy91
Member
Registered: 2010-10-16
Post 1,349/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

The case of which the game is freezing. That is entirely because the pointer is not ending at the exact bytes that you mentioned before? Or COULD there be another reason? (maybe a stupid question... "how long is a rope?")

Normally (I can't think of any other ways at the moment), the game freezing is caused by processor executing data in a way it's not supposed to.
For example when calling text data, some in-game code tells that the byte where the pointer leads must be one from 00, 01, ..., to 16. All of these have different effects though. For example, if you point to 01 instead of 00, the data following it should not be regular text data, instead a ram address should follow it for looking something there.

An occasion where this would be used is for example the following battle message:
"00 Enemy 50 01 [ram address1] 00 used 50 01 [ram address2] 00 !"
These 00's and 01's here are used for making the game load "text data" of types 00 (normal text) and 01 ("ram address").

If you think about it, this is much more efficient way of coding stuff instead of having dozens of checks for [ram address1] (= "pokemon") and [ram address2] (="move").

But back to the point, in this occasion the freezing occurs because you're not pointing to 00 with the text pointers. I actually couldn't pick up what you meant by "how long is a rope?" there. But to put it simply, pointers can be anything. If you're pointing to the rom bank you're working with, they're always something between 00 40 (4000) and FF 7F (7FFF) because this is how Gameboy works there. But if you want to point elsewhere (and here I don't mean in another rom bank, this is done with "3-byte pointers"), you can achieve that by changing the pointer somewhere between 00 00 and FF 3F or 00 80 and FF FF. These here are used for manipulating ram memory.

Last edited by Miksy91 (2012-12-19 22:15:21)

Offline

#30 2012-12-20 07:58:30

Skurbert
Member
Registered: 2012-12-16
Post 18/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:

Normally (I can't think of any other ways at the moment), the game freezing is caused by processor executing data in a way it's not supposed to.
For example when calling text data, some in-game code tells that the byte where the pointer leads must be one from 00, 01, ..., to 16. All of these have different effects though. For example, if you point to 01 instead of 00, the data following it should not be regular text data, instead a ram address should follow it for looking something there.

An occasion where this would be used is for example the following battle message:
"00 Enemy 50 01 [ram address1] 00 used 50 01 [ram address2] 00 !"
These 00's and 01's here are used for making the game load "text data" of types 00 (normal text) and 01 ("ram address").

If you think about it, this is much more efficient way of coding stuff instead of having dozens of checks for [ram address1] (= "pokemon") and [ram address2] (="move").

But back to the point, in this occasion the freezing occurs because you're not pointing to 00 with the text pointers. I actually couldn't pick up what you meant by "how long is a rope?" there. But to put it simply, pointers can be anything. If you're pointing to the rom bank you're working with, they're always something between 00 40 (4000) and FF 7F (7FFF) because this is how Gameboy works there. But if you want to point elsewhere (and here I don't mean in another rom bank, this is done with "3-byte pointers"), you can achieve that by changing the pointer somewhere between 00 00 and FF 3F or 00 80 and FF FF. These here are used for manipulating ram memory.

I Think I get this, but I can't do anything since your screenshot failed to give me all correct numbers. And reading from your others posts, It doesnt give me anything new to insert so I don't know what to write! Please post a new screenshot OR the full hex-numbers you want me to write.

Nice, good to know what those 3-bytes is for. I'm trying to understand what this "-rom-bank-thingy" is all about. I'm thinking about rOoms. One room stores one type of information. You tell the game to open the door and go into that room to find the information it needs. But if you tell the wrong room then it won't gather it, hence the game is freezing. Right? Just trying to memorize this for myself. The learning curve is huge here.

"you're not pointing to 00 with the text pointers". That line has been repeated in this thread and I STILL don't get it. Am I NOT pointing because I wrote the text wrong OR do I have to do something else in JohtoMap?

Offline

#31 2012-12-20 08:34:19

comet
Member
Registered: 2012-04-09
Post 61/672

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

banks are just shorthand for getting different chunks in the rom. the gameboy only has enough ram to have two banks loaded at a time. if you load a different bank it's going to contain data from a different location so it's not going to be what you want. when you start reading random data, Bad Things happen.

Offline

#32 2012-12-20 08:44:49

Miksy91
Member
Registered: 2010-10-16
Post 1,351/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

I Think I get this, but I can't do anything since your screenshot failed to give me all correct numbers. And reading from your others posts, It doesnt give me anything new to insert so I don't know what to write! Please post a new screenshot OR the full hex-numbers you want me to write.

Nice, good to know what those 3-bytes is for. I'm trying to understand what this "-rom-bank-thingy" is all about. I'm thinking about rOoms. One room stores one type of information. You tell the game to open the door and go into that room to find the information it needs. But if you tell the wrong room then it won't gather it, hence the game is freezing. Right? Just trying to memorize this for myself. The learning curve is huge here.

Yeah, the freezing occurs due to "that reason".
Rom banks are simply data sets, each being 0x4000 bytes long. You can't look for text data from another rom bank with an ordinary text pointer.
Like in that example, the rom bank starts at $128000, it has to end with $128000 + $4000 - 1 = $12BFFF. So if you tried for instance to look for text data from $12C100, you might assume you could set your text pointer to 00 81 (8100) but no, that wouldn't work.
Instead, this pointer wouldn't be pointing to a rom bank at all.

For refence:

0x128000 + 0x8100 - 0x4000 = 0x12C100 (but 00 81 isn't the pointer used for looking data starting at this offset)

Skurbert wrote:

"you're not pointing to 00 with the text pointers". That line has been repeated in this thread and I STILL don't get it. Am I NOT pointing because I wrote the text wrong OR do I have to do something else in JohtoMap?

Take a look at the "offset block" there and see what it shows when you're able to edit those 00's that are used for the text data (by rolling over the "blue block"/"mouse" above them).
Currently, your text datas start at $12A414 and $12A423 but with text pointers, you're making the game to look for them at $12A415 and $12A425 leading into game freezing (because now the first bytes of the text datas aren't 00's).

To fix things:
Write the text datas again in offsets $12A415 and $12A425 so that the first byte in those offsets is 00. The text data itself has to end with 57.
If you wanted to make a person say "ABC" when you talk to him, his text pointer would have to point to the following "structure":
00 80 81 82 57

For rest of the actual script data, starting at offset $124A0C starts the script data that is loaded after the battle ends.
In your image, you're missing one particular byte there, 3B.

How this works in your example:

talkaftercancel
loadfont
2writetext 0x5364
loadmovesprites
end

#org 0x129364
#raw 0xAC (you're pointing to this byte which is not 00, thus it would freeze here too)
#raw 0x7F
#raw 0xB3
#raw 0xA7
#raw 0xA4
#raw 0x7F
#raw 0xB2
#raw 0xA4
#raw 0xA2
#raw 0xAE
#raw 0xAD
#raw 0xA3
#raw 0x7F
#raw 0xAE
#raw 0xA5
#raw 0x4F
#raw 0xB2
#raw 0xA4
#raw 0xB5
#raw 0xA4
#raw 0xAD
#raw 0x7F
#raw 0xA2
#raw 0xA7
#raw 0xA8
#raw 0xAB
#raw 0xA3
#raw 0xB1
#raw 0xA4
#raw 0xAD
#raw 0xE8
#raw 0x57
= TUSCANY: Today is\nnot Tuesday. That\lis unfortunate[.]\e

While this is what it should look like:

talkaftercancel
loadfont
2writetext 0x643B
closetext
loadmovesprites
end

#org 0x129364
I was no match for you...

The "3B" missing between "4C" and "64" there makes a huge difference to the final result. 4C is a scripting command, in byte form (in PKSV, "2writetext"). It uses the two bytes following it as a text pointer. By missing that 3B, the game looks for the text pointer as "64 53" (as 53 is the closetext command but it is never run in your example due to 3B being not there) leading into "false" text data (starting with AC there).

If this 3B is put there like you see in example of mine, 4C is looking for text with pointer 3B 64 instead leading to the text data where "I was no match for you" was supposed to be written to (this text has to start with 00 just like anything else, so 00 has to be located at $12A43B). Not only that but now that the "53" there is a separate value (because 4C doesn't look for it, it only uses the two bytes following it), it can be used as it's own command ("closetext").
Again, "49" is a separate command ("loadmovesprites") and so is 90 ("end").

Last edited by Miksy91 (2012-12-20 08:51:05)

Offline

#33 2012-12-20 08:52:26

comet
Member
Registered: 2012-04-09
Post 62/672

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

basically, text has its own set of commands. command $00 prints the text immediately after it until it encounters a terminator ($50 merely stops printing, while $57 ends a text box). there are other text commands that can print things like the time of day or play a given sound. all text is formatted this way.

Offline

#34 2012-12-20 09:21:01

Skurbert
Member
Registered: 2012-12-16
Post 19/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Ok. Fair enough. I will add that 3B then. Will this ever gonna work for me!? :(

Another question. Can i change some simply numbers on existing trainers to be able to meet them again (like in this code). You said: Exiting the screen - Able to meet the trainer again when return. I will not bother with this now, just asking.

EDIT: IT WORKED! YOU GUYS ARE MY HEROES!!! :D

Now I'm gonna check if there are some bugs like, what happens if i deafeat the trainer and if it crashes when i fight him again, etc.

Thank you very much! I will write back soon. :D Miksy91, You should really make a tutorial for this. It would really help many newbies like me and life would be much easier. Do you have any sort of list somewhere for trainer numbers? Now I have cooltrainer. But what about trainers? Thanks a lot!

YES! There were glitches! When finished the battle, beating him, he says nothing (blank text space) and it stops as normal. Then I try to talk to him: GAME RESETS! So something is missing.

Screenshot:

RQf0E.png

Last edited by Skurbert (2012-12-20 09:55:03)

Offline

#35 2012-12-20 10:09:27

Miksy91
Member
Registered: 2010-10-16
Post 1,353/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Again the freezing is for the same reason, you're not pointing to 00's with the text pointers. And actually, you got lucky there that the battle just ends without no text being displayed, it could have freezed there as well. So adjust both text pointers (25 64) and (3B 64) point to text data.

Skurbert wrote:

Thank you very much! I will write back soon. :D Miksy91, You should really make a tutorial for this. It would really help many newbies like me and life would be much easier. Do you have any sort of list somewhere for trainer numbers? Now I have cooltrainer. But what about trainers? Thanks a lot!

YES! There were glitches! When finished the battle, beating him, he says nothing (blank text space) and it stops as normal. Then I try to talk to him: GAME RESETS! So something is missing.

There are pointer tutorials and trainer editing tutorials out there. Once you understand both, you can easily handle doing these kind of things.

Check out Global FAQ and Resource thread for Trainer Groups.

Last edited by Miksy91 (2012-12-20 10:11:26)

Offline

#36 2012-12-20 10:22:03

Skurbert
Member
Registered: 2012-12-16
Post 20/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:

Again the freezing is for the same reason, you're not pointing to 00's with the text pointers. And actually, you got lucky there that the battle just ends without no text being displayed, it could have freezed there as well. So adjust both text pointers (25 64) and (3B 64) point to text data.

Skurbert wrote:

Thank you very much! I will write back soon. :D Miksy91, You should really make a tutorial for this. It would really help many newbies like me and life would be much easier. Do you have any sort of list somewhere for trainer numbers? Now I have cooltrainer. But what about trainers? Thanks a lot!

YES! There were glitches! When finished the battle, beating him, he says nothing (blank text space) and it stops as normal. Then I try to talk to him: GAME RESETS! So something is missing.

There are pointer tutorials and trainer editing tutorials out there. Once you understand both, you can easily handle doing these kind of things.

Check out Global FAQ and Resource thread for Trainer Groups.

Yeees I know. Numbers missing. But it's hard to cherry pick all the numbers and insert them at the right place without a screenshot containing them all! :P

Also, where is the last number gonna end (with 57). 12a450? 12a451??

Offline

#37 2012-12-20 12:03:44

Miksy91
Member
Registered: 2010-10-16
Post 1,354/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

You can see it straight from my picture there; every line contains 16 (0x10) bytes so if the first line starts at 0x12A400, the sixth line (AE B4 75 57) starts at 0x12A450 --> 0x12A453

Of course the text data in your image there is missing every 16th letter due to you "copying" the hex data from my image. You could also try re-creating the whole thing for example starting at 0x12A460 and adjusting the script pointer of that person event pointing there.
Personally, it takes me under a minute filling out the whole code but that's pretty much because I can calculate pointers by head and remember the whole structure as well (by working with it so much in the past). So yeah, shouldn't take long to do so either.

But how it goes with adding completely new trainers, you also have to become familiar with pointers and pointer tables before being able to achieve that. So why I'm saying to create this thing from scratch is because you have to assimilate filling out trainer datas and editing them correctly before moving further in progress.

Last edited by Miksy91 (2012-12-20 12:09:31)

Offline

#38 2012-12-20 12:39:07

Skurbert
Member
Registered: 2012-12-16
Post 21/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:

You can see it straight from my picture there; every line contains 16 (0x10) bytes so if the first line starts at 0x12A400, the sixth line (AE B4 75 57) starts at 0x12A450 --> 0x12A453

Of course the text data in your image there is missing every 16th letter due to you "copying" the hex data from my image. You could also try re-creating the whole thing for example starting at 0x12A460 and adjusting the script pointer of that person event pointing there.
Personally, it takes me under a minute filling out the whole code but that's pretty much because I can calculate pointers by head and remember the whole structure as well (by working with it so much in the past). So yeah, shouldn't take long to do so either.

But how it goes with adding completely new trainers, you also have to become familiar with pointers and pointer tables before being able to achieve that. So why I'm saying to create this thing from scratch is because you have to assimilate filling out trainer datas and editing them correctly before moving further in progress.

I see. I'm getting lost all the time, I'm gonna tell ya! :D

For a "break" I ALMOST succeded in adding a new trainer to the game. The Bugcatcher at Route 30. I found his hex-values and "copyed" the codes into a new place. He talked like he should, fought me with his caterpies and lost, saying "Your too strong" blabla.. and then the battle ended.

SUDDENLY: "ERROR OPCODE at 8019". DAMN IT!

Also it's so haaaard separating the codes when looked at in the hex-editor. Everything is clumped together and I'm trying to separate all the codes. It's like I said before: A Jungle. That's why i want to separate all my new trainers with several rows of "00 00 00 00 00 00".

0KP2E.png

As you can see, there are codes clumped together in a rather confusing manner. This can be a pain, especially for a beginner like me. You said before to end the code with "57" and maybe "47" so I tried them all. You can tell by the red-painted boxes that I tried all of them, but all ended the same way: Error Opcode after the battle was finished.

This is devastating for ones health. I'm gonna end up on hospital for stress-related symptoms lol.

Last edited by Skurbert (2012-12-20 13:12:32)

Offline

#39 2012-12-20 15:42:52

Miksy91
Member
Registered: 2010-10-16
Post 1,355/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

Also it's so haaaard separating the codes when looked at in the hex-editor. Everything is clumped together and I'm trying to separate all the codes. It's like I said before: A Jungle. That's why i want to separate all my new trainers with several rows of "00 00 00 00 00 00".

To be able to handle this, you'll have to learn to "read the code", think about what each byte there means.
The two first bytes are the Bit Number, the next two bytes determine the trainer you fight, the next two bytes define the 1st text to load, the next two bytes define the 2nd text to load, the next two bytes have to be set to 00 and the next two bytes define where "after-battle" script data is located. And after going through all of this code byte by byte, I would have no trouble seeing where this script code ends.

Personally, I don't watch the code "too far if I don't have to". And the thing that may be confusing you the most is actually lack of understanding of pointers. Until you can count pointers on your head, it'll be hard to keep up with code such as trainer data.


Skurbert wrote:

As you can see, there are codes clumped together in a rather confusing manner. This can be a pain, especially for a beginner like me. You said before to end the code with "57" and maybe "47" so I tried them all. You can tell by the red-painted boxes that I tried all of them, but all ended the same way: Error Opcode after the battle was finished.

This is devastating for ones health. I'm gonna end up on hospital for stress-related symptoms lol.

"57" is a byte/command that is used for telling the game: "don't display any more text data".
"90" is a scripting command used for ending all main-/ and subscripts (for scripts of Type 0) (and the pointer to "after-battle script data" actually points to a script data of Type 0 and so 90 is used for ending that script data)

The actual reason for "Error Opcode" after battle in this situation is that where there should be 00 00 after two text pointers, you've got another 89 57. And if you took it out (by moving all the other data two bytes backwards), the last part of the code would actually never be executed (as the "after-battle" script data pointer is set to 73 55, leading to 0x129573 where the original script data is located).


Anyway, I'd advise you to check out my video tutorials in youtube (linked to this site too). Others around have said they've helped to understand some things a lot better. If you do that, you should actually start watching them already from the beginning (part 1) although the first part may not be that helpful. Once you get the hang of stuff explained in parts 1 to 6 or so, you should have gained the "needs" to learn how these kind of stuff really works too.

Last edited by Miksy91 (2012-12-20 15:44:35)

Offline

#40 2012-12-20 15:59:25

Skurbert
Member
Registered: 2012-12-16
Post 22/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Again, Miksy91, Thank you for your help. I think I'm about to get this stuff now. It will take some time to learn all the pointers but I guess it would be handy to do it.

I will definitely take a look at them! Video tutorials are always helpfull. I can't belive I missed that, I was actually surfing this forum for a solutions to this problem. I never thought I was gonna start hex-editing again.


The Code: It works! But there's one obstacle: Once that trainer is defeated, the other bug catcher, i.e. the one i copyed that code from will, not challenge me. Any simple/quick way to bypass that? I mean, be able to challenge both and not only each of them.

EDIT. 07 00 did the trick! hah! I'm learning! Am I not?? Well, It's not the best solution, but it works. But what's the reason for the other trained on the map not to challenge me? There should be another way to bypass it (tedious to go challenge the trainer again just because you accidently walked out of the area).

Last edited by Skurbert (2012-12-20 16:43:52)

Offline

#41 2012-12-20 16:56:43

Miksy91
Member
Registered: 2010-10-16
Post 1,357/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

Again, Miksy91, Thank you for your help. I think I'm about to get this stuff now. It will take some time to learn all the pointers but I guess it would be handy to do it.

I will definitely take a look at them! Video tutorials are always helpfull. I can't belive I missed that, I was actually surfing this forum for a solutions to this problem. I never thought I was gonna start hex-editing again.

No problem at all :)


Skurbert wrote:

The Code: It works! But there's one obstacle: Once that trainer is defeated, the other bug catcher, i.e. the one i copyed that code from will, not challenge me. Any simple/quick way to bypass that? I mean, be able to challenge both and not only each of them.

EDIT. 07 00 did the trick! hah! I'm learning! Am I not?? Well, It's not the best solution, but it works. But what's the reason for the other trained on the map not to challenge me? There should be another way to bypass it (tedious to go challenge the trainer again just because you accidently walked out of the area).

Each trainer has its own Bit Number. This is used for checking a value of the "numbered" bit in ram.
If your Bit Number is set to 38 05 like in that example picture, the 0x538th (38 05 --> 05 38 --> 538) bit of a bittable is set (changed to 1, bits can be either 0 or 1) when the trainer is beaten. When you talk another trainer using its Bit Number as 38 05, the same effect will take place, "you've beaten him already".

Bit Numbers are explained elsewhere on the board as well, actually: http://hax.iimarck.us/topic/238/

Last edited by Miksy91 (2012-12-20 16:58:22)

Offline

#42 2013-01-19 15:00:01

Skurbert
Member
Registered: 2012-12-16
Post 24/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Okay. I'm stuck again. I think i have trouble with the repointing.

I redid everything you said in this thread and created the code from scratch. I have learned a lot since and can change trainer types and stuff. This time I "repaired" the code that i wrote wrong before, but this time i had created a new trainer and used another spot. Instead of 12a580, I used adress 12a680.

When I face the trainer. Everything went smooth. He says: "A battle yes?" and the fight goes on. But when he is defeated he says NOTHING and the fight ends. Something is wrong there. And then i try to talk to him again. The game restarts.

So I GUESS there are some pointers that are written incorrectly. I have a slight suspicion that changing from 12a580 to 12a680 is conflicting with the "3B 64"-pointer. Should I change this pointer and how? Because I don't know how and why they should be just "3B 64". What converter should I use for this?

I'm just very confused right now. It's not working and I don't know why and how to fix it.. :(


Also: Is it possible to extend the amount of money the player can hold? I asked this before and it's of real interest if the player is bored and wants to collect money instead of training. I want the players mom to be the "Bank" - The player should be able to hold 9,999,999 and the mother 999,999,999. Is this possible? Quick guess: The money is stored in one byte.

Last edited by Skurbert (2013-01-19 15:13:29)

Offline

#43 2013-01-19 15:15:50

Miksy91
Member
Registered: 2010-10-16
Post 1,454/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Happened to notice this right away after you posted it...

Anyway, it seems that you have indeed pointed to the data right, the script pointer should be 80 66 (or 6680 shown with Johtomap there).
The beginning of the script ought to work too but after the text pointer to "A battle yes?", you've got something wrong there.
The data should follow with the text pointer to the text after battle (which you've written wrong obviously) along with a pointer to the script executed if the person is talked to again. This script pointer may not lead into script data at all. If it does, the script data is somehow "messy" and leads into game freezing.

All you've gotta do is fix the pointers to point to text (text pointer should point to byte 00 followed with "normal text data") and script data pointer should point to "65 + script data" (in which 65 there is "talkaftercancel" command).

As example;

0x12A680
07 00 11 01 A0 66 A5 66 8A 66

0x12A68A
65 47 4C AA 66 53 49 90

0x12A6A0
00 80 81 82 57 "ABC"

0x12A6A5
00 A0 A1 A2 57 "abc"

0x12A6AA
00 96 A7 AA B3 E6 57 "What?"

Last edited by Miksy91 (2013-01-19 15:17:19)

Offline

#44 2013-01-19 15:23:50

Skurbert
Member
Registered: 2012-12-16
Post 25/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Yes, Miksy, Your right and I'm still having huge troubles with pointers and trying to understand how to decode them and stuff. I actually checked the text, like 1000 times and tried different pointers but same result everytime.

Now I understand since 80 66 makes perfectly sense! I'm gonna tweak around with the codes and see what I can get. Actually, writing text is kinda simple, but repointing/calculating stuff is always confusing :S

Next step for me (If I get this to work) is to create a new trainer totally from scratch, no tutorials, no copy/paste, everything all from scratch. I will update about this.


EDIT: Screenshot (taken before I asked for help):

OYfwnGT.png

Last edited by Skurbert (2013-01-19 15:40:50)

Offline

#45 2013-01-19 22:53:03

Miksy91
Member
Registered: 2010-10-16
Post 1,455/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

What your trainer script does;

1) Uses bit number of the trainer as 0700
2) Uses trainer 24 01 for the battle
3) Displays text from offset 0x12A415
4) Displays text from offset 0x12A425 when the battle ends
5) Executes script data at offset 0x12A40C after the battle

In other words, none of the pointers match to the text data following the trainer's script. And 0C 64 leads to 0x12A40C like I said there, it should probably be 8C 66 by taking a look at the picture you've got there (because you've inputted the script data starting at offset 0x12A68C).

Even after fixing all this, the game will freeze after talking to the trainer again, simply because the "after battle text pointer" (or in other words, the two bytes following 4C there which are currently 3B 64) doesn't point to the right text data either.


Calculating pointers isn't that hard;
The start offset of every rom bank is a multiply of 0x4000. In this case, the rom bank begins at 0x128000 because that is a multiply of 0x4000 (so would be 0x120000, 0x124000 and 0x12C000).

To see where for example 2A 7B would lead, you'd do the following "operations":
0x(7B2A - 4000) = 0x3B2A
0x128000 + 0x3B2A = 0x12BB2A // done

Last edited by Miksy91 (2013-01-19 22:56:32)

Offline

#46 2013-01-20 02:06:31

Skurbert
Member
Registered: 2012-12-16
Post 26/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Lesson learned! I understand the concept of pointers better now and I finaly got it to work. The first thing I did wrong, like you said, it pointed completely wrong so i looked at the adress and then calculated it. Then I tried it. It worked and the game didnt freeze. Howerever, the trainer said something like "0f3hf030fgk" so what I did was to recalculate to $12A6a5 instead of $12A6a6. It worked!

But I gotta tell you I had to read your text about 1000 times to understand, but it was totally worth it! What confused me first, was the fact that i tried to convert  Pointer to Offset instead of Offset to Pointer.

Great!! Another thing: Is it a possibilty to create a "random text" when facing a trainer? Or is that a very complicated process that might f-up the game?

Quick Question: The "A Battle, Yes?" which are the pointer to that code?

"I was not match for you" = BB 66
"My pokemon fought well" = A5 66
"A Battle, Yes?" = ????

The code works. But if i want to create a new trainer I will have to repoint it and want to know which numbers to change. I tried to figure out, I could see the other pointers but the third one doesnt make sense. It works NOW but it won't work if used on another trainer. I Suspect it is the "15 64" but I could be wrong?

[07 00] [24 01] 15 64 [BB 64] 00 00 [8C 66] 65 47 4C [A5 66] 53 49 90

Etc.. Etc..

Last edited by Skurbert (2013-01-20 05:23:17)

Offline

#47 2013-01-20 14:39:11

Miksy91
Member
Registered: 2010-10-16
Post 1,456/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Yes, the pointer to that text string is 15 64 leading to 0x12A415. You have the same text string obviously written there as well.

Practically, it would be possible to make every encountered trainer say random text (chosen from some list of text strings) but this would be assembly work. There is a text-in-code for calling asm routines during text so you'd obviously wanna use that.
I have never done that and don't think it would be worthy of doing though.

But remember, text data starts normally with 00 and that's where you've got to point to. Script data after the battle often starts with 65 but can be any other scripting command as well. Like I said before, 65 is "talkaftercancel" command.

Good to hear you've got it working though, and learned what I tried to point out there :)

Last edited by Miksy91 (2013-01-20 14:40:29)

Offline

#48 2013-01-21 14:24:29

Skurbert
Member
Registered: 2012-12-16
Post 28/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Yeah, I'm making progress slow but steady. I can actually solve some problems by myself now and think more logical when I'm stuck. This was out of question before. Your help has indeed been very helpfull!!

Bad news though...

I can't get the "talkaftercancel"-command ("My pokemon fought well"..) to work, I have written codes to several trainers, and everything goes smooth, until I'm trying to talk to the trainer again. It still says "My pokemon fought well" even though i repointed it to my new text!! I tried EVERYTHING. I changed a lot and tested it like 1000 times but everytime i tested it and the battles ends it says "ERROR OPCODE", I even tried to follow your example and change 00 to 65 and then the battle ends BUT freezes when i try to talk to the trainer again. I also tried to write 00 65 00, 65 00, 00 65 and only 65 but NOTHING works. Also, As an experiment I tried to repoint to that nugget-bridge-line "I did my best, i have no regrets". That was also a total fail.

The code is very messy atm and looks something like this:

[07 00] [24 01] [15 64] [BB 64] 00 00 [8C 66] 65 47 4C [A5
66] 53 49 90 00 00 ..etc ..etc..

What I'm trying to repoint to:

$12a715 (15 67)


What am I doing wrong this time?


(Note that i do manage to get every trainer to say different stuff and with different types of pokemon, etc, except for that "My pokemon fought well"-line so it's not a DISASTER, but it's still very frustrating to have EVERY trainer to say that line after a battle and don't know how to correct it..)

The code needs to be "stripped" right? From what I've learned from your tutorials, the code should end after that 8C 66 so why is it so messy now? Am I missing something? Should I try and put 65 before [8C 66] and then delete the rest?

Last edited by Skurbert (2013-01-21 14:32:20)

Offline

#49 2013-01-21 15:34:34

Miksy91
Member
Registered: 2010-10-16
Post 1,457/2,306

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Go here: http://hax.iimarck.us/files/scriptingco … ventaufbau

You'll see that every person event using its Type as 02 has its script pointer point to "Trainer" script structure:

[Bit no. (2byte)][Trainer group][Trainer][2byte pointer to Text when seen][2byte pointer to text when trainer beaten][2byte pointer to script when lost (0000=Blackout)][2byte pointer to script if won/talked to again]

The two byte pointer in the end points to script data, not text.
That data can be practically anything you'd want it to be!

Like you can see in that document (http://hax.iimarck.us/files/scriptingco … tm#marke65), 65 is mentioned as "Script talk-after-cancel" command and that's why I told you to make that the [2byte pointer to script if won/talked to again] lead to script data starting with 65. But it can lead to any other byte as well, you have to know what you're doing though unless you want every person event to just say something and make the script end.

An easy way of making a person event just say something is to make [2byte pointer to script if won/talked to again] lead to:
65 47 4C xx yy 53 49 90

xx yy is a just text pointer for displaying text (which is related to scripting command 4C there).

47 = "loadfont"
4C xx yy = Display text, xx yy = text pointer
53 = wait for A button to be pressed before closing text box
49 = make person events able to move
90 = end the script data to return to gameplay

Last edited by Miksy91 (2013-01-21 15:38:01)

Offline

#50 2013-01-21 15:48:46

Skurbert
Member
Registered: 2012-12-16
Post 29/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Great link! And good explanation:  I understand this much better now.

I will try this out.

EDIT: IT WORKS!!! Yay!



Quick question: How does the trainers on the "Fast Ship" works? They do not let you fight them again when you've left the room, but when you board the ship the next time, you will be able to challenge them again. This could be useful!

Last edited by Skurbert (2013-01-21 16:09:08)

Offline

  • Index
  • → Help/Question
  • → Create new trainers? [And other scripts] // updated: [2013-01-24]

Board footer

Powered by FluxBB