Trainerbattle 0x0
Just a simple
trainerbattle script:
Code:
#dynamic 0x800000
#org @start
trainerbattle 0x0 0x001 0x0 @before @after
msgbox @beaten 0x6
release
end
#org @before
= Go, all my PIKACHUs!
#org @after
= Nooo! My PIKACHUs!!!!!
#org @beaten
= My PIKACHUs can be used to\ncharge my Nintendo DS Lite.
trainerbattle is a battle with a trainer.
trainerbattle is great because the game keeps track of whether you have beaten a trainer or not. In this script, we have no need for a
checkflag/
setflag situation.
Now to explaining these values after the
trainerbattle. These are:
trainerbattle 0x0 [Type of battle]
0x001 [Trainer ID]
0x0 [Reserved Byte (normally 0x0)]
@before [Pointer to Message When Seen]
@after [Pointer to Winning Message]
I guess I'll explain the type of battle. This byte determines whether it's a double battle, Gym Leader Battle, or another type. A normal
trainerbattle is 0x0. The trainer will "see you", then go to the beginning message, then the battle, and then goes to the message when you win.
Now we'll move onto the Trainer ID. This is the ID of a trainer that's found in PET. For example, Brock can be found with with a Trainer ID of 0x19E, and Blaine can be found with 0x1A3.
Now, there are two pointers, @
before & @
after. I've labeled these to help display what they are used for. The first pointer, @
before, shows the pointer to the message displayed
before the battle.
Now onto @
after. It's the pointer to the message
after the battle, obviously! This message appears while we are still in the battle itself. Remember the colors that were mentioned towards the beginning of this tutorial? Well, we can use colors with this too! They're different, though. Sadly, I don't have a list for those values.
Now, if I were to test it in a ROM, what would happen after the
trainerbattle? Nothing. The script ends. So why do I have a
msgbox after it?
Remember how I talked about
trainerbattle keeping track of whether you have beaten them or not? Well, once you beat the trainer, the
trainerbattle will be skipped, so when you speak to them after beating them in a battle, it'll be treated like a normal message script.
Wait! Why don't I have a
lock and
faceplayer after the
trainerbattle? The reason is that once you have beaten that trainer,
trainerbattle will also act as the
lock/faceplayer combo, and you don't have to worry about them in this script.
That's the scripting side of this command done. Now the A-Map side. Now compile this script, and test it in a ROM. Did it work like a normal in-game trainer battle? I bet your answer is no.
You'll need to fill in these boxes: