Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#101 2011-02-25 17:18:26

Miksy91
Member
Registered: 2010-10-16
Post 297/2,311

Re: Noob trying to hack Crystal (Help)

You could for example take a look at the script of "Theresa" in my dark future hack (she's the only trainer you face in the demo).
The script is at: 0x182D2A

Oh, and use PKSV by the way...
Also, after the battle, the win/loss text is load from the same bank as the event data structure of that map is located (aka, the bank where the data of that people event is).


Battle with Theresa is a normal people event - these kinds of events in g/s/c are various team rocket executive and gym leader battles).
The trainers you encounter, that walk towards you, are trainer events and have their own structures.
And, the script you're trying to accomplish to do is also a normal people event script.

Last edited by Miksy91 (2011-02-25 17:20:04)

Offline

#102 2011-03-02 23:39:13

Riverside
Member
Registered: 2010-12-12
Post 43/55

Re: Noob trying to hack Crystal (Help)

Tauwasser wrote:

You're probably looking at a Trainer Event. Trainer Event Script Pointers point to a pre-defined structure instead of an actual script. See the compendium's info on events.

Do you mean this part?

Color|Function:

[...]

02 = Trainer: scriptpointer points to this 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 bit no. tell the game later on if the trainer has been beaten already (bit = 1) or not (bit = 0). All Bit no. of BitTable1.

In other words, in the [color/function] byte I use 02 instead of 00 (which it's what I've been using so far for people) and in the script pointer I use that structure

Miksy91 wrote:

You could for example take a look at the script of "Theresa" in my dark future hack (she's the only trainer you face in the demo).
The script is at: 0x182D2A

I'll check it out later...

Oh, and use PKSV by the way...

I downloaded it, but I don't know how to use it yet... seems more complicated than hex.

Battle with Theresa is a normal people event - these kinds of events in g/s/c are various team rocket executive and gym leader battles).
The trainers you encounter, that walk towards you, are trainer events and have their own structures.
And, the script you're trying to accomplish to do is also a normal people event script.

Ok, but one question: So if it's a "normal people event" instead of a "trainer event" (like every regular trainer), does that means that in the [color/function] byte in the event structure I have to use 00 instead of 02?

Last edited by Riverside (2011-03-02 23:54:46)

Offline

#103 2011-03-09 05:36:31

Riverside
Member
Registered: 2010-12-12
Post 44/55

Re: Noob trying to hack Crystal (Help)

Ok, for the moment I'll not do the trainer battle thing because I really havent had enough time to look for it deeper.

What I want to do now it's to activate a trigger event ONLY after you do certain task (after you get your first Pokemon)

I tried looking in other trigger events that also activate after you do some stuff (like the rival encounter in Cherrygrove, you need to get the call from Elm before you can activate that trigger event) but I couldn't find a clue of what should I do in order to do that. Any ideas? I tried using code 31 and 09 but they haven't been working, unless I did something wrong.

Offline

#104 2011-03-11 17:35:57

Miksy91
Member
Registered: 2010-10-16
Post 303/2,311

Re: Noob trying to hack Crystal (Help)

Couldn't get here earlier but finally, I'm about to answer a few guestions :D

Color/Function byte has to be set to 0xY0 (where Y defines the palette and 0 that the event script is a normal people event).
Then, just point the script to the wanted location and use scripting codes (in Gold/Silver) : 5D, 5E, 5F and 63 to accomplish with the script.

See here (code 5B):
Loads trainer data when HIRO is in a trainer’s range of sight.

I don't remember how the structure for "normal" route trainers work but they use this code.
Instead of it, you're going to have to use code 5D.

Offline

#105 2011-03-22 04:08:43

Riverside
Member
Registered: 2010-12-12
Post 45/55

Re: Noob trying to hack Crystal (Help)

Sorry for not logging in many days... stuff happens.

Btw, I solved that problem I had before (how to make it so one trigger event is active just once after certain event while the others are active everytime)

Miksy91 wrote:

Couldn't get here earlier but finally, I'm about to answer a few guestions :D

Color/Function byte has to be set to 0xY0 (where Y defines the palette and 0 that the event script is a normal people event).
Then, just point the script to the wanted location and use scripting codes (in Gold/Silver) : 5D, 5E, 5F and 63 to accomplish with the script.

