View Single Post
Old 18th March 2015, 09:11 AM   #14
Emerald Hacker
Sky0fBlades's Avatar
Join Date: Sep 2012
Location: Ice Path
Age: 25
Posts: 128

Originally Posted by 64smashmaster3ds View Post
Could you make a sample script for gym battles and other type of boss battle. Also setting the checkflag, trainerbattle, setflag for a trainer and gym leader.
Unfortunately I've been away for quite some time (college stuff) and haven't been hacking much but I did manage to throw together a basic Gym Leader sequence with this trick in it. Unlike your typical GL script, this one has a different structure to accomodate the weirdness that Special 0x3E causes if it isn't in the right places. I've tested it a few times, and it works perfectly for me. It doesn't include the other stuff like variable setting and deactivating the surrounding trainers, but it serves the purpose (as in, first a battle, then it gives the player the badge, sets the flag for it, and gives the player a TM once). You'll have to modify the text lines and add in what values you want but with the find-and-replace feature in XSE you can replace the little groups of 3 symbols described in the top line based on what they affect:
// Custom GYM LEADER battle with changeable battle music. Symbol sets to replace: ###, $$$, %%%, ???

#freespace 0xFF
#dynamic 0x9C0B20

#org @start
checkflag 0x### // Checks if the TM has been given to you.
if 0x0 goto @battle_or_tm
msgbox @after_2 MSG_KEEPOPEN

#org @battle_or_tm
checkflag 0x$$$ // Has player gotten the badge?
if 0x0 goto @battleforbadge
giveitem ITEM_TM01 0x1 MSG_OBTAIN // Give player a TM.
compare LASTRESULT 0x0 // Is bag full?
if 0x1 goto @bagfull
setflag 0x### // You've gotten the TM.
msgbox @tmdescription MSG_KEEPOPEN

#org @battleforbadge
msgbox @intro MSG_KEEPOPEN
special 0x3E // Special that makes a default battle happen. Required.
playsong 0x%%% 0x0 // What song you want during battle.
trainerbattle 0x1 0x??? 0x0 @intro @defeat @after_1
goto @after_1 // Must put this here even though it is in the above line, or it won't work.

#org @bagfull
msgbox @fullmessage MSG_KEEPOPEN

#org @after_1
preparemsg @receivedbadge
call @badgefanfare
setflag 0x$$$ // Player now has this badge.
msgbox @describebadge MSG_KEEPOPEN
goto @battle_or_tm

#org @badgefanfare
fanfare 0x171

#org @intro
= Hi there, welcome to my GYM.\pLet's battle now!

#org @defeat
= Alright, you win.

#org @receivedbadge
= [player] received the MYSTERY BADGE\nfrom LEADER.

#org @tmdescription
= That TECHNICAL MACHINE, TM01,\ncontains COOLMOVE.\pIt not only does THIS, but it\nalso does THIS too.

#org @describebadge
= The MYSTERY BADGE heightens the ATTACK\n of your POKéMON.\pIt also enables them to use the HM move\nWHIRLPOOL outside of battle.\pPlease take this TM, too.

#org @after_2
= Good luck on your path to the LEAGUE.

#org @fullmessage
= Uh... You have at least 99 of this TM.\nDid you.... cheat, or something?
The first script I posted is meant mainly for "boss"-like battles since it won't really work properly as far as I know for trainers who battle you on sight (not including ones where you've directly scripted one like that). If you want Elite-4 Battles to be like this you must make similar changes as outlined in the commented sections inside the script. A more permanent and thorough way to get the Gyms and E4 to play the themes you want is to switch/edit the default songs and their voicegroups using a GBA music editing program like Sappy 2006 Mod-17. Good luck, feel free to post if you need any more help.

Last edited by Sky0fBlades; 13th January 2017 at 03:18 AM. Reason: spelling error
Sky0fBlades is offline   Reply With Quote