Jump to content

Kaphotics

Helpful Member
  • Posts

    6925
  • Joined

  • Last visited

  • Days Won

    329

Posts posted by Kaphotics

  1. Overworld Structure (unfinished) ~ Might look at PPRE source later to see if there's any similarity.

    Basically there's 8 bytes for a header, followed by any Furniture entries, then followed by NPCs, then Warps, then Triggers. At the end, every OW has 00000000 to signify the end of the file.

    [u]Header (0x08 long)[/u]
    0x00-0x03:	Overworld Data Read Length
    0x04-0x07:	Header Data (Count)
        0x04:	Furniture
        0x05:	NPCs/Interactables
        0x06:	Warps
        0x07:	Triggers (Floor)
    
    [u]Furniture (0x14 long)
    [/u]    0x00-0x01 - Script Used (???)
       0x02-0x03 - ???
       0x04-0x05 - ???
       0x06-0x0B - X Coordinate
       0x0C-0x0F - Y Coordinate
       0x10-0x13 - Z Coordinate (lowest 4 bits for something else), signed!
    
    [u]NPC/Interactable (0x24 long)
    [/u]    0x00-0x01 - Overworld ID
       0x02-0x03 - Overworld Sprite
       0x04-0x05 - Movement Permissions
       0x06-0x07 - Unused / Permission 2
       0x08-0x09 - Overworld Flag ~ Items (checkflag related. Default 0)
       0x0A-0x0B - Script Called (Special for Overworld Items)
       0x0C-0x0D - Face Direction Default
    00 00 = Up
    01 00 = Down 
    02 00 = Left
    03 00 = Right
       0x0E-0x0F - Sight Range (Eyecatch Leash)
       0x10-0x11 - ????
       0x12-0x13 - ????
       0x14-0x15 - Left/Righ Leash (Deviation)
       0x16-0x17 - Up/Down Leash (Deviation)
       0x18-0x19 - ????
       0x1A-0x1B - ????
       0x1C-0x1D - X Coordinate (Left/Right)
       0x1E-0x1F - Y Coordinate (Up  / Down)
       0x20-0x21 - ????
       0x22-0x23 - Z Coordinate (Levitation)
    
    [u]Warp (0x14 long)
    [/u]    0x00-0x01 - Map
       0x02-0x03 - UseWarpCoordinates (From Above Map)
    		essentially chooses which Building/Side
       0x04 - ??? (1/2/4)
       0x05 - ??? (1/3/4)
       0x06-0x09 - Exit X (lowest 4 bits act as directional flags?)
       0x0A-0x0D - Exit Y (^)
       0x0E-0x0F - X Extention (how far the warp extends RIGHT)
       0x10-0x11 - Y Extention (how far the warp extends up/down, unsure)
       0x12-0x13 - ??? (00)
    
    [u]Trigger (0x16 long)
    [/u]    0x00-0x01 - Entity Number?
       0x02-0x03 - Constant Value
       0x04-0x05 - Constant Reference - Apparently, if Ref=Val, trigger.
       0x06-0x07 - ????
       0x08-0x09 - ????
       0x0A-0x0B - X Coordinate (16bit)
       0x0C-0x0D - Y Coordinate (16bit)
       0x0E-0x0F - Z Coordinate (16 Bit)
       0x10-0x11 - ????
       0x12-0x13 - ????
       0x14-0x15 - ????
    
     Extra Stuff (Trigger Related?)
     0x06 long
     0x00-0x01 - Selects One of something
     0x02-0x05 - Does something to it
    
    [u]00 00 00 00 = end of overworld (at the end of every OW file), sometimes 00 00
    [/u]

    for parsing:

    Furniture Start (if readbyte(0x04)>0): 		0x08
    NPC Start 	(if readbyte(0x05)>0): 		0x08+readbyte(0x04)*0x14
    Warp Start 	(if readbyte(0x06)>0): 		0x08+readbyte(0x04)*0x14+readbyte(0x05)*0x24
    Trigger Start 	(if readbyte(0x07)>0):		0x08+readbyte(0x04)*0x14+readbyte(0x05)*0x24+readbyte(0x06)*0x14
    Extra/End:					0x08+readbyte(0x04)*0x14+readbyte(0x05)*0x24+readbyte(0x06)*0x14+readbyte(0x07)*0x16

    BW Movement Permissions ~ via Oxnite

    	02 00	Looking AROUND (randomly)
    03 00	Walking AROUND randomly till max
    04 00	Looking UP and DOWN
    05 00	Looking LEFT and RIGHT
    06 00	Looking UP and LEFT
    07 00	Looking UP and RIGHT
    08 00	Looking LEFT and DOWN
    09 00	Looking RIGHT and DOWN
    0A 00	Looking UP, DOWN and LEFT (randomly)
    0B 00	Looking UP, DOWN and RIGHT (randomly)
    0C 00	Looking UP, LEFT and RIGHT (randomly)
    0D 00	Looking DOWN, LEFT and RIGHT (randomly)
    0E 00	Looking UP
    0F 00	Looking DOWN
    10 00	Looking LEFT
    11 00	Looking RIGHT
    12 00	Looking UP, LEFT, DOWN, RIGHT (counter-clockwise)
    13 00	Looking UP, RIGHT, DOWN, LEFT (clockwise)
    20 00	Running DOWN till max, RIGHT till max; then returns + repeats
    21 00	Running RIGHT till max, UP till max; then returns + repeats

    ezmeh

    g4ACU.pngaScpM.png

    tutorial video

  2. Hi, is there any way to edit level-up movesets? That feature isn't supported by the B2W2 ROM changer and I can't extract the narc to manually make these changes because the patched ROM is compressed.

    The patched ROM is not compressed, it's trimmed. There's not that much data inside the ROM; there's just meaningless padding to reach 512 MB.

    You can still extract narcs with editor.exe / Tinke.

  3. I have no idea about editing npcs, i've learned to edit simple things like stats, moveset, grottos... but i can´t find a decent npc editing tutorial, do you have one?

    Nah, I haven't dabbled in overworld editing. Drayano has added NPCs but we're not totally sure on what the overall structure is. Since I'm home on break I can't really give anything to help but I can tell you what I know:

    If you open an overworld file (similar to a script file), it's essentially a list that tells the game what (and how much) to load when it comes to NPCs, objects, etc. There's a header at the top which contains a bunch of #'s similar to how Advance Map has a NPC counter and other counts. The game then loads the overworld occupants/objects depending on how many it is instructed to load. All one would have to do is add the desired hex string in the proper format and edit the header setting.

    Identification and editing is similar to script editing. Use my zone data Lua script (B/W Lua scripts w/e) and it will tell you what overworld file is loaded in the game. You then extract the narc and open the overworld file that is used. For NPCs there's a certain structure (I think there's a thread on Moving Overworld NPCs) which has XZY coordinates, sprite, script assignment, and movement leashes.

    Drayano could possibly have something to help, but when he made BBVW2 he didn't really document the exact structure afaik. Figuring out the structure wouldn't take too much time so long as you know how to look! :)

  4. More on Giving Items: Using Flags and more Subscripts!

    One of the cool things about B2W2 is that there's a bunch of built in secondary scripts you can call by using variables.

    For example, we'll look at a GiveItem script that goes beyond just giving an item; it's super easy to set an NPC up with this kind of script.

    A bit of background on the 0x001C command:

    The 0x001C command instructs the game to branch out to another script file to continue the event. By setting variables in the main script, the secondary script can then execute a common routine with ease. If you ever need to do the same kind of script again, you just call the script again! Basically it's a subfunction you can use at any time.

    The secondary script we'll be using is 0x0AF0; this script uses 7 defined variables to give one (+quantity) item, check and set a flag, and play 3 unique messages based on the flag setting.

    Example Script that uses 0x001C 0x0AF0:

    iqp2u.png

    =====

    Analyzing the script to use in a desired custom script:

    Here's the raw hex for a main script that calls 0x0AF0:

    Special Flag Dependent GiveItem ; Example in Accumula Town (BalmMushroom Giver)
    
    2E 00 			LockAll
    
    [b]09 00 00 80 		Using Variable 8000 (var 0)
    09 00 01 80 		Using Variable 8001 (var 1) 
    09 00 02 80 		Using Variable 8002 (var 2)
    09 00 03 80 		Using Variable 8003 (var 3)
    09 00 04 80 		Using Variable 8004 (var 4)
    09 00 05 80 		Using Variable 8005 (var 5)
    09 00 06 80 		Using Variable 8006 (var 6)
    
    2A 00 00 80 xx xx 	Item to Give (16 bit hex)
    2A 00 01 80 xx xx	Quantity to Give (16 bit hex)
    2A 00 02 80 xx xx 	Event Flag to consider [16bit]
    2A 00 03 80 xx xx 	First Message [before giving]
    2A 00 04 80 xx xx 	Post  Message [After  giving]
    2A 00 05 80 xx xx 	After Message [if player talks to again]
    CC 00 06 80 		Sets Variable 6 as "Item"
    
    1C 00 F0 0A 		Calls the script which uses these 7 defined variables
    
    0A 00 06 80 		Clear the variables at the end.
    0A 00 05 80 
    0A 00 04 80 
    0A 00 03 80 
    0A 00 02 80 
    0A 00 01 80 
    0A 00 00 80 [/b]
    
    30 00 			After returned, wait moment
    2F 00 			ReleaseAll
    02 00			End
    

    Now a somewhat translated to readable via the Lua script:

    LockAll (0x002E)
    
    [b]Logic09 (0x0009)  Var_0
    Logic09 (0x0009)  Var_1
    Logic09 (0x0009)  Var_2
    Logic09 (0x0009)  Var_3
    Logic09 (0x0009)  Var_4
    Logic09 (0x0009)  Var_5
    Logic09 (0x0009)  Var_6
    
    SetVarEq2A (0x002A) Var_0 Num_580	BalmMushroom
    SetVarEq2A (0x002A) Var_1 Num_1		Quantity 1
    SetVarEq2A (0x002A) Var_2 Num_335	Flag to Set/Check
    SetVarEq2A (0x002A) Var_3 Num_0		Intro Message
    SetVarEq2A (0x002A) Var_4 Num_1		PostItem
    SetVarEq2A (0x002A) Var_5 Num_1		After Message
    SetVarQualItem (0x00CC) Var_6
    
    CallStd (0x001C) 0x0AF0
    
    Logic0A (0x000A)  Var_06
    Logic0A (0x000A)  Var_05
    Logic0A (0x000A)  Var_04
    Logic0A (0x000A)  Var_03
    Logic0A (0x000A)  Var_02
    Logic0A (0x000A)  Var_01
    Logic0A (0x000A)  Var_00[/b]
    
    WaitMoment (0x0030)
    UnlockAll (0x002F)
    End (0x0002)

    If you want this in a custom script, all you have to do is define your variables and call 0x0AF0 the same way the example script does. Be sure to define an item, quantity, flag, and the 3 text messages that are to used. The secondary script does the rest of the work for you!

    Just for kicks, here's the layout of 0x0AF0 so you can see how it works.

    PlaySound (0x00A6) id=0x547
    FacePlayer
    Readflag (0x0010)  Var_2
    Logic08 (0x0008)  Num_1
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x00000014
    Message2 (0x003D) 0x6 0x80 mid=Var_5 view=0 type=0
    WaitKeyPress (0x0032)
    CloseMessage (0x003E)
    GoTo (0x001E) jump=0x00000063
    Message2 (0x003D) 0x6 0x80 mid=Var_3 view=0 type=0
    CloseMessage (0x003E)
    ?????? (0x00B7) A=Var_0 B=Var_1 C=Var_16
    Logic09 (0x0009)  Var_16
    Logic08 (0x0008)  Num_0
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x00000018
    SetVar29 (0x0029) Var_8 Var_0
    SetVar29 (0x0029) Var_9 Var_1
    CallRoutine (0x0004) 0x0000022F
    GoTo (0x001E) jump=0x00000012
    SetVar29 (0x0029) Var_8 Var_0
    SetVar29 (0x0029) Var_9 Var_1
    CallRoutine (0x0004) 0x000002A1
    Message2 (0x003D) 0x6 0x80 mid=Var_4 view=0 type=0
    WaitKeyPress (0x0032)
    CloseMessage (0x003E)
    SetFlag (0x0023)  Var_2
    EndStdReturn[**] (0x001D)
    SetVar29 (0x0029) Var_8 Var_0
    SetVar29 (0x0029) Var_9 Var_1
    CallRoutine (0x0004) 0x0000027B
    EndStdReturn[**] (0x001D)
    End (0x0002)

    0x0029 = copyvar (variable to be set, variable to copy)

    As you can see, it's a somewhat hefty script. By making this a script the game can call up any time, the programmer doesn't have to include all this inside the main script.

  5. [video=youtube;ncbJHL36FTQ]

    Uses 0x001C 0x0AF5

    A little tutorial on how to edit the scripts and have a customized script in game with current tools. It's suggested that you read the first few posts of this thread to understand what certain commands are and how everything works via hex.

    If you want a list of what commands are currently known, the interpreter Lua script can be opened with notepad to see how each one works.

  6. I'm thinking that the group of 4 unused is for set move; currently the game just grabs the current level moves since none are special. I'd also think that one would set nationality similar to the HGSS Magicarp (Foppa). EVs might be in there too.

    Ability=3 would be rand(0,1) for ability, and 4 would be rand of all 3 abilities similar to how we've seen with wondercards. There might be a shiny prevention flag or a shiny always flag, too. No time for me to test all of this though :P

    It's pretty easy to edit with tinke by just swapping out each bin

  7. You were already answered.

    Poketransfer is only to get Gen IV pokemon to a Gen V game. Try setting the location to Route 23, and the origin as White 2.
    And you mean to say these arent hacking?

    http://www.pokecheck.org/?p=search&=0&tid=%40Agonist&=&=0&=0&=1&=0&=0&=0&=0&=0&=0&=0&=0&=0&=0&=0

    http://www.pokecheck.org/?p=detail&uid=2837860 ----This one especially was received before both BW2 japanese and english was released.

    Stop being Hypocritical and please answer the Question.

    Plus, those are legit. He knows how to RNG and they're just a false positive because he purposefully RNG'd his ID/SID for that.

  8. Since Andi didn't give where that RAM was located in the memory (usually in dumps it starts at 0x00000000 rather than 0x02000000), I set out to find it in the RAM myself :P

    The string that Andi found is located in the RAM offset : 0x224C048 for the Tutor (edit: this location varies).

    scrcmd_shop.c is what is right before it, indicating that script command shop is what's being grabbed.

    As for the structure, it looks like u32 & u32 for Move and Shard Quantity.

    The script the shopkeeper uses WAS located at 224BC84 (again, it varies), which isn't the typical location for the main scripts. I'm now looking for what script file he's located in. For now, here's a barebones parse of what his script is:

    Script 1: 00000014
    ~~~~~Script 1~~~~~~
    SetVarEqVal (0x0028) Var_32 Num_0
    SetVarEqVal (0x0028) Var_33 Num_0
    SetVarEqVal (0x0028) Var_34 Num_0
    SetVar29 (0x0029) Var_33 Var_0
    SetVar29 (0x0029) Var_34 Var_1
    Logic09 (0x0009)  Var_34
    Logic08 (0x0008)  Num_0
    Logic11 (0x0011)  Num_5
    IfThenGoTo (0x001F) 0xFF jump=0x0000000C
    Message1 (0x003C) MID=Num_4 NPC=32785
    CompareAtoB (0x0019) A=Var_33 B=Num_246
    IfThenGoTo (0x001F) 0x01 jump=0x0000002D
    CompareAtoB (0x0019) A=Var_33 B=Num_245
    IfThenGoTo (0x001F) 0x01 jump=0x00000020
    CompareAtoB (0x0019) A=Var_33 B=Num_244
    IfThenGoTo (0x001F) 0x01 jump=0x00000013
    CompareAtoB (0x0019) A=Var_33 B=Num_243
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x0000000C
    CallRoutine (0x0004) 0x000001DE
    GoTo (0x001E) jump=0x00000032
    CompareAtoB (0x0019) A=Var_33 B=Num_254
    IfThenGoTo (0x001F) 0x01 jump=0x00000013
    CompareAtoB (0x0019) A=Var_33 B=Num_253
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x0000000C
    CallRoutine (0x0004) 0x00000153
    GoTo (0x001E) jump=0x00000006
    CallRoutine (0x0004) 0x00000002
    EndStdReturn[**] (0x001D)
    0x8023
    0x0
    SetVarEqVal (0x0028) Var_36 Num_0
    SetVarEqVal (0x0028) Var_37 Num_0
    Logic09 (0x0009)  Var_34
    Logic08 (0x0008)  Num_2
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x00000012
    Message1 (0x003C) MID=Num_1 NPC=32785
    GoTo (0x001E) jump=0x0000000C
    Message1 (0x003C) MID=Num_0 NPC=32785
    SetVarEqVal (0x0028) Var_36 Num_1
    SetVarEqVal (0x0028) Var_37 Num_1
    Logic09 (0x0009)  Var_37
    Logic08 (0x0008)  Num_1
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x000000BF
    CompareAtoB (0x0019) A=Var_36 B=Num_0
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x00000018
    Message1 (0x003C) MID=Num_2 NPC=32785
    SetVarEqVal (0x0028) Var_36 Num_1
    GoTo (0x001E) jump=0x0000008E
    CompareAtoB (0x0019) A=Var_36 B=Num_1
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x00000012
    CallRoutine (0x0004) 0x00000112
    SetVar29 (0x0029) Var_36 Var_32
    GoTo (0x001E) jump=0x00000069
    CompareAtoB (0x0019) A=Var_36 B=Num_2
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x00000012
    CallRoutine (0x0004) 0x00000143
    SetVar29 (0x0029) Var_36 Var_32
    GoTo (0x001E) jump=0x00000044
    CompareAtoB (0x0019) A=Var_36 B=Num_3
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x00000012
    CallRoutine (0x0004) 0x0000015F
    SetVar29 (0x0029) Var_36 Var_32
    GoTo (0x001E) jump=0x0000001F
    CompareAtoB (0x0019) A=Var_36 B=Num_255
    IfThenGoTo (0x001F) 0x01 jump=0x00000006
    GoTo (0x001E) jump=0x0000000C
    SetVarEqVal (0x0028) Var_37 Num_0
    GoTo (0x001E) jump=0x00000000
    GoTo (0x001E) jump=0xFFFFFF2E
    Message1 (0x003C) MID=Num_3 NPC=32785
    WaitKeyPress (0x0032)
    CloseMessage (0x003E)
    SetVarEqVal (0x0028) Var_37 Num_0
    SetVarEqVal (0x0028) Var_36 Num_0
    SetVarEqVal (0x0028) Var_35 Num_0
    End???[*TR] (0x0005)
    SetVarEqVal (0x0028) Var_38 Num_0
    SetVarEqVal (0x0028) Var_39 Num_0
    SetVarEqVal (0x0028) Var_40 Num_0
    Message1 (0x003C) MID=Num_8 NPC=32785
    PopYesNoVar (0x0047) Var_38
    Logic09 (0x0009)  Var_38
    Logic08 (0x0008)  Num_0
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x00000006
    CallRoutine (0x0004) 0x0000008E
    Message1 (0x003C) MID=Num_9 NPC=32785
    WaitKeyPress (0x0032)
    CloseMessage (0x003E)
    SetVarEqVal (0x0028) Var_40 Num_0
    SetVarEqVal (0x0028) Var_39 Num_0
    SetVarEqVal (0x0028) Var_38 Num_0
    End???[*TR] (0x0005)
    SetVarEqVal (0x0028) Var_41 Num_0
    CallRoutine (0x0004) 0x0000005E
    SetVarEqVal (0x0028) Var_41 Num_0
    End???[*TR] (0x0005)
    SetVarEqVal (0x0028) Var_42 Num_0
    ?????Multi2 (0x00B2) A=0x11F B=0x1 C=0x0 D=0x100 16=0x2A01 E=44928
    ScriptText??? (0x00AF) A=Num_5 B=Var_16383 C=Num_2
    ScriptText??? (0x00AF) A=Num_6 B=Var_16383 C=Num_3
    ScriptText??? (0x00AF) A=Num_7 B=Var_16383 C=Num_255
    ???? (0x0077)
    Logic09 (0x0009)  Var_42
    Logic08 (0x0008)  Var_16382
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x0000000C
    SetVarEqVal (0x0028) Var_32 Num_255
    GoTo (0x001E) jump=0x00000006
    SetVar29 (0x0029) Var_32 Var_42
    SetVarEqVal (0x0028) Var_42 Num_0
    End???[*TR] (0x0005)
    SetVarEqVal (0x0028) Var_43 Num_0
    SetVarEqVal (0x0028) Var_43 Num_1
    CloseMessage (0x003E)
    0x149
    0x8021
    0x802B
    Logic09 (0x0009)  Var_43
    Logic08 (0x0008)  Num_0
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x0000000C
    SetVarEqVal (0x0028) Var_32 Num_255
    GoTo (0x001E) jump=0x00000006
    SetVarEqVal (0x0028) Var_32 Num_0
    SetVarEqVal (0x0028) Var_43 Num_0
    End???[*TR] (0x0005)
    SetVarEqVal (0x0028) Var_44 Num_0
    SetVarEqVal (0x0028) Var_45 Num_0
    0x1A4
    0x1A7
    CloseMessage (0x003E)
    0x14B
    0x14E
    0x0
    0x802C
    0x802D
    0x14A
    0x1A3
    0x1A7
    Logic09 (0x0009)  Var_44
    Logic08 (0x0008)  Num_0
    Logic11 (0x0011)  Num_1
    IfThenGoTo (0x001F) 0xFF jump=0x0000000C
    SetVarEqVal (0x0028) Var_32 Num_255
    GoTo (0x001E) jump=0x00000006
    SetVarEqVal (0x0028) Var_32 Num_0
    SetVarEqVal (0x0028) Var_45 Num_0
    SetVarEqVal (0x0028) Var_44 Num_0
    End???[*TR] (0x0005)
    SetVarEqVal (0x0028) Var_34 Num_0
    SetVarEqVal (0x0028) Var_33 Num_0
    0x0
    0x5200
    0x46
    0x1800
    ?????Multi2 (0x00B2) A=0x2800 B=0xA928 C=0x24A9 D=0x224 16=0x2 E=0
    
    -- beyond here it errors out due to not all commands being known 
    
    0x0
    CallRoutine (0x0004) 0x6373194D
    0x6372
    0x646D
    0x735F
    0x6F68
    0x2E70
    0x63
    0xBE34
    0xDA00
    0x125
    0xDFC5
    0xBA84
    0x7
    0xF5
    0x1
    0x0
    0xD
    0x0
    0x15
    0x0
    0x1E58
    ??? (0x0227) A=Cont_10020 B=Num_546
    0xDA24
    0x221
    0x3024
    0x222
    0x7124
    0x222
    0xAE24
    0x222
    0x183
    0x0
    End (0x0002)
    ~~~~~~Finish~~~~~~
    0x0
    script returned but is still running registered functions
    

    script begins in scriptnarc @ 7CC78, corresponds to script file 6_1247.

    Depending on what tutor you talk to, the list that Andi gave will be different. No idea where the table is from though!

    shardchange.png

    Was able to change the move he gives out. Most likely the text of the menu is set within the script, but when selecting a move it loads the proper text.

×
×
  • Create New...