![]() |
Script for NPC pokemon trade?
Hey guys
As the title says, I need a script that will make NPC trade certain pokemon in Fire Red Rom. I tried to read the compiled script on fire red and leaf green roms but i didn't find any sense there XD Thanks |
Quote:
|
Quote:
Code:
|
Quote:
|
Quote:
|
Quote:
Also, there's always a way. |
Quote:
|
Quote:
I'll give you a link, but make sure you search thoroughly next time https://www.pokecommunity.com/showthread.php?p=8528011#post8528011 |
Quote:
well, you see, the project i am participating in is simple enough and I didn't need any ASM, only some simple XSE and now it is finally ending. Ye know, it's the kind of games that story and body movements have priority ok I saw the post but i really can't understand shit :( , I can't find the 0x26CF8C or well, even when i find it in advancedmap it shows me a givegg command. 0_o |
Quote:
|
Quote:
https://i37.servimg.com/u/f37/19/56/75/41/screen22.png dammit... i feel such a noob when it comes for hex values |
I believe there is actually a trade editor tool out there. PGE can do it, for instance. It has a lot of tools and it's much quicker than hex. As a novice you'll probably find that easier. Heck, I can edit ASM a bit and /I/ still prefer tools most of the time when given the opportunity.
|
Quote:
Initially, lets understand the script first: Code:
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:
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: Quote:
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. http://i.imgur.com/6d6MKgF.png 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 :) |
Quote:
Quote:
thanks for you time! |
Quote:
|
| All times are GMT -8. The time now is 9:14 AM. |
![]()
© 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.
Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.