pichu2001 Posted June 24, 2012 Posted June 24, 2012 Foreground Hi, people! I see you're latest trying to figure how scripts works on BW, and I wanna give my contribution. Really, I've started about two years ago editing BW scripts, for a future addition on PPRE, but nothing happened later and my work remained hidden for a lot. I wanna share with you my knowledge about scripts, so let's go! (This tutorial presume that you know something about hex and programmation) Script Structure In a BW file, like DPP and HGSS, the scripts can divided in two main sections: declarative and command section. Declarative Sections Declarative part contains all "offset" of the scripts (start offset in particular). The Each offset is saved in a UInt32 (4 byte), and we must add the "actual" reader position for reach the real script start. This section end ever with 0x13FD. Example: 0A 00 00 00 08 00 00 00 FD 00 00 00 13 FD This is a declarative part for a/0/5/7-0, containing 3 scripts. 1st offset script: 0x0A + 0x04 = 0x0E 2nd offset script: 0x08 + 0x08 = 0x10 3rd offset script: 0xFD + 0x0A = 0x107 Command Sections Command section contains the real commands that will be executed by scripts. There are 800+ different command, but the main structure is 0x0 -0x4 ID Command [Various parameter] Next lesson, we can see some simple script in action. Stay tuned.
pichu2001 Posted June 24, 2012 Author Posted June 24, 2012 Thanks for support... Lesson 1: Simple Message Script Starting with something of simple: we wanna a overworld tell us a simple message, like "Hello, world!". So, after we have opening our file to edit, go to offset of the our script (Lesson 0 - Declarative Part) and start writing. (I'll use red color for command and blue for parameters) So, the first command we need to insert is: [b][color="red"]002E [/color][/b] This command rapresent the beginning of the script. It haven't any parameters. We'll call StartScript . After, maybe we wanna to "hear" the famous 'click' when we talking with a person. So our script became: [b][color="red"]StartScript [/color][/b] [b][color="red"]A600[/color][/b] [b][color="blue"]4705[/color][/b] This new command playing a generic sound, in this case 4705, that rapresent 'click'. If you want another sound, you can change the parameter. We will call PlaySound . Now we wanna talk with well-mannered person, so we wanna that he/she face us while he's talking. We'll use: [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]7400 [/color][/b] This command forced people to face the player. We'll call in fact FacePlayer . Now the message: [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]FacePlayer [/color][/b] [b][color="red"]3D00[/color][/b] [b][color="blue"]0004[/color][/b] [b][color="blue"]0000[/color][/b] [b][color="blue"]0000[/color][/b] [b][color="blue"]0000[/color][/b] The message is a little more complex. There are a lot of different command for showing a message, but this is the simplest. Now we analized each parameter. 0004 : Costant. We ever need to insert it. 0000 : Message Id. Differently from GBA games, we needn't to insert the offset of message. In fact each map is linked with a file of Msg.Narc ( a/0/0/3) that contains an ordered sequence of "messages". So the parameter tell us that the message is the 0x0 message in linked msg-file.(Later I give you all the association script-message file, I promise) 0000 : Top/Bottom View.Indicate where the message is show on the screen. (0000 = Bottom, 0001 = Top) 0000 : Type of Border.Indicate which type of border has the messages. (0000 = Simple) Now we have finally insert message, but we need other commands to close the script. First: [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]FacePlayer [/color][/b] [b][color="red"]Message[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [b][color="blue"]ID=0[/color][/b] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] [b][color="red"]3200 [/color][/b] This command forced the message to remain open until you click a botton. We'll call WaitButton. [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]FacePlayer [/color][/b] [b][color="red"]Message[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [b][color="blue"]ID=0[/color][/b] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] [b][color="red"]WaitButton [/color][/b] [b][color="red"]3E00[/color][/b] This command close the message. We'll call CloseMessage. [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]FacePlayer [/color][/b] [b][color="red"]Message[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [b][color="blue"]ID=0[/color][/b] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] [b][color="red"]WaitButton [/color][/b] [b][color="red"]CloseMessage[/color][/b] [b][color="red"]3000[/color][/b] I don't know really what this command do. But you need to insert after a CloseMessage. [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]FacePlayer [/color][/b] [b][color="red"]Message[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [b][color="blue"]ID=0[/color][/b] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] [b][color="red"]WaitButton [/color][/b] [b][color="red"]CloseMessage[/color][/b] [b][color="red"]3000[/color][/b] [b][color="red"]2F00[/color][/b] This command closing the script. We'll call EndScript. Latest command is the 0200 command, that is the End of all routine. So we have this sequence's of command to insert into our HexViewer: [b][color="red"]2E00[/color][/b] [b][color="red"]A600[/color][/b] [b][color="blue"]4705[/color][/b] [b][color="red"]7400[/color][/b] [b][color="red"]3D00[/color][/b] [b][color="blue"]0004[/color][/b] [b][color="blue"]0000[/color][/b] [b][color="blue"]0000[/color][/b] [b][color="blue"]0000[/color][/b] [b][color="red"]3200[/color][/b] [b][color="red"]3E00[/color][/b] [b][color="red"]3000[/color][/b] [b][color="red"]2F00[/color][/b] [b][color="red"]0200[/color][/b] The "human-friendly" version of the script is: [b][color="red"]StartScript [/color][/b] [b][color="red"]PlaySound[/color][/b] [b][color="blue"]CLICK[/color][/b] [b][color="red"]FacePlayer [/color][/b] [b][color="red"]Message[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [b][color="blue"]ID=0[/color][/b] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] [b][color="red"]WaitButton [/color][/b] [b][color="red"]CloseMessage[/color][/b] [b][color="red"]3000[/color][/b] [b][color="red"]EndScript[/color][/b] [b][color="red"]End[/color][/b] This is all for now. I hope I was clear. Stay tuned for next lessons... pichu2000
tybantarnusa Posted June 25, 2012 Posted June 25, 2012 What a nice lesson. So, that's how the script works. Really easy to understand.
pichu2001 Posted June 25, 2012 Author Posted June 25, 2012 (edited) Thanks a lot, I'm very happy that it's simple to understand.... Now another lessons for you, people! Lesson 2: Simple Message Script with variations. There are a lot of different messages command, that give us a very powerful way to tell something. Now we start analyze. 003D We already use this command, but now we give a deeply look into. The last parameter, that we called NORMAL, can be changed to give another whole aspect to the box. Here there's a list of values that we can use: 0000 : NORMAL. 0001 : ANGRY. 003C This command has a similar sintax of Message, although there is a new parameter, called NPCID, that rapresent the person from which depart the "arrow" of the message. We'll call DirectedMessage . The signature of command is: [b][color="red"]DirectedMessage[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [b][color="blue"]ID=0[/color][/b] [u][b][color="blue"]NPCID[/color][/b][/u] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] We can use this command when we want that another people speak during script. 0034 This command is more simple than the other two. It show a message into a grey box, used mostly when you received an item. We'll call EventGreyMessage. The signature of command is: [b][color="red"]EventGreyMessage[/color][/b] [b][color="blue"]MSGID[/color][/b] [b][color="blue"]BOTTOM[/color][/b] Important: To close this message, we need to use 0036 command, instead of CloseMessage. We'll call this last command CloseEventMessage. 0038 It show a message without arrow, used mostly when we don't know who's speaking. We'll call BubbleMessage. The signature of command is: [b][color="red"]BubbleMessage[/color][/b] [b][color="blue"]MSGID[/color][/b] [b][color="blue"]BOTTOM[/color][/b] Important: To close this message, we need to use 0039 command, instead of CloseMessage. We'll call this last command CloseBubbleMessage. 003A With this command, we show a bubblemessage at specified coordinates. We'll call ShowMessageAt. The signature of command is: [b][color="red"]ShowMessageAt[/color][/b] [b][color="blue"]MSGID[/color][/b] [b][color="blue"]X[/color][/b] [b][color="blue"]Y[/color][/b] Note: The (0,0) position is on left upper angle of screen. 0043 It show a message with a coloured border, used mostly when we read city's signs or target. We'll call BorderedMessage. The signature of command is: [b][color="red"]BorderedMessage[/color][/b] [b][color="blue"]MSGID[/color][/b] [b][color="blue"]COLOR[/color][/b] The color values are: 0000 : PINK. 0001 : BROWN. 0002 : BLUE. 0003 : GREEN. Important: To close this message, we need to use 0044 command, instead of CloseMessage. We'll call this last command CloseBorderedMessage. 0045 It show a strange transparent message, like a destroyed paper. We'll call PaperMessage. The signature of command is: [b][color="red"]BubbleMessage[/color][/b] [b][color="blue"]MSGID[/color][/b] [b][color="blue"]X[/color][/b] This command need't some little study research. Important: To close this message, we need to use 0046 command, instead of CloseMessage. We'll call this last command ClosePaperMessage. 0048 This command is equal at DirectedMessage. The only difference is an other last parameter, that is always 0. We don't use it, for now. 0049 This command is similar at DirectedMessage, but with an important differences: the message change if we are playing Black or White. So we'll call DoubleMessage The signature of command is: [b][color="red"]DoubleMessage[/color][/b] [b][color="blue"]MSGCONST[/color][/b] [u][b][color="blue"]MSGIDBLACK[/color][/b] [b][color="blue"]MSGIDWHITE[/color][/b][/u] [b][color="blue"]NPCID[/color][/b] [b][color="blue"]BOTTOM[/color][/b] [b][color="blue"]NORMAL[/color][/b] 004A It show an angry Message, when we want that the people "shout", We'll call AngryMessage. The signature of command is: [b][color="red"]AngryMessage[/color][/b] [b][color="blue"]MSGID[/color][/b] [b][color="blue"]BOTTOM[/color][/b] Important: To close this message, we need to use 004B command, instead of CloseMessage. We'll call this last command CloseAngryMessage. All of this command we can use in our simple script, remembering to close messages with right command. Today's lesson finish here. The next time we'll see messages contains variables (Like Hiro's name and other type) Stay tuned! pichu2000 Edited June 26, 2012 by pichu2001 Fixed a duplication of text
X-Lan Posted June 25, 2012 Posted June 25, 2012 You make things so much easier to understand. I only know a handful of stuff like pokemon, type & move editing (the basics on HxD) but where/how do i find the message lines so i dont mess with the wrong stuff? How do i edit the narc files text? I would be grateful if you let me know some of the locations, either here or via pm Btw! 0034 This command is more simple than the other two. It show a message into a grey box, used mostly when you received an item. We'll call EventGreyMessage. The signature of command is: Code: EventGreyMessage MSGID BOTTOM Important: To close this message, we need to use 0036 command, instead of CloseMessage. We'll call this last command CloseEventMessage. 0034 This command is more simple than the other two. It show a message into a grey box, used mostly when you received an item. We'll call EventGreyMessage. The signature of command is: Code: EventGreyMessage MSGID BOTTOM Important: To close this message, we need to use 0035 command, instead of CloseMessage. We'll call this last command CloseEventMessage. Whats the difference between the 2, than the 'CloseEventMessage' command 0036 & 0035?
pichu2001 Posted June 25, 2012 Author Posted June 25, 2012 Sorry, I adjust it. It's a duplication of text, my mistake. For messages you can use PPTXT (In this forum), for association (script --> messages) , you had to wait a little. I make an association table soon, I promise. (Preview: Nuvema Town has a057/778 as script, a003/428 as message.)
Flintiex Posted June 30, 2012 Posted June 30, 2012 Thank you! These tutorials are great! Keep em coming Hopefully there'll be a PPRE for gen 5 which would have a script editor for B/W soon..
Drayano Posted September 11, 2012 Posted September 11, 2012 Bump because this is a useful thread. I noticed an issue with the first post... This is a declarative part for a/0/5/7-0, containing 3 scripts.1st offset script: 0x0A + 0x04 = 0x0E 2nd offset script: 0x08 + 0x08 = 0x10 3rd offset script: 0xFD + 0x0A = 0x107 I'm fairly sure the 3rd offset is 0xFD + 0x0C, rather than 0x0A. It goes up in a sequence of 4s each time, so +4, +8, +C, +10, +14, +18, +1C... etcetera. I gave this a whirl on BW2 and got some success! The possibilities are exciting me, heh. But there's still some crucial commands that I need to find the codes for, such as 'Setflag', 'Clearflag' and such.
Kaphotics Posted September 12, 2012 Posted September 12, 2012 The best way to figure out script command codes is by finding an area with as little scripts as possible; find the NPC that uses said script and try to identify what the overall purpose of the script is. Then you figure out the overall structure based on known commands, then find the areas that are unknown... By fiddling with them a bit in the RAM, you can see how they break the script if changed. Take a piece of the script (32 bits) and search it with DeSmuME after you've made the game use one script on the currently loaded map. (The game doesn't load the script file for a given location unless a script is called for that location!) I suggest looking at an NPC that trades, and says certain lines based on if the trade was completed or not.
Drayano Posted September 12, 2012 Posted September 12, 2012 (edited) Yeah, that sounds good. Thankfully there's a lot of buildings with only one or two people inside, so it's not too hard to zone in on things. ...I should probably learn how to tinker with RAM, haha. I think there's a few commands I've figured out; "70 01 XX XX YY 00" seems to be the regular Wild Battle script, although if used by itself the game freezes after the fight, so I assume you need something else to stop that from happening. I managed to copy the Volcarona script into another area and that seems to be working okay... "93 02 XX XX YY 00" is a weird one; it's another wild encounter script but what it actually does seems to change depending on what's around it. You see it used both in the shiny Haxorus script and for the Black/White Kyurem fight. I can't seem to figure out what it actually does by itself, heh. Experimentation has also found it to cause the battle pads to be different. Really, really strange. "23 00" is the setflag command I think. Btw, can't thank you enough for the lua script. Definitely made things so much easier. (Note to self: the game doesn't seem to like all values of flags up to 65535 even though there are two bytes. Numbers about 3000 and below seem to be fine, though.) Edited September 12, 2012 by Drayano
Kaphotics Posted September 12, 2012 Posted September 12, 2012 Nice Back when I ripped the stationary encounter data, it was all from scripts; I just searched the "wild battle" script command after I figured out what it was in B2W2. As for the other flag commands, they'd probably be adjacent to the setflag, and in the <0x0030 range. If it's any confirmation, 1E/1F/20 handled flags in DPPt.
Drayano Posted September 12, 2012 Posted September 12, 2012 (edited) Haha, yeah, I guess stationary encounters are pretty easy to find. I'm not surprised you figured that one out easy. Okay, seems you're right. I can confirm the clearflag command is "24 00 XX XX". Though it doesn't seem to support all numbers up to 65535; a lot of numbers past 3000+ won't allow the flag for it to be set in the first place. I dunno if I'm just messing something up or if the game outright won't let me do it, though. I also found one more interesting script - the key unlocker! The code is AC 02 XX XX, where XX XX is the value of the key. I found these: 00 - ?? (Assist Mode?) 01 - Challenge Mode 02 - ??? (Rock Peak Room?) 03 - Iron Room 04 - Glacier Room 05 - Assist Mode (Purple Key??) 06 - Challenge Mode (Purple Key??) 07 - Purple Key? 08 - Purple Key? 09 - Purple Key? When I say purple key, I had some values with a messed up colour key. For example, the challenge mode ones: Purple one left, regular one right. I suspect it's just an invalid key or something. I didn't find the values for the Black Tower / White Treehollow but they'd probably be pretty easy to find. So I guess unlocking Assist/Challenge Mode off the bat should be easy enough. :3 edit: I /think/ the Checkflag is "10 00 XX XX", though I don't know how to actually use it. Edited September 12, 2012 by Drayano
aninymouse Posted September 14, 2012 Posted September 14, 2012 Ohoho... that is just perfect ♥ Thanks for finding this out! Have you tested it to see if it permanently unlocks challenge/assist in this way?
Kaphotics Posted September 14, 2012 Posted September 14, 2012 Ohoho... that is just perfect ♥ Thanks for finding this out!Have you tested it to see if it permanently unlocks challenge/assist in this way? It should persist as flags and stuff are kept until they are changed by another script.
Drayano Posted September 14, 2012 Posted September 14, 2012 I didn't actually check the menu but the appearance was identical to when you unlock the keys in the real game, so I'm pretty sure it's permanent.
Drayano Posted October 8, 2012 Posted October 8, 2012 Sorry to double post but I have had one hell of a setback - I tried inserting my edited a/0/5/6 from the Japanese ROM into the American ROM and it's messed everything up. The script files seem to be incompatible with each other... Sigh...
Kaphotics Posted October 8, 2012 Posted October 8, 2012 I haven't done a compare of the narcs, maybe the localization required some scripts to be changed. Might want to replace the individual script files first, if the script codes didn't change.
Drayano Posted October 8, 2012 Posted October 8, 2012 (edited) Yeah, after looking into it more and doing a hex comparison there seems to be quite a few differences, but it's still similar files so I'll try the individual script files and see if that works. I would just make the changes but there's so many it seems like the file replacement will be easier. Off the top of my head they probably had to change one script in Floccessy Town that originally swapped the game between Kanji and Non-Kanji. I assume there's others... Time to compile a list and remember what I've edited. D: edit: If I'm not mistaken, the English script has five extra files compared to the Japanese narc. edit2: Seems kiwi.ds can't recompile the narc correctly either, but inserting the files with ct2 seems to have sorted it. edit3: Okay, the English script DOES seem to be different after all; the identifiers for most of the commands have changed. If I'm not mistaken some of them are now +4 of their originals (e.g. the previous cry command, A7 00 is now AB 00, the keys are now B0 02 XX XX, etc. So yeah, that breaks everything I've done before. Yeesh. I guess starting early didn't help in that case. <: Edited October 9, 2012 by Drayano
Kaphotics Posted December 6, 2012 Posted December 6, 2012 (edited) [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. Edited December 6, 2012 by Kaphotics
Kaphotics Posted December 6, 2012 Posted December 6, 2012 (edited) 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: ===== 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. Edited December 7, 2012 by Kaphotics
wyndamn Posted December 7, 2012 Posted December 7, 2012 Wow ! it really sounds simple ! nice work pichu !... really interesting all of the data B/W2 has helped to acquire, its so many info that i been looking at recently that i think my head is going to explode at some point because of all of the data lol. Thanks to everyone who has made this possible, i simply love this forum !
Kaphotics Posted December 24, 2012 Posted December 24, 2012 (edited) I've been using NPRE's source and improving it to read B2W2 script commands and output the script's function. It's now way better than the Lua script I previously posted. http://dl.dropbox.com/u/12206225/NPRE-1226.zip To see scripts, open ROM, navigate to /a/0/5/6, right click and Open As [script (narc)]. Dropdown on the top left to change what script you are viewing. Since NPRE is open source, I included the source that I compiled from. In the process of learning how to script in B2/W2, I've parsed a few scripts by hand so you can see the hex -> meaning. http://dl.dropbox.com/u/12206225/pporg/bw2scr/932%20(Move%20suggesting%20random%20text%20at%20Humilau%20Yellow%20Shard).txt http://dl.dropbox.com/u/12206225/pporg/bw2scr/Energypowder.txt Not really the best examples; those were some of the first ones I did. If you examine scripts.cs inside NPRE's source, you can see what each command is believed to do and how many bytes it reads. Drayano wanted a special script for B2W2, to give a random egg. Here's the script that does it if you want to see how a ton of hex makes a script. All these scripts are pretty basic, nothing like a full blown event. Gotta have movement! Movement is just u16 movement type, u16 iterations * instructions, with an end of FE 00 00 00. (At least I think it's FE 00 00 00 not FE 00) With this and pretty good knowledge of commands, it's possible to make in-game events. [video=youtube;8tBDVstp1hM] (script that is executed, commented). Image is just flashy to not give away the premise of the video, but to whore views on YouTube. note~ overworld and text edits were done, using HxD and the structure I posted at B2W2 General ROM Info && PPTXT. Edited December 26, 2012 by Kaphotics new build
jhoon1 Posted January 1, 2013 Posted January 1, 2013 I have tried the egg giving script,but how can i give just one egg?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now