-
Posts
7270 -
Joined
-
Last visited
-
Days Won
362
Content Type
Profiles
Pokédex
Portal
Technical Documentation
Pages
Tutorials
Forums
Events
Downloads
Gallery
Blogs
Everything posted by Kaphotics
-
resource B2W2 Scripting Thread
Kaphotics replied to Kaphotics's topic in ROM - NDS Guides and Other Resources
. Testing custom scripts in real time Using a Lua script, you can write a script into the game in real time. Using Event Script Writer (scrins.Lua), the script writes a text string (of hex copypasted from a hex editor) directly into the memory. If an NPC were to initiate script 0, the game would read the inserted script rather than the one from the ROM. To use: Save state. Load the script. Stop it for now. Talk to the NPC once so that the default script data is loaded. Use the Overworld Editor script to force all NPCs to use Script 1 (offset 0xA = 0x1). Run the insertion script. Talk to the NPC, custom script runs. Dump of scripting related tutorial resources: ============ Feel free to ask questions related to scripting, whether it be how they work or how to script a certain event. -
resource B2W2 Scripting Thread
Kaphotics replied to Kaphotics's topic in ROM - NDS Guides and Other Resources
. Massive Script Examples Scripted Event [video=youtube;8tBDVstp1hM] Raw Script "Chargestone Cave: HACKED" [video=youtube;z0VLebo1mnk] Raw Script "DRAYNO60S MARVELOUS TRIP THROUGH ISSHU" [video=youtube;XiHALWTQ5Tc] BBVW2 Scripts (by me, not yet in public versions) Force save before continuing the script Random Baby Egg script -
resource B2W2 Scripting Thread
Kaphotics replied to Kaphotics's topic in ROM - NDS Guides and Other Resources
. NPC Manipulation (Add / Remove / MOVE) NPCs are referred to with an 8 bit number, based off of their overworld data. The hero is always 0xFF (entry 255), and the map's overworld NPCs start at 0x00+ Adding and Removing an NPC: Overworld Add/Remove: You can add and remove an NPC based on its overworld ID. [color="blue"]006B[/color] [color="red"]AddNPC[/color][color="green"] - u16: NPC ID[/color] [color="blue"]6B 00[/color] [color="green"]0A 00[/color] Add NPC ID=0x0A ===== [color="blue"]006C[/color] [color="red"]RemoveNPC[/color][color="green"] - u16: NPC ID[/color] [color="blue"]6C 00[/color] [color="green"]0A 00[/color] Remove NPC ID=0x0A Adding only works for NPCs that already exist in the overworld file, but aren't on the map (previously removed, or flag prevented spawn). In order to add a new NPC from scratch, use CreateNPC [color="blue"]0069[/color] [color="red"]CreateNPC[/color][color="green"] - u16: X coordinate - u16: Y coordinate - u16: Face direction - u16: Overworld ID - u16: Sprite Number - u16: Movement Permission[/color] [color="blue"]69 00[/color] [color="green"]01 00 02 00 03 00 41 00 53 00 02 00[/color] make NPC @ (X,Y)=(1,2) facing Right, NPC ID=0x41, sprite=SuitMan, looks around randomly Moving an NPC: You have three methods to move NPCs. 0064 - Applymovement - You can tell them what movements to perform. 006D - RelocateNPC - You can instantly relocate them to new coordinates. 024F - MoveNPC - You can tell them to move coordinates (over a time period) from their current coordinates. ========== 0064 - Applymovement Applymovement has many movement types. Give the NPC a movement and how many times it does that movement. ...time to move an NPC. [color="blue"]64 00[/color] [color="green"]FF 00[/color] [color="purple"]08 00 00 00[/color] ApplyMovement 0xFF~hero (jump 0x00000008, start those movements, continue script) [color="blue"]65 00[/color] WaitMovement [color="blue"]1E 00[/color] [color="purple"]16 00 00 00[/color] Jump (0x00000016) past the movement instructions [color="gold"]01 00 00 00[/color] Face Down for 0 iterations. [color="gold"]4B 00 00 00[/color] Exclamation for 0 iterations (0 or 1 is ok) [color="gold"]17 00 01 00[/color] Shuffle right 1 step (one can always have StoreHeroPosition -> different moves) [color="gold"]14 00 01 00[/color] Shuffle up 1 step [color="gold"]01 00 00 00[/color] Face Down for 0 iterations [u]FE 00 00 00[/u] End Movement Instructions ... continue script List of movement types ========== 006D - RelocateNPC - Used mainly for off-screen relocation of NPCs or between fadeouts. [color="blue"]006D[/color] [color="red"]RelocateNPC[/color][color="green"] - u16: Overworld ID - u16: X coordinate - u16: Y coordinate - u16: Z coordinate - u16: Face direction[/color] [color="blue"]6D 00[/color] [color="green"]00 41 01 00 02 00 00 00 02 00[/color] relocate NPC=0x41 to (X,Y,Z)=(1,2,0), facing left ========== 024F - MoveNPC [color="blue"]024F[/color] [color="red"]MoveNPC[/color][color="green"] - u16: Overworld ID - u16: X coordinate - u16: Y coordinate - u16: Z coordinate - u16: Rapidity (how fast) - u16: Face Direction (not used?)[/color] [color="blue"]4F 02 [/color] [color="green"]FF 00 19 00 0F 00 02 00 0C 00 02 00[/color] relocate NPC=0xFF to (X,Y,Z)=(0x19,0x15,0x02), at speed 0x0C -
resource B2W2 Scripting Thread
Kaphotics replied to Kaphotics's topic in ROM - NDS Guides and Other Resources
. Useful Large Scripts (Trainer / Wild Battles) Trainer Battle [color="blue"]85 00[/color] [color="green"]2D 03 00 00 00 00[/color] [color="red"]SingleTrainerBattle[/color] [color="orange"](813 - Colress), trainer2 = none, params=none[/color] ---Battle Ends, script continues--- [color="blue"]8D 00[/color] [color="green"]10 80[/color] [color="orange"]StoreBattleResult to var 0x8010[/color] [color="blue"]09 00[/color] [color="green"]10 80[/color] [color="orange"]StoreVar 0x8010[/color] [color="blue"]08 00[/color] [color="green"]01 00[/color] [color="orange"]CompareTo 0x01[/color] [color="blue"]11 00[/color] [color="green"]01 00[/color] [color="orange"]Condition 0x01 (notEQ)[/color] [color="blue"]1F 00[/color] [color="green"]FF[/color] [color="purple"]08 00 00 00 [/color] [color="orange"]Incapacitation logic (return to pokecenter, etc)[/color] [color="blue"]8E 00[/color] [color="orange"]and eventually restore to Overworld if won[/color] [color="blue"]1E 00[/color] [color="purple"]02 00 00 00[/color] [color="blue"]8C 00[/color] PKM Battle [color="blue"]74 01[/color] [color="green"]7D 02 41 00 01 00 [/color] [color="red"]StartWildBattle[/color] [color="orange"]dex=0x027D @ level 0x41, parameters=0x0001[/color] ---Battle Ends, script continues--- [color="blue"]77 01[/color] [color="green"]10 80[/color] [color="orange"]Check if KO'd[/color] [color="blue"]09 00[/color] [color="green"]10 80[/color] [color="blue"]08 00[/color] [color="green"]01 00[/color] [color="blue"]11 00[/color] [color="green"]01 00[/color] [color="blue"]1F 00[/color] [color="green"]FF[/color] [color="purple"]14 00 00 00[/color] [color="orange"]Incapacitation Logic[/color] [color="blue"]23 00[/color] [color="green"]A0 03[/color] [color="orange"]Set disablespawn flag[/color] [color="blue"]23 00[/color] [color="green"]94 01[/color] [color="orange"]Set encountered at least once flag[/color] [color="blue"]6C 00[/color] [color="green"]00 00[/color] [color="orange"]Remove NPC[/color] [color="blue"]75 01[/color] [color="red"]EndWildBattle[/color] [color="blue"]1E 00[/color] [color="purple"]02 00 00 00[/color] [color="blue"]76 01[/color] [color="red"]EndWildBattle1[/color] [color="blue"]78 01[/color] [color="green"]10 80[/color] [color="blue"]19 00[/color] [color="green"]10 80 00 00[/color] [color="orange"]Check if captured[/color] [color="blue"]1F 00[/color] [color="green"]01[/color] [color="purple"]06 00 00 00[/color] [color="blue"]1E 00[/color] [color="purple"]0A 00 00 00[/color] [color="blue"]23 00[/color] [color="green"]93 01[/color] [color="orange"]Set captured flag, goto end[/color] [color="blue"]1E 00[/color] [color="purple"]30 00 00 00[/color] [color="blue"]19 00[/color] [color="green"]10 80 01 00[/color] [color="orange"]Check if player was defeated?[/color] [color="blue"]1F 00[/color] [color="green"]01[/color] [color="purple"]13 00 00 00 [color="blue"]19 00[/color] [color="green"]10 80 02 00[/color] [color="orange"]Check if defeated[/color] [color="blue"]1F 00[/color] [color="green"]01 [color="purple"]06 00 00 00[/color] [color="orange"]Goto #defeated[/color] [color="blue"]1E 00[/color] [color="purple"]10 00 00 00 [/color] [color="orange"]Goto end[/color] [color="blue"]34 00[/color] [color="green"]01 00 02 00[/color] [color="orange"]#defeated pkm, message flew away.[/color] [color="blue"]32 00[/color] [/color] [color="blue"]36 00[/color] [/color] [color="blue"]1E 00[/color] [color="purple"]00 00 00 00[/color] [color="orange"]Goto end[/color] [color="blue"]30 00 2F 00 02 00[/color] 00 00 end --- Other Useful Scripts (Trades / PokeMart) .. coming soon .. -
resource B2W2 Scripting Thread
Kaphotics replied to Kaphotics's topic in ROM - NDS Guides and Other Resources
. Common Use Scripts & Snippets of Large Ones Simple NPC Interaction [color="blue"]2E 00[/color] -- [color="red"]LockAll[/color] [color="blue"]A6 00[/color] [color="green"]47 05[/color] -- [color="red"]PlaySound Clink[/color] [color="blue"]74 00[/color] -- [color="red"]FacePlayer[/color] [color="blue"]3D 00[/color] [color="green"]00 04 0A 00 00 00 00 00[/color] -- [color="red"]Message2[/color][color="orange"], current text file, text line 0xA, default settings[/color] [color="blue"]32 00[/color] -- [color="red"]WaitKeypress[/color] [color="blue"]3F 00[/color] -- [color="red"]CloseMessage2[/color] [color="blue"]30 00[/color] -- [color="red"]WaitDelay[/color] [color="blue"]2F 00[/color] -- [color="red"]UnlockAll[/color] [color="blue"]02 00[/color] -- [color="red"]End[/color] NPC that you didn't interact with says a message: ... You can't use FacePlayer. [color="blue"]3C 00[/color] [color="green"]00 04 02 00 01 00 00 00 00 00[/color] [color="red"]Message[/color] [color="orange"]current text file, line 0x0002, NPC 0x0001 (from overworld #), default view/type[/color] [color="blue"]32 00[/color] [color="red"]WaitKeypress[/color] [color="blue"]3E 00[/color] [color="red"]CloseMessage[/color] ... YesNo Box - Saying No ends the conversation ... [color="blue"]47 00[/color] [color="green"]10 80[/color] [color="red"]PopYesNo[/color] [color="orange"]Store Result@Var10[/color] [color="blue"]09 00[/color] [color="green"]10 80[/color] [color="orange"]Internalize Var10[/color] [color="blue"]08 00[/color] [color="green"]00 00[/color] [color="orange"]Compare to 0 (yes=true=0)[/color] [color="blue"]11 00[/color] [color="green"]01 00[/color] [color="orange"]Condition Equal[/color] [color="blue"]1F 00[/color] [color="green"][b][u]FF[/u][/b][/color] [color="purple"]06 00 00 00[/color] [color="orange"]If False, Jump 0x00000006 to #no[/color] [color="blue"]1E 00[/color] [color="purple"]14 00 00 00[/color] [color="orange"]Jump 0x00000014 to #body[/color] [color="blue"]3D 00[/color] [color="green"]00 04 02 00 00 00 00 00[/color] [color="orange"]##no Message (line 2)[/color] [color="blue"]32 00[/color] [color="red"]WaitKeypress[/color] [color="blue"]3F 00[/color] [color="red"]CloseMessage2[/color] [color="blue"]30 00[/color] [color="red"]WaitMoment[/color] [color="blue"]2F 00[/color] [color="red"]ReleaseAll[/color] [color="blue"]02 00[/color] [color="Red"]End[/color] [color="blue"]A6 00[/color][color="green"] 47 05[/color] [color="orange"]##body Sound Clink[/color] [color="blue"]3D 00[/color][color="green"] 00 04 03 00 00 00 00 00[/color] [color="orange"]Message (line 3)[/color] [color="blue"]32 00[/color] [color="Red"]WaitKeypress[/color] [color="blue"]3F 00[/color] [color="Red"]CloseMessage2[/color] ... proceed... YesNo box script in action: GiveItem ... [color="blue"]09 00[/color] [color="green"]00 80[/color] [color="red"]StoreVar[/color] [color="orange"]0x8000[/color] [color="blue"]09 00[/color] [color="green"]01 80[/color] [color="red"]StoreVar[/color] [color="orange"]0x8001[/color] [color="blue"]2A 00[/color] [color="green"]00 80 32 00[/color] [color="orange"]Item # to give[/color] [color="blue"]2A 00[/color] [color="green"]01 80 01 00[/color] [color="orange"]Amount to give[/color] [color="blue"]1C 00[/color] [color="green"]F5 0A[/color] [color="red"]CallStd[/color] [color="orange"]'give item'[/color] [color="blue"]0A 00[/color] [color="green"]01 80[/color] [color="red"]ClearVar[/color] [color="orange"]0x8000[/color] [color="blue"]0A 00[/color] [color="green"]00 80[/color] [color="red"]ClearVar[/color] [color="orange"]0x8000[/color] ... Another one which says the quantity but no colored item text ... [color="blue"]09 00[/color] [color="green"]00 80 [/color] [color="red"]StoreVar[/color] [color="orange"]0x8000[/color] [color="blue"]09 00[/color] [color="green"]01 80 [/color] [color="red"]StoreVar[/color] [color="orange"]0x8000[/color] [color="blue"]2A 00[/color] [color="green"]01 80 02 00 [/color] [color="orange"]Item # to give[/color] [color="blue"]2A 00[/color] [color="green"]00 80 0F 00 [/color] [color="orange"]Amount to give[/color] [color="blue"]1C 00[/color] [color="green"]01 0B[/color] [color="red"]CallStd[/color] [color="orange"]'give item2'[/color] [color="blue"]0A 00[/color] [color="green"]01 80[/color] [color="red"]ClearVar[/color] [color="orange"]0x8001[/color] [color="blue"]0A 00[/color] [color="green"]00 80[/color] [color="red"]ClearVar[/color] [color="orange"]0x8000[/color] -
resource B2W2 Scripting Thread
Kaphotics replied to Kaphotics's topic in ROM - NDS Guides and Other Resources
. Quick Script Interpretation The best way to figure out how to script an event is to observe one in game. I created a subversion of NPRE that parses B2W2 scripts. Download this NPRE svn https://www.dropbox.com/s/owrbm4fw4nh07ut/NPREzz.zip?dl=0 https://www.dropbox.com/s/kf1gi0i23yfc266/NPRE-1226.zip?dl=0 . How to use NPRE: Open the program File->Open your ROM Navigate to /a/0/5/6, right click open as Narc (script). Select Target game as B2W2 A new window will pop up. In the top left corner, enter the script number you want to open. It will then parse the script! Open spoiler for visual illustration of ^ above process ^ To exhibit the parsing, here's an image of the first example script file I gave in part 1. Open script file 0 with NPRE via the dropdown in the top left corner. Open spoiler for visual illustration of ^ above process ^ As you can see, Script 1 (displayed as Script 0) starts at Offset 60. In hex, that's 0x3C. The next script starts at 0x3E; this is exactly the same as we mathematically solved in part one of this tutorial. Now that you can quickly see how the game does certain events in game, you can easily open up that script file to see the raw hex instructions and what they do! But... you want to script your own stuff too! ----- List of Common Commands C# reference of known commands and parameter length, from NPRE's source . Should be fairly easy to understand; although most don't have comments, it should be obvious as to how the parameters of each command are used (and how many). Here's a reduced list with some description: Logic & Meta commands: NPC Interaction Teleportation All this is pretty useless unless you know what you are doing. More advanced scripting is covered in the next post. Sound Hexes for PlaySound/Play... again, C# reference of known commands and parameter length, from NPRE's source . Biggest database of known commands. -
Introduction: Scripting is what coordinates and executes in-game events to create a story for the player. Gen III hacks have been able to tell new stories with custom scripts written from scratch; future hacks in more current generations are key for good hacks. This thread is to provide information in regards to how to script, what script commands do, and some example scripts. I'll try to go more in depth than pichu2001 did in his basic tutorial thread; if you are just starting off scripting, you should definitely read his thread first. Starting Information: First you need to extract the Script .narc with NitroExplorer, and unpack it into the individual files with editor.exe (kiwi.ds). Program & Lua starter kit: download here The location of the scripts is /a/0/5/6 There is currently no XSE equivalent of symbolic scripting for B2W2. We're doing this with hex. So have a hex editor ready (HxD or Hex Workshop), and get PPNFR to replace the individual scripts you edit. How do you know what script is used where? You currently need to use a Lua script while emulating. The script depicted below is in the starter kit. At the bottom right corner of the touch-screen, it tells you which Script is being used. Correlate this with the file numbers you extracted from the narc. Script Structure: As previously described by pichu2001 , the script contains two parts. The pointers and the scripts that are pointed to. Pointers are 4 bytes long (32 bits); the first script in this example image points to 00 00 00 38, which is equivalent to 00000038 = 0x38. 0x38 bytes after this pointer is the start of script 1. Use this formula to find the script's location in the file: Current Read Offset + Pointer Value = Script Offset In this example image, 0x04+0x38 = 0x3C. The first script is located at 0x3C... unfortunately it starts off reading as "End", so the script ends there. Try finding the offset of Script 2; you should get 0x3E, which just so happens to start right after Script 1 ends. To tell the game to stop reading pointers, a 16 byte "STOP" = 13 FD is used (0xFD13). After the STOP, there are no more pointers and the raw script command data starts. Pointers are an important part of the file; if you insert anything between existing data, the pointers will point to improper locations. I'll cover this later. Hello World: Interpreting Existing Scripts Knowing how to script requires you to observe how commands are normally used by others. I'll show you an example script that has an NPC says a text line and ends the script when dismissed. Above is the example script file. As you can see, it contains one script, which starts at 0x06. [color="purple"]02 00 00 00[/color] [u][i]13 FD[/i][/u] [color="blue"]2E 00 A6 00 47 05 74 00 3D 00 00 04 0A 00 00 00 00 00 32 00 3F 00 30 00 2F 00 02 00 00 00[/color] First we must separate out our script data. Remove everything before the start of our script (everything before 0x06) [color="blue"]2E 00 A6 00[/color] [color="green"]47 05[/color] [color="blue"]74 00 3D 00[/color] [color="green"]00 04 0A 00 00 00 00 00[/color] [color="blue"]32 00 3F 00 30 00 2F 00 02 00[/color] 00 00 Looks decent, let's make this more easily to see: [color="blue"]2E 00[/color] -- [color="red"]LockAll[/color] [color="blue"]A6 00[/color] [color="green"]47 05[/color] -- [color="red"]PlaySound Clink[/color] [color="blue"]74 00[/color] -- [color="red"]FacePlayer[/color] [color="blue"]3D 00[/color] [color="green"]00 04 0A 00 00 00 00 00[/color] -- [color="red"]Message2, text line 0xA, default settings[/color] [color="blue"]32 00[/color] -- [color="red"]WaitKeypress[/color] [color="blue"]3F 00[/color] -- [color="red"]CloseMessage2[/color] [color="blue"]30 00[/color] -- [color="red"]WaitDelay[/color] [color="blue"]2F 00[/color] -- [color="red"]UnlockAll[/color] [color="blue"]02 00[/color] -- [color="red"]End[/color] 00 00 -- Padding to make the file's size divisible by 0x4 This is gibberish to the untrained eye, so I'll explain what each line does in 'English'. [color="red"]LockAll[/color] [color="blue"]0x002E[/color] -- Stop all movements of NPCs and Player. LOCK EVERYTHING. [color="red"]PlaySound Clink[/color] [color="blue"]0x00A6[/color] [color="green"]0x0547[/color] -- Play a sound, sound number 0x0547 - "clink" [color="red"]FacePlayer[/color] [color="blue"]0x0074[/color] -- Make the NPC that was interacted with face the player [color="red"]Message2[/color] [color="blue"]0x003D[/color] -- Pops up a speech bubble from the interacted with NPC [color="green"]0x0400[/color] -- Tells the game to use the current text file [color="green"]0x000A[/color] -- Tells the game to use text line 0xA [color="green"]0x0000[/color] -- Tells the game to place the bubble away from interaction [color="green"]0x0000[/color] -- Tells the game to use the default speech bubble [color="red"]WaitKeypress[/color] [color="blue"]0x0032[/color] -- Wait until a button is pressed before proceeding [color="red"]CloseMessage2[/color] [color="blue"]0x003F[/color] -- Close the popped up speech bubble [color="red"]WaitDelay[/color] [color="blue"]0x0030[/color] -- Waits a frame; cools down the game [color="red"]UnlockAll[/color] [color="blue"]0x002F[/color] -- Allow all NPCs and player to move [color="red"]End[/color] [color="blue"]0x0002[/color] -- Ends the script; read no further! Pretty easy to interpret when you know what each command is... Value Storage: Flags, Containers (const) and Variables The game likes to keep track of what has happened in game, and your choices that you have made. If you get an item from an NPC, the game sets a flag so that the NPC doesn't give it out again. The game also sets flags to prevent NPCs from spawning (so that progress based NPCs appear/disappear) [*]If you choose a certain starter, the game sets a Const container to know what Rival teams to face you against. Constants are stored in the save file along with flags. [*]Variables are temporary values that are used to contain values for a short time. Variables do the majority of the work in scripts. They are defined by some command, then later used as dynamic parameters. Essentially symbolic math. Variables are not saved in the save file; however if they are not cleared/set properly their values can persist into other custom scripts. When you are done with them, clear them! Conclusion: Part 1 This introduction to scripting is just touching the surface on what you can do with B2W2 scripting. With over 800 commands at your disposal (more than 3x that of Gen III), there's so much more you can do!
-
Start over without using Tinke. This past week there already was a thread with a walkthrough, and people have done it.
-
Looks like you've corrupted the part of your save data which contains your MXYZ and OT. 0x19400 and 0x19500 blocks of the Save File. It's stored in the RAM.
-
you have to re-animate it yourself, or use the static animation files used by MissingNo (index 0) No, there is no tutorial for this; it is up to you to figure it out.
-
answered B2/W2 BWME Full-body Shot Help
Kaphotics replied to Va13ntine's topic in ROM - NDS Discussion & Help
PPNFR to replace the exact files in their proper positions -
Hex is incredibly easy to understand; BlackShark even indicated how the code works and what values it sets. 0x03E7 = 999dec 0x003B = 59dec 399dec = 0x018F 59dec = 0x003B 003B03E7->003B018F Hex is base16 (2^4), dec is base10, binary is base2. Windows has a built in calculator program that can easily convert... and there's many online.
-
use PokeGen.
-
answered B2/W2 How do I change the image of the card coach?
Kaphotics replied to ciprian's topic in ROM - NDS Discussion & Help
you can't, it's hard coded into the trainer card's code. I presume there's some coordinate boundaries that could be changed, but that's way beyond what you'd want. Just make a new sprite that fits the original dimensions. -
answered Change picture of the board?
Kaphotics replied to ciprian's topic in ROM - NDS Discussion & Help
solved a/2/9/1 -
answered B2/W2 How do I change the image of the card coach?
Kaphotics replied to ciprian's topic in ROM - NDS Discussion & Help
too many colors in the palette -
no only thing it will have are the moves/item/nature, and the qualities of shininess.
-
To be distributed at VGC Nationals (confirmed in Italy thus far); Edit: Now confirmed for Germany. Moves: Meteor Mash Earthquake Zen Headbutt Protect Adamant @Clear Body #Lum Berry, Shiny. Exact Metagross he used (for reference)
-
lol, baseless speculation save files can be ripped/written afaik, so they can't block them out.
-
no http://www.smogon.com/forums/showpost.php?p=4339385&postcount=952
-
answered B2/W2 How do I change the image of the card coach?
Kaphotics replied to ciprian's topic in ROM - NDS Discussion & Help
You can append the filenames to give them the correct file extension. Seriously, just go find a guide on how to edit sprites and go from there. You have all the information you need to achieve what you want to do.