Jump to content

resource Pokémon Black and White - Overworlds and scripts


Recommended Posts

Hi, people.

I have a question about Pokémon Black & White script editing.

I know that:

  • a/1/2/5 contains the overworld data.
  • a/0/5/7 contains the scripts.

My question is: how is the overworld data calling up scripts from the script narc? I know that overworlds have hex data for ''script'' added, but I don't know how that corresponds with the data in the script narc (a/0/5/7).

I know for example that the overworld data is grouped per map. So all data of Route 2 is together in one part of the narc.

For example, the script hex data of the Lass on Route 2 is BA 0B. Which part of the script narc does that relate with? How is the script data arranged?

Link to comment
Share on other sites

this is pretty much untouched as people haven't really investigated like they've done in gen3/4.

i'll help later today and over the weekend, I'm actually kinda interested in this :)

drayano and others have done some work on 0/5/7, I think that understanding the format of the script narc first will help understand the overworld->script fetch

http://projectpokemon.org/forums/showthread.php?21828-Moving-Stationary-Pokemon-B-W

http://projectpokemon.org/forums/showthread.php?15806-NPCs-Giving-Multiple-Items

http://projectpokemon.org/forums/showthread.php?17968-List-Hex-for-each-pok%E9mon-in-a-0-5-7&p=136085&viewfull=1#post136085

http://projectpokemon.org/forums/showthread.php?22329-Pok%E9mon-Black-and-White-Script-NARC

as drayano said, using a Lua script to quickly fetch overworld position & map is verrry helpful. the script setup might be very similar to gen 4 as BW is essentially the same engine.

Link to comment
Share on other sites

Yeah, well I'm currently working on my hack and I've made a lot of progress. I added new Trainers to certain routes etc. but my only question is: how are the scripts actually ''called'' by the overworlds? How does the overworld's script hex data correspond with the script narc?

Link to comment
Share on other sites

I'm not really keen on ROM editing; I tend to stick with sav/RAM editing myself. As such I try to edit these scripts in game -- the best (and only) time to apply these changes is when the overworld loads. The overworld won't re-load if you view the party screen, so you have to physically leave the map.

I'll be taking a RAM editing approach instead of ROM editing, however it should be easy to apply the following to the ROM instead. Since I don't know how this stuff works at all I might as well catalog my learning process.

setup & learning the ropes:

I was able to find Drayano's example Desert Resort overworld at the offset 0x02250244 in my unmodified copy of English White. This area is right after eventdata_system.c, so we know this is the right place. (0x02250000).

now, I just start toying with the scripts that are loaded, by applying a cheat code right before the game interprets the script to show what's on the overworld. I apply an internal code of 13631494 (dec, which is 00D00006) at 02250244 to change up the sprite that's loaded.

MVP3g.png

shazam, I can edit the scripts without editing the ROM directly. Much quicker than editing the ROM in my opinion. So now that I've explained that, we can see that the overworld is present here and can be changed, but that stuff is already known.

establishing that this is the a/1/2/5 overworld data file:

now, by copying and searching, we see that the ROM mirrors the RAM:

0x02250114 (RAM)

0x083B4400 (ROM) - starting data - AC 04 00 00 04 1C 03 02

So, we now know that this data is loaded from the a/1/2/5 narc, but which file? 158, the map ID! duh...

Ok, so the map event file is loaded into the memory, and it then calls for reference scripts. That's the ultimate goal.

Script File and Memory Locations

So, we know that Darmanitan is what you encounter from the statue. So, knowing that it has to call the Pokemon Index Hex (0x022B) to get one to appear and the memory has to have the Scripts loaded already, we look for Darmanitan's hex further in the memory.

I find 2B 02 23 00 20 80 7B 01 23 80 09 00 23 80 08 00 01 00 11 later on, and search for that in a/0/5/7. Found a match in file 316. We find the 78 01 pokemonhex for each of them, so this is the right file.

