View Single Post
Old February 26th, 2013 (7:10 PM).
karatekid552's Avatar
karatekid552 karatekid552 is offline
What happens if I push it?....
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Posts: 1,766
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Originally Posted by Noossab Blue View Post
I'm trying to create a simple yes/no trainer battle. Here is what I have:

#dynamic 0x800000
#org @begin
checktrainerflag 0x66
compare lastresult 0x0
if 0x1 goto @finished
msgbox @ask 0x5
compare lastresult 0x0
if 0x1 goto @nope
trainerbattle 0x0 0x66 0x0 0x81722C7 0x81722F9
goto @finished

#org @nope
msgbox @no 0x6
settrainerflag 0x66

#org @finished
msgbox 0x8172315 MSG_NORMAL '"Ssh! You'll scare the bugs away.\n..."

' Strings
#org 0x1722C7
= Great! Let's battle our\nPOKéMON!

#org 0x1722F9
= No!\nCATERPIE can't hack it!

#org 0x172315
= Ssh! You'll scare the bugs away.\nAnother time, okay?

#org @ask
= Wanna battle?

#org @no
= No? Lame!

It's close to working. The problem is, the trainer only asks if you want to battle once, so if you say no you can't change your mind and say yes until you enter another battle and come back to him. Conversely, if you say yes, the battle commences, but if you come back to him after another battle, he asks if you want to battle again, even though you already won...not sure why...
Well, the first problem is there is no "end" at the end of @begin. This can cause bytes to run together if you have, let's say another script in that same area, and it might just keep going onto the next script.

There is no need to set the trainers flag if you say no, it was already set from the start.

Lastly, play with the type of trainer battle. I think your problem lies in using the wrong type. The types range from 0-3 so give them all a try.

Paired with Simba