See here (code 5B):
Loads trainer data when HIRO is in a trainer’s range of sight.

I don't remember how the structure for "normal" route trainers work but they use this code.
Instead of it, you're going to have to use code 5D.

I'll check that later. Kinda-kinda not get it. I need to test it to understand it better (The color/function thingy, the rest of your post it's clear as water)

dh68gy.jpg

I got a question about this: Where does the trainer script ends? it ends with the code 04? (yellow circle) or it ends when it reaches the code 90? (red circle). I'm guessing it ends with the code 04 because when I follow the hypothetical code 00 (000083) it leads me to 184300 which doesn't corresponds to any code. (it leads me to 184300, which starts with A4, and A4 isn't even a script)

Another question is: when you use the code 5D (trainer code) it asks you for a trainer group and trainer number. How do I know the trainers group and more importantly, the number?

Last edited by Riverside (2011-03-22 04:18:04)

Offline

#106 2011-03-25 18:21:10

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

Re: Noob trying to hack Crystal (Help)

The script begins with a 3-byte pointer (04 + [3-byte pointer]) so the script is located at 0x4C390.
It's a BIG one so you might want to check it with PKSV.
Use hex editor to check how its commands are written in the rom if the commands don't make sense.

Trainers and their groups:
1) Use the pointer table that leads to the trainer data to see which group the wanted trainer belongs to.
For example, the first pointer leads to Falkner's data so trainer group "LEADER (that shows Falkner's sprite)" is used by byte 01.
Falkner's trainer data is eventually found by [Trainer Group] = 01, [Trainer Number] = 01 because there are no other LEADERs that use the sprite of Falkner in the game except Falkner-battle itself.

I know that was pretty confusing but yeah...

Let's try another example:
In Dark Future demo, you battle Theresa who belongs to trainer group 1D.
If you follow the 1Dth pointer in the pointer table that leads to the trainer data of each trainer group, you'll notice that all the trainers, with trainer group 1D, are BEAUTYs. Theresa's trainer data is the 9th in the list so her trainer data is load by script 5D 1D 09.

Last edited by Miksy91 (2011-03-25 18:33:51)

Offline

#107 2011-03-25 23:58:31

Riverside
Member
Registered: 2010-12-12
Post 47/55

Re: Noob trying to hack Crystal (Help)

Miksy91 wrote:

...

Ok, I got it.

So now I know how to create a Pokemon battle, most of it, but there's one thing left to do.

I want to insert a Pokemon trainer sprite into the game, make it so it becomes the code 44 (The final trainer code in the game is 43 for Eusine, in Crystal) and well, use it in a battle (give the trainer a team, make the team become the code 01 for the trainer 44) and well, battle against that trainer.

Any idea on how to do that?

Also, I got other question:

-How do I make it so I battle only once against the trainer? Everytime I talk to him, I battle and even after I win, I battle again and again when I talk to him.

Last edited by Riverside (2011-03-25 23:59:41)

Offline

#108 2011-03-26 02:18:51

174/701

Re: Noob trying to hack Crystal (Help)

Riverside wrote:

I want to insert a Pokemon trainer sprite into the game, make it so it becomes the code 44 (The final trainer code in the game is 43 for Eusine, in Crystal) and well, use it in a battle (give the trainer a team, make the team become the code 01 for the trainer 44) and well, battle against that trainer.

Simple:

  • Add the name of the trainer type to the ROM, and put the pointer to the name at the end of the list of pointers to trainer type names.

  • Add the picture of the trainer to the ROM, and put the pointer to the picture at the end of the list of pointers to trainer pictures.

  • Add the team data of the trainer to the ROM, and put the pointer to the trainer data at the end of the list of pointers to trainer team data.

  • I think there is some ASM that limits the game to $43 trainers; you’ll have to change the byte to allow $44 trainers. (I looked a bit but could not find it, so I could be remembering wrong.)

Riverside wrote:

How do I make it so I battle only once against the trainer? Everytime I talk to him, I battle and even after I win, I battle again and again when I talk to him.

Have a flag initially set to 0. When you talk to him, check if the flag is 1 or 0. If 0, start a battle. After the battle, set the flag to 1.

