• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Script] Pokemon Emerald: How do I change rematch trainer battles to on demand?

Hey, so I'm completely noobish at scripting. I know that in Emerald, battles are not so easily started, and are (I believe) RTC based. How could I make a battle to an already existing trainer go from the vanilla script to something that you can request as many times as you wish on demand?

So, I'd like the script text to be something like this:
*Talks to trainer*
Trainer: "Wanna rematch?"
Options: Yes/No
Option Yes: Engage battle
Option No: "Alright then, maybe later"

Also, would I need to create a new Person event in Advance Map? (I use PKSV-UI script editor) or can I just edit the existing script and compile it? Also, could this cause any foreseeable glitches after making specific trainers rematch on demand? If I remember correctly, the PokeNav lets you know when a trainer is ready to rebattle. Could that cause any issues if I do this? Also note, I don't know the offsets of the trainers. This is for an older mod called Theta Emerald EX but I can't figure out specific trainer information. What would I need to know beforehand?

Please be willing to explain, step by step how to accomplish this. I'm somewhat used to AM but not to the script editor. I'd appreciate the help! Thanks!
 
Here's a short script I compiled using XSE:

#dynamic 0x800000
#org @start
trainerbattle 0x0 0x1 0x0 @ch @de
msgbox @t1 0x5
compare 0x800d 0x1
if 0x0 goto @nope

settrainerflag 0x1
trainerbattle 0x0 0x1 0x0 @ch @de

release
end

#org @nope
msgbox @later 0x6
release
end

'-----------------
#org @ch
= Battle time!

#org @de
= How did I lose?

#org @t1
= Want a rematch?


#org @later
= Okay, Maybe later?
 
Here's a short script I compiled using XSE:

#dynamic 0x800000
#org @start
trainerbattle 0x0 0x1 0x0 @ch @de
msgbox @t1 0x5
compare 0x800d 0x1
if 0x0 goto @nope

settrainerflag 0x1
trainerbattle 0x0 0x1 0x0 @ch @de

release
end

#org @nope
msgbox @later 0x6
release
end

'-----------------
#org @ch
= Battle time!

#org @de
= How did I lose?

#org @t1
= Want a rematch?


#org @later
= Okay, Maybe later?

I appreciate that, but if I paste that and compile, will it work the same way? Would I need to know any trainer offset info?
 
I've only been scripting in XSE and never used PKSV UI, but I don't think that it could be pasted onto PKSV UI from XSE as the codes are not written in the same way. You could however, use XSE for this code and compile it (I recommend it as it has become a modern scripting software) .
As far as trainer offset goes (I'm assuming you are talking about the 0x1 of the trainerbattle command), you have to open up your rom with a trainer editing tool like HTE, and if you make your first trainer (using the ID of 001) that is 0x1 in scritpting (if its 002 its 0x2, if its 010 its 0xA as 10 = A in hexadecimal)
 
Back
Top