+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 16 to 26 of 26

Thread: Pokémon Black and White - Overworlds and scripts

  1. #16

    Re: Pokémon Black and White - Overworlds and scripts

    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!

    Spoiler
    here's an example textfile with 33 linecount
    Code:
    01 00 21 00 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!
    Last edited by Kaphotics; Jun 13th, 2012 at 11:11 PM.

  2. #17

    Re: Pokémon Black and White - Overworlds and scripts

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



    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.


  3. #18

    Re: Pokémon Black and White - Overworlds and scripts

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

    Code:
    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

  4. #19

    Re: Pokémon Black and White - Overworlds and scripts

    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.


    Beta Version 0.85 BRAND NEW!
    OUT NOW!

    (as of 06/12/'12)

  5. #20

    Re: Pokémon Black and White - Overworlds and scripts

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

    scriptfile_772

    Code:
    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

    Last edited by Kaphotics; Jun 14th, 2012 at 08:02 PM.

  6. #21

    Re: Pokémon Black and White - Overworlds and scripts

    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).

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

    Spoiler

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

    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
    Last edited by Kaphotics; Jun 16th, 2012 at 04:55 AM.

  7. #22

    Re: Pokémon Black and White - Overworlds and scripts

    more scripting adventures; this time: warping

    Spoiler


    Code:
    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:

    Code:
    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

    Code:
    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:

    Code:
    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:

    Code:
    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"?
    Last edited by Kaphotics; Jun 15th, 2012 at 03:34 PM.

  8. #23

    Re: Pokémon Black and White - Overworlds and scripts

    so many post bumps, but hey im doin shit



    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


    Code:
    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
    Last edited by Kaphotics; Jun 15th, 2012 at 11:33 PM.

  9. #24

    Re: Pokémon Black and White - Overworlds and scripts

    Teleportation script
    Code:
    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.
    Last edited by Kaphotics; Jun 16th, 2012 at 03:49 AM.

  10. #25

    Re: Pokémon Black and White - Overworlds and scripts

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

    No idea what ???? is for.



    Code:
    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
    Last edited by Kaphotics; Jun 18th, 2012 at 08:29 PM.

  11. #26
    Member Drayano's Avatar
    Join Date
    Sep 2009
    Location
    UK
    Age
    20
    Posts
    192

    Re: Pokémon Black and White - Overworlds and scripts

    I can provide a little insight on that last one...

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

    The ??? is what decides whether the battle is a loss if you die iirc. If it's set to 0 then it plays out normally, if it's 1 then even if you lose the game continues on as if you won. It's something to that effect in HG/SS so I assume it works the same way.

    But much thanks for looking into this, it's very nice to see some scripting progress finally! The structure does look very similar to 4th gen indeed.

+ Reply to Thread
Page 2 of 2
FirstFirst 1 2

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
PPN Top 50