#109 2011-03-26 02:37:43

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 520/3,492

Re: Noob trying to hack Crystal (Help)

I seem to remember there being a table that lists which song each trainer will use, so you might need to add entries to that as well

Offline

#110 2011-03-26 03:32:19

175/701

Re: Noob trying to hack Crystal (Help)

Mateo wrote:

I seem to remember there being a table that lists which song each trainer will use, so you might need to add entries to that as well

Red has two lists, one for the “sinister theme” and one for the “girl theme.” Any trainers not in those lists uses the default theme. That said, GSC may be different (and if it just uses a list of songs instead, I think it’s better!).

Plus, remember that songs only come up for normal trainers in the overworld, not special events like gym leaders or rivals.

#111 2011-04-08 03:31:16

Riverside
Member
Registered: 2010-12-12
Post 48/55

Re: Noob trying to hack Crystal (Help)

Hmm.. sorry for not login in many days :S

IIMarckus wrote:
  • Add the name of the trainer type to the ROM, and put the pointer to the name at the end of the list of pointers to trainer type names.

  • Add the picture of the trainer to the ROM, and put the pointer to the picture at the end of the list of pointers to trainer pictures.

  • Add the team data of the trainer to the ROM, and put the pointer to the trainer data at the end of the list of pointers to trainer team data.

  • I think there is some ASM that limits the game to $43 trainers; you’ll have to change the byte to allow $44 trainers. (I looked a bit but could not find it, so I could be remembering wrong.)

Hmm... damn.

How do I find where is the list of pointers for trainer type names, pictures and team data?

Have a flag initially set to 0. When you talk to him, check if the flag is 1 or 0. If 0, start a battle. After the battle, set the flag to 1.

How do I use flags? :S

Offline

#112 2011-04-08 15:45:01

Miksy91
Member
Registered: 2010-10-16
Post 317/2,311

Re: Noob trying to hack Crystal (Help)

I'm not sure about the others (and somewhat lazy to check them out) but the pointer table to the list of pointers to the trainer types is located in bank E (38000 - 3BFFF).

You basically make a simple flag script. Doing this is really simple if you've any idea how to write a program using "if - else" commands.
Instead of writing some "if - else" thing in the rom, you'd have to use the codes to check if ram is either 00 or 01.
It goes like this (using the scripting codes of Pokemon Gold/Silver).

Let's assume this script is located in offset 0x120000.
31 25 00 09 E9 4B + script for the code to battle + 33 25 00 49 90.

$120BE9
51 F0 4B

$120BF0
"You beat me !"


In the first part, the game checks with command 31 if bit 2500 is set or not.
If it is set (RAM <> 0 and in this case, RAM is 01), the script continues in offset $120BE9 where is a simple command for displaying text (used by most people in the game).



31 BitTable1 check:
-------------------
Checks whether a bit of BitTable1 has the value 0 or 1. Gives feedback:     00 = Value 0 (OFF)       01 = Value 1 (ON)

Structure
[31][Bit no (2byte)]



33 BitTable1 set:   
-----------------
Sets a bit of BitTable1 to value 1.

Structure
[33][Bit-No (2byte)]

Last edited by Miksy91 (2011-04-08 15:58:56)

Offline

#113 2011-04-28 16:35:20

Riverside
Member
Registered: 2010-12-12
Post 49/55

Re: Noob trying to hack Crystal (Help)

Hmm... I'll check that out later. I don't know how to "if - else", but I don't think it shouldn't be that hard. A few tries and error should do it.

Anyways, these last days I've been trying to write tutorials about what I've learned so far so I don't forget it (I've been forgetting some stuff because I haven't practiced. To be honest I lost some interest on hacking, but I still want to do this. Just some personal problems)

