0x3DD3CE Posted May 17, 2020 Posted May 17, 2020 Hey all, I have been browsing through multiple threads and know that to create my own trainer(s), I have to do the following; 1. Copy paste files in the trdata and trpoke, name them accordingly 2. Go to BWTE 2 - 1000 and change everything to my preference 3. Extract a/0/0/2, go to file 382, and add the trainer's name 4. Reinsert everything after giving a custom script However, I am unsure of the third step as I don't know what to do in the file. I tried relating with ASCII but it seems different. So could someone explain what exactly to do in the file 382 (and how many bytes are allocated per name)?
Monty3540 Posted May 18, 2020 Posted May 18, 2020 (edited) There should be a long list of every trainer name inside a002.narc, file 382, which lines up with the order in BWTE 2-1000 Aslong as those names are in the same order it should pick it up in battle in theory. It might be worth asking @Drayano as he added in the Hoenn gym leaders plus a few other trainers in his brilliant Blaze Black 2 and Volt White 2 Rom hacks. So he may be able to help with that , or you can maybe reverse engineer what he did in his file to get an idea. There is a lot of battle messages underneath this list of trainers in file 382- which may have the numbers altered in the NPC trainer scripts, depending how many trainers you add. I have not tested this yet. In my current hack, I have inserted 5 trainers into the current gap between 616-620 (which is currently blank in BWTE) to go with the NPCs in Challengers Cave - which I have successfully fully reinserted into B2W2. They still don’t have trainer names in the BWTE list , I don’t know how to edit the names that appear in the BWTE list, but I wasn’t worrying about that as I knew which trainer was what. I managed to get all battle scripts working , so the NPCs trigger the ! and approach you when in sight range to start the battle. To do this for the NPCs, I went into the Overworld script , changed the script called (0A-0B) to point to the battle script for that trainer you edited in BWTE. For some reason, the script for an NPC that will approach you, is the BWTE number of the trainer , +3000 if you want to NPC to trigger the battle and approach you when you are within sight view. (Convert from DEC to Hex of course) However, the issue I found is these new NPCs Iv inserted into previous blanks within the original 813 battles, currently have no dialogue before and after the battle... Only in battle when you win - as I found that text file to make the changes, inside a002.narc. But I cannot find the text for before and after the battle and I cannot work out how the dialogue in files 381 - 382 link up with the NPC battling script for trainers in the game....so they currently just have blank message boxes until I work out where this text file is and how to add it etc. (Any help from anyone would be hugely appreciated!) Currently to get around this, I am just doing the workaround @Kaphotics posted on his YouTube tutorial for Battle Scripting below: I used this to add in the battle script with the Yes or No option removed .So now you talk to the NPC, set the dialogue you want them to say before and after the battle in a003.narc and paste the battle script and appropriately reference the number of the trainer in BWTE you inserted into the scripts data (a056.narc) In your overworld file (a126.narc), add the NPC as normal , but make the script they call be the one created in a056.narc that you create as per the video - not the BWTE one. So for example in a previously empty room it would call script 1, instead of script 3000+ that I mentioned at the start of the post. I would like to add the ! mark and make the new NPC walk towards you in what I’m doing now , just to replicate the normal NPC battle scenarios...however I haven’t worked out the commands I need to add to do this yet. If I could do that, it would be desirable as it would make it look and feel more like it is a normal NPC , ‘see you and battles you’ scenario - rather than a clear add on where you talk to request a battle. (If that makes sense) I hope this helps you! Just sharing my experience that I have been doing over the weekend which is on the same lines as what you are trying to do. Hopefully someone may have an idea on the issues I mentioned too, which could also help you in the long run too Edited May 18, 2020 by Monty3540
0x3DD3CE Posted May 18, 2020 Author Posted May 18, 2020 I read your response @Monty3540, thanks for the reply. The problem is I do not know what to do in the file itself (like adding some code or something). So when I open file 382 I see this and I'm not sure what to edit or insert. I'm also confused as to how to determine the ID of the trainer. Thank you in advance!
Monty3540 Posted May 18, 2020 Posted May 18, 2020 (edited) Open file 382 in PPTXT Link to the program is here So you open the a002.narc in PPTXT and then navigate to file 382 You should be able to then edit the text inside there. I usually copy and paste the whole content into Notepad ++, make a copy, so the changes and copy and paste back in. Dont forget to click Save Text in the top right once you have done your changes in PPTXT and then click File > Write to NARC to complete the process , before you reinsert it back into the ROM with NitroExplorer / Tinke The ID of the trainer is just the number you assigned them in BWTE. For example the battle with Colress in the post game is 813. So if you viewed the script data in the Plasma Frigate overworld script file (use the Lua script Kaphotics made is the best method here) you would see the number 813 in Colress’ NPC data, within bytes OA - OB. If you need a worked example of how to use PPTXT and how to edit the text etc. I recommend you watch the latter half of this YouTube video by @Kaphotics - as it shows him adding in a custom text file for NPC dialogue, as well as editing it and reinserting it into the ROM. Hope this helps Edited May 18, 2020 by Monty3540
0x3DD3CE Posted May 18, 2020 Author Posted May 18, 2020 (edited) Hey @Monty3540, thanks for the instant reply. I actually tried it but a whole bunch of nonsense comes up... edit: I actually know how to script n NPC (I don't really have problems with that anymore) and I can make them give items too, so yea Edited May 18, 2020 by 0x3DD3CE
Monty3540 Posted May 18, 2020 Posted May 18, 2020 Yeah I found that too first as for some reason the text comes up as symbols If you paste it into Notepad ++ though, you get the numbers to the left to denote each trainers ID number So you can work out which name is who from that (remember Notepad ++ starts from 1 however and PPTXT starts from 0 , so factor in the 1 difference when you find the correct trainer ) I did find that opening the Rom in SDSME and then clicking on the Text Editor . Then selecting the Game option and scrolling to 382 , opens up the a002.narc and the correct file , where the names were showing correctly in English . In my instance I scrolled to 616-620 and changed their names to the ones I wanted too , which matched the trainer battles I added to the restored Challenger Cave. So you can use SDSME to act as a further reference. Or you can copy and paste that into PPTXT as well if you so wish (Make sure it is an exact copy over what you need , becareful of any offsets) - just also make sure you keep the funny symbol that declares PKMN for the Pokemon Trainers showing , as the full name title won’t fit in the dialogue boxes
0x3DD3CE Posted May 18, 2020 Author Posted May 18, 2020 (edited) Thanks a lot! So the square symbol represent the 'PKMN' signature right? Ideally, I would have it like: Red? edit: Nvm, did it in SDSME. Thanks for all the help! I'll credit you in my ROM hack Edited May 18, 2020 by 0x3DD3CE
Monty3540 Posted May 18, 2020 Posted May 18, 2020 (edited) No need to credit Happy to help I did literally do the exact same thing you are doing now yesterday, so it made sense to share with you what I learnt to try and save you some pain ! If you do find out how to edit the dialogue the NPCs speak before and after a battle within the a002.narc and how they link up however, please do let me know! I racked my brain for a few hours on that last night, before giving up and doing the Kaphotics tutorial method instead - just so I could get to a mental checkpoint before this week Edited May 18, 2020 by Monty3540
0x3DD3CE Posted May 19, 2020 Author Posted May 19, 2020 Yeah, it's actually just better to use it in the text file that corresponds to where your trainer is...
Monty3540 Posted May 20, 2020 Posted May 20, 2020 (edited) Yeah I was going to try that tonight i did a quick test using an NPC with Colress’ 813 battle to see if that showed the pre and post battle text - however it didn’t , maybe because it is a Yes or No triggered battle I will try it on a random trainer number that I haven’t battled and see if it works. I haven’t tried it on a new trainer outside of the standard 813 yet . So I will try one at 814 , adding the three strings of dialog to 381 and the bottom of 382 to see if that works i do have a feeling it won’t be as simple as that though.... there must be a Call Routine per trainer that dictates what number of dialogue it picks up However I can’t be sure until I find the main script for NPC battles that trigger when you are in their sight range (triggering ‘ ! ‘ and then the trainer class music etc ) Will have another go soon. Edited May 20, 2020 by Monty3540
0x3DD3CE Posted May 21, 2020 Author Posted May 21, 2020 (edited) Hey @Monty3540, just a quick question, are the trainer texts in the battle itself i.e in between the battle and right after it, found in a/0/0/2 file 381? It has over 2500 entries and they seem like they would correspond to the text the trainers would say. Thanks in advance! BTW it might be best to actually parse a normal trainer's script using scrparse.lua to figure out what each of his hex codes does, there might be a call routine function stuck right there P.S: Have you figured out how to add text that a trainer would say in the battle just after defeated? It might help Edited May 21, 2020 by 0x3DD3CE
Monty3540 Posted May 21, 2020 Posted May 21, 2020 Yes I found all the in-battle text was in there for the Trainers i was editting 616-620 However since these Trainer ID seemed to be previously removed data, there is no text for before and after the battle. When I tried to add some strings above and below it doesn't seem to upload - and if it did I would imagine it shifts down all the strings below it and make a mess. I assumed they would be in an order to match each trainer, but it doesn't seem to be the case if you follow the links here: File 382 (Trainer ID) https://projectpokemon.org/rawdb/black2/msg/382.php File 381 (Trainer ID) https://projectpokemon.org/rawdb/black2/msg/381.php Eg. Trainer Shaun ID is 42, yet his text strings start at #2007 - 2009. So I assume there is another call routine within the NPC battle script itself that is specific for each battling NPC I did try adding in a new Trainer as 814, adding in three strings into 381 and the end of 382 as there is a duplicate of them. Yet all that did was not show a text box at all and the game would be in limbo... If you add in the Trainer 814 battle in the way Kaphotics did in his battle script, it all works fine. So there must be some sort of pointer between the Trainer ID and the dialogue. I tried parsing the script for the NPC after locking eye contact with them...I did get ALOT of data , three scripts - which I am admittedly struggling to work out (File attached) Was hoping it would be a little more straight forward haha What I may yet do as a last resort is just see if any of the current Trainers are Version Exclusive, and then swap those with the NPCs I have added , change their text accordingly and hopefully that works. However the only one off the top of my head is N - with the differing legendary depending on the version. But still, Ideally if I can work out how the NPC battle script works, I can use some of the commands and stick into the individual trainer scripts like in the Kaphotics method, or even just find out how it points to the messages etc. Challenger Cave B1F NPC Battle (scrparse)
0x3DD3CE Posted May 23, 2020 Author Posted May 23, 2020 (edited) On 5/21/2020 at 9:15 PM, Monty3540 said: If you add in the Trainer 814 battle in the way Kaphotics did in his battle script, it all works fine. So there must be some sort of pointer between the Trainer ID and the dialogue. Actually the thing is while he created a new "trainer", he does not make an entirely new one i.e. with all the custom text and sprite. He only called an existing trainer which is actually rather easy . So I assume we have to dig in to the script assigned to say Clay to actually figure out what line is called in the battle... BTW: For the trainer battle (script 3), I really can't visualize how the battle would go, and as far as I know, it should go something like this.. (pseudocode) lock clink faceplayer flag 0x(ID) store in variable compare condition if false jump x bytes hey, wanna battle? wait key press close message box trainerbattle checkresult if false i.e lost jump x bytes disable trainer end battle sum text idk jump to end wait key press close message box #if lost goto center logic jump to end #if defeated haha i lost alr... wait moment unlock end Although I'm not sure if I'm right, gotta test it later! edit: yeah 381 has the trainer in-battle text like the first battle with your rival can be found in 607 to 609 but is repeated thrice for the 3 starters. Edited May 23, 2020 by 0x3DD3CE
Monty3540 Posted May 23, 2020 Posted May 23, 2020 (edited) I found the line in Kaphotic's script where he calls a Trainer The readable command in NPRE is SingleTrainerBattle (XXX) 0 0 With the three XXXs being the Trainer ID. The Hex I have for setting up a Trainer battle with ID number 616 for the Trainer I added to fill in the blank slot is below: SingleTrainerBattle (616) 0 0 85 00 68 02 00 00 00 00 Byte 03-04 is the Trainer ID number It is then followed by a flag, normal battle logic. And I then added in some before and after message text into the correct file in a003.narc to make the dialogue. FYI I can send you what I did for the Battle Script, including a Flag to stop them endlessly rebattling you (which Kaphotics helped me work out) if you wish. I think Script 1 that I parsed is what calls the initial before battle scripting. So facing the trainer, reaction etc. I just now need to somehow add into this script a few commands. 1) NPC being alerted with '!' when you are in the sight range 2) trigger relevant Trainer Class music 3) walk towards you and then start the script I have already created. That would pretty much complete what I am looking at - and make the trainer looks less like they had just been placed in - as currently you have to directly talk to them to trigger the battle. I am currently looking down this route, since I still have no idea how the NPC battle script points to the relevant dialogue in a002.narc 381 before and after battle. After going through scrparse.lua a few times, I have come to the conclusion that one of the Call Routines call upon the other script (such as the trainer ID, messages etc.) however I cannot work out which one is right... I need to be a bit more clued up to work it out. Trainer 616 Challenger Cave Battle Script NPRE.txt Edited May 23, 2020 by Monty3540
Monty3540 Posted May 23, 2020 Posted May 23, 2020 (edited) Managed to find the Play Music Script for when the NPC spots you. So that is part 2 from the above post ticked off. NPRE decifers the command as 'PlaySound XXXX' Hex command that I have used is: 03 00 00 00 98 00 ** ** The last two bytes (** **) are the ID for the music / sound it calls. For example, D6 04 = 12 38 is Colress' Overworld Encounter theme. I have attached a notepad file with a range of values I found after dedicating just over an hour to trying to find a majority of them. Battle Music.txt Edited May 23, 2020 by Monty3540
0x3DD3CE Posted May 24, 2020 Author Posted May 24, 2020 20 hours ago, Monty3540 said: NPC being alerted with '!' when you are in the sight range Alright, from what I know, the sight range can be specified in the overworld file, byte 0E to 0F, so I guess you could add your value over there. 20 hours ago, Monty3540 said: walk towards you and then start the script I have already created. If I'm right, that is automatic once you've given the sight range but if I'm wrong then you could do this, 64 00 (NPC ID) 06 00 - Apply movement 1E 00 08 00 00 00 - IDK why this needs to be there Walk whatever direction, x steps eg. 4C 00 05 00 (Walk up 5 steps) FE 00 00 00 - End movement 65 00 - Wait for movement 64 00 FF 00 06 00 - Apply movement for hero, that's FF 1E 00 08 00 00 00 Face whatever direction eg. 00 00 01 00 (face up for 1 iteration) FE 00 00 00 65 00 - Wait for movement And then your battle script. For the movement things, check this link https://pastebin.com/raw/tJXgpmYA
Monty3540 Posted May 24, 2020 Posted May 24, 2020 Thanks for the heads up! I will try that later today. Although I swear I may need a StoreHero command, if I am going to trigger the NPC to Exclaim and walk towards me. Will give it a go. I currently have it working where when I talk to the NPC, music plays, correct diagloue loads, battle commences, flag is set so it isn't rebattlable. Maybe I was naive to think that just adding a ! to an NPC when they are spoken too / see you would be so long winded haha! I tried the Sight Range on the NPC in the Overworld - however that only seems to work if the script it points too is the NPC battle. If it is pointing to a script in a056.narc, it doesn't seem to do anything sadly.
0x3DD3CE Posted May 27, 2020 Author Posted May 27, 2020 (edited) Hey @Monty3540, a small questio, do you know where the trainer classes are stored? edit: figured that it is in a/0/0/2 383 BTW, does the trainer class decide the music that plays during battle and the sprite used? Edited May 27, 2020 by 0x3DD3CE
Monty3540 Posted May 27, 2020 Posted May 27, 2020 a002.narc file 383 is the Trainer Classes You can alter the names in there etc. I swear you can change them. I think I have seen a thread on this somewhere on this forum. I had them bookmarked because it was something I was going to look at last once I had everything else done in the hack. EDIT! I have attached some links below which may help you:
0x3DD3CE Posted May 27, 2020 Author Posted May 27, 2020 (edited) Oh ty! BTW I just wanted to edit one trainer's music, and I wanted to give him the Colress battle theme, but now that I come to think of it, it looks impossible as the sprite may be different than intended. edit: Is there anything wrong with this script? My game just hangs when I use it. 2E 00 A6 00 47 05 74 00 10 00 E0 0B 64 00 12 00 06 00 00 00 1E 00 08 00 00 00 4B 00 01 00 FE 00 00 00 65 00 3D 00 00 04 2C 00 00 00 00 00 32 00 3F 00 09 00 00 80 09 00 01 80 2A 00 00 80 1D 00 2A 00 01 80 03 00 1C 00 F5 0A 0A 00 01 80 0A 00 00 80 3D 00 00 04 2D 00 00 00 00 00 32 00 3F 00 30 00 64 00 FF 00 06 00 00 00 1E 00 0C 00 00 00 4E 00 01 00 01 00 01 00 FE 00 00 00 65 00 64 00 12 00 06 00 00 00 1E 00 0C 00 00 00 4D 00 07 00 4E 00 06 00 FE 00 00 00 65 00 6C 00 12 00 30 00 23 00 E0 0B 2F 00 02 00 Edited May 27, 2020 by 0x3DD3CE
Monty3540 Posted May 27, 2020 Posted May 27, 2020 Does it come up with any errors in NPRE? I managed to set Trainer music for the NPC interaction, but not for in the actual battle. The script I used was taken from the Celestic Tower Script #678 PlayTrainerMusic 455 : 8B 00 C7 01 455 = the Trainer ID, which then plays the theme for the Trainer Class they are assigned. I haven't started playing with the trainer class script as of yet regarding anything in battle, so I can't really give any heads up on anything as of yet sorry. I will give it a try over the coming days though inbetween work (Y)
0x3DD3CE Posted May 28, 2020 Author Posted May 28, 2020 (edited) actually no errors, but the game just hangs, I probably checked like 10 times... Edited May 28, 2020 by 0x3DD3CE
Monty3540 Posted May 28, 2020 Posted May 28, 2020 Iv had it a few times where I have tried a Store variable (Eg. StoreTrainerID or StoreFlag) and when putting it before an animation - such as the Exclaim like when the NPC spots you, it caused the game to hang with just music playing, but all actual game play stops. So for now I have just built all my NPC interactions without the ! animation for now because I was spending so much time on it, I was getting literally nothing else done. So I will revisit that at some point.
0x3DD3CE Posted May 28, 2020 Author Posted May 28, 2020 (edited) I have had some successful runs with the flag before exclamation, let me try putting the flag after it.. edit: nope, still hangs, lemme try without the ! edit 2: works fine until the last movement part, no idea what's going on Edited May 28, 2020 by 0x3DD3CE
Monty3540 Posted May 28, 2020 Posted May 28, 2020 Yeah I had the same problem, I legit could not work it out, got frustrated and applied what worked for now - put it on the bench until the weekend when I have a bit more time. Even when I did get the exclaim working, after the battle - it still triggered the Exclamation animation whenever you talked to the NPC, even though correct post battle message showed up as intended, For some reason putting any StoreVAR before the movement seems to stop it from working for me - but it is needed there to stop the ! appearing everytime you talk post-battle. I really didn't expect it to be such a minefield haha.
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