You will need an external program to edit the trainer data. I use PET, but there are other programs you can use. However, I've heard that some PET downloads carry viruses (which is true because it happened to me before), so I will provide you guys with the PET on my computer. I never had a virus with this, so I doubt you guys should either.
pet.exe | |
File Size: | 35 kb |
File Type: | exe |
This explains how to make trainer battles, which is what gym battles are. However, there are some differences, which is what I will explain here.
The main difference between a regular pokemon battle and a gym battle would probably
1. Music played
2. You get a badge after the battle.
However, I will still go over regular trainers first, since gym leaders are based off of trainer battles.
We will start with PET's format. When you open PET, make sure to open the correct ROM.
The main difference between a regular pokemon battle and a gym battle would probably
1. Music played
2. You get a badge after the battle.
However, I will still go over regular trainers first, since gym leaders are based off of trainer battles.
We will start with PET's format. When you open PET, make sure to open the correct ROM.
I divided PET into 4 sections.
1- Shows you all of the trainer data in the game. Note the trainer flag number next to the name.
2- Shows you the trainer data. You can configure the trainer's name, class, music, # of pokemon, and type of battle here. Make sure to save the data afterwards.
3- Shows you the items that the trainer can use. These items may be used in battle.
4- Shows you the pokemon data. Here you can configure the level, pokemon, and the attacks it can use (I don't know what AI level does).
This is what will happen in-game.
1- Shows you all of the trainer data in the game. Note the trainer flag number next to the name.
2- Shows you the trainer data. You can configure the trainer's name, class, music, # of pokemon, and type of battle here. Make sure to save the data afterwards.
3- Shows you the items that the trainer can use. These items may be used in battle.
4- Shows you the pokemon data. Here you can configure the level, pokemon, and the attacks it can use (I don't know what AI level does).
This is what will happen in-game.
trainer_battle_script.pks | |
File Size: | 0 kb |
File Type: | pks |
Before I explain the script, let me go over the A-map configurations.
If you want to add a trainer into the game, you must make sure 'Trainer' is equal to 1. This will allow the use of the view radius. The view radius is simply how far you can be before the trainer to sees you, approaches you, and battles you.
Since you usually talk to gym leaders before battling them, don't use this feature for gym leaders.
Now, onto the script!
#dyn 0x740000
#org @begin
trainerbattle 0x0 0x0D5 0x0 @intro @defeat
msgbox @afterwards
callstd msg_normal
end
#org @intro
= Note how I say something before\nthe battle.
#org @defeat
= Here I say stuff when I lose.
#org @afterwards
= That is all.
This is actually very easy. I was lazy though, so I used the 'trainer battle' generated script in PKSV.
The new line here is 'trainerbattle'. The format is
trainerbattle 0x(0 or 1 *see note 1) 0x(trainer flag *see note 2) 0x(0 or 1 * see note 3) @(message to be said before battle) @(message to be said after defeat)
1. The first value is usually 0x0 because after the battle, we don't want anymore to happen. However, in the case of a gym battle or such, usually the gym leader will congratulate us and give us stuff after the battle. To tell the game that we want to continue even after a battle, we use 0x1 instead.
2. To find the trainer flag, in PET, next to the trainer's name, the hex value is what you will use.
3. Normally, if we lose a battle, it's a trip to the pokemon center. However, the game has a special event to happen where you can lose a battle and continue playing. This is only used when you battle with your rival, according to what I've seen. Using 0x1 here allows you to trigger the special part where your rival goes "Yeah, I'm so awesome" or something, and you get Oak's lecture about losing.
Now onto gym leader battles. As I have said before, the gym leaders make their first 0x0 as 0x1 for setting special flags/vars and such. However, since this process is done to allow the game to advance, and not necessary, I will not do that.
Now, open PET. Lets edit a trainer and his/her pokemon.
Since you usually talk to gym leaders before battling them, don't use this feature for gym leaders.
Now, onto the script!
#dyn 0x740000
#org @begin
trainerbattle 0x0 0x0D5 0x0 @intro @defeat
msgbox @afterwards
callstd msg_normal
end
#org @intro
= Note how I say something before\nthe battle.
#org @defeat
= Here I say stuff when I lose.
#org @afterwards
= That is all.
This is actually very easy. I was lazy though, so I used the 'trainer battle' generated script in PKSV.
The new line here is 'trainerbattle'. The format is
trainerbattle 0x(0 or 1 *see note 1) 0x(trainer flag *see note 2) 0x(0 or 1 * see note 3) @(message to be said before battle) @(message to be said after defeat)
1. The first value is usually 0x0 because after the battle, we don't want anymore to happen. However, in the case of a gym battle or such, usually the gym leader will congratulate us and give us stuff after the battle. To tell the game that we want to continue even after a battle, we use 0x1 instead.
2. To find the trainer flag, in PET, next to the trainer's name, the hex value is what you will use.
3. Normally, if we lose a battle, it's a trip to the pokemon center. However, the game has a special event to happen where you can lose a battle and continue playing. This is only used when you battle with your rival, according to what I've seen. Using 0x1 here allows you to trigger the special part where your rival goes "Yeah, I'm so awesome" or something, and you get Oak's lecture about losing.
Now onto gym leader battles. As I have said before, the gym leaders make their first 0x0 as 0x1 for setting special flags/vars and such. However, since this process is done to allow the game to advance, and not necessary, I will not do that.
Now, open PET. Lets edit a trainer and his/her pokemon.
Change up whatever you want. However, since this is a gym leader battle, I would recommend you put the trainer class to 'Leader', and the music to 0 or 129 (for male or female gym leader respectively).
Now we must write a gym leader script for this person. The format would probably be something like this.
#dyn 0x740000
#org @main
lock
faceplayer
trainerbattle 0x1 0x1 0x0 @intro @defeat @aftermath
message @repeatafterbattle
callstd MSG_NORMAL
release
end
#org @aftermath
message @praise
callstd MSG_NORMAL
setflag FR_BADGE_1
additem
message @gotitem
release
end
#org @intro
= Text before fight.
#org @defeat
= Text after fight.
This is the basic skeleton of your gym leader script. Note that the flag I set, FR_BADGE_1, is a special flag that will add the badge to your trainer card. You can go from 1-8, but I recommend you do not skip over numbers.
So, we begin with the message at offset intro (@intro), and we proceed to battle the trainer with data 0x001 (for me). After we win, we will see the message at offset defeat (@defeat). Since we want to jump to another offset after the battle, we make the first integer value 1 (or hex value as 0x1) to tell the game that we want to progress with the script after the battle. The offset we want to continue with is @aftermath.
After @aftermath is done (which includes all of the congrats and items you get from the leader), this section will never trigger again. Instead, now whenever we talk to this gym leader, we will only get the message at offset repeatafterbattle (@repeatafterbattle). To trigger future battles, you would have to check for certain flags/vars, and probably write multiple 'trainerbattle' with multiple trainer data.
If everything went well, something like this should have happened.
#dyn 0x740000
#org @main
lock
faceplayer
trainerbattle 0x1 0x1 0x0 @intro @defeat @aftermath
message @repeatafterbattle
callstd MSG_NORMAL
release
end
#org @aftermath
message @praise
callstd MSG_NORMAL
setflag FR_BADGE_1
additem
message @gotitem
release
end
#org @intro
= Text before fight.
#org @defeat
= Text after fight.
This is the basic skeleton of your gym leader script. Note that the flag I set, FR_BADGE_1, is a special flag that will add the badge to your trainer card. You can go from 1-8, but I recommend you do not skip over numbers.
So, we begin with the message at offset intro (@intro), and we proceed to battle the trainer with data 0x001 (for me). After we win, we will see the message at offset defeat (@defeat). Since we want to jump to another offset after the battle, we make the first integer value 1 (or hex value as 0x1) to tell the game that we want to progress with the script after the battle. The offset we want to continue with is @aftermath.
After @aftermath is done (which includes all of the congrats and items you get from the leader), this section will never trigger again. Instead, now whenever we talk to this gym leader, we will only get the message at offset repeatafterbattle (@repeatafterbattle). To trigger future battles, you would have to check for certain flags/vars, and probably write multiple 'trainerbattle' with multiple trainer data.
If everything went well, something like this should have happened.
gym_leader_battle.pks | |
File Size: | 0 kb |
File Type: | pks |
This concludes the lesson. Thanks to this lesson, I could go over trainer battles. I hope this was what the person who requested this lesson desired. If not, tell me and I'll add on this lesson. Thank you for reading. Go to the other requested scripts if you want, or go ahead and continue with the general PKSV lessons.