Note that the entire script file for the map is loaded at offset 0x0225CB44 (there's a pointer at 0x0225C614 that points here). However, this isn't what we're looking for.

We instead look for 0x013C (the Script File number) after the overworld data. We find it at 0x022592C2. Change this on the fly, and you access different scripts!

Ok, so that's pretty cool. But just for fun, what's around this area? "zonedata.c", cool. Lets corrupt some crap.

Went into the ruins, and encountered a Pokemon.

WVWLi.png

yeeeeeee. Changed up the pads of WILD POKEMON. Zone data!

Back to our intentions:

The overworld data has to point to the script file somehow. We know that overworld_158 must point to script_316. So we search for 3C 01 in the overworld file...

not found. well fuck, gotta figure out wat do.

Edited by Kaphotics
Link to comment
Share on other sites

That's some cool information, Kaphotics! Thanks for your time and interest!

However, you say:

Found a match in file 316. We find the 78 01 pokemonhex for each of them, so this is the right file.

I don't see how that's so obvious? How actually is a/0/5/7-316 related to 78 01 hex data? Also, where did you get 78 01 from?

Moreover, I understand that 0x013C = 316, which corresponds with the script file in a/0/5/7. But where does it mention 0x013C in the overworld data?

You see, what I'm trying to achieve is the following.

For example, I want to add the National Dex at the beginning of the game. However, to add that function, I want to take a look at the original script data for both the National Dex event (after defeating the Elite Four), as well as the original Pokédex event at the very beginning of the game. It's nearly impossible to find that without any other information whatsoever. I did find the overworld trigger files, but I don't see how the corresponding script hex data calls the script from a/0/5/7. I can't see how it's related.

Another example, like I said in the first post: the script hex data of the Lass on Route 2 is BA 0B. But which part of the script narc does that relate with? How is the script data arranged?

If only each script had its own file in a/0/5/7, it would be a lot easier. However, 0xBBA gives 3002 and there aren't that many files available. To which part of a/0/5/7 does it relate, then?

Link to comment
Share on other sites

Oh, I just pasted the darmanitan data starting at it's dex #. the whole string was

"78 01 2B 02 23 00 20 80 7B 01 23 80 09 00 23 80 08 00 01 00 11"

From the overworld data I just searched for the nearest 2B 02, and ^ came up. Once I saw the 78 01 right before it, it hinted that it could be right, so I went with it and found that data in the ROM, and it ended up being in a/0/5/7-316.

Just updated the post about 0x013C about how I couldn't find it in a/1/2/5...

Copying the zonedata from the RAM as it contained the data for the script number, and look for it in the ROM/narcs.

"00 10 16 00 67 00 3C 01 3D 01 A6 00 36 04 36 04 36 04 36 04 08 00 9E 00 9D 00 22 04 00 00 40 6D 67 00 00 00 05 00 00 00 00 00 00 00 04 00 00 00" is at 0x0225B92BE for a total size of 30 bytes. Andibad noted that "zonedata" is a/0/1/2 in this thread. This data I found is indeed at a/0/1/2, which is one large file. Looks like this controls the selection of data like scripts, pads, (encounter slots?) etc.

a/0/1/2 IS A VERY IMPORTANT FILE.

View as 48 bytes each, 427 lines. Remember that a/1/2/5 has 427 files? Each line corresponds to a certain overworld file!

Back checking now, we have our Desert Resort data at 0x1DA0, which is line 158. Bingo. So now you can get a list of what map overworlds reference what scripts. lolol

Now we know the meaning of the zonedata narc and part of it's structure; it determines what map uses what script!

Now that's one structure that would be VERY useful to catalog and have an editor for!

Link to comment
Share on other sites

Getting to your question now that I have documented a lot of new stuff :P

Map 319 corresponds to Route 2. Thus Line 319 of zonedata will contain the script reference at 0x3BD0 of the zonedata narc.

"00 01 06 00 00 00 7E 02 7F 02 5F 01 0E 04 0F 04 10 04 11 04 4E 00 3F 01 3F 01 0F 04 40 00 00 EC 00 00 00 00 FA 02 00 00 00 00 00 00 91 02 00 00"

As you can see, it's referencing scripts 027E and 027F (638 and 639). So, if you have an object on overworld_319, it would access the script index number of scriptfile_638.

My question is: how is the overworld data calling up scripts from the script narc?

Answered!

That's half the puzzle so far (what scripts an overworld map uses, thus where to edit); we still need to know HOW to edit the scripts!

slightly related tangent: I'm sure that a lot more cool stuff can come from editing the zonedata!

Link to comment
Share on other sites

instead of finding what line of zonedata to look at, I separated my english white narc into pieces for each zone; just a quick reference of what each zone is.

http://min.us/mr1CGmENC

alternatively, line separated pastebin (copy to notepad++ to get line numbers)

For the structure of the map's zonedata, (desert resort, v v v )

00 10 16 00 67 00 3C 01 3D 01 A6 00 36 04 36 04 36 04 36 04 08 00 9E 00 9D 00 22 04 00 00 40 6D 67 00 00 00 05 00 00 00 00 00 00 00 04 00 00 00

not 100% on this, might have made a mistake since I went hex by hex seeing what happened.

0x00-0x01 - ??
0x02-0x03 - Tile Set Load (?)
0x04-0x05 - Map Terrain load
[color="silver"]0x06-0x07 - Script Set A?
0x08-0x09 - Script Set B? [size="2"]usually blank?[/size][/color]
0x0A-0x0B - Text Script # Load
0x0C-0x0D - music set A?
0x0E-0x0F - music set B?
0x10-0x11 - music set C?
0x12-0x13 - music set D?
[color="orange"]0x14-0x15 - Encounter Slot Table, 0xFFFF = no encounters[/color]
[b][color="red"]0x16-0x17 - Map # Load ~ (0-426)[/color][/b]
0x18-0x19 - Map within Map ~ Currently loaded map is located within VALUE as a submap (Current Location).
0x1A-0x1B - ??
0x1C-0x1D - controls camera angle
0x1E-0x1F - battle pads & background, other data:
7th bit: Bike [u]not[/u] allowed (0 = true, 1 = false)
10th bit: Flying [u]not[/u] allowed (0 = true, 1 = false)
don't know exactly what the other bits do
0x20-0x21 - more camera angle crap, shifts the viewing position x y?
0x22-0x23 - always zero
[color="blue"]0x24-0x25 - flyto-x coordinate
0x26-0x27 - always zero[/color]
[color="green"]0x28-0x29 - flyto z coordinate (auto drops to floor I think)
0x2A-0x2B - always zero[/color]
[color="orange"]0x2C-0x2D - flyto-y coordinate
0x2E-0x2F - always zero[/color]

to allow people to bike everywhere, make 0x1E's 7th bit always 1.

Edited by Kaphotics
Link to comment
Share on other sites

trying to wrap my head around the basic structure of scripts...

picture below is notepad++ and the script file of 316 (for desert resort) split up into common pattern chunks.

agrdk.png

I wasn't sure on the endianness of the structure so I assumed nothing; but it looks like there is 1 byte instructions and 02 00 is "end" just like in gen 4.

Edited by Kaphotics
Link to comment
Share on other sites

mmk so toying with the known behavior of the script, I see that each darmanitan script has 2 references to Ragecandybar (hex 0x01F8),

after changing it to Life Orb (an item in my inventory), the game first checks if HEX is in your inventory, the second one is to remove HEX from your inventory. So I was able to encounter Darmanitan by consuming a life orb ^.^

In the above pattern map, the gold and dark blue highlights contain the part of the script. The rest of the script is almost exactly the same, bar some readlength data.

Looking at the first darmanitan script, we see "DE 03", which tells us to do something 0x03DE... which just so happens to be right where a 02 00 happens. So this is either a readlength or jumpforward XX for data instruction.

"28 00 77 40 02 00" (I didn't see this 02 00 at the time and didn't separate it out... oops!). However, there's another descending number that occurs before 03DE... "0397", this readlength points to some other data that is right below all 5 darmanitan scripts starting with 0x10; it also is right after 02 00.

So, this pretty much confirms that "02 00" means end line/script... there arent many occurrences of 02 00 that aren't "ends", so it should be a good starting fact when figuring structures out.

might as well look at scripts of a smaller map just to get my bearings... like in your starting room for starters.

Link to comment
Share on other sites

AOxUc.png

zonedata.lua

local bnd,br,bxr=bit.band,bit.bor,bit.bxor
local rshift, lshift=bit.rshift, bit.lshift
local mdword=memory.readdwordunsigned
local mword=memory.readwordunsigned
local mbyte=memory.readbyteunsigned
local wdword=memory.writedword
local pos_m=0x0224F90C

if mdword(0x023FFE0C)==0x4F415249 then
game='White'
g=1
  else
game='Black'
g=0
end

while true do

if rshift(mbyte(0x022592BB+0x20*g),2)%2==1 then
	gui.text(159,110,string.format("Bike - Enabled"))
else
	gui.text(159,110,string.format("Bike - Disabled")) end
if rshift(mbyte(0x022592BB+0x20*g),5)%2==1 then
	gui.text(159,120,string.format("Fly  - Enabled"))
else
	gui.text(159,120,string.format("Fly  - Disabled")) end

					gui.text(1,35,string.format("Active Zonedata for Location (%s)",game))	
gui.text(1,50,string.format("00-01: %04x",mword(0x0225929C+g*0x20+2*0)))	gui.text(80,50,string.format("10-11: %04x",mword(0x0225929C+g*0x20+2*8)))	gui.text(159,50,string.format("20-21: %04x",mword(0x0225929C+g*0x20+2*16)))
gui.text(1,60,string.format("02-03: %04x",mword(0x0225929C+g*0x20+2*1)))	gui.text(80,60,string.format("12-13: %04x",mword(0x0225929C+g*0x20+2*9)))	gui.text(159,60,string.format("22-23: %04x",mword(0x0225929C+g*0x20+2*17)))
gui.text(1,70,string.format("04-05: %04x",mword(0x0225929C+g*0x20+2*2)))	gui.text(80,70,string.format("14-15: %04x",mword(0x0225929C+g*0x20+2*10)))	gui.text(159,70,string.format("24-27: %08x",mdword(0x0225929C+g*0x20+2*18)))
gui.text(1,80,string.format("06-07: %04x",mword(0x0225929C+g*0x20+2*3)))	gui.text(80,80,string.format("16-17: %04x",mword(0x0225929C+g*0x20+2*11)))	gui.text(159,80,string.format("28-2B: %08x",mdword(0x0225929C+g*0x20+2*20)))
gui.text(1,90,string.format("08-09: %04x",mword(0x0225929C+g*0x20+2*4)))	gui.text(80,90,string.format("18-19: %04x",mword(0x0225929C+g*0x20+2*12)))	gui.text(159,90,string.format("2C-2F: %08x",mdword(0x0225929C+g*0x20+2*22)))
gui.text(1,100,string.format("0A-0B: %04x",mword(0x0225929C+g*0x20+2*5)))	gui.text(80,100,string.format("1A-1B: %04x",mword(0x0225929C+g*0x20+2*13)))
gui.text(1,110,string.format("0C-0D: %04x",mword(0x0225929C+g*0x20+2*6)))	gui.text(80,110,string.format("1C-1D: %04x",mword(0x0225929C+g*0x20+2*14)))
gui.text(1,120,string.format("0E-0F: %04x",mword(0x0225929C+g*0x20+2*7)))	gui.text(80,120,string.format("1E-1F: %04x",mword(0x0225929C+g*0x20+2*15)))	

gui.text(1,135,string.format("FlyTo: X %d, Y %d, Z %d",mdword(0x0225929C+g*0x20+2*18),mdword(0x0225929C+g*0x20+2*22),mdword(0x0225929C+g*0x20+2*20)))
gui.text(40,145, string.format("Zonedata Map: %d",mword(0x0225929C+g*0x20+2*11)))

gui.text(40,165, string.format("Current Overworld Position"))
gui.text(40,175, string.format("M: %d, X: %d, Y: %d, Z: %d", mword(pos_m+0x20*g), mword(pos_m+0x6+0x20*g), mword(pos_m+0xE+0x20*g), mword(pos_m+0xA+0x20*g)))

emu.frameadvance() 
end

detects if it is black or white (english for now), and displays the zonedata. tip: use the town map to see a whole load of map IDs rather than manually going to them; when you select a location the game pops up the zonedata!

Link to comment
Share on other sites

Woow thank you so much for this helpful tool!

Thanks to you, I edited a script, so that a person at the Day Care @Route 3 gives away a Pokémon Egg!

There's one little problem, though.

You see, I copied the Egg event from Route 18 (where you could originally obtain a Larvesta Egg). It's completely working, however, that event takes 8 lines of text.

I edited a plain overworld that stands in the Day Care. So that overworld now has the new Egg Give Away script. However, she uses other text lines. I figured out that 3D 00 00 04 XX XX or 3C 00 00 04 XX calls up the textbox, with XX XX being the text line for that map. So it uses the text line of a certain a/0/0/3 file that's connected with the map.

My event uses 3D 00 00 04 00 00 till 3D 00 00 04 07 00, which is a total of 8 text lines. However, though I can change that, I still need 8 lines for my event. But I can't add new lines using PPTXT. How do I add new text lines to a certain a/0/0/3- PPTXT file?

Link to comment
Share on other sites

Oh right I totally forgot about the dialog file! Zonedata determines which one is pulled up -- it's 0xA-0xB to decide which text file is loaded. I've updated my post with the zonedata structure with this info.

I didn't do anything related to translations so I have no experience with that narc, but I can help with that!

Text Script Codes -- With this you should be able to format your text to a readable string, and I don't think there's any sort of syntax for new line. After looking at the structure of what's displayed with PPTXT, it looks as if just pressing enter creates a new line. But that doesn't work!

I believe it's because PPTXT doesn't allow the change of line length, because it simply isn't expected with all the past use. I'mma take a look at the src

Edited by Kaphotics
Link to comment
Share on other sites

Woow thank you so much for this helpful tool!

Thanks to you, I edited a script, so that a person at the Day Care @Route 3 gives away a Pokémon Egg!

There's one little problem, though.

You see, I copied the Egg event from Route 18 (where you could originally obtain a Larvesta Egg). It's completely working, however, that event takes 8 lines of text.

I edited a plain overworld that stands in the Day Care. So that overworld now has the new Egg Give Away script. However, she uses other text lines. I figured out that 3D 00 00 04 XX XX or 3C 00 00 04 XX calls up the textbox, with XX XX being the text line for that map. So it uses the text line of a certain a/0/0/3 file that's connected with the map.

My event uses 3D 00 00 04 00 00 till 3D 00 00 04 07 00, which is a total of 8 text lines. However, though I can change that, I still need 8 lines for my event. But I can't add new lines using PPTXT. How do I add new text lines to a certain a/0/0/3- PPTXT file?

so extract the files from 0/0/3, append text to the end of the right file with whatever you need for the proper formatting, make a new narc(i can do this with nnsarc if you want), and repack the rom with dsbuff. then point that script command to the new lines at the end. not seeing the issue.

e: forget that, why can't you just add to the end of a given file with pptxt then point the script straight there? i just tried adding some lines of text and it seemed to work ok.

Link to comment
Share on other sites

So I took the time to figure out why PPTXT is refusing to add the lines... here's why.

The amount of lines in the file is predetermined from the header of the text file. PPTXT won't edit it, and makes sure that the amount of lines is the same. So PPTXT can't directly add or remove lines.

However, I was able to think up a little trick to change the amount of lines a given file has:

  1. Create a backup copy of the text script narc, dubbed "dummy".
  2. Extract all a/0/0/3 text files into a folder.
  3. Open up the dummy narc file in PPTXT, find the text file you have to edit, then determine how many new lines you have to add.
  4. Close PPTXT
  5. Open the individual text file (from step 2) in HxD or hex viewer, and look at 0x2. That's how many lines are currently programmed into that file.
  6. Current Lines Lines + New Lines Required = Total Lines
  7. Find a Text File with 0x2 == Total Lines Required
  8. Open the dummy narc in HxD and search hex "01 00 XX 00", where XX is for how many lines you want (in hex) -- you'll find it right after encrypted hex not in the middle of other similar hex.
  9. That is the start of a given text file; open kiwids with the dummy narc and find what file has that region of data...
  10. Make a copy of this text file that has the total lines required (files from step 2)
  11. Delete the textfile you want to expand, and rename the copy from the above step to effectively replace the deleted file.
  12. kiwids make a new narc of all the text files
  13. Open new narc with PPTXT, go to the textfile that you originally intended to edit.
  14. In another PPTXT window (run 2 copies), open original narc with PPTXT, go to the textfile that you originally intended to edit.
  15. Restore the dummy narc with the text from the original; you will be left with extra lines of text from the copied textfile.
  16. The remaining lines of text are yours to edit!
  17. Dummy narc becomes the actual narc with the extended lines!!!

with this you essentially copy other textfiles with bigger linecounts. copypaste restore the original text back and do whatever with the remaining lines, new lines to play with!

here's an example textfile with 33 linecount

[u][b]01 00 21 00[/b][/u] 50 01 00 00 00 00 00 00 10 00 00 00 
50 01 00 00 0C 01 00 00 01 00 E0 00 0E 01 00 00 
01 00 E0 00 10 01 00 00 01 00 E0 00 12 01 00 00 
01 00 E0 00 14 01 00 00 01 00 E0 00 16 01 00 00 
01 00 E0 00 18 01 00 00 01 00 E0 00 1A 01 00 00 
01 00 E0 00 1C 01 00 00 01 00 E0 00 1E 01 00 00 
01 00 E0 00 20 01 00 00 01 00 E0 00 22 01 00 00 
01 00 E0 00 24 01 00 00 01 00 E0 00 26 01 00 00 
01 00 E0 00 28 01 00 00 01 00 E0 00 2A 01 00 00 
01 00 E0 00 2C 01 00 00 01 00 E0 00 2E 01 00 00 
01 00 E0 00 30 01 00 00 01 00 E0 00 32 01 00 00 
01 00 E0 00 34 01 00 00 01 00 E0 00 36 01 00 00 
01 00 E0 00 38 01 00 00 01 00 E0 00 3A 01 00 00 
01 00 E0 00 3C 01 00 00 01 00 E0 00 3E 01 00 00 
01 00 E0 00 40 01 00 00 01 00 E0 00 42 01 00 00 
01 00 E0 00 44 01 00 00 01 00 E0 00 46 01 00 00 
01 00 E0 00 48 01 00 00 01 00 E0 00 4A 01 00 00 
01 00 E0 00 4C 01 00 00 02 00 E0 00 76 83 F3 59 
70 30 ED 06 6A DD E7 B3 64 8A E1 60 5E 37 DB 0D 
58 E4 D5 BA 52 91 CF 67 4C 3E C9 14 46 EB C3 C1 
40 98 BD 6E 3A 45 B7 1B 34 F2 B1 C8 2E 9F AB 75 
28 4C A5 22 22 F9 9F CF 1C A6 99 7C 16 53 B2 98

essentially i just make blank text files with XX lines... and replace whatever text file I need 33 lines with 'em, then restore the text with copypaste!

Edited by Kaphotics
Link to comment
Share on other sites

k so the daycare has 0xA-0xB = 0x163, which corresponds to text file 355.

EdzeI.png

The first four bytes of this text file are [01 00 01 00], which means there is one line of text script for the one roughneck NPC -- I'm sure you already know this!

We need to add 8 lines to the text file in addition to the 1 pre-existing line... so we need a 9 long text file! Search the narc for [01 00 09 00]...

The first text file with 9 lines is file 31; so we copy it, make it the new 355, and then restore the old 355 text line that it had to restore compatibility. Here's the new text file for 355 if you want to rebuild the narc with this one and test it out.

:D

Link to comment
Share on other sites

sparse list of map -> location (~26%, major locations)

0	White Forest
1	Black City
--
6	Striaton City
28	Castelia City
36	Castelia Left Pier (victini)
37	Castelia Leftmid Pier
38	Castelia Mid Pier
62	Nimbasa City
63	Nimbasa Gym
64	Outside Ferris Wheel
65	Nimbasa Pokecenter
66	Gear Station
67	Single Line (regular)
68	Super Single Line 
69	Double Line (regular)
70	Super Double
71	Multi
72	Super Multi
73	WiFi Train
74	Train to Anville
77	Musical Building
79	Big Staduim Lobby
80	Big Stadium Bleachers
82	Big Stadium Field
84	Small Stadium Lobby
85	Small Stadium Bleachers
87	Small Stadium Field
88	House where Guy gives strength HM
91	Route Link Left from Nimbasa
92	Route Link Right from Nimbasa
93	Battle Institute
94	House next to guy who gives STR
96	Driftveil Town
97	Driftveil Town B1F++
98	Driftveil Gym Ground Floor
99	Driftveil Pokecenter
100	Driftveil House (2nd right above with patrat)
101	Driftveil House (right above)
102	Driftveil House (2nd right)
103	Driftveil House (rightmost)
104	Driftveil Advice House (town hall?)
105	Driftveil Market
106	Driftveil House (left above)
107	Mistralton City
109	Mistralton Pokecenter
120	Opelucid City
136	Pokemon League
152	Dreamyard
154	Pinwheel Forest
157	Desert Resort
158	Desert Resort Deep
159	Desert Resort Route Link
160	Relic Castle 1F
191	Cold Storage (South Driftveil)
192	Cold Storage Interior
193	Cold Storage Crate (sage)
194	Chargestone Cave Exterior
195	Chargestone Cave Interior (1F)
198	Twist Mountain
205	Dragonspiral Tower
214	Victory Road
230	Giant Chasm
235	Liberty Garden
236	Victini Outer Chamber
237	Victini Inner Chamber
238	P2 Lab
240	Undella Bay
249	Skyarrow Bridge
253	Driftveil Drawbridge
255	Village Bridge
263	Marvelous Bridge
279	Entralink
317 	Route 1
319	Route 2
321	Route 3
323	Inside the Daycare
324	Wellspring Cave
326	Route 4
329	Route 5
330	Route 5 Motor Home (ingredient)
331	Route 6
332	Season Research Lab
333	Mistralton Cave
336	Route 6 Rest House
337	Route 7
352	Challenger's Cave
355	Route 10
365	Route 11
368	Route 12
370	Route 13
374	Route 14
375	Route Link above White Forest
376	Abundant Shrine
378	Route 15
379	Route Link Left White Forest
380	Marvelous Bridge Route Link to Route 15
381	Poketransfer Place
382	Motor Home on Route 15 (Rotom Ditto Trade)
383	Route 16
384	Marvelous Bridge Route Link to Route 16
385	Lostlorn Forest
386	Lostlorn Forest Motor Home (Zoroark Event)
387	Route 18
389	Numeva Town
397	Accumula Town
406	Lacunosa Town
412	Undella Town
418	Anville Town
419	Middle House in Anville
420	Bottom Left house in Anville
421	Bottom Right house in Anville	(lost item guy)
423	Route 17
425	White Forest Pokecenter
426	White Forest House

Link to comment
Share on other sites

I don't have enough time at the moment, but I just wanted to thank you all for all the work. =)

Thank you so much!!!

Also, thank you too, @Bond697, however PPTXT didn't allow me to add new lines, though Kaphotics seems to have a solution. I will try it out tomorrow.

Link to comment
Share on other sites

Lostlorn Forest -- Inside the Motor Home, not the Zoroark Script. Trying to figure out more structure of scripts

scriptfile_772

02 00 00 00 		(Header)

13 FD 			(START Scripts)

2E 00 			(Script Start)
A6 00 			(Start NPC Interaction)
47 05  			(Play Sound, 0547)
74 00 		 	(Turn NPC to face Player)?
3D 00 		 	(Open White Text Dialog with)~couldnt get 3C to do anything..
00 04 			(Text Line)~
00 00 			(0)
00 00 			(Screen Anchor Bitflag)
00 00 			(Special Textbox Flag)

32 00 			(WaitForInput)
3E 00 			(WindowClose?)

30 00 			(DoInstantly)
2F 00 			(RestorePlayersAbilitytoMove)

02 00 			(End Script)

00 00 			(nothing)

Now that I kind of know scripts a little better, going to mod certain ones:

~~~~

A6 set to anything else makes the NPC not interact with you, the script goes off but nothing happens. This means that this is the "Start NPC Interaction" line.

~~~~

0547 -> 0546 == soundless textbox pops up, changing it to 48 makes it play a different clonk sound, 49 makes it bzzbep etc

So this part determines what sound is played for the textbox

~~~~

Screen Anchoring of text message:

00 00 displays it where the player isnt (so the interaction between NPC and player is shown)

01 00 always has it anchored to the top

02 00 always has it anchored to the bottom

~~~~

Textbox Flag

00 00 has the default chat bubble

01 00 plays the !!! jagged edge sound and window border, imagine Belle's father.

02 xx is broken

Essentially these are just bitflags that cause something else to happen for the displayed text. Regardless of start sound, the game plays the jagged box sound instead.

~~~~

32 means wait for input (AB) to proceed

31->2E & 33 is close ASAP without input (there might be a slight variation in text speed)

34++ breaks

~~~~

30 is do instantly. Right after 2F looks like it restores player input for movement.

So long as the script doesn't call the game to hang, the 02 00 at the end restores movement so I really couldn't figure out what the ending hexes signified

Here's a little demo of the special textbox editing. For now it's simple hacks :)

