Jump to content

I need help with some basic hex editing in Generation 5


MackanK

Recommended Posts

I have tried to change or replace items in the BW/B2W2 games, both items that can be found in the overworld and those given by NPCs. I have no previous experience with hex editing but I have done my best going through this forum and trying to grasp what I need to know to be able to do this.

The problem I have now is that I cannot find the hex numbers for the various items within the script files for the various maps. If I open the script for a certain location, for example, Route 2 in Black and White, which is not too complicated but contains examples of various things, then there are both items on the ground and a scripted one at the beginning. 

Looking at this page: List of items by index number (Generation V) ... I can find the hex values for the items in the games, and I know that Route 2 is script file 319 in B/W. The problem is that I am unable to find the hex values for any of the items within the script code. I have looked through many, many different threads here trying to find out what I am doing wrong but without success.

Could someone here who has experience with this kind of editing tell me what I am missing, where the hex numbers for the items can be found and if there is anything else I have misunderstood?

Thanks in advance, I would be very grateful for any help.

Link to comment
Share on other sites

4 hours ago, MackanK said:

The problem is that I am unable to find the hex values for any of the items within the script code.

Are you looking for items given by NPCs as part of a script event (not after battle), or ground items (ball/hidden)?

Ground items are scripted in a single file if I recall correctly (one of the script files at the end).

Link to comment
Share on other sites

Thanks for the reply.

21 minutes ago, Kaphotics said:

Are you looking for items given by NPCs as part of a script event (not after battle), or ground items (ball/hidden)?

2

Both. The given items are those in scripted events, particularly those items you get from main characters and similar, as well as many other early items like, for example, in Route 2 you receive the Running Shoes. I'm not talking about the berries or repels you get from Rangers or such.

 

21 minutes ago, Kaphotics said:

Ground items are scripted in a single file if I recall correctly (one of the script files at the end).

 

I suspected they were located somewhere else since I couldn't find any signs of them being in the specific map scripts, but I didn't know where to look. Do you any idea which of the later script files it could be inside? It would help to have something to go on because there are several of the later script files that are very, very long and I have already looked at several of the scripts that are not tied to a certain map without being able to find if any of them is the correct one. Do you think it would be possible for you to take a look at it if it isn't too much trouble? Thanks for the help. 

Link to comment
Share on other sites

I wrote up some notes back in the day for b2w2 here:

https://sites.google.com/site/kaphotics/b2w2-scripting

sc_1238 - give item scripts?

sc_1241 - ground item scripts

If you run the game with an emulator, you can try searching for the script data that is loaded during the event -> find the corresponding script file in the ROM.

 

Keep in mind that there's a difference between stored items and untangible items (like Running Shoes); those would likely just be event/system flags that are set.

 

The give item standard scripts are probably just calling script file 'm', subscript 'n'... ie, CallScript(m, n), which opens script file m and runs the nth script. Not sure if there's a way to pass parameters {CallScript(m,n,o...)}... it's been too long since I've done anything with scripting ;)

Link to comment
Share on other sites

Thanks again, I was currently working on Black and White 1, which I wanted to start with. The scripts you mentioned are probably correct but BW1 have much fewer script files than that, so it can't be applied to those games too it seems. Since I am assuming that you do not want to go through the BW1 files for me there are a few things that would help me find them.

You mentioned that the script data could be viewed while running the game, but I have no idea how to do this. Is there a specific option in the emulator (I use DeSmuMe) or another program I should use?

One of the specific events that I was trying to find was when you receive the Super Rod right at the start of the Post-game. I have not found any uses of the Hex numbers for it when looking through the script files for Nuvema Town. I have searched many other non-map specific scripts too but has seen no trace of it. Do you have any idea how I should go about finding this one in particular?

Thanks once more for the help, I know myself that it's not easy trying to help with stuff you haven't worked on in a long time.

Link to comment
Share on other sites

Lua parser for b2w2:

you'd have to mess around with where it's reading from. script editing in gen4/5 isn't as fully fleshed out as it is for generation 2/3 games. 

it's much easier to start by following the insertion/editing tutorial videos I've posted to get familiar with the process, then start tinkering with the tools to understand how they really work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...