great, i had it installed already but i don't know exactly how to use it. Seems like for some reason i can't find the offset 26CF8C ... how can i see the offsets between 26CF88 and 26CF90 :/
dammit... i feel such a noob when it comes for hex values
Right, so lets go through this step by step for you.
Initially, lets understand the script first:
Code:
'---------------
#org 0x16F602
lock
faceplayer
setvar 0x8008 0x0
call 0x81A8CAD
checkflag 0x248
if 0x1 goto 0x816F674
msgbox 0x81A597B MSG_YESNO '"I'm looking for the POKéMON\n[buff..."
....
I assume you are aware of what these scripting commands do. But I will explain to you how to edit this script in the way you wish.
At the start of the script, looking past the lock and faceplayer commands, var 0x8008 is set to 0 and we call another script. When you call a script, the initial location of the call is saved and the other script is executed with all the script variables and such intact. So basically it runs this other script at 0x1A8CAD to determine something and then checks a flag.
If this flag is set, then it does goto 0x816F674 - which is to the message "My old [buffer2] is great isn't it?". So the flag is most likely to indicate that you've already had a successful trade with the npc. But even more so, you'll notice that the NPC buffer's their former Pokemon's name! That means they must have retrieved the name prior. So far we know all of what has been executed doesn't deal with retrieving then name...except for that other script that was called at the start, 0x1A8CAD!
Code:
'---------------
#org 0x1A8CAD
copyvar 0x8004 0x8008
special2 LASTRESULT 0xFC
copyvar 0x8009 LASTRESULT
return
So you can see that it sets var 0x8004 to whatever var 0x8008 was, and then launched special2 with an arguement of the lastresult. I'll butt in here and say that special2 0xFC is hardcoded to use variable 0x8004, so the fact they've passed LASTRESULT means nothing, other than this should have been coded as just be a normal special rather than special2 :P
Anyways, I'm ranting, getting back to the point, 0x8004 is 0 and the special is called. The special's function is to load the Pokemon's name and species into special buffer. Buffer2 = name, Buffer3 = species. The value in 0x8004 determines which index of the table the Pokemon trade NPC is for. So since 0x8004 == 0, then it's clearly the first trade slot.
Cool, lets look at the table data doesnt documented again:
In-game trades in FR are at 0x26CF8C. The scripts relating to them store very little information, and just index into this table. Each entry is 0x3C bytes, used as such:
0x0 - Nickname, limited to ten characters + 0xFF.
0xC - Half-word, ID of the NPC's pokemon.
0xE - IVs, stored in HP/Atk/Def/Speed/SAtk/SDef order. One byte each.
0x14 - An entire word dedicated to the ability bit.
0x18 - NPC's trainer ID. Only the low bits are visible on the status screen.
0x1C - Five bytes; four of them are 5 and one is 0x1E. Not sure what they do if anything.
0x24 - Personality value; influences nature, gender, etc; more info here:
https://bulbapedia.bulbagarden.net/wiki/Personality_value
0x28 - Hold item.
0x2A - 0x00 if the mon carries mail (only ZYNX has mail in FR), 0xFF otherwise.
0x2B - Original trainer's name. Limited to seven characters + 0xFF.
0x36 - 0x00 if original trainer is male, 0x01 if original trainer is female. Only visible in RSE.
0x37 - Always 0xA. Not sure what it controls if anything.
0x38 - Half-word, ID of the species the NPC is looking for.
0x3A - Half-word, seems unused.
He mentions that each NPC's entry in the table is 0x3C bytes, that is to say the first NPC's data is in the first 0x3C bytes and the next NPC's data is in the 0x3C bytes after that and so on. So starting we do this operation to get the starting address of the Xth trade trainer Address = (0x26CF8C) + (0x3C * X). So in the case of the 0th entry (first entry) it's going to be 0x26CF8C + (0x3C *0) = 0x26CF8C.
On the very left column he has some numbers, these are the relative addresses for each entry. For example, the nickname is at 0x0 and NPC's Pokemon is that 0xC. So to get the Species ID of the Pokemon that trainer has, we do: (0x26CF8C + 0xC)
Doing that, we know var 0x8004 == 0, so this is the first trainer, their starting address is going to be at
address = (0x26CF8C) + (0x3C * 0)
address = 0x26CF8C
now we need to know what Pokemon they have with according to the post is the 0xCth value of that entry, so we add 0xC to the starting address to get the NPC's pokemon species.
npc's species = starting_address + 0xC
npc's species = 0x26CF8C + 0xC
npc's species = 0x26CF98
go to 0x26CF98, and you'll see the 2 bytes read 0x78 0x0. That means the species they have is 00 78 = 0x78 = MrMime. To edit the species this NPC gives away, you must edit the 0x78 0x0 then.
Do the same logical operation to edit what Pokemon the NC wants. "0x38 - Half-word, ID of the species the NPC is looking for."
--
Now let me show you something about the hex editor.
Clicking a byte or highlighting it will tell you what the offset of that value is. You see in the highlight it shows the byte I've highlighted is the 0x26CF80 byte. From 0x26CF80, fine 0x26CF8C by going through the subsequent bytes. Hint in your case, the amount of bytes you have to go through is just 0x26CF8C - 0x26CF88 = 0x4 :)