[video=youtube;p19VtiuMLNY]

Edited by Kaphotics
Link to comment
Share on other sites

Still looking at script structures, namely the headers this time.

As we already know, there's data before 0xFD13. But what does it mean? It's the offset pointers for each script.

Here's an example image -- first portion being for the above post (with only one script for one NPC on the map).

============

pWaxf.png

============

As you can see, the NPC scriptstart pointer is 0x00000002, which means "2 bytes after this position, my script starts".

~~

For the latter 3 examples, we have 3 NPCs in the Rest Home @ Route 6.

Script0 has a value of 0x0000000A, and the image confirms this is where the script starts (with 2E 00)

Script1 has a value of 0x00000091, and the image confirms this is where the script starts (...)

Script2 has a value of 0x00000022, and .....

As you can see, when adding new scripts to the script file, you have to insert the offset distance to it correctly!

edit:

make sure the script file is padded correctly at the end such that

(amount of data after pointers)%4 = 0, pad with 00 as necessary..... (this would include FD13 and all following data in the total amount)

basically just ensure that the file has n amount of dwords.

~~~~~~~~~~~~~

pretty much that's it for 'hacking' the scripts and overworlds, all that's left is to pound out the rest of the script functions (like above post) and have tools :D

Edited by Kaphotics
Link to comment
Share on other sites

