Adding Trainers to G/S
I haven't come across a tutorial yet for this, but I can see why. Gym/Rival battles are pretty easy because they're usually within a script that has special meaning. However, if you don't know the layout, regular trainer battles can be a real pain to comprehend, especially since PKSV doesn't load it correctly. And there's reason for this.
Regular Trainer battles begin with a Bit No(or flag) so when PKSV reads the script, it doesn't understand that these trainer battles begin this way. Instead, the event OW itself has the data that allows the game to recognize that it's a trainer. Which makes things easier for us in the end since we don't need to do to much.
In this thread, I will attempt to cover Trainer Battles and Gym Battles. I will also try to explain Rival Battles too, as this may become complicated to those who decide to include more than one starter in their hack. Now than.
REGULAR TRAINER BATTLES
To start off, realize that the layout to these battles are like this.
[Bit no. (2byte)][Trainer group (1byte)][Trainer (1byte)][2byte pointer to Text when seen][2byte pointer to text when trainer beaten][2byte pointer to script when lost (0000=Blackout)][2byte pointer to script if won/talked to again]
Had I not found this in this thread I would have went nuts. Anyway, to break it down.
What goes here is a bit number, or flag. I don't need to tell you what that is because there are plenty of tutorials that explain this. So in laymen terms, you shouldn't be attempting this if you haven't the slightest idea how bit no's work. For an example, I'll be using B1 05, which happens to be the bit number of Youngster Warren from Route 3. Now then.
[B1 05] We have our 2 bytes here, which any bit no should be anyway.
[Trainer group (1byte)]
This area would be specifying what Trainer Group that is to be loaded. In this case(note that B1 05 doesn't have to be used for Warren, this is just an example, you could use this number with any Trainer)the trainer group is Youngster, which is byte 16. All the Youngsters byte is 16. There should be a list in the link above. So far we have:
[B1 05] 
Now this is where we insert the number of the trainer. Warren is number 09 in the Youngster list, so we include 09 with our structure.
[B1 05]  
So far we have our Bit number, to stop the battle from recurring, the trainer group Youngster set, and the 9th trainer data of the Youngster set, Warren. To make things look easier, I'll be showing how it would look in a hex editor.
B105 16 09
Now for the pointer. Structure is like this. *Note, don't ask me about pointers. There should be guide on that somewhere. Use a program called Pointer Berechner, this calculates the pointers for you.
[2byte pointer to Text when seen]
So the pointer uses 2 bytes which would be accessed when you're in view or when you talk to them.
B105 16 09 XXYY
XXYY being the pointer. For this example, it'll be E2 4F. Pointer's location have to be in the same bank. To find the bank, use Johto Map and click Map Properties, Event/Script Bank will have the Bank number. We now have.
B105 16 09 E24F
E24F points to 140FE2(the bank number is 50, so with Pointer Brechner in the right hand box type 50E24F to get the offset. This is why knowing banks is required, for those of you using existing trainer data)
At this offset is the text we insert that the trainer will say before battle. Basic knowledge of scripting is required.
[2byte pointer to text when trainer beaten]
This pointer goes beside the first one. For beaten during battle, the pointer will point to the text you point it to. For this one it's 01 50.
B105 16 09 E24F 0150
[2byte pointer to script when lost (0000=Blackout)]
For that pointer, type 0000 to let the game know that if you lose you will blackout. So.
B105 16 09 E24F 0150 0000
[2byte pointer to script if won/talked to again]
This pointer will point to text that would appear after the game returns to normal to indicate the trainer has been beaten. For this script, it's 46 4F.
B105 16 09 E24F 0150 0000 464F
That is a completed battle script for Trainers. Let me break it down.
[Bit no. (2byte)] Insert the Bit No here, my case B1 05.
[Trainer group (1byte)] Insert the Trainer Group number here. My case 16.
[Trainer (1byte)] Insert the Trainer number of the specified group here. My case is 09, the ninth name in the section of Youngsters(which has it's Pokemon data set).
[2byte pointer to Text when seen] Insert the 2byte pointer for the beginning text(when you're in view or you talk to them). My case it was E24F.
[2byte pointer to text when trainer beaten] Insert the 2byte pointer here to initate the text that would appear in the battle when they've been beaten. My case it was 0150.
[2byte pointer to script when lost (0000=Blackout)] Insert 0000 here to tell the game that you should blackout if you lose.
[2byte pointer to script if won/talked to again] Insert the 2byte pointer here to initiate the text that would appear when you talk to trainer again. In my case, the pointer was 464F.
B105 16 09 E24F 0150 0000 464F
That was the best way I could explain it. Basic knowledge of scripting is required. Maybe I'll do a tut on that too...or not. There's plenty of explanations on that here. This is for Intermediate scriptors who have a grasp on pointers, bits, and messages.
If there are any questions, ask and I'll try my best to answer.
|All times are GMT -8. The time now is 11:44 AM.|
© 2002 - 2015 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2015.