View Single Post
Old October 3rd, 2011 (11:32 AM).
Missingyep Missingyep is offline
Join Date: Jul 2010
Posts: 275
Originally Posted by treeckopa View Post
I have some questions about trainerbattle.
For trainerbattle 0x1, it can be used for both rival and GYM leader? What about the music during the battle? How can I change it?
For trainerbattle 0x3, it seems that it's for elite four, but some said that for 0x3, the script will continue even if you've lost in the battle. So what is the exact function for 0x3?
And for other kinds of trainerbattle, what are their functions?
Type 0 is an ordinary battle. Script execution stops after the battle, regardless of its outcome.

1 and 2 are identical, and run scripts after the battle ends (but only if the player won). They except one extra argument: the offset of the script to run. (The script with "trainerbattle" stops running, and the offset you specify starts running.)

3 is a continue-battle. The script that calls "trainerbattle" keeps running after the battle (but only if the player won).

4 is a double battle. It accepts one extra argument: the offset of some text to display if the player does not have two or more usable Pokemon (and hence can't start the battle).

5 is a rematch battle. It's almost identical to 0, but it will actually check the trainer number and do a lookup, to see if you're supposed to battle one of their rematch battles instead. To use this to its fullest potential, you would need to learn more about the rematch functionality.

6 is a special kind of double battle that accepts two extra arguments. I have no idea what the second extra argument is.

7 is a double rematch battle.

8 is a clone of 6.

9 is a tutorial battle. So far as I know, it functions identically to 0 except that the player will not whiteout if they lose the battle. Passing in 0x0003 instead of 0x0000 (as the unknown halfword argument) enables Oak's mid-battle narration.

All other values are treated as type-0 battles.

Note that if the trainer you specify has already been defeated, "trainerbattle" does nothing and the script that calls it will keep running unless you used a rematch battle type. And I think you need an ASM hack to change the music.