Jump to content

B2W2 Understanding NPC Dialogue Script

Recommended Posts

Hi Everyone

Hope someone can help...

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 five NPCs that exist in Challengers Cave  - which I have successfully fully reinserted into B2W2. (Massive credit to @theSLAYER for all his help on that ! )

I managed to get all battle scripts working from the Overworld Script, so the NPCs trigger the' ! 'and approach you when in sight range to start the battle. (turns out byte 0x06 is this exact function)


However, the issue I found is these new NPCs that I have inserted into the previous blanks files of 616-620 within BWTE, currently have no dialogue before and after the battle...

I found that text file witin a002.narc to make the changes for the message after 'winning' the battle. So that is one piece of dialogue I have found I can change.
But I cannot work out how the dialogue in files 381 of a002.narc link up with the NPC battling script for trainers in the game....

If I know where that points, I can add in the messages to the bottom of that particular file, re-point it and hopefully get these messages in-game.

Some files in 381 show multiple text entries from different NPCs.
For example, Veteran Shaun has three bits of dialogue showing in this link here: https://projectpokemon.org/rawdb/black2/msg/381.php#entry2007
His entries are numbers 2007-2009 for Starting the battle, Winning the battle and After the battle.
But I cannot for the life of me work out how the script finds these values....


Has anyone by anychance got any knowledge of the complete NPC battle script that triggers when an NPC gets within sight-range of you?


I have currently done a work around using @KaphoticsBattle Scripting Tutorial in the meantime.
However with this I cannot work out how to stop endlessly rebattling the trainer when you speak to them (as I have removed the Yes or No battle box that was used in the tutorial)
If someone can shed some light on how I do this - I will atleast have a fully working backup if the above isn't possible.


Any help from anyone would be hugely appreciated! :)

Edited by Monty3540
Link to comment
Share on other sites

Usually it's trainer index * 3 or something. All trainer messages are stored sequentially in the text file.

How to stop rebattling: have the game set an event flag, and put that event flag number as the overworld NPC's event flag to deactivate it (not hide it) -- refer to other overworld trainers that do eyecatch battles.

Link to comment
Share on other sites

Thanks for the heads up on stopping the re-battling @Kaphotics!
I had a literal brain fart ignoring the absolute obvious that I had literally been doing for the static Pokemon previously in my hack...

Managed to sort the re-battling issue quite quickly with a StoreFlag command. Similar to how the 'Yes or No' box works in your Battle Script example, where I set the flag for the NPC after the battle is won.

I have had a look into the 381 file for the dialogue, quite a few are *3 the Trainer ID, but quite a few I noticed weren't.
For example Veteran Shaun's ID is 42, yet his dialogue is appearing in 2007-2009.
So I am a bit stumped on that still - might need to do some more research and some trial and error tomorrow.

If I get no where with that however...
Is there a way to fully replicate the NPC trainer battle sequence, to go alongside the battle script I have?

So the NPC would spot you, ' ! ' exclaim pop up, they walk towards you, whilst correct trainer class music plays - then into the battle script etc.

As that may probably be quicker in the long run now that I think about it more....

Link to comment
Share on other sites

No worries will try that soon @Kaphotics 👍

Im trying to remember the best way of seeing the script the NPC uses...

Isn’t that by using your scrparse.lua script ? (I think that’s the correct one ) Using it as soon I engage with the NPC.

I have a feeling there will be a ton of scripts involved that I will probably be out of my depth with - but I will give it a try !


Edited by Monty3540
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...