• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

PPRE Trainer Script

50
Posts
14
Years
  • Seen Aug 21, 2014
Hi guys, this is my first tutorial so sorry for mistakes :( Also I'm sorry for double posting, but when I first submitted this I found out that I was in the wrong forum :( So please delete my other post. So sorry :'(

Anyways, like the title says, it's about Pokemon Trainer Battle Scripting. So far I only know it works for HG/SS. If you want to use in Platinum or D/P, feel free to try and please tell me if it works.

On to the tutorial. Here are the tools you need:
Spoiler:


Once you've downloaded the things needed, put your HG/SS rom into PPRE's folder. Then open up PPRE and click on choose rom. Select your rom and click Set Rom.

1.png


Then command prompt should appear. PPRE is extracting your rom now.

2.png


Once PPRE has finished, click on Trainers.

3.png


Once you opened up Trainers, select a random trainer from the list. Edit the Trainer's information now(Number of Pokemon he/she had and so on). Once you changed the number of Pokemon, click another trainer from the list and go back to the trainer you edited to see that the number of Pokemon had changed. NOTE: I can't seem to edit the Trainer's name, so I used an older version of PPRE, which worked. However, the Pokemon's level is maximum 99 and I cant save my scripts using that.

After you've edited the Trainer, TAKE NOTE OF THE NUMBER BESIDE HIS/HER NAME. IT'S VERY IMPORTANT. For me it's 24.

4.png


Save your changes afterwards.

Next, go to Maps and choose the map you want. For me I'm going to use Cianwood City Gym.

Go to the Events tab and click on Overworlds. See the number at the top right corner? That's the number of overworlds. Click on the up arrow to increase the number of overworlds.

You might see a new tab now. Type in the ID of the overworld, which is this:
5.png


Now type in the sprite. The values for them are here:
Spoiler:


However, PPRE can read only Dec numbers, but these are Hex numbers. So open up Calculator, and go to the Scientific Mode for XP. I don't know what to press for the other computers so you have to figure out yourself. Go to Hex and type in the number for the sprite. Click on Dec next to get the Dec number. Write this in PPRE.

Next for the movement. I don't really have the list for the movements(I'm too lazy to figure out :'( So if you got the list, please tell me and I will give credit.) However I do know that 15 is facing down and 20 is facing up.) Type it in the box.

Flag... I don't really know what's that but I will figure it out sometime, probably after B/W is released.. I'm just too busy :sleeping:

Script we will come to it later.

Line of Sight, by the name, you probably know what's it. It's use for detection for normal trainers, like when you're walking along Viridan Forest when a trainer spot you.

X-, Y- and Z- coordinate, pretty simple. I don't know bout Z though. Anyway, you might ask, how do we find the X and Y coordinate? Simple! Using the Lua Script, open it in DeSmuME and activate the script! Move to the spot where you want your trainer to be at and he will stand there! However the Lua Script doesn't work on Patched Roms.

6.png


After finding out the X and Y coordinate, type it in the boxes.

Once you've done all these, take note of the ID of your overworld.

Next, go to the Text tab. You will see that there's already a lot of text. Write your trainer's beginning and losing text like this:
text_[continued number]="[text]"
So for example I want to write this:
Yo! This is a guide!
And the text number is 5, I will write in PPRE this:
text_5="Yo! This is a guide!"
Just remember, \n is for line break and \r is for new box.
After writing your text, note down the text numbers - both beginning and lose text. I don't know how to make the winning text activate, sorry :(

7.png


Now go to the Scripts text and go to Scripts. Press add script and go to the new script. Now we can begin writing our script.
Example of Script:
Spoiler:


Lockall starts your script. Lockall is basically the same as the script starter you use when hacking GBA games.

Faceplayer, too, exists in GBA hacking. Just let the trainer turn to you when you talk to him/her.

Message [number] is the text you wrote just now. [number] is the text number which I told you to note.

WaitButton and CloseMsgOnKeyPress works together. The trainer battle will begin after you pressed A or B(WaitButton). The message will then close(CloseMsgOnKeyPress).

TrainerBattle [number] 0 1 starts your trainer battle. [number] is the trainer number I told you to note just now. You can see why it's important now.

Message [number] is the losing text.

Releaseall MUST be present if you wrote Lockall. It releases the NPCs around.

End is the ending of the script. VERY IMPORTANT.

Now that you finished your script, save your changes.

Go back to PPRE and type in your rom name, also remember to write in the ".nds" without the quotient marks.

8.png


After your rom has finished creating, open your rom and enjoy! Also if you want to edit the sprite of your trainer, I might write a tutorial on it, but it's best if you follow KazoWAR's on Youtube.

Thanks for reading my tutorial! This is my first tutorial so I hope you would rate my skills on writing tutorials.
 
Last edited:
50
Posts
14
Years
  • Seen Aug 21, 2014
Here's a completely optional part: Removing people.
Basically, after you've finished your battle, you can make the trainer disappear.
Here's an example of the script:
Spoiler:

The new part edited, as you can see, is
Applymovement 5 mov_1
Waitmovement
Removepeople 5

Before I go into explaining, go to Maps, choose your map and Scripts, before finally going to Movements.
1-1.png

Choose Add Movement. A new tab should form.
Now, you have to write your movement. The movement format must be like this:
[movement_name] [number_of_times]
Movement_name is the type of movement you want your OW to move, such as the 1 I used, WalkDownNormal.
Here's a list of the movements:
Spoiler:


Number of times is the number of steps you want your OW to move. Pretty simple, you should understand.

Now to explain the script.
Applymovement [OW ID] [mov_[id]] is put into your script.
Applymovement is to apply a movement on [OW ID] which is your OW's ID, which I explained earlier at the previous post, and [mov_[id]] is the ID of your movement.
2-1.png

For me it's mov_1.

Waitmovement is to wait for the movement to be finished before the OWs can be released.

Removepeople [OW ID] is to remove the OW you assigned to. By now you should know what's [OW ID].

So now that your movement script is finished, save your changes, write your rom and begin playing!

~Hope this helps!~
 
Last edited:

sesshomaru13

Azuril Trainer
3
Posts
14
Years
  • Age 34
  • Seen Jul 13, 2023
Great tutorial!
I just started using PPRE and I've been trying to figure out how this worked, Thanks!
 

jota_rdk

Spanish hacker [Javi4315]
98
Posts
13
Years
Wow, very good tutorial. In spanish forums don't seen tools and his tutorials for ds roms.

I prove it for see his functioning. Great tutorial and great tool.

I think it will serve me. Greetings!
 
50
Posts
14
Years
  • Seen Aug 21, 2014
Thanks guys for the comments xD

Wow, very good tutorial. In spanish forums don't seen tools and his tutorials for ds roms.

I prove it for see his functioning. Great tutorial and great tool.

I think it will serve me. Greetings!
Are you referring to me? If so, I'm not Spanish :/
I just happened to find the scripts needed. My real life friend helped me a bit too.
 

jota_rdk

Spanish hacker [Javi4315]
98
Posts
13
Years
Thanks guys for the comments xD


Are you referring to me? If so, I'm not Spanish :/
I just happened to find the scripts needed. My real life friend helped me a bit too.

(?) haha, I tell you that in spanish forums (because I am spanish), don't publish tutorials for NDS tools. Sorry if you don't understand me xD

finaly, great tutorial! :D
 
16
Posts
13
Years
  • Seen Jul 28, 2012
It does work for Platinum!=D I like the Trainer Pokemon Editor on this one better then some other one I use.

BTW, I wanted to add a trainer, lets say if I get my hands on a Ash DP Overworld Sprite and battle sprite, how can I add it in???

ps: thanks for the tools.
 
50
Posts
14
Years
  • Seen Aug 21, 2014
It does work for Platinum!=D I like the Trainer Pokemon Editor on this one better then some other one I use.

BTW, I wanted to add a trainer, lets say if I get my hands on a Ash DP Overworld Sprite and battle sprite, how can I add it in???

ps: thanks for the tools.

KazoWAR has made videos of these.
 
50
Posts
14
Years
  • Seen Aug 21, 2014
Is it for Heartgold/Soulsilver or Platinum?? I wanted to add a trainer in Platinum, is his/her tutorials for HGSS or Plat? I'll check it out though.

I don't know. But I'm sure the overworld sprite is for HGSS, since KazoWAR hasn't found the narc file for Platinum.
 
16
Posts
13
Years
  • Seen Jul 28, 2012
I am having a bit of a problem with scripting. I am playing SoulSilver, I added a Dawn DP Overworld sprite in the Cherrygrove City Pokemon Center. So here is what I did.

Script:

Lockall
Faceplayer
Message 6
WaitButton
CloseMsgOnKeyPress
TrainerBattle 136 0 1
Message 7
WaitButton
CloseMsgOnKeyPress
Applymovement 9 mov_1
Waitmovement
Releaseall
Removepeople 9
End

Text:

text_6="???: Hello. Oh, my name's Dawn.\nMy hometown is located in Twinleaf Town.\rDawn: Well, it's in the Sinnoh Region.\nCool, you have a starter, let's battle!"
text_7="Dawn: Wow you're really strong!!\nLet's battle again sometime..."

Movement:

WalkLeftNormal 3
WalkDownNormal 2
WalkLeftNormal 4
WalkDownFast 6

After I have battled her, she says text_7 and then the textbox disappears, she doesn't do her movements, nor can I do anything, its like it froze. Any help?
 
50
Posts
14
Years
  • Seen Aug 21, 2014
I am having a bit of a problem with scripting. I am playing SoulSilver, I added a Dawn DP Overworld sprite in the Cherrygrove City Pokemon Center. So here is what I did.

Script:

Lockall
Faceplayer
Message 6
WaitButton
CloseMsgOnKeyPress
TrainerBattle 136 0 1
Message 7
WaitButton
CloseMsgOnKeyPress
Applymovement 9 mov_1
Waitmovement
Releaseall
Removepeople 9
End

Text:

text_6="???: Hello. Oh, my name's Dawn.\nMy hometown is located in Twinleaf Town.\rDawn: Well, it's in the Sinnoh Region.\nCool, you have a starter, let's battle!"
text_7="Dawn: Wow you're really strong!!\nLet's battle again sometime..."

Movement:

WalkLeftNormal 3
WalkDownNormal 2
WalkLeftNormal 4
WalkDownFast 6

After I have battled her, she says text_7 and then the textbox disappears, she doesn't do her movements, nor can I do anything, its like it froze. Any help?

I'm not sure, but I guess it's this part:
Releaseall
Removepeople 9

Try changing their positions(Removepeople 9 up and vice versa), it might help. I havn't ROM Hack in a few months :(
 
16
Posts
13
Years
  • Seen Jul 28, 2012
I'm not sure, but I guess it's this part:
Releaseall
Removepeople 9

Try changing their positions(Removepeople 9 up and vice versa), it might help. I havn't ROM Hack in a few months :(

I tried and still the same result.....X( Thanks anyway. I guess I'm going to have to mix it around to see if it works.
 
10
Posts
14
Years
  • Seen May 9, 2012
great tutorial. one question though: Im trying to replace overworld sprites for gym leaders and having no luck. every time I input the new hex sprite number and try to save, I get an error message. for example, I try to replace falkner (hex 352) with bugsy (353) in the gym. is there anyway to make this work?
 
15
Posts
6
Years
  • Age 27
  • Seen Feb 27, 2020
I know this is very old, but I was wanting to create a script for a HG hack I'm making, and I don't even know where to begin. I'm doing a test right now to make sure I know what i'm doing before I mess up my current rom. But I placed a mew sprite it my house across the table from the mom, and currently there is no script on the mew yet. All I want is to create a script that allows me to fight the mew. This is all i want to do along with creating an npc that gives you a pokemon. these two things I could do on the GBA rom hacks (super easy), but the NDS rom hacks are much harder.

Edit: I managed to write a script for the Mew by examining the scripts for battling the other legendaries in the game. But now I am having a problem with the pokemon disappearing after the fight. I have a feeling it might be a Flag problem or something, but the Mew is there forever and can be fought an infinite amount of times. Obviously I only want one battle to occur. But I can't seem to figure that out. Any help would be appreciated.
 
Last edited:
Back
Top