Anyways, the last tutorial I was trying to do was a tutorial about resizing maps, I tried to expand a map before and it worked (I resized Hiro's room and make it bigger) but when I try to resize a CITY this happens:

http://www.youtube.com/watch?v=aSUhn_dZz60

I'm guessing it has something to do with the Map connections, but I don't know anything about Map connections and I want to complete the tutorials so I don't forget how to hack, or if I forget at least I could've somewhere to look around and remember quickly :S

This video was done using GoldMap's "Resize Map" option, but I also tried doing it "manually" in Crystal and the same happens.

Offline

#114 2013-06-27 21:25:20

Riverside
Member
Registered: 2010-12-12
Post 50/55

Re: Noob trying to hack Crystal (Help)

I guess this is what you would call a necrobump. What's up. I'n reviving the thread because there's really no reason to create.a different thread for this topic.

Anyways, I'm interested in hacking again because of Pokemon x and y.

Going straight to the point this is my question and problem: I've got a people event whose function is to act as a trainer. My issue is that I want to make that people event hidden before you get your first Pokemon  Pokemon. If I write 1A00. In the (bit no. Of bittable1 (2byte) then the event hides once I get my first pokemon, which is the vopposite of what I want to do. After that, I want to make that people to hide after you name your rival.

I guess I could play aroundwith Trigger events to hide and show those people events but I want to know if there's another way to do that.

Looking back I noticed that some of the things I asked before weren't that hard to understand as I thought at the beginning. I hope I can understand map connections this time (I got stuck there before)

Offline

#115 2013-06-28 06:48:11

Miksy91
Member
Registered: 2010-10-16
Post 1,786/2,311

Re: Noob trying to hack Crystal (Help)

Well hi there Riverside,
(As soon as I saw your name there, I somehow remembered we'd been discussing about this kind of stuff lately, hahha.)

Well as you know, if you give person event a Flag/Bit Number, he'll be shown if that bit number refers to bit 0 in ram, and hidden if that bit number refers to bit 1 in ram.

(Bits used for bit numbers start at D7B7 so that eight bits are stored in each byte. What this means that for example bit number 1A00 refers to a bit in
byte at 0xD7B7 + 0x001A / 0x8 = 0xD7BA. 1800 is the first bit number that refers to this byte and 1A00 the third. So if you take a look at byte D7BA with Memory Viewer and see bit number 1A00 being set from 0 to 1, you'll see the value of D7BA increasing by binary value 100 ("third bit set") = 04.)

Well, that was just some background information that's handy to know.
But anyway, when it comes to programming aspect like you're asking here, there is no way you can do what you're asking by giving the person bit number 1A00, or any similar bit number either. How the original games normally do stuff such as "Guide Gent" (first hidden in his house and shown outside, and then shown in his house and hidden outside) works by using two different bit numbers of which one is set from the start of the game, and the other one is unset. The unset bit number is given for Gent who is outside and the set bit number for Gent who is inside. And now during the script in which he introduces Cherrygrove City, the set bit number used for inside Gent is reset.

The weak point about doing stuff like this is having to use two bit numbers for absolutely no reason. You could succeed simply with one bit number which is adjusted for Gent who is outside and building a script called from the map header of Gent's house. "If bit number used for Gent outside is 0 --> Hide person event Gent".

Now for your problem, I'd go for doing the exact same thing - using scripts called from the script header to solve the problem.
I'd assume that once you've named your rival, another bit number is set (other than, the trigger number for the lab is modified). You're going to have to check that bit number first and see if it's "true". If it is, disappear "trainer" + return. Then, "if 1A00 true --> return". Then, disappear "trainer" + return.

And that's pretty much it.

Offline

#116 2013-06-29 15:57:06

Riverside
Member
Registered: 2010-12-12
Post 51/55

Re: Noob trying to hack Crystal (Help)

Nice to see you again Miksy. Your hacking tutorials videos helped me this time when I tried to remember how to hack. Thanks.

Miksy91 wrote:

(Bits used for bit numbers start at D7B7 so that eight bits are stored in each byte. What this means that for example bit number 1A00 refers to a bit in byte at 0xD7B7 + 0x001A / 0x8 = 0xD7BA. 1800 is the first bit number that refers to this byte and 1A00 the third. So if you take a look at byte D7BA with Memory Viewer and see bit number 1A00 being set from 0 to 1, you'll see the value of D7BA increasing by binary value 100 ("third bit set") = 04.)

Well, that means that if you get your first Pokemon then the bit number 1A00 should change right? because this is what I tried in the memory viewer

16lw9ar.jpg
2qd7as7.jpg

And the value never changed at all. It was always set as FF

Also

es2ec1.jpg

This is what I have so far in Player's house upstairs. I have 2 people events for the girl. The girl above has a regular function and just tells you to go to Elm's lab then dissapears once you get your first Pokemon. The girl below has a trainer function ([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]) and she's supposed to dissapear until you get your first Pokemon, then dissapear again when you name your rival. In her script I made it so once she's defeated, she gives you an item and then every time you talk to her she tells you something about her Marill. I did that by using code 33 and setting bit number 4C00 to load different text once she gives you her item using other codes and stuff. The thing is that I also checked what's supposed to be Bitnumber 4C00 in the memory viewer (Its supposed to be D7C0) and the bit number never changes even after using my script which its supposed to set it. I don't know what am I missing here. I guess I dont understand bit numbers quite yet or maybe Crystal uses different locations.

By the way, setting a bitnumber is the same as changes its value to 1, right?

But anyway, when it comes to programming aspect like you're asking here, there is no way you can do what you're asking by giving the person bit number 1A00, or any similar bit number either. How the original games normally do stuff such as "Guide Gent" (first hidden in his house and shown outside, and then shown in his house and hidden outside) works by using two different bit numbers of which one is set from the start of the game, and the other one is unset. The unset bit number is given for Gent who is outside and the set bit number for Gent who is inside. And now during the script in which he introduces Cherrygrove City, the set bit number used for inside Gent is reset.

The weak point about doing stuff like this is having to use two bit numbers for absolutely no reason. You could succeed simply with one bit number which is adjusted for Gent who is outside and building a script called from the map header of Gent's house. "If bit number used for Gent outside is 0 --> Hide person event Gent".

Now for your problem, I'd go for doing the exact same thing - using scripts called from the script header to solve the problem.
I'd assume that once you've named your rival, another bit number is set (other than, the trigger number for the lab is modified). You're going to have to check that bit number first and see if it's "true". If it is, disappear "trainer" + return. Then, "if 1A00 true --> return". Then, disappear "trainer" + return.

And that's pretty much it.

That reminds me something. When I tried to add a trigger event into the map it didn't load. I tried to make it so the girl with the trainer function dissapeared once you stepped in the room and once you entered the room with a pokemon she would appear again or something like that or something like that. Anyways, the Trigger event didn't work at all.

and I never used the Script Header. I tried looking at New bark town's script header but all I found were 00s and return codes if I remember correctly so I didn't understand what I had to do there or how to code it. I also looked at Players house upstairs script header and I didnt found any script for the first part. Only scripts for the 2nd part are written and they are script for decoration.

I'm using an expended players house upstairs map because I dont know how to create my own map and it seems more practical to just expand a map instead of creating a new one.

Last edited by Riverside (2013-06-29 15:57:48)

Offline

#117 2013-06-30 16:13:51

Miksy91
Member
Registered: 2010-10-16
Post 1,788/2,311

Re: Noob trying to hack Crystal (Help)

Oh, right... The bit numbers are stored starting at D7B7 in ram. But this is only in Gold and Silver american versions.
I checked it out for you and I'm pretty confident the same ram area used for bit numbers is located in DA72 in Crystal (U) rom.

(And by the looks of it, the trigger table could be in D972 then but check that out yourself to be sure.)

Riverside wrote:

By the way, setting a bitnumber is the same as changes its value to 1, right?

Yeah. Or perhaps being said a bit more accurately - using script code, "setbit", 1 is always written to this address (even if the bit value was already 1 of course).

Anyway, what comes to "script header problems", you're going to have to keep the existing script data in there but at the same time, add your own stuff in. The easiest way to do this is to expand the Second Part of the script header with one existing script data that is loaded everytime the map is entered.

What you've to do is to repoint the script header to blank space, and copy paste the original script header data there (not scripts, but only the header). Once you've done that, add another script to be loaded from the second part of the script header.

There is discussion about the script headers somewhere around this forum so go looking for some useful info if you need.

Offline

#118 2013-07-10 01:50:37

Riverside
Member
Registered: 2010-12-12
Post 52/55

Re: Noob trying to hack Crystal (Help)

Thanks for the update with the bitNumbers. It works perfectly and helps me understand how do they work.

So I've read this thread http://hax.iimarck.us/topic/1732/ looking for information about the Script Header but I would like some help with this.

So the Script Header in Crystal is located at $7ABAB.

00 / 02 05 B46B 01 C56B 91

$7ABB4
0F 4A00 33 0700 31 3600 09 C46B 0C 1800 90
$7ABC4
90

$7ABC5
0F 4900 90

(Codes after 52 need to be added 1 more code in Crystal, that's why Return code is 91 instead of 90 like in GS)

I assume since the first part it's just 1 byte and it says 00 that means there's no first part at all. I also think the return code (91) is part of the structure but I can't assure that because I never messed up with this.

The second part has some content that I wrote down there.

So anyways, what I need to do is after "C56B(91?)" add another data for the 2nd part of the script header right?

The structure is

[[Number2 of pointers] Number2 * [Number][2byte pointer to script]]

So I would need to add a number. How do I do that? Would it be number 01 because my script would kick in when the map loads but before the tileset are shown?

Then I would need a 2byte pointer for my script. My script would be 31 XXYY where XXYY is for when the Rival gets named right? then 09 XXXX so I can point to the script that dissappears the girl right?

It would end up looking like this

01(2byte pointer)

$(2byte pointer)
31(BitNumber when Rival gets named) 09(2byte pointer to show/hide the character) 90

Also how can I know the bitnumber when the rival is named? I tried looking at the memory viewer and see if any byte changed after I named my rival but I didn't noticed any difference.

Sorry if Im asking too much.

Offline

#119 2013-07-10 08:55:39

Miksy91
Member
Registered: 2010-10-16
Post 1,805/2,311

Re: Noob trying to hack Crystal (Help)

Return code2 (91) shouldn't be part of the structure, but an interesting fact is that it's never accessed in the game either (="nothing points to it").
I'd try leaving it out since it makes no sense for being there in the first place.

So yeah, add another script data to be loaded after "C5 6B". Notice that you'll of course have to increase the amount of scripts to be loaded from the Second Part for it to be run in the game --> change [Number2 of pointers].

Riverside wrote:

So I would need to add a number. How do I do that? Would it be number 01 because my script would kick in when the map loads but before the tileset are shown?

I'll use number 02 for most stuff and it works here too. Other numbers should be fine also, but do not use number 05. It shouldn't be a problem but just in case... (this is related for bit table to be "activated" in the start of the game. It's accessed from the first script loaded from the Second Part with "0C 18 00" you've documented there).

So what your script header would have to look like from now on:
00 03 05 B46B 01 C56B 02 xx yy

You can do this by re-pointing the first script to be loaded from the header (stuff starting at $7ABB4), or re-pointing the header in blank space in the same rom bank. Either way is fine of course. Next, fill the script data for the third script to be loaded from the Second Part.

What you fill there is what I described above:

Miksy91 wrote:

I'd assume that once you've named your rival, another bit number is set (other than, the trigger number for the lab is modified). You're going to have to check that bit number first and see if it's "true". If it is, disappear "trainer" + return. Then, "if 1A00 true --> return". Then, disappear "trainer" + return.

This way, the trainer can be seen only when bit number 1A00 is set to 1, but before the certain bit number is set once you've named your rival.

Riverside wrote:

Also how can I know the bitnumber when the rival is named? I tried looking at the memory viewer and see if any byte changed after I named my rival but I didn't noticed any difference.

Apparently, you're right. No bit number is set when you're asked to name your rival.
Script data here:

#org 0x78F16
'-----------------------------------
applymovement 0x0 0x4F74 ' 0x78F74
spriteface 0x7 0x2
loadfont
2writetext 0x60F0 ' 0x7A0F0
keeptextopen
special 0x24
2writetext 0x61C0 ' 0x7A1C0
closetext
loadmovesprites
applymovement 0x7 0x4F78 ' 0x78F78
disappear 0x7
dotrigger 0x2
end

#org 0x7A0F0
= = I heard a [POKé]MON\nwas stolen here[.]\pI was just getting\nsome information\lfrom PROF.ELM.\pApparently, it was\na young male with\llong, red hair[.]\pWhat?\pYou battled a\ntrainer like that?\pDid you happen to\nget his name?\e

#org 0x7A1C0
= = OK! So \h53\nwas his name.\pThanks for helping\nmy investigation!\e

#org 0x78F74
M step_up step_up look_right end

#org 0x78F78
M step_down step_down step_down step_down step_down end

With dotrigger 0x2, it writes 02 to the position of the map in trigger table (in $D987), but that doesn't help you one bit with this.
Anyway, if it's important that the person in your house is gone after this event, but before talking to Elm, you could always solve it through some other ways. The most convenient way of doing the job would be by using another bit number for this.

What you could do would be looking for possible free space somewhere in WRAM (in this case, between DA72 and DEFF, I think) for storing data of another bit number (what you really need is only 1 bit). Or, you could for example edit Guide Gent's script like I explained also in my earlier post.

It currently works so that Guide Gent needs two bit numbers of which one (the one used for him in his house) is set to 1 from the start of the game (with that "0C 18 00" there). So, you could for example add another script to be loaded from Cherrygrove City outside map which hides Gent if this bit number is set to 0. This way, you have one more safe bit number for usage (the one that was used originally for Gent who is outside in Cherrygrove City map) and you can use it for fixing this "problem".

You could make it so that the script which asks you to give a name to the rival also sets this specific bit number, and thus, use this specific bit number in the script header of the player's room map. I'd personally go for checking for possible free space where to store a bit value though. But this was just another example of what you could do.

Riverside wrote:

Sorry if Im asking too much.

No big deal :)

Edit:
Also, just mentioning that this stuff got way more complicated than I thought it would be.
Though I've got all of this "in my hands", so if and when you need help, feel free to ask.

Last edited by Miksy91 (2013-07-10 09:04:44)

Offline

#120 2013-07-12 21:44:21

Riverside
Member
Registered: 2010-12-12
Post 53/55

Re: Noob trying to hack Crystal (Help)

Thanks for your help but I give up. I'll pick the easiest way. I'll put both People events in the same place and hide one when you get your first Pokemon so the People event that battles you is the only one showing and then hide that People event after you talk to Elm about the Mysterious Egg.

I tried changing the number of Script events in the Script Header to 3, then adding my own script in the header and using the 2byte pointer to the script to use code 31 (Bittable 1 check) 1E00 (When you talk Prof Elm about the Mysterious Egg) 6E (Hide Person in Crystal) 0B (The people event I want to hide) 90 (Refresh code) and nothing happened. I figured it might something to do with the "[Bit no. of BitTable1 (Hidden if set)(FFFF for none)(2byte)]" byte in the People Event itself so I went there and wrote 1E00 and it still didn't work so I deleted the Bittable Check and only leave the code to hide the people event just to see if something happened and what happened was that the game would not trigger the event when Prof Elm takes the Mystery egg so you could not make any more progress in the game and I didn't really understand the relationship between the People Event and the Script Header.

I also tried using 31 XXXX 09 XXXX 90 and then 31 XXXX 08 XXXX 90 but it still didn't work.

So just stacking the sprites might be unprofessional but at least will get the job done I think. Thanks anyways.

Offline

#121 2013-07-13 05:21:02

Miksy91
Member
Registered: 2010-10-16
Post 1,807/2,311

Re: Noob trying to hack Crystal (Help)

The problem you're having is most likely the third script from the Second Part not loading at all.
Try writing some messed up data there and see if the game freezes. If not, you've done something a bit wrong while editing the data of the script header.

Also, keep the bit number of this person event set to FF FF. You won't really need two person events for the job, but even if you feel like adding another one, the job won't turn any easier. You're still going to need to call stuff from the script header.

You sure though that the person event is really 0Bth ? If there were 8 people events in the map originally, 0B is the right value for this new person event you've added yourself though.

Offline

#122 2013-07-13 22:08:13

Riverside
Member
Registered: 2010-12-12
Post 54/55

Re: Noob trying to hack Crystal (Help)

I know the game recognized the changes I made not only because the Elm event stopped working, but also because I forgot I had to use code 90 as the Return Code instead of 91 like it's mostly done so I used code 91 without noticing and whenever I entered Player's house upstairs the game loaded a Yes/no box or an earthquake happened for a few seconds before stopping. That stopped once I started using Code 90 as the Return code.

And my map has 10 person events and I want to hide the 10th one. I thought it would be 0B in hex. Even then I was trying out hiding people events with a lower number just to see if any of those worked and no people event hid.

I thought that I would need 2 people event because there was a trainer battle involved. I needed that the people event talked to me normally, then after getting your first Pokemon the people event battled you and after you name your rival/show Prof. Elm the egg the people event would get hidden but I thought that when you are talking to a people event that's set as a trainer the first thing that happens when you talk to that people event is the pokemon battle.

Last edited by Riverside (2013-07-13 22:11:58)

Offline

#123 2013-07-14 05:40:08

Miksy91
Member
Registered: 2010-10-16
Post 1,808/2,311

Re: Noob trying to hack Crystal (Help)

(Okay, I've got this now.)

First of all, you should really study how different numerical systems work. In hexadecimal, we've got 16 different numbers and in decimal, there are 10. In hex, A B C D E and F stand for the highest values and when you convert those to decimal, you'll get 10 11 12 13 14 and 15.

(And in binary, we've got 0 and 1, and it's easy to convert sets of 4 bits into hexadecimal digits since 4 bits form one hex value. 0000 as the lowest 4-bit binary value which matches hex value 0x0 and 1111 is the highest 4-bit binary value which matches hex value 0xF.)

(1111 into hex --> 2^3 + 2^2 + 2^1 + 2^0 = 15 = 0xF)

But back on the problem...
If you want to hide the person event of which Johtomap shows its Person event number as 10, that has to be number 10 + 2 = 12 --> 0C. GoldMap shows person event values differently. Player is referred by person event number 00, 01 is unused and all the people events are referred by numbers 02, 03, 04, and so on (by using the script codes).

You don't necessarily need two people event, but having two might be a better idea for implementing it since it's easier. But it's more than possible to implement this thing by using just one person event. Then, you really don't want to make this person a typical trainer, but instead, activate the possible trainer battle through a script like gym leaders have been scripted.

Offline

#124 2013-07-18 23:31:54

Riverside
Member
Registered: 2010-12-12
Post 55/55

Re: Noob trying to hack Crystal (Help)

Miksy91 wrote:

Then, you really don't want to make this person a typical trainer, but instead, activate the possible trainer battle through a script like gym leaders have been scripted.

And this is the point where I start looking at the floor because I did something stupid.

I completely forgot that Gym Leaders can be talked to without triggering immediately a battle.

I still don't understand how the Script Header. I thought 0C would be the people byte for a people event that's number 10 in decimal, but when I tried it the game crashed for some reason and it didn't crashed whne I tried 0B so I thought 0B was the last people event in the map for whatever reason.

Anyways, I managed to do what I wanted to because I took the scripts gym leaders use as an example.

Now I need to create a new Trainer Group (Fisherman, Bug Catcher, etc), give that Trainer Group a name and create a trainer under that Trainer Group. That also means I want to insert a Trainer Sprite for that Trainer Group.

I think once I do that I would FINALLY complete what I planned for New Bark Town 100%. At least for now since I'm trying to "devamp" HG SS with Crystal and I don't know if HG SS introduced more events in New Bark Town later in the game. I don't know if I'll come up with a new event on my own later too...

Anyways, thanks for your help mate. How do I include a new trainer group?

I know there's a table for the name of the trainer groups located at $2C1EF(Crystal) but I don't know anything else about the topic.

I tried looking for a 2byte or 3byte pointer for $2C1EF but I couldn't find anything. (I assume there must be a pointer or something that tells the game to read that table of names for the trainer groups)

Last edited by Riverside (2013-07-18 23:55:21)

Offline

#125 2013-07-19 04:47:03

Miksy91
Member
Registered: 2010-10-16
Post 1,823/2,311

Re: Noob trying to hack Crystal (Help)

Well, the first people event matches up with value x02, the second to x03 and so on. So if there are 10 in total, the tenth one matches up with x0B (11) then.

I haven't really ever created a new trainer group, but like you said, you just gotta fill some more content here and there. This would be a lot more efficient to be done with disassembly just like most stuff related to hacking Crystal, but I don't think I can help you out with it much.

If I was to do this using Gold/Silver myself, I'd start looking for stuff with assembly editor, and see what I have to replace in order to make room for more data in the tables, or how to relocate the tables elsewhere and such.

Offline

Board footer

Powered by FluxBB