|
Post by Miksy91 on Aug 9, 2010 6:35:21 GMT -5
I understand the most of the basics but can't still make this work. I'm trying to make a new script for Hiro's mom.
Here is the event data for Hiro's room (downstairs): $181B89 (60:5B89)
I made a new (not-working) script to offset 182667. It's supposed to make Hiro's mom give lv7 Eevee with a Berry for him. It's here: 6A 47 4C 1A 17 54 2D 85 07 AD 00 53 49 90
I'm pretty sure pointer 1A 17 is wrong but I'm not sure. The text she says is located in 18171A.
So, I've got two problems here. I don't know if 1A 17 is pointed wrong or not but the next problem is to change the pointer for the script itself.
As I said in the other thread, I can't use pointer calculator because I've 64 bit Vista which pretty much sucks when making hacks.
I checked Mateo's tutorial about adding new events to maps and understand how to change where event data points to. I just have to know the pointer for 182667, that's all (also, sometime before I saw how to calculate to the pointer without any pointer calculators but didn't really understand it).
|
|
|
Post by Tauwasser on Aug 9, 2010 6:51:46 GMT -5
Pointers can be easily calculated in your head. Also, there is obviously Windows Calculator, which you could use. You already have the proper address 60:5B89. You will notice that the pointer part is between 0x4000 and 0x7FFF (inclusive). Your pointer 0x171A points to Rom bank 0x00. If you modify it to be 0x571A (0x4000 + 0x171A), you will actually point to your text in the current bank 0x60.
The rest of your script looks correct.
cYa,
Tauwasser
|
|
|
Post by Miksy91 on Aug 9, 2010 8:36:43 GMT -5
Okay, so now I changed 1A 17 part to 57 1A. Also, what should I have done if for example 80B9 was in 5B89's place ?
But I still don't know how to calculate the pointers myself as you never explained how to, furthermore Google didn't really help me out.
|
|
|
Post by Tauwasser on Aug 9, 2010 18:22:38 GMT -5
60:80B9 technically points to VRAM bank 0, address 0x80B9.
In all but a few very early gameboy games (that use a different memory controller), rom banks are mapped as follows:
Rom bank 0x00 is mapped to 0x00 thru 0x3FFF (inclusive). All other rombanks are switched in from 0x4000 thru 0x7FFF (inclusive). After that is VRAM, WRAM, OAM and some control registers.
This is why all pointers that point inside of the ROM have to be between 0x4000 and 0x7FFF (inclusive).
Now, your question is probably, if you were in the next bank, what would your pointers look like?
Bank 0x61 is from 0x61 * 0x4000 = 0x184000 thru 0x62*4000 = 0x188000 (exclusive).
So offset 0x185678 for instance is 61:5678, while offset 18ABCD is 62:6BCD. Notice this address notation contains rombank + DELIMITER + pointer, where delimiter is ":".
So basically, for any offset:
Pointer = (Offset Mod 0x4000) + 0x4000 Bank = Offset \ 0x4000
If bank == 0x00 after that, pointer -= 0x4000 (subtract 0x4000 from the pointer). While technically you would expect the gb to map rom bank 0x00 when requested, some docs say it actually maps rom bank 0x01 regardless.
cYa,
Tauwasser
|
|
|
Post by Miksy91 on Aug 10, 2010 2:13:28 GMT -5
I got the rom completely messed up by changing 895B to 6766 and realized what was the problem. So, I don't want to change either the event data or the pointer for it.
Anyway, is the script for mom walking towards you and giving you Pokegear located in the event data ? I couldn't find any moving script there (68 xx + 2b) (what's 2b anyway). Or, is there a pointer there too which tells the game where her script is located ? If so, does event data only tell the rom how many warps, triggers, signposts and people are in the map ?
Sorry if I bother you with so many questions but it's just that I need help learning this.
|
|
|
Post by Tauwasser on Aug 10, 2010 4:32:55 GMT -5
I got the rom completely messed up by changing 895B to 6766 and realized what was the problem. So, I don't want to change either the event data or the pointer for it. You can't be afraid of everything. Make mistakes and learn from them. Touch and change pointers until they become natural to you and tinker with the data. Anyway, is the script for mom walking towards you and giving you Pokegear located in the event data ? No, why would it? It's not an event like a signpost or a person or warp! It's a script and as such not an event! I couldn't find any moving script there (68 xx + 2b) (what's 2b anyway). 2b means 2-byte pointer. So this is 68 xx ll hh where hl is the pointer and xx is some value (for 68 it's the person number). Or, is there a pointer there too which tells the game where her script is located ? Usually, there is a pointer for every people event (person), every signpost and every trigger event that all point to a script. However, the script you're looking at is not activated by - stepping on a trigger
- talking to a person/signpost
- coming in the range of a trainer people event
The logical conclusion from that is, that the script you're looking for is not referenced in the event data, because no event is activating it, as we just saw in the list. Where else could it be? Take my scripting doc and read up on script headers. Script headers can be used for events that perform once you enter a map, e.g. for the first time, after a certain event has happened etc. Basically, there are two different parts of the script header that both perform different things, which you will both find explained in much more detail in my doc. Basically, the script you're referring to is referenced in there. It's a one-time event and will happen once you enter the map. This is the same as the professor giving you your Pokémon or the Cop asking you the red-haired kid's name. They're both one-time events that are activated through a trigger number (the same that trigger events use). You can pretty much go from there, I think and figure out which script it is. All trigger numbers are set to 0x00 at the game's start with a few exceptions I documented somewhere... If so, does event data only tell the rom how many warps, triggers, signposts and people are in the map ? Exactly. Just as described in my scripting doc, this is what event data is! However, it doesn't only tell how many of each there are, but also what properties each has (location, picture, script pointer etc.)
|
|
|
Post by Miksy91 on Aug 10, 2010 5:55:53 GMT -5
I'm going to skip that for now but I'll come back to it later when I'm more used to this (I read it but didn't really understand even how to find the script header...)
Still one thing though: Here is the secondary map header address: $09649D (25:649D)
$09649D: 00 04 05 2A 9B 76 60 40 56 89 5B 00
So banks (2A & 60) with their pointers (9B 76 & 89 5B) determine where Map & Event data are located in the rom. What's the use of "40 56" ?
So I guess that bank 25 along with 9D 64 point where the Secondary Map Header is. Are the scripts for all the events of that map located where the pointer 9D 64 (and bank 25) is (expect the one in script header) ?
|
|
|
Post by Tauwasser on Aug 10, 2010 6:32:40 GMT -5
So banks (2A & 60) with their pointers (9B 76 & 89 5B) determine where Map & Event data are located in the rom. What's the use of "40 56" ? That's the pointer to the script header. 0x60 is the rom bank for both, events and script header. So I guess that bank 25 along with 9D 64 point where the Secondary Map Header is. Correct, as you gave this offset above. Are the scripts for all the events of that map located where the pointer 9D 64 (and bank 25) is (expect the one in script header) ? No, they are usually located as follows: Script header pointer points to the script header. And event pointer points to events. Events and script header have 2byte pointers to their scripts. From there on, technically, you could call a script from a different rom bank. However, most scripts do not do this and simply are in the script header/event bank. Their location is determined by the fact that at least some bits of the script have to be located in that bank, because events cannot directly point to scripts outside of their banks ― except by calling another script in another bank out of their own script that is definitely located in the same bank as events/script header are. cYa, Tauwasser
|
|
|
Post by Miksy91 on Aug 10, 2010 6:56:06 GMT -5
So, in the Event Data I can find the properties of the events along 2 byte pointers to their scripts. Am I right with this one now ?
Actually, is that 2 byte pointer the "Text Block" & "Text Bank" which GoldMap shows in the properties of the event ? So, as text block & text bank for Mom are: 203 86 is the 2 byte pointer for her talking script CB 56 ?
|
|
|
Post by iimarckus on Aug 10, 2010 9:17:00 GMT -5
So, in the Event Data I can find the properties of the events along 2 byte pointers to their scripts. Am I right with this one now ? Actually, is that 2 byte pointer the "Text Block" & "Text Bank" which GoldMap shows in the properties of the event ? So, as text block & text bank for Mom are: 203 86 is the 2 byte pointer for her talking script CB 56 ? Yes, GoldMap labels that incorrectly.
|
|
|
Post by Miksy91 on Aug 10, 2010 13:09:48 GMT -5
Ok, I didn't really get it where does CB 56 point to... Anyway, I'll take a break for a couple of days from hacking and will be back in the next week (going to visit some relatives & friends).
|
|
|
Post by Miksy91 on Aug 18, 2010 11:30:21 GMT -5
I'm trying to do this again and I made another script but this one doesn't work either.
It's like this: 6A 47 4C D7 42 54 56 F0 84 F0 00 47 4C B0 42 53 49 90
It works fine until it starts to load the picture of the pokemon that should be shown. Am I missing something between 42 and 54 ?
Also, I'm not really sure if it should "Close text box" before it shows the pokemon picture or not.
|
|
|
Post by Tauwasser on Aug 18, 2010 16:21:05 GMT -5
Look at my doc. What you're doing doesn't add up.
Command 0x56 doesn't take another byte. Instead, it is used to close the box that command 0x55 creates.
So your script will try to interpret the first occurrence of 0xF0 as a script code and do something undefined.
cYa,
Tauwasser
|
|
|
Post by Miksy91 on Aug 20, 2010 14:23:33 GMT -5
Thanks for the help, I'm going to give you some credit too Also, I'm going to edit the Pokegear script soon... EDIT: I tried to edit the script in script header in which you get Pokegear and successed to do so but the problem is that it can't load movesprites and the script won't end like it usually would. Instead, NPC keeps talking the same things over and over again...
|
|
|
Post by Tauwasser on Aug 20, 2010 16:42:27 GMT -5
You will need to deactivate it by activating another trigger that does nothing (usually 0x14 0x01 will suffice for a script executed on first entering the map). Also, make sure the map id is in the table at 25:4000 (GS) and assigned a proper ram slot. If not, the asm is actually buggy and will return the wrong entry in that list.
Also, make sure you choose the proper stage to implement this script. Usually, scripts will use 0x05 or 0x07 IIRC.
cYa,
Tauwasser
|
|