more scripting adventures; this time: warping

[video=youtube;N7j2ihs-OSc]

30 00 - do instantly
C2 00 - Fade2Black warpto(mxyf)
78 00 - map
A9 01 - x
AE 00 - y
00 00 - facedirection (0 up, 1 down, 2 left, 3 right 

other commands functions I've finally nailed down:

2F 00 - clear dialog box

After recording that video, I realized I forgot to clear the text from the screen. So, I added that line right before the warp script after the 0030... so the proper ending part of her script was

0030 - do instant
002F - clear dialog
00C2 - warpto with fadetoblack (64 bits following with conditions m,x,y,f)
0078 - map
01A9 - x coord
00AE - y coord
0000 - facedirection (0 up, 1 down, 2 left, 3 right)
0002 - end

======

I looked at other scripts and there's some that determine the variables for the displayed text. The Rotom for Ditto trade has this:

57 00 01 DF 01 			Trade Recieve		Rotom					-- TextVar1 = Rotom
57 00 00 84 00 			Trade Give		Ditto					-- TextVar0 = Ditto

thus, 0057 xx YYYY is the structure of this function

0057 - get-text pokedex(i)
01   - text variable number
01DF - i ~ pokemon hex

This makes it display what Pokemon the person wants to trade.

edit: some more instructions similar to the warp command, haven't bothered figuring out the condition structure after the instruction though:

C1	SandPit Falling (directionals?)->position
C2	WarpTo M,X,Y,Face (auto level)		With FadeToblack/Sound
C3	WarpTo Union Room
C4	WarpTo MXYZ,Face			No FadeToBlack/Sound change
C5	Start Surfing?
C6	Gooey Directional? (Bug Gym)
C7	Cut Animation and Subsequent text?
C8	Warp Out animation.... maybe the undersea "out of breath"?

Edited by Kaphotics
Link to comment
Share on other sites

so many post bumps, but hey im doin shit

[video=youtube;SYCTHahfzFA]

Getting into more custom stuff:

Modified zonedata to change the battlepads and allowing the bike on the map

Modified overworld to change the NPC sprite to Mew

Modified script to trigger encounter with a level 10 Mew

Didn't bother trying to change the playsound to mew's cry, rather not waste time searching for that hex... additionally didn't bother changing the text as it's trivial :)

002F - close text
0178 - proc battle
0097 - pokemon #
000A - level

8021 - I have no idea what this shit is but it makes the overworld pop back up after the battle
017B - it also removes the NPC from the map
8010 - since the NPC spawn doesn't depend on any flags, the NPC will re-appear when the map is refreshed.
0009 - taken from musharna's spawn, maybe each map has its own set of flags which can disable events?
8010
0008
0001
0011
0001
001F
FF
0010
0000
006C - this might be the flag setting to prevent re-spawning
0000
0023
02EC
0179
0002 - originally 001E, changing to 0002 gave player control back asap
0002 - end

Edited by Kaphotics
Link to comment
Share on other sites

Teleportation script

2E 00 - Start Interaction Script
.. other data
BF 00 - Warp (spinning upwards, fade, spinning downwards, land) MXYF
89 00 - M
1F 00 - X
30 00 - Y
00 00 - Face
30 00 - Do Instant
2F 00 - Close Crap
02 00 - End

BE - Soundless Map Change (no animation, just fade to black and to new position)

C0 - Door exit sound warp, might use stored variables for positions (doesn't MXYF)

After checking the DPP scripting wiki, I noticed that most of BW's are in the same relative order as DPPHS's format. Of course there are new/deleted commands & parameters, but it's a good resource to get a general idea of what a particular command does.

Edited by Kaphotics
Link to comment
Share on other sites

0085 xxxx yyyy ???? - opponent0, opponent1, ????

0086 xxxx yyyy zzzz ???? - ally, opponent0, opponent1, ????

No idea what ???? is for.

yMoP8.png

some script commands with some sense so far

0000 nop
0001 nop1
0002 --
000C XXXX XXXX
0012 xxxx
001A xxxx
001E XXXXXXXX
002F -
0030 - 					doinstant
0032 -					waitbuttonthen
003C 0400 xxxx yyyy zzzz aaaa		textA
003D 0400 xxxx yyyy zzzz		textB
003E -
003F -
0046 xx xx
0049					textC
004C xx
0057 xx XXXX				Text Variables
0085 xxxx xxxx zzzz			start 1v# battle with ????
0086 yyyy xxxx xxxx zzzz		start 2v# battle with ????
0098 xxxx				PlayBGM
00BE mmmm xxxx yyyy ffff		f2b mapchange nosound
00BF mmmm xxxx yyyy ffff		spinwarp
00C0					soundless variable door warp
00C1 					sandpit
00C2 mmmm xxxx yyyy ffff		f2b mapchange with sound
00C3					goto union
00C4					instant change, bad
00C5					play surf anim
00C6					gooey push
00C7					play cut anim
0178 dddd ll				wildencounter dex level

Edited by Kaphotics
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...