Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.


Reply
 
Thread Tools
  #1    
Old July 14th, 2017 (2:24 PM). Edited 4 Weeks Ago by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
XSE Scripting Tutorial for 2017
-----------------------------------------------------------------------------------------------------------------------------------------------------
Before anyone says it - I'm well aware that scripting tutorials have been around for ages. I would like to first and foremost like to thank tajaros and diegoisawesome plus those who inspired them way back when for theirs which taught me the foundations of scripting. My tutorial aims to go over some points of theirs, make it as easy as possible for new members to learn, collect everything script-related on one page, and share some tips and tricks I picked up on my own that I wish someone had put in a tutorial when I was starting out!

This thread is a work in progress and might look a little dishevelled or incomplete as of right now, but I'm committed to finishing it quickly. To find something in particular that you might be curious about that isn't immediately obvious in the contents list, you can Ctrl+F and search for a key word, such as "attack" if you're looking for something to do with attacks.

Scripting is, in my humble opinion, THE most important thing to learn in manipulating Pokémon games at this pre-disassembly stage we're at at this point in time. It's what you use to create your dialog, your events, your quests, to make stuff happen, to literally create your gameplay. You can create a perfectly good hack using default sprites and tiles in your ROM if you script it well. If you're new to ROM hacking, learn scripting first. Fancy tiles, custom sprites and all that stuff can come later.

The first thing you should do, if you haven't already, is download a copy of HackMew's XSE 1.1.1, Lu-ho's AdvanceMap 1.92 and a ROM of your choice. At this point in time this tutorial is for FireRed[FR] and Emerald[EM] only as these two seem to be the most popular ROMs of choice nowadays. If you find any terminology confusing or want very in-depth explanations of commands, I recommend DavidJCobb & Spherical Ice's extensive documentation on XSE commands here.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Table Of Contents

Part #1: The Basics
Part #2: The Core
Part #3: Manipulating the Overworld
Quick Links
*to be expanded upon*
__________________
x
Luna <3
Reply With Quote

Relevant Advertising!

  #2    
Old July 15th, 2017 (4:41 AM). Edited July 15th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Part #1: The Basics
-----------------------------------------------------------------------------------------------------------------------------------------------------

Pointers & Script Layout

XSE uses dynamic offsets - meaning it automatically searches for free space from a given beginning offset. For the sake of this tutorial, we'll use #dynamic 0x800000, although it can technically be any free offset. 0x800000 and upwards is generally the safest, as from that point onwards there is a lot of free space to use.


Thus, below should be the first line of your script. This means that every script you compile from now on will automatically compile to the first free offset it finds after 0x800000.

Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

Now, onto the second line of your script. A pointer is just a label for a section of your script, prefixed with @. It can be any mixture of letters or numbers as long as it doesn't contain any spaces or special characters. For example, we can have @MyScript1 but not @My Script 1. We'll call our first pointer @main for the sake of the tutorial, so now we've got this:

Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main

The #org part notes that this is the start of a new script section labelled pointer @main. There are lots of different ways of "closing" the script which I will cover later in the tutorial, but for now I'll just show you the most basic way of finishing it: end. That's it. You can put whatever you want between your pointer and your "finishing statement", like this:

Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
{your script contents}
end

Above is your basic layout. This tells the game to compile the script labelled @main to free space anywhere above 0x800000.

__________________
x
Luna <3
Reply With Quote
  #3    
Old July 15th, 2017 (4:43 AM). Edited July 18th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Simple Text Scripts

Let's start with a basic NPC - we want to make someone face us and say hi, or in scripting terms, display a string of text. We do this with a msgbox.

The msgbox command is set up like this:
Quote:
Originally Posted by Avara View Post
msgbox @pointer 0x[number of msgbox type]
There are various msgbox types which we'll go through one at a time. Here's the most common, 0x6:



Spoiler:
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @greeting 0x6
release
end

#org @greeting
= Hi!


So, we have quite a few new additions here.
lock prevents the player from moving. Alternatively, lockall stops all NPCs on the map from moving. Should come directly after your #org @main but before your msgbox.
faceplayer is fairly self explanitory too; it just makes the NPC face the PC before talking.
release lets the player move again. If you used lockall instead, you'll have to use releaseall. After release or releaseall, finish with end.
#org @greeting is a pointer to our text string, "= Hi!". I'll go into more detail on text info later, but the "=" basically tells XSE it's the start of a string, or line of text.

That script will make someone face you and say "Hi!". Alternatively, there is a shorter way of scripting NPCs: msgbox 0x2.



Spoiler:
#dynamic 0x800000

#org @main
msgbox @greeting 0x2
end

#org @greeting
= Hi!


Using the above version, msgbox 0x2, means you don't need the lock, faceplayer or release commands, whereas msgbox 0x6 does. Both scripts do exactly the same thing.

msgbox 0x3 is used in the original games for signposts; it displays the sign textbox when used on an actual signpost tile. Like 0x2, you don't need the lock, faceplayer or release commands.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
msgbox @sign 0x3
end

#org @sign
= Signpost
msgbox 0x4 is a normal textbox just like 0x6, in that you need the lock, faceplayer and release commands surrounding it. The difference here is that the textbox will stay open, meaning we require a new command to make it go away, closeonkeypress.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @greeting 0x4
closeonkeypress
release
end

#org @greeting
= Hi!
From here on in for a bunch of things, you are going to need to refer to the following:

__________________
x
Luna <3
Reply With Quote
  #4    
Old July 15th, 2017 (4:45 AM). Edited October 13th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
FireRed & Emerald Item ID Numbers
Spoiler:
0001 = Master Ball
0002 = Ultra Ball
0003 = Great Ball
0004 = Poke Ball
0005 = Safari Ball
0006 = Net Ball
0007 = Dive Ball
0008 = Nest Ball
0009 = Repeat Ball
000A = Timer Ball
000B = Luxury Ball
000C = Premier Ball

000D = Potion
000E = Antidote
000F = Burn Heal
0010 = Ice Heal
0011 = Awakening
0012 = Parlyz Heal
0013 = Full Restore
0014 = Max Potion
0015 = Hyper Potion
0016 = Super Potion
0017 = Full Heal
0018 = Revive
0019 = Max Revive
001A = Fresh Water
001B = Soda Pop
001C = Lemonade
001D = MooMoo Milk
001E = Energy Powder
001F = Energy Root
0020 = Heal Powder
0021 = Revival Herb
0022 = Ether
0023 = Max Ether
0024 = Elixer
0025 = Max Elixer
0026 = Lava Cookie

0027 = Blue Flute
0028 = Yellow Flute
0029 = Red Flute
002A = Black Flute
002B = White Flute
002C = Berry Juice
002D = Sacred Ash
002E = Shoal Salt
002F = Shoal Shell
0030 = Red Shard
0031 = Blue Shard
0032 = Yellow Shard
0033 = Green Shard

003F = HP Up
0040 = Protein
0041 = Iron
0042 = Carbos
0043 = Calcium
0044 = Rare Candy
0045 = PP Up
0046 = Zinc
0047 = PP Max

0049 = Guard Spec
004A = Dire Hit
004B = X Attack
004C = X Defend
004D = X Speed
004E = X Accuracy
004F = X Special

0050 = Poke Doll
0051 = Fluffy Tail
0053 = Super Repel
0054 = Max Repel
0055 = Escape Rope
0056 = Repel

005D = Sun Stone
005E = Moon Stone
005F = Fire Stone
0060 = Thunder Stone
0061 = Water Stone
0062 = Leaf Stone

0067 = Tiny Mushroom
0068 = Big Mushroom
006A = Pearl
006B = Big Pearl
006C = Stardust
006D = Star Piece
006E = Nugget
006F = Heart Scale

0079 = Orange Mail
007A = Harbor Mail
007B = Glitter Mail
007C = Mech Mail
007D = Wood Mail
007E = Wave Mail
007F = Bead Mail
0080 = Shadow Mail
0081 = Tropic Mail
0082 = Dream Mail
0083 = Fab Mail
0084 = Retro Mail

0085 = Cheri Berry
0086 = Chesto Berry
0087 = Pecha Berry
0088 = Rawst Berry
0089 = Aspear Berry
008A = Leppa Berry
008B = Oran Berry
008C = Persim Berry
008D = Lum Berry
008E = Sitrus Berry
008F = Figy Berry
0090 = Wiki Berry
0091 = Mago Berry
0092 = Aguav Berry
0093 = Iapapa Berry
0094 = Razz Berry
0095 = Bluk Berry
0096 = Nanab Berry
0097 = Wepear Berry
0098 = Pinap Berry
0099 = Pomeg Berry
009A = Kelpsy Berry
009B = Qualot Berry
009C = Hondew Berry
009D = Grepa Berry
009E = Tamato Berry
009F = Cornn Berry
00A0 = Magost Berry
00A1 = Rabuta Berry
00A2 = Nomel Berry
00A3 = Spelon Berry
00A4 = Pamtre Berry
00A5 = Watmel Berry
00A6 = Durin Berry
00A7 = Belue Berry
00A8 = Liechi Berry
00A9 = Ganlon Berry
00AA = Salac Berry
00AB = Petaya Berry
00AC = Apicot Berry
00AD = Lansat Berry
00AE = Starf Berry
00AF = Enigma Berry

00B3 = Bright Powder
00B4 = White Herb
00B5 = Macho Brace
00B6 = Exp Share
00B7 = Quick Claw
00B8 = Soothe Bell
00B9 = Mental Herb
00BA = Choice Band
00BB = King's Rock
00BC = Silver Powder
00BD = Amulet Coin
00BE = Cleanse Tag
00BF = Soul Dew
00C0 = Deep Sea Tooth
00C1 = Deep Sea Scale
00C2 = Smoke Ball
00C3 = Everstone
00C4 = Focus Band
00C5 = Lucky Egg
00C6 = Scope Lens
00C7 = Metal Coat
00C8 = Leftovers
00C9 = Dragon Scale
00CA = Light Ball
00CB = Soft Sand
00CC = Hard Stone
00CD = Miracle Seed
00CE = Black Glasses
00CF = Black Belt
00D0 = Magnet
00D1 = Mystic Water
00D2 = Sharp Beak
00D3 = Poison Barb
00D4 = Nevermelt Ice
00D5 = Spell Tag
00D6 = Twisted Spoon
00D7 = Charcoal
00D8 = Dragon Fang
00D9 = Silk Scarf

00DA = Up-Grade
00DB = Shell Bell
00DC = Sea Incense
00DD = Lax Incense
00DE = Lucky Punch
00DF = Metal Powder
00E0 = Thick Club
00E1 = Stick
00FE = Red Scarf
00FF = Blue Scarf
0100 = Pink Scarf
0101 = Green Scarf
0102 = Yellow Scarf

0103 = Mach Bike
0104 = Coin Case
0105 = ItemFinder
0106 = Old Rod
0107 = Good Rod
0108 = Super Rod
0109 = S.S. Ticket
010A = Contest Pass
010C = Wailmer Pail
010D = Devon's Goods
010E = Soot Sack
010F = Basement Key
0110 = Acro Bike
0111 = PokeBlock Case
0112 = Letter
0113 = Eon Ticket
0114 = Red Orb
0115 = Blue Orb
0116 = Scanner
0117 = Go-Goggles
0118 = Meteorite
0119 = Rm.1 Key
011A = Rm.2 Key
011B = Rm.4 Key
011C = Rm.6 Key
011D = Storage Key
011E = Root Fossil
011F = Claw Fossil
0120 = Devon Scope

0121 = TM01 (Focus Punch)
0122 = TM02 (Dragon Claw)
0123 = TM03 (Water Pulse)
0124 = TM04 (Calm Mind)
0125 = TM05 (Roar)
0126 = TM06 (Toxic)
0127 = TM07 (Hail)
0128 = TM08 (Bulk Up)
0129 = TM09 (Bullet Seed)
012A = TM10 (Hidden Power)
012B = TM11 (Sunny Day)
012C = TM12 (Taunt)
012D = TM13 (Ice Beam)
012E = TM14 (Blizzard)
012F = TM15 (Hyper Beam)
0130 = TM16 (Light Screen)
0131 = TM17 (Protect)
0132 = TM18 (Rain Dance)
0133 = TM19 (Giga Drain)
0134 = TM20 (Safeguard)
0135 = TM21 (Frustration)
0136 = TM22 (Solar Beam)
0137 = TM23 (Iron Tail)
0138 = TM24 (Thunderbolt)
0139 = TM25 (Thunder)
013A = TM26 (Earthquake)
013B = TM27 (Return)
013C = TM28 (Dig)
013D = TM29 (Psychic)
013E = TM30 (Shadow Ball)
013F = TM31 (Brick Break)
0140 = TM32 (Double Team)
0141 = TM33 (Reflect)
0142 = TM34 (Shock Wave)
0143 = TM35 (Flamethrower)
0144 = TM36 (Sludge Bomb)
0145 = TM37 (Sandstorm)
0146 = TM38 (Fire Blast)
0147 = TM39 (Rock Tomb)
0148 = TM40 (Aerial Ace)
0149 = TM41 (Torment)
014A = TM42 (Facade)
014B = TM43 (Secret Power)
014C = TM44 (Rest)
014D = TM45 (Attract)
014E = TM46 (Thief)
014F = TM47 (Steel Wing)
0150 = TM48 (Skill Swap)
0151 = TM49 (Snatch)
0152 = TM50 (Overheat)
0153 = HM01 (Cut)
0154 = HM02 (Fly)
0155 = HM03 (Surf)
0156 = HM04 (Strength)
0157 = HM05 (Flash)
0158 = HM06 (Rock Smash)
0159 = HM07 (Waterfall)
015A = HM08 (Dive)

015D = Oak's Parcel
015E = PokeFlute
015F = Secret Key
0160 = Bike Voucher
0161 = Gold Teeth
0162 = Old Amber
0163 = Card Key
0164 = Lift Key
0165 = Dome Fossil
0166 = Helix Fossil
0167 = Silph Scope
0168 = Bicycle
0169 = Town Map
016A = VS Seeker
016B = Fame Checker
016C = TM Case
016D = Berry Pouch
016E = Teachy TV
016F = Tri-Pass
0170 = Rainbow Pass
0171 = Tea
0172 = Mystery Ticket
0173 = Aurora Ticket
0174 = Powder Jar
0175 = Ruby
0176 = Sapphire

[Emerald Only]
0177 = Magma Emblem
0178 = Old Sea Map


FireRed & Emerald Pokémon ID Numbers
Spoiler:
0001 = BULBASAUR
0002 = IVYSAUR
0003 = VENUSAUR
0004 = CHARMANDER
0005 = CHARMELEON
0006 = CHARIZARD
0007 = SQUIRTLE
0008 = WARTORTLE
0009 = BLASTOISE
000A = CATERPIE
000B = METAPOD
000C = BUTTERFREE
000D = WEEDLE
000E = KAKUNA
000F = BEEDRILL
0010 = PIDGEY
0011 = PIDGEOTTO
0012 = PIDGEOT
0013 = RATTATA
0014 = RATICATE
0015 = SPEAROW
0016 = FEAROW
0017 = EKANS
0018 = ARBOK
0019 = PIKACHU
001A = RAICHU
001B = SANDSHREW
001C = SANDSLASH
001D = NIDORAN Female
001E = NIDORINA
001F = NIDOQUEEN
0020 = NIDORAN Male
0021 = NIDORINO
0022 = NIDOKING
0023 = CLEFAIRY
0024 = CLEFABLE
0025 = VULPIX
0026 = NINETALES
0027 = JIGGLYPUFF
0028 = WIGGLYTUFF
0029 = ZUBAT
002A = GOLBAT
002B = ODDISH
002C = GLOOM
002D = VILEPLUME
002E = PARAS
002F = PARASECT
0030 = VENONAT
0031 = VENOMOTH
0032 = DIGLETT
0033 = DUGTRIO
0034 = MEOWTH
0035 = PERSIAN
0036 = PSYDUCK
0037 = GOLDUCK
0038 = MANKEY
0039 = PRIMEAPE
003A = GROWLITHE
003B = ARCANINE
003C = POLIWAG
003D = POLIWHIRL
003E = POLIWRATH
003F = ABRA
0040 = KADABRA
0041 = ALAKAZAM
0042 = MACHOP
0043 = MACHOKE
0044 = MACHAMP
0045 = BELLSPROUT
0046 = WEEPINBELL
0047 = VICTREEBEL
0048 = TENTACOOL
0049 = TENTACRUEL
004A = GEODUDE
004B = GRAVELER
004C = GOLEM
004D = PONYTA
004E = RAPIDASH
004F = SLOWPOKE
0050 = SLOWBRO
0051 = MAGNEMITE
0052 = MAGNETON
0053 = FARFETCH'D
0054 = DODUO
0055 = DODRIO
0056 = SEEL
0057 = DEWGONG
0058 = GRIMER
0059 = MUK
005A = SHELLDER
005B = CLOYSTER
005C = GASTLY
005D = HAUNTER
005E = GENGAR
005F = ONIX
0060 = DROWZEE
0061 = HYPNO
0062 = KRABBY
0063 = KINGLER
0064 = VOLTORB
0065 = ELECTRODE
0066 = EXEGGCUTE
0067 = EXEGGUTOR
0068 = CUBONE
0069 = MAROWAK
006A = HITMONLEE
006B = HITMONCHAN
006C = LICKITUNG
006D = KOFFING
006E = WEEZING
006F = RHYHORN
0070 = RHYDON
0071 = CHANSEY
0072 = TANGELA
0073 = KANGASKHAN
0074 = HORSEA
0075 = SEADRA
0076 = GOLDEEN
0077 = SEAKING
0078 = STARYU
0079 = STARMIE
007A = MR.MIME
007B = SCYTHER
007C = JYNX
007D = ELECTABUZZ
007E = MAGMAR
007F = PINSIR
0080 = TAUROS
0081 = MAGIKARP
0082 = GYARADOS
0083 = LAPRAS
0084 = DITTO
0085 = EEVEE
0086 = VAPOREON
0087 = JOLTEON
0088 = FLAREON
0089 = PORYGON
008A = OMANYTE
008B = OMASTAR
008C = KABUTO
008D = KABUTOPS
008E = AERODACTYL
008F = SNORLAX
0090 = ARTICUNO
0091 = ZAPDOS
0092 = MOLTRES
0093 = DRATINI
0094 = DRAGONAIR
0095 = DRAGONITE
0096 = MEWTWO
0097 = MEW

0098 = CHIKORITA
0099 = BAYLEEF
009A = MEGANIUM
009B = CYNDAQUIL
009C = QUILAVA
009D = TYPHLOSION
009E = TOTODILE
009F = CROCONAW
00A0 = FERALIGATR
00A1 = SENTRET
00A2 = FURRET
00A3 = HOOTHOOT
00A4 = NOCTOWL
00A5 = LEDYBA
00A6 = LEDIAN
00A7 = SPINARAK
00A8 = ARIADOS
00A9 = CROBAT
00AA = CHINCHOU
00AB = LANTURN
00AC = PICHU
00AD = CLEFFA
00AE = IGGLYBUFF
00AF = TOGEPI
00B0 = TOGETIC
00B1 = NATU
00B2 = XATU
00B3 = MAREEP
00B4 = FLAAFFY
00B5 = AMPHAROS
00B6 = BELLOSSOM
00B7 = MARILL
00B8 = AZUMARILL
00B9 = SUDOWOODO
00BA = POLITOED
00BB = HOPPIP
00BC = SKIPLOOM
00BD = JUMPLUFF
00BE = AIPOM
00BF = SUNKERN
00C0 = SUNFLORA
00C1 = YANMA
00C2 = WOOPER
00C3 = QUAGSIRE
00C4 = ESPEON
00C5 = UMBREON
00C6 = MURKROW
00C7 = SLOWKING
00C8 = MISDREAVUS
00C9 = UNOWN
00CA = WOBBUFFET
00CB = GIRAFARIG
00CC = PINECO
00CD = FORRETRESS
00CE = DUNSPARCE
00CF = GLIGAR
00D0 = STEELIX
00D1 = SNUBBULL
00D2 = GRANBULL
00D3 = QWILFISH
00D4 = SCIZOR
00D5 = SHUCKLE
00D6 = HERACROSS
00D7 = SNEASEL
00D8 = TEDDIURSA
00D9 = URSARING
00DA = SLUGMA
00DB = MAGCARGO
00DC = SWINUB
00DD = PILOSWINE
00DE = CORSOLA
00DF = REMORAID
00E0 = OCTILLERY
00E1 = DELIBIRD
00E2 = MANTINE
00E3 = SKARMORY
00E4 = HOUNDOUR
00E5 = HOUNDOOM
00E6 = KINGDRA
00E7 = PHANPY
00E8 = DONPHAN
00E9 = PORYGON
00EA = STANTLER
00EB = SMEARGLE
00EC = TYROGUE
00ED = HITMONTOP
00EE = SMOOCHUM
00EF = ELEKID
00F0 = MAGBY
00F1 = MILTANK
00F2 = BLISSEY
00F3 = RAIKOU
00F4 = ENTEI
00F5 = SUICUNE
00F6 = LARVITAR
00F7 = PUPITAR
00F8 = TYRANITAR
00F9 = LUGIA
00FA = HO-OH
00FB = CELEBI

0115 = TREECKO
0116 = GROVYLE
0117 = SCEPTILE
0118 = TORCHIC
0119 = COMBUSKEN
011A = BLAZIKEN
011B = MUDKIP
011C = MARSHTOMP
011D = SWAMPERT
011E = POOCHYENA
011F = MIGHTYENA
0120 = ZIGZAGOON
0121 = LINOONE
0122 = WURMPLE
0123 = SILCOON
0124 = BEAUTIFLY
0125 = CASCOON
0126 = DUSTOX
0127 = LOTAD
0128 = LOMBRE
0129 = LUDICOLO
012A = SEEDOT
012B = NUZLEAF
012C = SHIFTRY
012D = NINCADA
012E = NINJASK
012F = SHEDINJA
0130 = TAILLOW
0131 = SWELLOW
0132 = SHROOMISH
0133 = BRELOOM
0134 = SPINDA
0135 = WINGULL
0136 = PELIPPER
0137 = SURSKIT
0138 = MASQUERAIN
0139 = WAILMER
013A = WAILORD
013B = SKITTY
013C = DELCATTY
013D = KECLEON
013E = BALTOY
013F = CLAYDOL
0140 = NOSEPASS
0141 = TORKOAL
0142 = SABLEYE
0143 = BARBOACH
0144 = WHISCASH
0145 = LUVDISC
0146 = CORPHISH
0147 = CRAWDAUNT
0148 = FEEBAS
0149 = MILOTIC
014A = CARVANHA
014B = SHARPEDO
014C = TRAPINCH
014D = VIBRAVA
014E = FLYGON
014F = MAKUHITA
0150 = HARIYAMA
0151 = ELECTRIKE
0152 = MANECTRIC
0153 = NUMEL
0154 = CAMERUPT
0155 = SPHEAL
0156 = SEALEO
0157 = WALREIN
0158 = CACNEA
0159 = CACTURNE
015A = SNORUNT
015B = GLALIE
015C = LUNATONE
015D = SOLROCK
015E = AZURILL
015F = SPOINK
0160 = GRUMPIG
0161 = PLUSLE
0162 = MINUN
0163 = MAWILE
0164 = MEDITITE
0165 = MEDICHAM
0166 = SWABLU
0167 = ALTARIA
0168 = WYNAUT
0169 = DUSKULL
016A = DUSCLOPS
016B = ROSELIA
016C = SLAKOTH
016D = VIGOROTH
016E = SLAKING
016F = GULPIN
0170 = SWALOT
0171 = TROPIUS
0172 = WHISMUR
0173 = LOUDRED
0174 = EXPLOUD
0175 = CLAMPERL
0176 = HUNTAIL
0177 = GOREBYSS
0178 = ABSOL
0179 = SHUPPET
017A = BANETTE
017B = SEVIPER
017C = ZANGOOSE
017D = RELICANTH
017E = ARON
017F = LAIRON
0180 = AGGRON
0181 = CASTFORM
0182 = VOLBEAT
0183 = ILLUMISE
0184 = LILEEP
0185 = CRADILY
0186 = ANORITH
0187 = ARMALDO
0188 = RALTS
0189 = KIRLIA
018A = GARDEVOIR
018B = BAGON
018C = SHELGON
018D = SALAMENCE
018E = BELDUM
018F = METANG
0190 = METAGROSS
0191 = REGIROCK
0192 = REGICE
0193 = REGISTEEL
0194 = KYOGRE
0195 = GROUDON
0196 = RAYQUAZA
0197 = LATIAS
0198 = LATIOS
0199 = JIRACHI
019A = DEOXYS
019B = CHIMECHO


FireRed & Emerald Attack ID Numbers
Spoiler:
001 Pound
002 Karate Chop
003 DoubleSlap
004 Comet Punch
005 Mega Punch
006 Pay Day
007 Fire Punch
008 Ice Punch
009 ThunderPunch
00A Scratch
00B ViceGrip
00C Guillotine
00D Razor Wind
00E Swords Dance
00F Cut
010 Gust
011 Wing Attack
012 Whirlwind
013 Fly
014 Bind
015 Slam
016 Vine Whip
017 Stomp
018 Double Kick
019 Mega Kick
01A Jump Kick
01B Rolling Kick
01C Sand-Attack
01D Headbutt
01E Horn Attack
01F Fury Attack
020 Horn Drill
021 Tackle
022 Body Slam
023 Wrap
024 Take Down
025 Thrash
026 Double-Edge
027 Tail Whip
028 Poison Sting
029 Twineedle
02A Pin Missile
02B Leer
02C Bite
02D Growl
02E Roar
02F Sing
030 Supersonic
031 SonicBoom
032 Disable
033 Acid
034 Ember
035 Flamethrower
036 Mist
037 Water Gun
038 Hydro Pump
039 Surf
03A Ice Beam
03B Blizzard
03C Psybeam
03D BubbleBeam
03E Aurora Beam
03F Hyper Beam
040 Peck
041 Drill Peck
042 Submission
043 Low Kick
044 Counter
045 Seismic Toss
046 Strength
047 Absorb
048 Mega Drain
049 Leech Seed
04A Growth
04B Razor Leaf
04C SolarBeam
04D PoisonPowder
04E Stun Spore
04F Sleep Powder
050 Petal Dance
051 String Shot
052 Dragon Rage
053 Fire Spin
054 ThunderShock
055 Thunderbolt
056 Thunder Wave
057 Thunder
058 Rock Throw
059 Earthquake
05A Fissure
05B Dig
05C Toxic
05D Confusion
05E Psychic
05F Hypnosis
060 Meditate
061 Agility
062 Quick Attack
063 Rage
064 Teleport
065 Night Shade
066 Mimic
067 Screech
068 Double Team
069 Recover
06A Harden
06B Minimize
06C SmokeScreen
06D Confuse Ray
06E Withdraw
06F Defense Curl
070 Barrier
071 Light Screen
072 Haze
073 Reflect
074 Focus Energy
075 Bide
076 Metronome
077 Mirror Move
078 Selfdestruct
079 Egg Bomb
07A Lick
07B Smog
07C Sludge
07D Bone Club
07E Fire Blast
07F Waterfall
080 Clamp
081 Swift
082 Skull Bash
083 Spike Cannon
084 Constrict
085 Amnesia
086 Kinesis
087 Softboiled
088 Hi Jump Kick
089 Glare
08A Dream Eater
08B Poison Gas
08C Barrage
08D Leech Life
08E Lovely Kiss
08F Sky Attack
090 Transform
091 Bubble
092 Dizzy Punch
093 Spore
094 Flash
095 Psywave
096 Splash
097 Acid Armor
098 Crabhammer
099 Explosion
09A Fury Swipes
09B Bonemerang
09C Rest
09D Rock Slide
09E Hyper Fang
09F Sharpen
0A0 Conversion
0A1 Tri Attack
0A2 Super Fang
0A3 Slash
0A4 Substitute
0A5 Struggle
0A6 Sketch
0A7 Triple Kick
0A8 Thief
0A9 Spider Web
0AA Mind Reader
0AB Nightmare
0AC Flame Wheel
0AD Snore
0AE Curse
0AF Flail
0B0 Conversion 2
0B1 Aeroblast
0B2 Cotton Spore
0B3 Reversal
0B4 Spite
0B5 Powder Snow
0B6 Protect
0B7 Mach Punch
0B8 Scary Face
0B9 Faint Attack
0BA Sweet Kiss
0BB Belly Drum
0BC Sludge Bomb
0BD Mud-Slap
0BE Octazooka
0BF Spikes
0C0 Zap Cannon
0C1 Foresight
0C2 Destiny Bond
0C3 Perish Song
0C4 Icy Wind
0C5 Detect
0C6 Bone Rush
0C7 Lock-On
0C8 Outrage
0C9 Sandstorm
0CA Giga Drain
0CB Endure
0CC Charm
0CD Rollout
0CE False Swipe
0CF Swagger
0D0 Milk Drink
0D1 Spark
0D2 Fury Cutter
0D3 Steel Wing
0D4 Mean Look
0D5 Attract
0D6 Sleep Talk
0D7 Heal Bell
0D8 Return
0D9 Present
0DA Frustration
0DB Safeguard
0DC Pain Split
0DD Sacred Fire
0DE Magnitude
0DF DynamicPunch
0E0 Megahorn
0E1 DragonBreath
0E2 Baton Pass
0E3 Encore
0E4 Pursuit
0E5 Rapid Spin
0E6 Sweet Scent
0E7 Iron Tail
0E8 Metal Claw
0E9 Vital Throw
0EA Morning Sun
0EB Synthesis
0EC Moonlight
0ED Hidden Power
0EE Cross Chop
0EF Twister
0F0 Rain Dance
0F1 Sunny Day
0F2 Crunch
0F3 Mirror Coat
0F4 Psych Up
0F5 ExtremeSpeed
0F6 AncientPower
0F7 Shadow Ball
0F8 Future Sight
0F9 Rock Smash
0FA Whirlpool
0FB Beat Up
0FC Fake Out
0FD Uproar
0FE Stockpile
0FF Spit Up
100 Swallow
101 Heat Wave
102 Hail
103 Torment
104 Flatter
105 Will-O-Wisp
106 Memento
107 Facade
108 Focus Punch
109 SmellingSalt
10A Follow Me
10B Nature Power
10C Charge
10D Taunt
10E Helping Hand
10F Trick
110 Role Play
111 Wish
112 Assist
113 Ingrain
114 Superpower
115 Magic Coat
116 Recycle
117 Revenge
118 Brick Break
119 Yawn
11A Knock Off
11B Endeavor
11C Eruption
11D Skill Swap
11E Imprison
11F Refresh
120 Grudge
121 Snatch
122 Secret Power
123 Dive
124 Arm Thrust
125 Camouflage
126 Tail Glow
127 Luster Purge
128 Mist Ball
129 FeatherDance
12A Teeter Dance
12B Blaze Kick
12C Mud Sport
12D Ice Ball
12E Needle Arm
12F Slack Off
130 Hyper Voice
131 Poison Fang
132 Crush Claw
133 Blast Burn
134 Hydro Cannon
135 Meteor Mash
136 Astonish
137 Weather Ball
138 Aromatherapy
139 Fake Tears
13A Air Cutter
13B Overheat
13C Odor Sleuth
13D Rock Tomb
13E Silver Wind
13F Metal Sound
140 GrassWhistle
141 Tickle
142 Cosmic Power
143 Water Spout
144 Signal Beam
145 Shadow Punch
146 Extrasensory
147 Sky Uppercut
148 Sand Tomb
149 Sheer Cold
14A Muddy Water
14B Bullet Seed
14C Aerial Ace
14D Icicle Spear
14E Iron Defense
14F Block
150 Howl
151 Dragon Claw
152 Frenzy Plant
153 Bulk Up
154 Bounce
155 Mud Shot
156 Poison Tail
157 Covet
158 Volt Tackle
159 Magical Leaf
15A Water Sport
15B Calm Mind
15C Leaf Blade
15D Dragon Dance
15E Rock Blast
15F Shock Wave
160 Water Pulse
161 Doom Desire


FireRed Multichoice ID Numbers
Spoiler:
[00] - Yes
No
[01] - Eevee
Flareon
Jolteon
Vaporeon
Quit looking.
[02] - Normal
Black
Pink
Sepia
[03] - Hall of Fame
Quit
[04] - Eggs
Quit
[05] - Victories
Quit
[06] - Hall of Fame
Eggs
Quit
[07] - Hall of Fame
Victories
Quit
[08] - Eggs
Victories
Quit
[09] - Hall of Fame
Eggs
Victories
Quit
[0A] - Exit
[0B] - Exit
[0C] - Exit
[0D] - Bicycle $1,000,000
No Thanks
[0E] - Abra 180 coins
Clefairy 500 coins
Dratini 2,800 coins
Scyther 5,500 coins
Porygon 9,999 coins
No Thanks
[0F] - SLP
PSN
PAR
BRN
FRZ
EXIT
[10] - Yes
No
Info
[11] - Single battle
Double battle
Multi battle
Info
Exit
[12] - Yes
No
Info
[13] - Make a Challenge
Info
Exit
[14] - Rooftop
B1F
Exit
[15] - Helix Fossil
Exit
[16] - Dome Fossil
Exit
[17] - Old Amber
Exit
[18] - Helix Fossil
Old Amber
Exit
[19] - Dome Fossil
Old Amber
Exit
[1A] - Fresh Water $200
Soda Pop $300
Lemonade $350
Exit
[1B] - 50 coins $1,000
500 coins $10,000
Exit
[1C] - Excellent
Not So Bad
[1D] - Right
Left
[1E] - TM13 4,000 coins
TM23 3,500 coins
TM24 4,000 coins
TM30 4,500 coins
TM35 4,000 coins
No Thanks
[1F] - 5F
4F
3F
2F
1F
Exit
[20] - Fresh Water
Exit
[21] - Soda Pop
Exit
[22] - Fresh Water
Soda Pop
Exit
[23] - Lemonade
Exit
[24] - Fresh Water
Lemonade
Exit
[25] - Soda Pop
Lemonade
Exit
[26] - Fresh Water
Soda Pop
Lemonade
Exit
[27] - Trade Center
Colosseum
Exit
[28] - Game Link Cable
Wireless
Exit
[29] - Smoke Ball 800 coins
Miracle Seed 1,000 coins
Charcoal 1,000 coins
Mystic water 1,000 coins
Yellow flute 1,600 coins
No Thanks
[2A] - B1F
B2F
B4F
Exit
[2B] - Linked game play
Direct Corner
Union Room
Quit
[2C] - Two Island
Three Island
Exit
[2D] - One Island
Three Island
Exit
[2E] - One Island
Two Island
Exit
[2F] - Trade Center
Colosseum
Berry Crush
Exit
[30] - Nada
Nada
Exit
[31] - Pokemon Jump
Dodrio Berry-Picking
Exit
[32] - Trade Center
Colosseum
Exit
[33] - 2 Tinymushrooms
1 Big Mushroom
[34] - Trade Center
Colosseum
Berry Crush
Exit
[35] - Trade Center
Colosseum
Exit
[36] - Sevii Islands
Navel Rock
Exit
[37] - Sevii Islands
Birth Island
Exit
[38] - Sevii Islands
Navel Rock
Birth Island
Exit
[39] - One Island
Two Island
Three Island
Exit
[3A] - Vermilion
Two Island
Three Island
Exit
[3B] - Vermilion
One Island
Three Island
Exit
[3C] - Vermilion
One Island
Two Island
Exit
[3D] - Vermilion
Exit
[3E] - Blank
Blank
Exit
[3F] - Join Group
Become Leader
Exit
[40] - Single
Double
Knockout
Mixed
Exit


__________________
x
Luna <3
Reply With Quote
  #5    
Old July 15th, 2017 (4:48 AM). Edited 3 Weeks Ago by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Additional Text Info

As I mentioned before, the "=" before your desired script's text lets the program know you want the text that follows it to be displayed. Of course, there's a limit to how long the text can be - to ensure you're never wrong, use the Text Adjuster.

The \n allows the text to go to a new line when it gets too long.
After the initial use of \n, \l is used for each new line after that. As an example:
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @greeting 0x6
release
end

#org @greeting
= Hi! My name is Adam.\nWhat's your name? [.]\l[.][player]?
The [.] adds a little suspension point "..." in the actual text.
[player] will show up as the player's name in-game. Similarly, [rival] displays the rival's name.
That text string, first with \n and then \l to break up the lines, will look like this:
Quote:
Originally Posted by Avara View Post
Hi!
My name is Adam.
What's your name? ...
... [player's name]?
-----------------------------------------------------------------------------------------------------------------------------------------------------
We can display more than just the player or rival's name similarly, using buffer commands. These let you show the name of a Pokémon, item, attack or number.

Now that we've got that handy list of hex IDs, we can move onto our first set of commands that use them. Let's start with the easiest; bufferfirstpokemon, set up like this:
Quote:
Originally Posted by Avara View Post
bufferfirstpokemon 0x[buffer number]
The [buffer number] part is where you choose the buffer number to assign the first Pokémon in your party's name to - for [buffer1] set this to 0x0, for [buffer2] set this to 0x1, etc. The [buffer1] part is what you'll be using in your text to display the PC's first Pokémon's name like so:
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
lock
faceplayer
bufferfirstpokemon 0x0
msgbox @npctext 0x6
release
end

#org @npctext
= Wow, your [buffer1] is so cool!
The bufferfirstpokemon part has to come before your msgbox that uses it, otherwise the game won't know which name to display in your text and you'll get a nasty glitch. It's the same for all buffer commands, including the next one, bufferpokemon:
Quote:
Originally Posted by Avara View Post
bufferpokemon 0x[buffer number] 0x[Pokemon ID]
Like before, you need to assign the Pokémon's name to a buffer number. Using that list of hex IDs from earlier, you can then choose a Pokémon's name to display. Let's pick Venusaur for example, or the Pokémon ID number 3. Here's an example combining bufferfirstpokemon and bufferpokemon, assigning them to buffer numbers 1 and 2 respectively.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
lock
faceplayer
bufferfirstpokemon 0x0
bufferpokemon 0x1 0x3
msgbox @npctext 0x6
release
end

#org @npctext
= Your [buffer1] is so cool, but\nmy [buffer2] is tougher!
In-game, this will show up as "Your [first party member] is so cool, but my Venusaur is tougher!" in FR, or EM "Your [first party member] is so cool, but my Sceptile is tougher!" (I assume).

The bufferitem and bufferattack commands are almost identical to bufferpokemon, set up like this:
Quote:
Originally Posted by Avara View Post
bufferitem 0x[buffer number] 0x[Item ID]
Quote:
Originally Posted by Avara View Post
bufferattack 0x[buffer number] 0x[Attack ID]
All you have to do is choose your buffer number as before, and an item ID. For the sake of the tutorial, let's use item ID #1 - a Master Ball in both FR and EM.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
bufferitem 0x0 0x1
msgbox @npctext 0x2
end

#org @npctext
= I wish I had a [buffer1].
... Or an attack ID. For the sake of the tutorial, let's use item ID #1 - Pound.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
bufferattack 0x0 0x1
msgbox @npctext 0x2
end

#org @npctext
= The only attack my Pokémon\nknows is [buffer1].
If you're using the "stdattacks.rbh" file as demonstrated below, you can substitute the attack ID for how it's defined there, so for the same attack, Pound (0x1) can simply be "ATK_POUND".
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000
#include stdattacks.rbh

#org @main
bufferattack 0x0 ATK_POUND
-----------------------------------------------------------------------------------------------------------------------------------------------------

The buffernumber command isn't as straightforward. It actually shows the numerical value of a variable. We'll go into more detail on variables later, but let's use 0x8000 and its value is 100 for example purposes.
Quote:
Originally Posted by Avara View Post
buffernumber 0x[buffer number] 0x[Variable containing desired number]
With buffernumber we choose the number of the buffer to display, and then the variable we want the value of to get our desired number. In this case, we've assumed var 8000 contains our desired number, 100.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
buffernumber 0x00 0x8000
msgbox @npctext 0x2
end

#org @npctext
= My Charizard grew to level [buffer1]!
-----------------------------------------------------------------------------------------------------------------------------------------------------

Adding color to your text is a nice way of differentiating characters and making item or place names stand out.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000
#org @main
lock
faceplayer
msgbox @npctext 0x6
release
end

//FireRed;

#org @npctext
= [blue_fr]What I wouldn't give for a cup\nof [green_fr]Coffee[blue_fr] from Clifftop Café[.]

//Emerald;
#org @npctext
= [blue_em]What I wouldn't give for a cup\nof [green_em]Coffee[blue_em] from Clifftop Café[.]
Fire Red Colors:
Spoiler:
White - [white_fr]
Black - [black_fr]
Gray - [grey_fr]
Red - [red_fr]
Orange - [orange_fr]
Green - [green_fr]
Light Green - [lightgreen_fr]
Blue - [blue_fr]
Light Blue - [lightblue_fr]
Light Blue 2 - [lightblue2_fr]
Cyan - [cyan_fr]
Light Blue 3 - [lightblue3_fr]
Navy Blue - [navyblue_fr]
Dark Navy Blue - [darknavyblue_fr]


Emerald Colors:
Spoiler:
White - [white_em]
Dark Gray - [darkgrey_em]
Gray - [grey_em]
Red - [red_em]
Orange - [orange_em]
Green - [green_em]
Light Green - [lightgreen_em]
Blue - [blue_em]
Light Blue - [lightblue_em]
White 4 - [white4_em]
Lime Green- [limegreen_em]
Aqua - [aqua_em]
Navy - [navy_em]


__________________
x
Luna <3
Reply With Quote
  #6    
Old July 15th, 2017 (4:50 AM). Edited October 13th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Conditional Text Scripts

Let's start the next section with something nice and simple, shall we? Throwback to our msgbox command. This time we'll be looking at msgbox 0x5, or in other words, making a script where the player can answer "Yes" or "No".


Spoiler:
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @yesno 0x5
compare 0x800D 0x1
if 0x1 goto @YesOrg
msgbox @no 0x6
release
end

#org @YesOrg
msgbox @yes 0x6
release
end

#org @yesno
= Yes or no?

#org @yes
= You said yes.

#org @no
= You said no.

The goto command is exactly as it sounds; it literally tells the script to go to another pointer.
compare 0x800D, or compare LASTRESULT gets the result of the player's choice - in msgbox 0x5's case, 0x0 for 0 "No" or 0x1 for 1 "Yes".
Notice that when the player chooses "Yes", it doesn't go straight to the msgbox command which displays the text. This needs to be contained in its own script section, hence why I named the pointer "@YesOrg" for convenience. If you accidentally send your "Yes" pointer to the pointer for the text string(@yes) instead of the script section it's contained in (@YesOrg), bugs will follow.
If the LASTRESULT, or 0x800D is not 0x1 for "Yes" it will not goto @YesOrg, it just continues the script, meaning it displays the text string for @no and closes.

goto works just as well - the example below will give you the exact same results as the script above.


Spoiler:
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @yesno 0x5
compare 0x800D 0x1
if 0x1 goto @YesOrg
goto @NoOrg

#org @NoOrg
msgbox @no 0x6
release
end

#org @YesOrg
msgbox @yes 0x6
release
end

#org @yesno
= Yes or no?

#org @yes
= You said yes.

#org @no
= You said no.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Let's go back to our basic NPC scripts for a moment. Every city needs filler NPCs, and they can get boring if they just say the same thing over and over again. In comes our next handy command, random. All it does is generate a random number within the range you set and then goes to the appropriate pointer, like this:

Quote:
Originally Posted by Avara View Post
random 0x[number of options you want]
compare 0x800D 0x0
if 0x1 goto @option1
[etc...]
Let's say you wanted a NPC to say three different things depending on the random number generated. You'd need a script like this:


Spoiler:
#dynamic 0x800000

#org @main
lock
faceplayer
random 0x03
compare 0x800D 0x0
if 0x1 goto @option1
compare 0x800D 0x1
if 0x1 goto @option2
compare 0x800D 0x2
if 0x1 goto @option3
end

#org @option1
msgbox @option1msg 0x6
release
end

#org @option2
msgbox @option2msg 0x6
release
end

#org @option3
msgbox @option3msg 0x6
release
end

#org @option1msg
= Message one text.

#org @option2msg
= Message two text.

#org @option3msg
= Message three text.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Now we've covered random, we can move onto multichoice. For those of you who don't know what a multichoice box is, here's an example.


The layout for the multichoice command is as follows:

Quote:
Originally Posted by Avara View Post
preparemsg @pointer
waitmsg
multichoice 0x[X Co-ordinate of Box] 0x[Y Co-ordinate of Box] 0x[Multichoice ID]* 0x1

*Refer to multichoice IDs provided.
preparemsg prepares a text string to display and waitmsg is self explanitory, it just makes sure the full text is displayed before opening the multichoice box.
The 0x1 at the end means the player can't press B to exit the multichoice box. If it's 0x0 it can be cancelled with B - 0x1 is just my personal preference as it forces the player to pick a choice. Here's an example script from the above screenshot of a FireRed ROM, with "Yes", "No" and "Info" as options:

Spoiler:
preparemsg @pointer
waitmsg
multichoice 0xE 0x0 0x10 0x1
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @yes
compare 0x8000 0x1
if 0x1 goto @no
compare 0x8000 0x2
if 0x1 goto @info
end

#org @yes
msgbox @yesmsg 0x6
release
end

#org @no
msgbox @nomsg 0x6
release
end

#org @info
msgbox @infomsg 0x6
release
end

The copyvar command here copies the result stored in LASTRESULT to var number 8000 so it can be compared to the result of the player's choice. More on vars later. Depending on the player's choice, you can make the script goto a different @pointer.

-----------------------------------------------------------------------------------------------------------------------------------------------------

Another minor conditional script example is one based on whether the player chose the male or female character - for this we could use the checkgender command:

Quote:
Originally Posted by Avara View Post
#org @start
lock
faceplayer
checkgender
compare LASTRESULT 0x0
if 0x1 goto @boy
goto @girl
If the value for the player's gender is 0, this means they are playing the male character and the script jumps to @boy, if not it goes to @girl. The value for the female character is 1, so vice-versa you can have this:

Quote:
Originally Posted by Avara View Post
#org @start
lock
faceplayer
checkgender
compare LASTRESULT 0x1
if 0x1 goto @girl
goto @boy
Ultimately, both of those examples do the same thing, so you can use either =)

__________________
x
Luna <3
Reply With Quote
  #7    
Old July 15th, 2017 (5:02 AM). Edited November 27th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Flags & Variables

Think of a flag as an on or off switch - it can be either 1 "ON" or 0 "OFF". Think of a variable as a better version of a flag - it can't just be 0x0 or 0x1 "on or off"- but holds any value between 0x0 and 0xFF, hence the name "variable". Both are crucial for creating your gameplay events, but we'll focus on flags for now:
Quote:
Originally Posted by Avara
setflag 0x[Flag Number]
Quote:
Originally Posted by Avara
clearflag 0x[Flag Number]


Here is a list of "special" flags for each game - these have different in-game functions when set, or "ON":

FireRed:
Spoiler:
0x820 – Activates First Badge
0x821 - Activates Second Badge
0x822 - Activates Third Badge
0x823 - Activates Fourth Badge
0x824 - Activates Fifth Badge
0x825 - Activates Sixth Badge
0x826 - Activates Seventh Badge
0x827 - Activates Eighth Badge
0x828 - Activates Pokémon Menu
0x829 - Activates Pokédex Menu
0x82F - Activates Running Shoes

Emerald:
Spoiler:
0x860 - Activates Pokémon Menu
0x861 - Activates Pokédex Menu
0x862 - Activates Pokénav Menu
0x867 - Activates First Badge
0x868 - Activates Second Badge
0x869 - Activates Third Badge
0x86A - Activates Fourth Badge
0x86B - Activates Fifth Badge
0x86C - Activates Sixth Badge
0x86D - Activates Seventh Badge
0x86E - Activates Eighth Badge
0x8C0 - Activates Running Shoes

-----------------------------------------------------------------------------------------------------------------------------------------------------
karatekid552 and DavidJCobb did an excellent job of referencing every flag and variable in the FireRed ROM and what they do. If you hack FR, this documentation will be invaluable to you. Emerald hackers will find this information on flags/vars useful.
-----------------------------------------------------------------------------------------------------------------------------------------------------

Let's move on to variables.
Quote:
Originally Posted by Avara
setvar 0x[Variable Number] 0x[Value To Set To]
As you could probably guess, the setvar command sets your chosen variable to your chosen value. If you want to add to a variable's existing value, we use addvar:
Quote:
Originally Posted by Avara
addvar 0x[Variable Number] 0x[Value To Add To Var]
Let's say I wanted to increase the value of 0x40D1 by 10 - I'd have addvar 0x40D1 0xA. Similarly, if I wanted to subtract from a variable's existing value, I'd use subvar, which is set up exactly the same:
Quote:
Originally Posted by Avara
subvar 0x[Variable Number] 0x[Value To Subtract From Var]
What if we want to copy the value of one variable into another?
Quote:
Originally Posted by Avara
copyvar 0x[Variable 1] 0x[Variable 2]
The above line just takes the value of Var #1 and stores it in Var #2.
Now that we know how to add to, subtract from and set a variable, how do we check it?
Quote:
Originally Posted by Avara
compare 0x[Variable Number] 0x[Value To Check For]
if 0x[More/Less/EqualTo] goto @pointer
__________________
x
Luna <3
Reply With Quote
  #8    
Old July 15th, 2017 (5:11 AM). Edited October 15th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Part #2: The Core
-----------------------------------------------------------------------------------------------------------------------------------------------------
Give, Take & Check For Items

Before you think about the multitude of free items you can give your players, you should always make sure they can actually take the item first!
Quote:
Originally Posted by Avara View Post
checkitemroom 0x[Item ID] 0x[Quantity]
compare LASTRESULT 0x0
if 0x1 goto @pointer
This neat little command checks if you have enough room in your bag for the amount of the desired item. If your bag is full, the last line sends you to @pointer.
Not using this command prior to giving items can cause the player to "lose" them if they've got no space in their bag to take it. Now, onto actually giving the items! There are two ways of doing it:
Quote:
Originally Posted by Avara View Post
giveitem 0x[Item ID] 0x[Quantity] 0x0
Nice and simple, and this way you even get a little message box automatically generated to notify the player that they've received the item. There is another way of giving the player an item "silently", meaning no pop-up notification.
Quote:
Originally Posted by Avara View Post
additem 0x[Item ID] 0x[Quantity]
This version is useful for if you want to add your own custom string, for example:
Quote:
Originally Posted by Avara View Post
additem 0x1 0x1
fanfare 0x101
msgbox @item 0x4
waitfanfare
closeonkeypress

#org @item
= [black_fr][player] received a [green_fr]Master\nBall[black_fr] from Atenza!
-----------------------------------------------------------------------------------------------------------------------------------------------------

Checking for items is easy with the checkitem command, set up like this:
Quote:
Originally Posted by Avara View Post
checkitem 0x[Item ID] 0x[Quantity]
Let's see an example and check if the player has one Master Ball.
Quote:
Originally Posted by Avara View Post
checkitem 0x1 0x1
compare LASTRESULT 0x1
if 0x4 goto @got
I used if 0x4 instead of 0x1 because this time, we're checking not that we have exactly one Master Ball - we're checking that we have more than one before we go to our pointer @Has.
Quote:
Originally Posted by Avara View Post
0x0 = Lower Than
0x1 = Equal To
0x2 = Greater Than
0x3 = Lower Than or Equal To
0x4 = Greater Than or Equal To
To remove an item from the player's bag, all we need is this:
Quote:
Originally Posted by Avara View Post
removeitem 0x[Item ID] 0x[Quantity]
Remember that if you're using the header file "#include stditems.rbh" you can substitute the item ID for its name beside the #define in any of these cases, e.g. if you want to take the player's Master Ball you could have:
Quote:
Originally Posted by Avara View Post
removeitem ITEM_MASTERBALL 0x1
-----------------------------------------------------------------------------------------------------------------------------------------------------

Adding an item to the player's PC is just as easy with a single line:
Quote:
Originally Posted by Avara View Post
addpcitem 0x[Item ID] 0x[Quantity]
Useful in cases where a player's bag might be full, but you want them to receive an item anyway.

__________________
x
Luna <3
Reply With Quote
  #9    
Old July 15th, 2017 (5:40 AM). Edited December 4th, 2017 by Avara.
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
Sounds, Fanfares & Music

Since we're hacking a Pokémon game, let's start with the cry command:
Quote:
Originally Posted by Avara
cry 0x[Pokémon's Hex ID] 0x[Cry Effect]
It plays the cry of any chosen Pokémon. Let's say we wanted to play Charizard's cry:
Quote:
Originally Posted by Avara
...
cry 0x6 0x0
msgbox @Roar 0x4
waitcry
closeonkeypress
release
end

#org @Roar
= Charizard: Roar!
We use waitcry to ensure that the cry has finished playing before continuing the script - in this case, the textbox won't go away until then. You don't have to use it, just keep in mind that if you choose not to, the script will continue as the cry sound plays. It's really up to you. One thing quite a few people seem not to be aware of is that there's actually a variety of different effects that you can use to change the sound of your desired cry - you don't have to use 0x0 after specifying the Pokémon, contrary to popular belief! I tested each cry effect in both FireRed and Emerald and have done my best to identify them, but seeing as I had no exact documentation to refer to I could definitely be inaccurate.
Quote:
Originally Posted by Avara
Cry Effects
0x0 - Normal cry
0x1 - Reversed cry
0x2 - Unsure (slightly louder normal cry?)
0x3 - Unsure (like 0x2, maybe used for Growl or similar attacks)
0x4 - Unsure (low cry in reverse?)
0x5 - Low cry (before fainting?)
-----------------------------------------------------------------------------------------------------------------------------------------------------

It's kind of hard to describe what a fanfare is - in not so many words it's a short tune, for example, the healing jingle in Pokémon Centers. To use one in your script, use these lines:
Quote:
Originally Posted by Avara
fanfare 0x[Fanfare's Hex ID]
waitfanfare
All you have to do is choose the ID number of the fanfare you want from this list and put it after the 0x. waitfanfare means the script will wait for the sound to finish playing before continuing.

-----------------------------------------------------------------------------------------------------------------------------------------------------

For sounds, the layout is almost identical to fanfares:
Quote:
Originally Posted by Avara
sound 0x[Sound's Hex ID]
That's literally it. If you want to make the script wait for the sound to finish before continuing, you can add waitsound if you want to.

-----------------------------------------------------------------------------------------------------------------------------------------------------

If you'd like to play music through your script, this is also nice and simple:
Quote:
Originally Posted by Avara
playsong 0x[Song's Hex ID] 0x0
Similarly to the others, use the ID of your desired music after playsong 0x, only you need that 0x0 at the end! There are a variety of ways to revert or change the music. Entering a battle after using the playsong command will also change the music back to default, so if you want to continue your music for the remainder of your script, you'll need another playsong straight after the battle.
Quote:
Originally Posted by Avara
playsong 0x[Song's Hex ID] 0x0
fadesong 0x[Song's Hex ID]
fadesong, as the name suggests, fades your song into another nicely so it doesn't just abruptly cut to the next music.
Quote:
Originally Posted by Avara View Post
playsong 0x[Song's Hex ID] 0x0
fadeout 0x[Fade Speed]
pause 0x1
fadein 0x[Fade Speed]
fadeout fades the song that was playing to silence. pause 0x1 does what it says on the tin, it's just a small pause which lasts for approximately half a second. fadein fades the song that was playing back in from silence.

__________________
x
Luna <3
Reply With Quote
  #10    
Old July 15th, 2017 (6:07 AM).
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
FireRed Songs & Fanfares
Spoiler:
0105 Healing (RS)
0106 Level Up
0107 Evolution Start
0108 Evolution/Safari
0109 Battle 1
010A Battle 2
010B Unknown/Not listed in Sappy
010C Fanfare 1
010D Fanfare 2
010E You Fail It!
010F You Fail It Again!
0110 Follow Me
0111 Game Corner
0112 Evil Lurks
0113 Gym
0114 Jigglypuff's Song
0115 Introduction
0116 Pokemon Theme
0117 Cinnabar Island
0118 Lavender Town
0119 Healing
011A Bicycle
011B Encounter 1
011C Encounter 2
011D Encounter 3
011E You're In The Hall of Fame!
011F Viridian Forest
0120 Mount Moon
0121 Abandoned Place
0122 End Credits
0123 Route Theme 1
0124 Route Theme 2/Intro
0125 Route Theme 3
0126 Route Theme 4
0127 Indigo Plateau
0128 Battle 3
0129 Battle 4
012A Battle 5
012B Battle 6
012C Pallet Town
012D Oak's Lab
012E Oak's Theme
012F Pokemon Center
0130 SS Anne
0131 Surf's Up
0132 Pokemon Tower
0133 Silph Co.
0134 Cerulean City
0135 Celadon City
0136 Victory 1
0137 Victory 2
0138 Victory 3
0139 Vermillion City
013A Viridian City and Pewter City
013B Gary's Theme
013C Gary's Theme (bis)
013D Fanfare 3
013E Fanfare 4
013F You caught a Pokemon!
0140 Trainer Card Photo
0141 Gamefreak
0142 Victory 2 (bis)
0143 Intro Message 1
0144 Intro Message 2
0145 Intro Message 3
0146 Game Corner (+1)
0147 Game Corner (+2)
0148 Net Corner
0149 Mystery Connection
014A Game Corner (+3)
014B Mount Ember
014C Follow Me (alt)
014D Water Labyrinth
014E Tanoby Ruins
014F Islands 1-3
0150 Islands 4-5
0151 Islands 6-7(AKA Violet City Theme from GSC)
0152 PokeFlute
0153 Battle - Deoxys
0154 Battle 5 (+1)
0155 Battle 5 (+2)
0156 Encounter 4
0157 Deoxys Encounter
0158 Trainer Tower
0159 Pallet Town (fame mix)
015A Teachy TV


FireRed Sound List ~ found by tajaros
Spoiler:
0x0 - Blank Noise (Stops BGM, not other S.E.)
0x1 - Use Item
0x2 - Log onto PC
0x3 - Turn off PC
0x4 - Turn on PC
0x5 - Click Noise
0x6 - Open Menu
0x7 - Wall Bump
0x8 - Door Open
0x9 - Exit Room
0xA - Jump
0xB - Bike Bell
0xC - Loud Crash (Like dropping of a heavy object)
0xD - Loud Crash (Higher pitch, and with echo)
0xE - Loud Crash (3 in rapid sucession, with long echo)
0xF - Low Pitch Pokeball Open
0x10 - Pokeball Close
0x11 - Flee S.E.
0x12 - PokeCenter Door Open
0x13 - Strange Noise (Like Water at the beginning, then like electricity)
0x14 - Low Pitch crash
0x15 - Super high pitch beep
0x16 - Error / False sound
0x17 - PokeCenter Pokeball Load up (Pokeballs being placed onto the heal machine.)
0x18 - PokeCasino Reel Stop
0x19 - Insert Coin into Machine
0x1A - Buzz (False/fail at Casino)
0x1B - EXP gauge
0x1C - Hop (Like on an Acro Bike)
0x1D - Lock / Break small rock?
0x1E - Unlock
0x1F - Strange Sound (Like a dor being locked, but different...)
0x20 - Strange Sound (A singular version of the previous sound)
0x21 - Crash sound (With echo)
0x22 - Singular Metal attack Sound (Like when using steel wing, but singular)
0x23 - Ice Break
0x24 - Ice Crack
0x25 - Falling
0x26 - Strange Sound (Super Low Pitch Ice Break?)
0x27 - Warp Away
0x28 - Warp Return
0x29 - Electricity?
0x2A - Turn Winch (Like in Winona's Gym)
0x2B - Truck Driving (Loop)
0x2C - Truck Stoping
0x2D - Truck Brake
0x2E - Truck Open
0x2F - Airplane Turbines
0x30 - Save
0x31 - Pokeball Bounce (Like in a trade)
0x32 - Pokeball Bounce (Quieter)
0x33 - Pokeball Bounce (Even Quieter)
0x34 - Pokeball Bounce (Even Quieter Still)
0x35 - Pokeball Open (Like in a trade)
0x36 - Throw Pokeball
0x37 - Musical Decoration Pad (Low C)
0x38 - Musical Decoration Pad (D)
0x39 - Musical Decoration Pad (E)
0x3A - Musical Decoration Pad (F#)
0x3B - Musical Decoration Pad (G)
0x3C - Musical Decoration Pad (A)
0x3D - Musical Decoration Pad (B)
0x3E - Musical Decoration Pad (High C)
0x3F - Mud Ball Smash
0x40 - Wodden Board
0x41 - Get Money
0x42 - P.A. (Like when an elevator is done, or end of Safari Zone)
0x43 - Water Baloon Pop (Low)
0x44 - Water Baloon Pop (Med)
0x45 - Water Baloon Pop (High)
0x46 - Wodden Smash
0x47 - Wooden Break
0x48 - Poison Afliction
0x49 - Conveyor Belt
0x4A - Conveyor Belt 2 (Loop)
0x4B - Conveyor Belt 2 (end)
0x4C - Loud Noise (Like a low conveyor belt 2) (Loop)
0x4D - Loud Noise (End)
0x4E - Light noise (Like a High conveyor belt 2) (Loop)
0x4F - Light Noise (End)
0x50 - Strange Noise (Like sonething being absorbed into a dark void. Sound goes from high to low)
0x51 - Strange Noise (Like an extension of hte previous sound. Sound goes from Low to Super Low)
0x52 - Buzz (Like a Circular Saw)
0x53 - Low Health Alert (Loop) (Can Not Be Turned Off Without Map Refresh)
0x54 - Level Up Ding
0x55 - Low Grumbling (Like a Diesel Engine) (Loop)
0x56 - Low Grumbling (End)
0x57 - Swipe Sound (Loop)
0x58 - Sell Item
0x59 - Low Ding (Like a really low "Low C" note)
0x5A - High Pitch Swipe
0x5B - High Pitch Swipe (Reverse)
0x5C - Smack
0x5D - Small Noise (Like a person kicking dirt)
0x5E - VS Seeker?
0x5F - Light Jingle
0x60 - Explosion
0x61 - Explosion (After Effect / Cont)
0x62 - STRONG Wind (Or Crowd Screaming? My PC to slow to tell...)
0x63 - Low Slamming sound (Like someone setting down a heavy box.)
0x64 - Red / Blue Orb
0x65 - Computer Chatter (One High Pitch Blip)
0x66 - Computer Chatter (2 Blips, pattern: MedHi-High)
0x67 - Computer Chatter (High Pitch PC on?)
0x68 - Computer Chatter (High Pitch PC off?)
0x69 - Computer Chatter (PC Scanning)
0x6A - Glass Breaking?
0x6B - Light Shuffle sound (Like feet sliding across the floor)
0x6C - High Pitch Quiet Blip
0x6D - Small Sound (Like a twig snaping)
0x6E - Strange Sound (Like low pitch Ice Shimmering, or Use of Flute)
0x6F - Loud Bang (Like a gun shot, but different)
0x70 - Lout Buzz
0x71 - Metal Sheen (Like on steel wing, but a little longer)
0x72 - Curse Attack
0x73 - Baton Pass Attack (Like a swipeing / falling sound)
0x74 - Low Crash
0x75 - Bubble Attack (Launch)
0x76 - Substitute attack?
0x77 - Watyer Gun Attack (Launch)
0x78 - Rain Dance Attack
0x79 - Slash Attack
0x7A - Gust Attack?
0x7B - Very Strange Sound (Like a downward Spiral?)
0x7C - Rock Smash Attack? (In Battle or not? I Can't tell)
0x7D - Powerful Wind (Loop)
0x7E - Powerful Wind (End)
0x7F - Pound Attack?
0x80 - Throwing Sound (Like Bait in the Safari Zone)
0x81 - Deep Slashing noise
0x82 - Ice Ball Attack
0x83 - Loud Swipe?
0x84 - Deep Bang (Like someone hit something hard with a big log...)
0x85 - Beam Attack Charge Sound. (Like Solar Beam's Charging sound)
0x86 - Deep Bang (Similar to 0x84)
0x87 - Bubbling Noise
0x88 - Throwing noise (Slightly Higher Pitch)
0x89 - VERY DEEP Throwing sound
0x8A - Deep Explosion like sound
0x8B - Deep Wave-like sound
0x8C - Strange Sound (A Smack Noise, tehn a Short Deep Explosion-ish sound)
0x8D - Deep Bubbling
0x8E - Deep Crash (Like a super deep opening pokeball)
0x8F - Deep Fire
0x90 - Deep Smack
0x91 - Low Whirling
0x92 - High Pitch Powerful Wind (Loop)
0x93 - High Pitch Powerful Wind (End)
0x94 - High Pitch Shuffling
0x95 - Loud Noise (No Explaination)
0x96 - Wing Flapping (Singular)
0x97 - Wing Flapping (Decending Octaves, High To Low)
0x98 - Kicking Sand?
0x99 - High Pitch Whips Sound
0x9A - Strange Sound (No Explaination)
0x9B - Whirling Upwards (Short....)
0x9C - Super Strong Wind Burst
0x9D - MEGA ULTRA Strong wind burst. (I think....)
0x9E - MEGA ULTRA Strong wind burst. (Pitch Goes up, then down, more like actual wind...)
0x9F - Small Noise (Like a twig breaking)
0xA0 - Splash Attack Flopping sound (Singular)
0xA1 - Sandpaper-ish?
0xA2 - Small Noise (No Explaination)
0xA3 - Stretching noise?
0xA4 - Speeding up fan? (Pitch raises, that is all)
0xA5 - Sing Attack
0xA6 - Perish Song Attack
0xA7 - Ice? (Souns like when a pokemon gets frozen...)
0xA8 - Noise (No Explaination)
0xA9 - Little Sound (No explaination...)
0xAA - Loud Sound (No Explaination)
0xAB - Explosion-ish Sound
0xAC - Recover Attack
0xAD - Absorb Smack (The sound before the absorbtion)
0xAE - Metal Sound?
0xAF - Aurora Beam (Small)
0xB0 - Aurora Beam (Main)
0xB1 - Confusion
0xB2 - Drum?
0xB3 - Amnesia "?" Appear
0xB4 - Egg Crack?
0xB5 - Amnesia (Deeper ? Sound)
0xB6 - Loud Hover Sound (Decending)
0xB7 - Loud Hover Sound (Acending)
0xB8 - Strange Sound (Sounds like a speed up, then an upward whirling noise)
0xB9 - Smack (With Echo)
0xBA - Wooshing noise
0xBB - Frustration "Angry" Symbols
0xBC - Small Metallic "Bling" sound
0xBD - Whispering noise
0xBE - Rest Attack
0xBF - Shattering Ice
0xC0 - Deep Watery noise
0xC1 - Strange Noise (No Explanation)
0xC2 - Solar Beam (Launch)
0xC3 - Sunny Day Attack
0xC4 - Strange Noise (Sounds like a small absorption, but not from any absorb attacks...)
0xC5 - Strange Noise (Previous sound, in reverse)
0xC6 - Small Noise (No Explanation)
0xC7 - Swift Attack (Singular - higher pitch)
0xC8 - Swift Attack (Singular - Longer)
0xC9 - Swift Attack (Singular - Lower Pitch)
0xCA - Odor Sleuth Attack
0xCB - Small Noise (Like a twig Snapping... again)
0xCC - Strange noise (Like... Ding, Dong... Ding, Dong....)
0xCD - Frustration "Angry" Symbols
0xCE - Noise (Descending Sound)
0xCF - Loud Crash (Very Deep)
__________________
x
Luna <3
Reply With Quote
  #11    
Old July 17th, 2017 (10:09 AM).
Avara's Avatar
Avara Avara is offline
Author Of Tales
  • Moderator
 
Join Date: Dec 2011
Location: Avlar
Gender: Female
Nature: Adamant
Posts: 662
How To Compile Your Script

To insert your script into your hack, or compile it, is nice and simple. First you want to open your ROM in AdvanceMap 1.92, and decide where you want your script to be run from:
  • A Person Event/NPC Green "P"
  • A Signpost/Red "S" tile
  • A Trigger/Green "S" tile
  • A Level Script/The Map Header

In this example, we're going to assign a script to a NPC. Assemble your script, then hit this button:



You should end up with a screen like this:



All you have to do is copy that offset beside @start, or your beginning pointer, and paste it in the person event's "Script Offset" Box, shown here:



For level scripts that are not triggered in the overworld, but from entering the map, you want to put your script here, outlined in red:



__________________
x
Luna <3
Reply With Quote
  #12    
Old July 17th, 2017 (10:52 AM).
ghoulslash's Avatar
ghoulslash ghoulslash is offline
     
    Join Date: Mar 2016
    Gender: Male
    Posts: 89
    This is certainly ambitious but definitely much needed! Let me know if you'd like any help with things

    I would suggest you cover preprocessing directives like #define and #include. Header files are really useful, especially when sharing scripts with other people in a project, or just your own sanity's sake so you don't have to try and remember the ID of an arbitrary pokemon or item every time you make a script.

    It might also be useful to go more in depth on some commands that aren't well documented such as spriteface, spritebehave, or if there are any differences between warp and warp1, for example.

    A level script tutorial would also be very helpful since most are somewhat older as well.

    I know this is a lot to dump on you at once, but it would make this tutorial the most complete I've seen yet!
    Reply With Quote
      #13    
    Old July 18th, 2017 (6:08 AM). Edited July 18th, 2017 by Avara.
    Avara's Avatar
    Avara Avara is offline
    Author Of Tales
    • Moderator
     
    Join Date: Dec 2011
    Location: Avlar
    Gender: Female
    Nature: Adamant
    Posts: 662
    Quote:
    Originally Posted by ghoulslash View Post
    This is certainly ambitious but definitely much needed! Let me know if you'd like any help with things

    I would suggest you cover preprocessing directives like #define and #include. Header files are really useful, especially when sharing scripts with other people in a project, or just your own sanity's sake so you don't have to try and remember the ID of an arbitrary pokemon or item every time you make a script.

    It might also be useful to go more in depth on some commands that aren't well documented such as spriteface, spritebehave, or if there are any differences between warp and warp1, for example.

    A level script tutorial would also be very helpful since most are somewhat older as well.

    I know this is a lot to dump on you at once, but it would make this tutorial the most complete I've seen yet!
    Thanks a lot! Yeah someone had suggested header files to me before, i'll definitely include some of those once I get around to making ones we don't already have! Less-documented commands and level scripting are going to be included too - my first aim is covering what we already have in other scripting tutorials like diego's and tajaros's, then when all that's done I'll move onto the extra stuff, just to make sure nothing is missed =)
    __________________
    x
    Luna <3
    Reply With Quote
      #14    
    Old July 18th, 2017 (10:14 AM). Edited November 26th, 2017 by Avara.
    Avara's Avatar
    Avara Avara is offline
    Author Of Tales
    • Moderator
     
    Join Date: Dec 2011
    Location: Avlar
    Gender: Female
    Nature: Adamant
    Posts: 662
    Giving Pokémon & Eggs

    Wondering how to give your player a Pokémon? In order to do this, we'll need to make use of two commands called givepokemon and countpokemon. Here's an example of how to use both, incorporating some things we've learned already:

    Spoiler:
    '---------------
    #dynamic 0x800000

    #org @start
    lock
    faceplayer
    checkflag 0x240
    if 0x1 goto @Done
    msgbox @question 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @Yes
    msgbox @saidnomsg 0x6
    release
    end

    #org @Yes
    countpokemon
    compare 0x800D 0x6
    if 0x1 goto @Full
    msgbox @take 0x6
    givepokemon 0x1 0x5 0x0 0x0 0x0 0x0
    fanfare 0x101
    msgbox @receive 0x4
    waitfanfare
    closeonkeypress
    msgbox @nick 0x5
    compare LASTRESULT 0x1
    if 0x1 call @YesToNick
    msgbox @Donemsg 0x6
    setflag 0x240
    release
    end

    #org @YesToNick
    setvar 0x8004 0x0
    call 0x81A74EB
    return

    #org @Full
    msgbox @Fullmsg 0x6
    release
    end

    #org @Done
    msgbox @Donemsg 0x6
    release
    end

    #org @question
    = Do you like grass-types?

    #org @saidnomsg
    = Too bad[.]

    #org @Fullmsg
    = Your party is full.

    #org @Donemsg
    = Bye!

    #org @take
    = You can have one of mine!

    #org @receive
    = [black_fr][player] received a Pokémon!

    #org @nick
    = [black_fr]Give it a nickname?


    This script is for a NPC who gives the player a Bulbasaur - if they answer "Yes" to the question and have room for it in their party. It only happens once, afterwards the NPC says something generic. Let's break it all down:
    Quote:
    Originally Posted by Avara
    '---------------
    #dynamic 0x800000

    #org @start
    lock
    faceplayer
    checkflag 0x240
    if 0x1 goto @Done
    First section checks if flag 0x240 is set, and if it is, go to the pointer @done.
    Quote:
    Originally Posted by Avara
    msgbox @question 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @Yes
    msgbox @saidnomsg 0x6
    release
    end
    Next section asks the player a question. If they answer "Yes", or the result is 1, the script goes to pointer @Yes. If they said "No", they just say a line of text and the script ends there. By the way, LASTRESULT can be substituted for 0x800D, which is a bit harder to remember!
    Quote:
    Originally Posted by Avara
    #org @Yes
    countpokemon
    compare 0x800D 0x6
    if 0x1 goto @Full
    This is the beginning of the @Yes pointer. countpokemon is fairly self explanitory, it counts how many party members you have.
    compare 0x800D 0x6 compares the result of countpokemon to 6, and if it is 6, the script goes to the pointer @Full.
    Quote:
    Originally Posted by Avara
    givepokemon 0x[Pokemon Hex ID] 0x[Level in Hex] 0x[Held Item ID] 0x0 0x0 0x0
    That is how the givepokemon command is set up - in our script, it's a level 5 Bulbasaur not holding any items, so we've got this:
    Quote:
    Originally Posted by Avara
    msgbox @take 0x6
    givepokemon 0x1 0x5 0x0 0x0 0x0 0x0
    Alternatively, if you're using "#include stdpoke.rbh" you could have this to make it easier on yourself:
    Quote:
    Originally Posted by Avara
    givepokemon PKMN_BULBASAUR 0x5 0x0 0x0 0x0 0x0
    The next part is music related which we'll cover in more detail later.
    Quote:
    Originally Posted by Avara
    fanfare 0x101
    msgbox @receive 0x4
    waitfanfare
    closeonkeypress
    All this section does is play the little level-up jingle and display a message notifying that the player's received a Pokémon.
    We've used msgbox 0x4 here, followed by waitfanfare then closeonkeypress, which prevents the message from being closed until the jingle has finished playing, similarly to how the pop-up message for finding items on the ground is.
    Quote:
    Originally Posted by Avara
    msgbox @nick 0x5
    compare LASTRESULT 0x1
    if 0x1 call @YesToNick
    msgbox @Donemsg 0x6
    release
    end
    Fairly straightforward repeat - this part asks the player if they want to give their new party member a nickname. The difference here is that instead of goto we've used call instead. call will jump to a pointer, and then back to the original script with return.
    Quote:
    Originally Posted by Avara
    #org @YesToNick
    setvar 0x8004 0x0
    call 0x81A74EB
    return
    In our nickname pointer that we've momentarily jumped to, we call 0x81A74EB - this will jump to the nicknaming screen in FireRed*.
    return takes us back to our original script when the nicknaming screen is exited.
    *If you're hacking Emerald, 0x2723DD for nicknaming instead of 0x81A74EB. Those are just pointers to already existing in-game scripts containing specials, which we'll cover much later!
    Quote:
    Originally Posted by Avara
    msgbox @Donemsg 0x6
    setflag 0x240
    release
    end
    setflag 0x240 goes at the end, to set the flag number 240 and stop you from receiving infinite Bulbasaurs =P To give an Egg instead of a Pokémon, all you have to do is remove the givepokemon line and replace it with the giveegg command:
    Quote:
    Originally Posted by Avara
    giveegg 0x[ID of Pokémon]
    So, to give a Bulbasaur egg, we'd have giveegg 0x1.
    __________________
    x
    Luna <3
    Reply With Quote
      #15    
    Old July 19th, 2017 (7:29 AM). Edited 3 Weeks Ago by Avara.
    Avara's Avatar
    Avara Avara is offline
    Author Of Tales
    • Moderator
     
    Join Date: Dec 2011
    Location: Avlar
    Gender: Female
    Nature: Adamant
    Posts: 662
    Header Files

    Open "stdpoke.rbh" (if you have it, it should come with XSE) and you'll see something like this:


    What does #define do? Let's look at Bulbasaur's entry - #define PKMN_BULBASAUR 0x1. This stops you needing to remember that Bulbasaur's ID is 0x1, you just have PKMN_BULBASAUR instead. To use a header file, all you have to do is add this line to the beginning of your script:
    Quote:
    Originally Posted by Avara
    #include [filename].rbh
    I'll refer back to an earlier example:
    Quote:
    Originally Posted by Avara
    #dynamic 0x800000

    #org @main
    ...
    wildbattle 0x149 0x32 0xD1
    ...
    This was to create a wild Pokémon battle with a level 50 Milotic holding Mystic Water. If you make use of "stdpoke.rbh" and "stditems.rbh", you could have this instead:
    Quote:
    Originally Posted by Avara
    #include stdpoke.rbh
    #include stditems.rbh

    #dynamic 0x800000

    #org @main
    ...
    wildbattle PKMN_MILOTIC 0x32 ITEM_MYSTICWATER
    ...
    For the majority of the tutorial I use the hex IDs so that you know where everything's supposed to be placed, but if you use header files like these, it will keep you from having to constantly refer to the hex ID lists. It really is a matter of personal preference!

    Mainly hosting these here for safekeeping instead of attaching as files ~

    Pokémon Header File
    Spoiler:
    #define PKMN_MISSINGNO 0x0
    #define PKMN_BULBASAUR 0x1
    #define PKMN_IVYSAUR 0x2
    #define PKMN_VENUSAUR 0x3
    #define PKMN_CHARMANDER 0x4
    #define PKMN_CHARMELEON 0x5
    #define PKMN_CHARIZARD 0x6
    #define PKMN_SQUIRTLE 0x7
    #define PKMN_WARTORTLE 0x8
    #define PKMN_BLASTOISE 0x9
    #define PKMN_CATERPIE 0xA
    #define PKMN_METAPOD 0xB
    #define PKMN_BUTTERFREE 0xC
    #define PKMN_WEEDLE 0xD
    #define PKMN_KAKUNA 0xE
    #define PKMN_BEEDRILL 0xF
    #define PKMN_PIDGEY 0x10
    #define PKMN_PIDGEOTTO 0x11
    #define PKMN_PIDGEOT 0x12
    #define PKMN_RATTATA 0x13
    #define PKMN_RATICATE 0x14
    #define PKMN_SPEAROW 0x15
    #define PKMN_FEAROW 0x16
    #define PKMN_EKANS 0x17
    #define PKMN_ARBOK 0x18
    #define PKMN_PIKACHU 0x19
    #define PKMN_RAICHU 0x1A
    #define PKMN_SANDSHREW 0x1B
    #define PKMN_SANDSLASH 0x1C
    #define PKMN_NIDORANF 0x1D
    #define PKMN_NIDORINA 0x1E
    #define PKMN_NIDOQUEEN 0x1F
    #define PKMN_NIDORANM 0x20
    #define PKMN_NIDORINO 0x21
    #define PKMN_NIDOKING 0x22
    #define PKMN_CLEFAIRY 0x23
    #define PKMN_CLEFABLE 0x24
    #define PKMN_VULPIX 0x25
    #define PKMN_NINETALES 0x26
    #define PKMN_JIGGLYPUFF 0x27
    #define PKMN_WIGGLYTUFF 0x28
    #define PKMN_ZUBAT 0x29
    #define PKMN_GOLBAT 0x2A
    #define PKMN_ODDISH 0x2B
    #define PKMN_GLOOM 0x2C
    #define PKMN_VILEPLUME 0x2D
    #define PKMN_PARAS 0x2E
    #define PKMN_PARASECT 0x2F
    #define PKMN_VENONAT 0x30
    #define PKMN_VENOMOTH 0x31
    #define PKMN_DIGLETT 0x32
    #define PKMN_DUGTRIO 0x33
    #define PKMN_MEOWTH 0x34
    #define PKMN_PERSIAN 0x35
    #define PKMN_PSYDUCK 0x36
    #define PKMN_GOLDUCK 0x37
    #define PKMN_MANKEY 0x38
    #define PKMN_PRIMEAPE 0x39
    #define PKMN_GROWLITHE 0x3A
    #define PKMN_ARCANINE 0x3B
    #define PKMN_POLIWAG 0x3C
    #define PKMN_POLIWHIRL 0x3D
    #define PKMN_POLIWRATH 0x3E
    #define PKMN_ABRA 0x3F
    #define PKMN_KADABRA 0x40
    #define PKMN_ALAKAZAM 0x41
    #define PKMN_MACHOP 0x42
    #define PKMN_MACHOKE 0x43
    #define PKMN_MACHAMP 0x44
    #define PKMN_BELLSPROUT 0x45
    #define PKMN_WEEPINBELL 0x46
    #define PKMN_VICTREEBEL 0x47
    #define PKMN_TENTACOOL 0x48
    #define PKMN_TENTACRUEL 0x49
    #define PKMN_GEODUDE 0x4A
    #define PKMN_GRAVELER 0x4B
    #define PKMN_GOLEM 0x4C
    #define PKMN_PONYTA 0x4D
    #define PKMN_RAPIDASH 0x4E
    #define PKMN_SLOWPOKE 0x4F
    #define PKMN_SLOWBRO 0x50
    #define PKMN_MAGNEMITE 0x51
    #define PKMN_MAGNETON 0x52
    #define PKMN_FARFETCHED 0x53
    #define PKMN_DODUO 0x54
    #define PKMN_DODRIO 0x55
    #define PKMN_SEEL 0x56
    #define PKMN_DEWGONG 0x57
    #define PKMN_GRIMER 0x58
    #define PKMN_MUK 0x59
    #define PKMN_SHELLDER 0x5A
    #define PKMN_CLOYSTER 0x5B
    #define PKMN_GASTLY 0x5C
    #define PKMN_HAUNTER 0x5D
    #define PKMN_GENGAR 0x5E
    #define PKMN_ONIX 0x5F
    #define PKMN_DROWZEE 0x60
    #define PKMN_HYPNO 0x61
    #define PKMN_KRABBY 0x62
    #define PKMN_KINGLER 0x63
    #define PKMN_VOLTORB 0x64
    #define PKMN_ELECTRODE 0x65
    #define PKMN_EXEGGCUTE 0x66
    #define PKMN_EXEGGUTOR 0x67
    #define PKMN_CUBONE 0x68
    #define PKMN_MAROWAK 0x69
    #define PKMN_HITMONLEE 0x6A
    #define PKMN_HITMONCHAN 0x6B
    #define PKMN_LICKITUNG 0x6C
    #define PKMN_KOFFING 0x6D
    #define PKMN_WEEZING 0x6E
    #define PKMN_RHYHORN 0x6F
    #define PKMN_RHYDON 0x70
    #define PKMN_CHANSEY 0x71
    #define PKMN_TANGELA 0x72
    #define PKMN_KANGASKHAN 0x73
    #define PKMN_HORSEA 0x74
    #define PKMN_SEADRA 0x75
    #define PKMN_GOLDEEN 0x76
    #define PKMN_SEAKING 0x77
    #define PKMN_STARYU 0x78
    #define PKMN_STARMIE 0x79
    #define PKMN_MRMIME 0x7A
    #define PKMN_SCYTHER 0x7B
    #define PKMN_JYNX 0x7C
    #define PKMN_ELECTABUZZ 0x7D
    #define PKMN_MAGMAR 0x7E
    #define PKMN_PINSIR 0x7F
    #define PKMN_TAUROS 0x80
    #define PKMN_MAGIKARP 0x81
    #define PKMN_GYARADOS 0x82
    #define PKMN_LAPRAS 0x83
    #define PKMN_DITTO 0x84
    #define PKMN_EEVEE 0x85
    #define PKMN_VAPOREON 0x86
    #define PKMN_JOLTEON 0x87
    #define PKMN_FLAREON 0x88
    #define PKMN_PORYGON 0x89
    #define PKMN_OMANYTE 0x8A
    #define PKMN_OMASTAR 0x8B
    #define PKMN_KABUTO 0x8C
    #define PKMN_KABUTOPS 0x8D
    #define PKMN_AERODACTYL 0x8E
    #define PKMN_SNORLAX 0x8F
    #define PKMN_ARTICUNO 0x90
    #define PKMN_ZAPDOS 0x91
    #define PKMN_MOLTRES 0x92
    #define PKMN_DRATINI 0x93
    #define PKMN_DRAGONAIR 0x94
    #define PKMN_DRAGONITE 0x95
    #define PKMN_MEWTWO 0x96
    #define PKMN_MEW 0x97
    #define PKMN_CHIKORITA 0x98
    #define PKMN_BAYLEEF 0x99
    #define PKMN_MEGANIUM 0x9A
    #define PKMN_CYNDAQUIL 0x9B
    #define PKMN_QUILAVA 0x9C
    #define PKMN_TYPHLOSION 0x9D
    #define PKMN_TOTODILE 0x9E
    #define PKMN_CROCONAW 0x9F
    #define PKMN_FERALIGATR 0xA0
    #define PKMN_SENTRET 0xA1
    #define PKMN_FURRET 0xA2
    #define PKMN_HOOTHOOT 0xA3
    #define PKMN_NOCTOWL 0xA4
    #define PKMN_LEDYBA 0xA5
    #define PKMN_LEDIAN 0xA6
    #define PKMN_SPINARAK 0xA7
    #define PKMN_ARIADOS 0xA8
    #define PKMN_CROBAT 0xA9
    #define PKMN_CHINCHOU 0xAA
    #define PKMN_LANTURN 0xAB
    #define PKMN_PICHU 0xAC
    #define PKMN_CLEFFA 0xAD
    #define PKMN_IGGLYBUFF 0xAE
    #define PKMN_TOGEPI 0xAF
    #define PKMN_TOGETIC 0xB0
    #define PKMN_NATU 0xB1
    #define PKMN_XATU 0xB2
    #define PKMN_MAREEP 0xB3
    #define PKMN_FLAAFFY 0xB4
    #define PKMN_AMPHAROS 0xB5
    #define PKMN_BELLOSSOM 0xB6
    #define PKMN_MARILL 0xB7
    #define PKMN_AZUMARILL 0xB8
    #define PKMN_SUDOWOODO 0xB9
    #define PKMN_POLITOED 0xBA
    #define PKMN_HOPPIP 0xBB
    #define PKMN_SKIPLOOM 0xBC
    #define PKMN_JUMPLUFF 0xBD
    #define PKMN_AIPOM 0xBE
    #define PKMN_SUNKERN 0xBF
    #define PKMN_SUNFLORA 0xC0
    #define PKMN_YANMA 0xC1
    #define PKMN_WOOPER 0xC2
    #define PKMN_QUAGSIRE 0xC3
    #define PKMN_ESPEON 0xC4
    #define PKMN_UMBREON 0xC5
    #define PKMN_MURKROW 0xC6
    #define PKMN_SLOWKING 0xC7
    #define PKMN_MISDREAVUS 0xC8
    #define PKMN_UNOWN 0xC9
    #define PKMN_WOBBUFFET 0xCA
    #define PKMN_GIRAFARIG 0xCB
    #define PKMN_PINECO 0xCC
    #define PKMN_FORRETRESS 0xCD
    #define PKMN_DUNSPARCE 0xCE
    #define PKMN_GLIGAR 0xCF
    #define PKMN_STEELIX 0xD0
    #define PKMN_SNUBBULL 0xD1
    #define PKMN_GRANBULL 0xD2
    #define PKMN_QWILFISH 0xD3
    #define PKMN_SCIZOR 0xD4
    #define PKMN_SHUCKLE 0xD5
    #define PKMN_HERACROSS 0xD6
    #define PKMN_SNEASEL 0xD7
    #define PKMN_TEDDIURSA 0xD8
    #define PKMN_URSARING 0xD9
    #define PKMN_SLUGMA 0xDA
    #define PKMN_MAGCARGO 0xDB
    #define PKMN_SWINUB 0xDC
    #define PKMN_PILOSWINE 0xDD
    #define PKMN_CORSOLA 0xDE
    #define PKMN_REMORAID 0xDF
    #define PKMN_OCTILLERY 0xE0
    #define PKMN_DELIBIRD 0xE1
    #define PKMN_MANTINE 0xE2
    #define PKMN_SKARMORY 0xE3
    #define PKMN_HOUNDOUR 0xE4
    #define PKMN_HOUNDOOM 0xE5
    #define PKMN_KINGDRA 0xE6
    #define PKMN_PHANPY 0xE7
    #define PKMN_DONPHAN 0xE8
    #define PKMN_PORYGON2 0xE9
    #define PKMN_STANTLER 0xEA
    #define PKMN_SMEARGLE 0xEB
    #define PKMN_TYROGUE 0xEC
    #define PKMN_HITMONTOP 0xED
    #define PKMN_SMOOCHUM 0xEE
    #define PKMN_ELEKID 0xEF
    #define PKMN_MAGBY 0xF0
    #define PKMN_MILTANK 0xF1
    #define PKMN_BLISSEY 0xF2
    #define PKMN_RAIKOU 0xF3
    #define PKMN_ENTEI 0xF4
    #define PKMN_SUICUNE 0xF5
    #define PKMN_LARVITAR 0xF6
    #define PKMN_PUPITAR 0xF7
    #define PKMN_TYRANITAR 0xF8
    #define PKMN_LUGIA 0xF9
    #define PKMN_HOOH 0xFA
    #define PKMN_CELEBI 0xFB

























    #define PKMN_TREECKO 0x115
    #define PKMN_GROVYLE 0x116
    #define PKMN_SCEPTILE 0x117
    #define PKMN_TORCHIC 0x118
    #define PKMN_COMBUSKEN 0x119
    #define PKMN_BLAZIKEN 0x11A
    #define PKMN_MUDKIP 0x11B
    #define PKMN_MARSHTOMP 0x11C
    #define PKMN_SWAMPERT 0x11D
    #define PKMN_POOCHYENA 0x11E
    #define PKMN_MIGHTYENA 0x11F
    #define PKMN_ZIGZAGOON 0x120
    #define PKMN_LINOONE 0x121
    #define PKMN_WURMPLE 0x122
    #define PKMN_SILCOON 0x123
    #define PKMN_BEAUTIFLY 0x124
    #define PKMN_CASCOON 0x125
    #define PKMN_DUSTOX 0x126
    #define PKMN_LOTAD 0x127
    #define PKMN_LOMBRE 0x128
    #define PKMN_LUDICOLO 0x129
    #define PKMN_SEEDOT 0x12A
    #define PKMN_NUZLEAF 0x12B
    #define PKMN_SHIFTRY 0x12C
    #define PKMN_NINCADA 0x12D
    #define PKMN_NINJASK 0x12E
    #define PKMN_SHEDINJA 0x12F
    #define PKMN_TAILLOW 0x130
    #define PKMN_SWELLOW 0x131
    #define PKMN_SHROOMISH 0x132
    #define PKMN_BRELOOM 0x133
    #define PKMN_SPINDA 0x134
    #define PKMN_WINGULL 0x135
    #define PKMN_PELIPPER 0x136
    #define PKMN_SURSKIT 0x137
    #define PKMN_MASQUERAIN 0x138
    #define PKMN_WAILMER 0x139
    #define PKMN_WAILORD 0x13A
    #define PKMN_SKITTY 0x13B
    #define PKMN_DELCATTY 0x13C
    #define PKMN_KECLEON 0x13D
    #define PKMN_BALTOY 0x13E
    #define PKMN_CLAYDOL 0x13F
    #define PKMN_NOSEPASS 0x140
    #define PKMN_TORKOAL 0x141
    #define PKMN_SABLEYE 0x142
    #define PKMN_BARBOACH 0x143
    #define PKMN_WHISCASH 0x144
    #define PKMN_LUVDISC 0x145
    #define PKMN_CORPHISH 0x146
    #define PKMN_CRAWDAUNT 0x147
    #define PKMN_FEEBAS 0x148
    #define PKMN_MILOTIC 0x149
    #define PKMN_CARVANHA 0x14A
    #define PKMN_SHARPEDO 0x14B
    #define PKMN_TRAPINCH 0x14C
    #define PKMN_VIBRAVA 0x14D
    #define PKMN_FLYGON 0x14E
    #define PKMN_MAKUHITA 0x14F
    #define PKMN_HARIYAMA 0x150
    #define PKMN_ELECTRIKE 0x151
    #define PKMN_MANECTRIC 0x152
    #define PKMN_NUMEL 0x153
    #define PKMN_CAMERUPT 0x154
    #define PKMN_SPHEAL 0x155
    #define PKMN_SEALEO 0x156
    #define PKMN_WALREIN 0x157
    #define PKMN_CACNEA 0x158
    #define PKMN_CACTURNE 0x159
    #define PKMN_SNORUNT 0x15A
    #define PKMN_GLALIE 0x15B
    #define PKMN_LUNATONE 0x15C
    #define PKMN_SOLROCK 0x15D
    #define PKMN_AZURILL 0x15E
    #define PKMN_SPOINK 0x15F
    #define PKMN_GRUMPIG 0x160
    #define PKMN_PLUSLE 0x161
    #define PKMN_MINUN 0x162
    #define PKMN_MAWILE 0x163
    #define PKMN_MEDITITE 0x164
    #define PKMN_MEDICHAM 0x165
    #define PKMN_SWABLU 0x166
    #define PKMN_ALTARIA 0x167
    #define PKMN_WYNAUT 0x168
    #define PKMN_DUSKULL 0x169
    #define PKMN_DUSCLOPS 0x16A
    #define PKMN_ROSELIA 0x16B
    #define PKMN_SLAKOTH 0x16C
    #define PKMN_VIGOROTH 0x16D
    #define PKMN_SLAKING 0x16E
    #define PKMN_GULPIN 0x16F
    #define PKMN_SWALOT 0x170
    #define PKMN_TROPIUS 0x171
    #define PKMN_WHISMUR 0x172
    #define PKMN_LOUDRED 0x173
    #define PKMN_EXPLOUD 0x174
    #define PKMN_CLAMPERL 0x175
    #define PKMN_HUNTAIL 0x176
    #define PKMN_GOREBYSS 0x177
    #define PKMN_ABSOL 0x178
    #define PKMN_SHUPPET 0x179
    #define PKMN_BANETTE 0x17A
    #define PKMN_SEVIPER 0x17B
    #define PKMN_ZANGOOSE 0x17C
    #define PKMN_RELICANTH 0x17D
    #define PKMN_ARON 0x17E
    #define PKMN_LAIRON 0x17F
    #define PKMN_AGGRON 0x180
    #define PKMN_CASTFORM 0x181
    #define PKMN_VOLBEAT 0x182
    #define PKMN_ILLUMISE 0x183
    #define PKMN_LILEEP 0x184
    #define PKMN_CRADILY 0x185
    #define PKMN_ANORITH 0x186
    #define PKMN_ARMALDO 0x187
    #define PKMN_RALTS 0x188
    #define PKMN_KIRLIA 0x189
    #define PKMN_GARDEVOIR 0x18A
    #define PKMN_BAGON 0x18B
    #define PKMN_SHELGON 0x18C
    #define PKMN_SALAMENCE 0x18D
    #define PKMN_BELDUM 0x18E
    #define PKMN_METANG 0x18F
    #define PKMN_METAGROSS 0x190
    #define PKMN_REGIROCK 0x191
    #define PKMN_REGICE 0x192
    #define PKMN_REGISTEEL 0x193
    #define PKMN_KYOGRE 0x194
    #define PKMN_GROUDON 0x195
    #define PKMN_RAYQUAZA 0x196
    #define PKMN_LATIAS 0x197
    #define PKMN_LATIOS 0x198
    #define PKMN_JIRACHI 0x199
    #define PKMN_DEOXYS 0x19A
    #define PKMN_CHIMECHO 0x19B

    Items Header File
    Spoiler:
    #define ITEM_NONE 0x0
    #define ITEM_MASTERBALL 0x1
    #define ITEM_ULTRABALL 0x2
    #define ITEM_GREATBALL 0x3
    #define ITEM_POKEBALL 0x4
    #define ITEM_SAFARIBALL 0x5
    #define ITEM_NETBALL 0x6
    #define ITEM_DIVEBALL 0x7
    #define ITEM_NESTBALL 0x8
    #define ITEM_REPEATBALL 0x9
    #define ITEM_TIMERBALL 0xA
    #define ITEM_LUXURYBALL 0xB
    #define ITEM_PREMIERBALL 0xC
    #define ITEM_POTION 0xD
    #define ITEM_ANTIDOTE 0xE
    #define ITEM_BURNHEAL 0xF
    #define ITEM_ICEHEAL 0x10
    #define ITEM_AWAKENING 0x11
    #define ITEM_PARLYZHEAL 0x12
    #define ITEM_FULLRESTORE 0x13
    #define ITEM_MAXPOTION 0x14
    #define ITEM_HYPERPOTION 0x15
    #define ITEM_SUPERPOTION 0x16
    #define ITEM_FULLHEAL 0x17
    #define ITEM_REVIVE 0x18
    #define ITEM_MAXREVIVE 0x19
    #define ITEM_FRESHWATER 0x1A
    #define ITEM_SODAPOP 0x1B
    #define ITEM_LEMONADE 0x1C
    #define ITEM_MOOMOOMILK 0x1D
    #define ITEM_ENERGYPOWDER 0x1E
    #define ITEM_ENERGYROOT 0x1F
    #define ITEM_HEALPOWDER 0x20
    #define ITEM_REVIVALHERB 0x21
    #define ITEM_ETHER 0x22
    #define ITEM_MAXETHER 0x23
    #define ITEM_ELIXIR 0x24
    #define ITEM_MAXELIXIR 0x25
    #define ITEM_LAVACOOKIE 0x26
    #define ITEM_BLUEFLUTE 0x27
    #define ITEM_YELLOWFLUTE 0x28
    #define ITEM_REDFLUTE 0x29
    #define ITEM_BLACKFLUTE 0x2A
    #define ITEM_WHITEFLUTE 0x2B
    #define ITEM_BERRYJUICE 0x2C
    #define ITEM_SACREDASH 0x2D
    #define ITEM_SHOALSALT 0x2E
    #define ITEM_SHOALSHELL 0x2F
    #define ITEM_REDSHARD 0x30
    #define ITEM_BLUESHARD 0x31
    #define ITEM_YELLOWSHARD 0x32
    #define ITEM_GREENSHARD 0x33











    #define ITEM_HPUP 0x3F
    #define ITEM_PROTEIN 0x40
    #define ITEM_IRON 0x41
    #define ITEM_CARBOS 0x42
    #define ITEM_CALCIUM 0x43
    #define ITEM_RARECANDY 0x44
    #define ITEM_PPUP 0x45
    #define ITEM_ZINC 0x46
    #define ITEM_PPMAX 0x47

    #define ITEM_GUARDSPEC 0x49
    #define ITEM_DIREHIT 0x4A
    #define ITEM_XATTACK 0x4B
    #define ITEM_XDEFEND 0x4C
    #define ITEM_XSPEED 0x4D
    #define ITEM_XACCURACY 0x4E
    #define ITEM_XSPECIAL 0x4F
    #define ITEM_POKEDOLL 0x50
    #define ITEM_FLUFFYTAIL 0x51

    #define ITEM_SUPERREPEL 0x53
    #define ITEM_MAXREPEL 0x54
    #define ITEM_ESCAPEROPE 0x55
    #define ITEM_REPEL 0x56






    #define ITEM_SUNSTONE 0x5D
    #define ITEM_MOONSTONE 0x5E
    #define ITEM_FIRESTONE 0x5F
    #define ITEM_THUNDERSTONE 0x60
    #define ITEM_WATERSTONE 0x61
    #define ITEM_LEAFSTONE 0x62




    #define ITEM_TINYMUSHROOM 0x67
    #define ITEM_BIGMUSHROOM 0x68

    #define ITEM_PEARL 0x6A
    #define ITEM_BIGPEARL 0x6B
    #define ITEM_STARDUST 0x6C
    #define ITEM_STARPIECE 0x6D
    #define ITEM_NUGGET 0x6E
    #define ITEM_HEARTSCALE 0x6F









    #define ITEM_ORANGEMAIL 0x79
    #define ITEM_HARBORMAIL 0x7A
    #define ITEM_GLITTERMAIL 0x7B
    #define ITEM_MECHMAIL 0x7C
    #define ITEM_WOODMAIL 0x7D
    #define ITEM_WAVEMAIL 0x7E
    #define ITEM_BEADMAIL 0x7F
    #define ITEM_SHADOWMAIL 0x80
    #define ITEM_TROPICMAIL 0x81
    #define ITEM_DREAMMAIL 0x82
    #define ITEM_FABMAIL 0x83
    #define ITEM_RETROMAIL 0x84
    #define ITEM_CHERIBERRY 0x85
    #define ITEM_CHESTOBERRY 0x86
    #define ITEM_PECHABERRY 0x87
    #define ITEM_RAWSTBERRY 0x88
    #define ITEM_ASPEARBERRY 0x89
    #define ITEM_LEPPABERRY 0x8A
    #define ITEM_ORANBERRY 0x8B
    #define ITEM_PERSIMBERRY 0x8C
    #define ITEM_LUMBERRY 0x8D
    #define ITEM_SITRUSBERRY 0x8E
    #define ITEM_FIGYBERRY 0x8F
    #define ITEM_WIKIBERRY 0x90
    #define ITEM_MAGOBERRY 0x91
    #define ITEM_AGUAVBERRY 0x92
    #define ITEM_IAPAPABERRY 0x93
    #define ITEM_RAZZBERRY 0x94
    #define ITEM_BLUKBERRY 0x95
    #define ITEM_NANABBERRY 0x96
    #define ITEM_WEPEARBERRY 0x97
    #define ITEM_PINAPBERRY 0x98
    #define ITEM_POMEGBERRY 0x99
    #define ITEM_KELPSYBERRY 0x9A
    #define ITEM_QUALOTBERRY 0x9B
    #define ITEM_HONDEWBERRY 0x9C
    #define ITEM_GREPABERRY 0x9D
    #define ITEM_TAMATOBERRY 0x9E
    #define ITEM_CORNNBERRY 0x9F
    #define ITEM_MAGOSTBERRY 0xA0
    #define ITEM_RABUTABERRY 0xA1
    #define ITEM_NOMELBERRY 0xA2
    #define ITEM_SPELONBERRY 0xA3
    #define ITEM_PAMTREBERRY 0xA4
    #define ITEM_WATMELBERRY 0xA5
    #define ITEM_DURINBERRY 0xA6
    #define ITEM_BELUEBERRY 0xA7
    #define ITEM_LIECHIBERRY 0xA8
    #define ITEM_GANLONBERRY 0xA9
    #define ITEM_SALACBERRY 0xAA
    #define ITEM_PETAYABERRY 0xAB
    #define ITEM_APICOTBERRY 0xAC
    #define ITEM_LANSATBERRY 0xAD
    #define ITEM_STARFBERRY 0xAE
    #define ITEM_ENIGMABERRY 0xAF



    #define ITEM_BRIGHTPOWDER 0xB3
    #define ITEM_WHITEHERB 0xB4
    #define ITEM_MACHOBRACE 0xB5
    #define ITEM_EXPSHARE 0xB6
    #define ITEM_QUICKCLAW 0xB7
    #define ITEM_SOOTHEBELL 0xB8
    #define ITEM_MENTALHERB 0xB9
    #define ITEM_CHOICEBAND 0xBA
    #define ITEM_KINGSROCK 0xBB
    #define ITEM_SILVERPOWDER 0xBC
    #define ITEM_AMULETCOIN 0xBD
    #define ITEM_CLEANSETAG 0xBE
    #define ITEM_SOULDEW 0xBF
    #define ITEM_DEEPSEATOOTH 0xC0
    #define ITEM_DEEPSEASCALE 0xC1
    #define ITEM_SMOKEBALL 0xC2
    #define ITEM_EVERSTONE 0xC3
    #define ITEM_FOCUSBAND 0xC4
    #define ITEM_LUCKYEGG 0xC5
    #define ITEM_SCOPELENS 0xC6
    #define ITEM_METALCOAT 0xC7
    #define ITEM_LEFTOVERS 0xC8
    #define ITEM_DRAGONSCALE 0xC9
    #define ITEM_LIGHTBALL 0xCA
    #define ITEM_SOFTSAND 0xCB
    #define ITEM_HARDSTONE 0xCC
    #define ITEM_MIRACLESEED 0xCD
    #define ITEM_BLACKGLASSES 0xCE
    #define ITEM_BLACKBELT 0xCF
    #define ITEM_MAGNET 0xD0
    #define ITEM_MYSTICWATER 0xD1
    #define ITEM_SHARPBEAK 0xD2
    #define ITEM_POISONBARB 0xD3
    #define ITEM_NEVERMELTICE 0xD4
    #define ITEM_SPELLTAG 0xD5
    #define ITEM_TWISTEDSPOON 0xD6
    #define ITEM_CHARCOAL 0xD7
    #define ITEM_DRAGONFANG 0xD8
    #define ITEM_SILKSCARF 0xD9
    #define ITEM_UPGRADE 0xDA
    #define ITEM_SHELLBELL 0xDB
    #define ITEM_SEAINCENSE 0xDC
    #define ITEM_LAXINCENSE 0xDD
    #define ITEM_LUCKYPUNCH 0xDE
    #define ITEM_METALPOWDER 0xDF
    #define ITEM_THICKCLUB 0xE0
    #define ITEM_STICK 0xE1




























    #define ITEM_REDSCARF 0xFE
    #define ITEM_BLUESCARF 0xFF
    #define ITEM_PINKSCARF 0x100
    #define ITEM_GREENSCARF 0x101
    #define ITEM_YELLOWSCARF 0x102
    #define ITEM_MACHBIKE 0x103
    #define ITEM_COINCASE 0x104
    #define ITEM_ITEMFINDER 0x105
    #define ITEM_OLDROD 0x106
    #define ITEM_GOODROD 0x107
    #define ITEM_SUPERROD 0x108
    #define ITEM_SSTICKET 0x109
    #define ITEM_CONTESTPASS 0x10A

    #define ITEM_WAILMERPAIL 0x10C
    #define ITEM_DEVONGOODS 0x10D
    #define ITEM_SOOTSACK 0x10E
    #define ITEM_BASEMENTKEY 0x10F
    #define ITEM_ACROBIKE 0x110
    #define ITEM_POKEBLOCKCASE 0x111
    #define ITEM_LETTER 0x112
    #define ITEM_EONTICKET 0x113
    #define ITEM_REDORB 0x114
    #define ITEM_BLUEORB 0x115
    #define ITEM_SCANNER 0x116
    #define ITEM_GOGOGGLES 0x117
    #define ITEM_METEORITE 0x118
    #define ITEM_RM1KEY 0x119
    #define ITEM_RM2KEY 0x11A
    #define ITEM_RM4KEY 0x11B
    #define ITEM_RM6KEY 0x11C
    #define ITEM_STORAGEKEY 0x11D
    #define ITEM_ROOTFOSSIL 0x11E
    #define ITEM_CLAWFOSSIL 0x11F
    #define ITEM_DEVONSCOPE 0x120
    #define ITEM_TM01 0x121
    #define ITEM_TM02 0x122
    #define ITEM_TM03 0x123
    #define ITEM_TM04 0x124
    #define ITEM_TM05 0x125
    #define ITEM_TM06 0x126
    #define ITEM_TM07 0x127
    #define ITEM_TM08 0x128
    #define ITEM_TM09 0x129
    #define ITEM_TM10 0x12A
    #define ITEM_TM11 0x12B
    #define ITEM_TM12 0x12C
    #define ITEM_TM13 0x12D
    #define ITEM_TM14 0x12E
    #define ITEM_TM15 0x12F
    #define ITEM_TM16 0x130
    #define ITEM_TM17 0x131
    #define ITEM_TM18 0x132
    #define ITEM_TM19 0x133
    #define ITEM_TM20 0x134
    #define ITEM_TM21 0x135
    #define ITEM_TM22 0x136
    #define ITEM_TM23 0x137
    #define ITEM_TM24 0x138
    #define ITEM_TM25 0x139
    #define ITEM_TM26 0x13A
    #define ITEM_TM27 0x13B
    #define ITEM_TM28 0x13C
    #define ITEM_TM29 0x13D
    #define ITEM_TM30 0x13E
    #define ITEM_TM31 0x13F
    #define ITEM_TM32 0x140
    #define ITEM_TM33 0x141
    #define ITEM_TM34 0x142
    #define ITEM_TM35 0x143
    #define ITEM_TM36 0x144
    #define ITEM_TM37 0x145
    #define ITEM_TM38 0x146
    #define ITEM_TM39 0x147
    #define ITEM_TM40 0x148
    #define ITEM_TM41 0x149
    #define ITEM_TM42 0x14A
    #define ITEM_TM43 0x14B
    #define ITEM_TM44 0x14C
    #define ITEM_TM45 0x14D
    #define ITEM_TM46 0x14E
    #define ITEM_TM47 0x14F
    #define ITEM_TM48 0x150
    #define ITEM_TM49 0x151
    #define ITEM_TM50 0x152
    #define ITEM_HM01 0x153
    #define ITEM_HM02 0x154
    #define ITEM_HM03 0x155
    #define ITEM_HM04 0x156
    #define ITEM_HM05 0x157
    #define ITEM_HM06 0x158
    #define ITEM_HM07 0x159
    #define ITEM_HM08 0x15A


    #define ITEM_OAKSPARCEL 0x15D
    #define ITEM_POKEFLUTE 0x15E
    #define ITEM_SECRETKEY 0x15F
    #define ITEM_BIKEVOUCHER 0x160
    #define ITEM_GOLDTEETH 0x161
    #define ITEM_OLDAMBER 0x162
    #define ITEM_CARDKEY 0x163
    #define ITEM_LIFTKEY 0x164
    #define ITEM_HELIXFOSSIL 0x165
    #define ITEM_DOMEFOSSIL 0x166
    #define ITEM_SILPHSCOPE 0x167
    #define ITEM_BICYCLE 0x168
    #define ITEM_TOWNMAP 0x169
    #define ITEM_VSSEEKER 0x16A
    #define ITEM_FAMECHECKER 0x16B
    #define ITEM_TMCASE 0x16C
    #define ITEM_BERRYPOUCH 0x16D
    #define ITEM_TEACHYTV 0x16E
    #define ITEM_TRIPASS 0x16F
    #define ITEM_RAINBOWPASS 0x170
    #define ITEM_TEA 0x171
    #define ITEM_MYSTICTICKET 0x172
    #define ITEM_AURORATICKET 0x173
    #define ITEM_POWDERJAR 0x174
    #define ITEM_RUBY 0x175
    #define ITEM_SAPPHIRE 0x176
    #define ITEM_MAGMAEMBLEM 0x177
    #define ITEM_OLDSEAMAP 0x178

    #define DEC_SMALLDESK 0x1
    #define DEC_POKEMONDESK 0x2
    #define DEC_HEAVYDESK 0x3
    #define DEC_RAGGEDDESK 0x4
    #define DEC_COMFORTDESK 0x5
    #define DEC_PRETTYDESK 0x6
    #define DEC_BRICKDESK 0x7
    #define DEC_CAMPDESK 0x8
    #define DEC_HARDDESK 0x9
    #define DEC_SMALLCHAIR 0xA
    #define DEC_POKEMONCHAIR 0xB
    #define DEC_HEAVYCHAIR 0xC
    #define DEC_PRETTYCHAIR 0xD
    #define DEC_COMFORTCHAIR 0xE
    #define DEC_RAGGEDCHAIR 0xF
    #define DEC_BRICKCHAIR 0x10
    #define DEC_CAMPCHAIR 0x11
    #define DEC_HARDCHAIR 0x12
    #define DEC_REDPLANT 0x13
    #define DEC_TROPICALPLANT 0x14
    #define DEC_PRETTYFLOWERS 0x15
    #define DEC_COLORFULPLANT 0x16
    #define DEC_BIGPLANT 0x17
    #define DEC_GORGEOUSPLANT 0x18
    #define DEC_REDBRICK 0x19
    #define DEC_YELLOWBRICK 0x1A
    #define DEC_REDBALLOON 0x1B
    #define DEC_BLUEBALLOON 0x1C
    #define DEC_YELLOWBALLOON 0x1D
    #define DEC_REDTENT 0x1F
    #define DEC_BLUETENT 0x20
    #define DEC_SOLIDBOARD 0x21
    #define DEC_SLIDE 0x22
    #define DEC_FENCELENGTH 0x23
    #define DEC_FENCEWIDTH 0x24
    #define DEC_TIRE 0x25
    #define DEC_STAND 0x26
    #define DEC_MUDBALL 0x27
    #define DEC_BREAKABLEDOOR 0x28
    #define DEC_SANDORNAMENT 0x29
    #define DEC_SILVERSHIELD 0x2A
    #define DEC_GOLDSHIELD 0x2B
    #define DEC_GLASSORNAMENT 0x2C
    #define DEC_ROUNDTV 0x2E
    #define DEC_CUTETV 0x2F
    #define DEC_GLITTERMAT 0x30
    #define DEC_JUMPMAT 0x31
    #define DEC_SPINMAT 0x32
    #define DEC_CLOWNOTEMAT 0x33
    #define DEC_DNOTEMAT 0x34
    #define DEC_ENOTEMAT 0x35
    #define DEC_FNOTEMAT 0x36
    #define DEC_GNOTEMAT 0x37
    #define DEC_ANOTEMAT 0x38
    #define DEC_BNOTEMAT 0x39
    #define DEC_CHIGHNOTEMAT 0x3A
    #define DEC_SURFMAT 0x3B
    #define DEC_THUNDERMAT 0x3C
    #define DEC_FIREBLASTMAT 0x3D
    #define DEC_POWDERSNOWMAT 0x3E
    #define DEC_ATTRACTMAT 0x3F
    #define DEC_FISSUREMAT 0x40
    #define DEC_SPIKESMAT 0x41
    #define DEC_BALLPOSTER 0x42
    #define DEC_GREENPOSTER 0x43
    #define DEC_REDPOSTER 0x44
    #define DEC_BLUEPOSTER 0x45
    #define DEC_CUTEPOSTER 0x46
    #define DEC_PIKAPOSTER 0x47
    #define DEC_LONGPOSTER 0x48
    #define DEC_SEAPOSTER 0x49
    #define DEC_SKYPOSTER 0x4A
    #define DEC_KISSPOSTER 0x4B
    #define DEC_PICHUDOLL 0x4C
    #define DEC_PIKACHUDOLL 0x4D
    #define DEC_MARILLDOLL 0x4E
    #define DEC_TOGEPIDOLL 0x4F
    #define DEC_CYNDAQUILDOLL 0x50
    #define DEC_CHIKORITADOLL 0x51
    #define DEC_TOTODILEDOLL 0x52
    #define DEC_JIGGLYPUFFDOLL 0x53
    #define DEC_MEOWTHDOLL 0x54
    #define DEC_CLEFAIRYDOLL 0x55
    #define DEC_DITTODOLL 0x56
    #define DEC_SMOOCHUMDOLL 0x57
    #define DEC_TREECKODOLL 0x58
    #define DEC_TORCHICDOLL 0x59
    #define DEC_MUDKIPDOLL 0x5A
    #define DEC_DUSKULLDOLL 0x5B
    #define DEC_WYNAUTDOLL 0x5C
    #define DEC_BALTOYDOLL 0x5D
    #define DEC_KECLEONDOLL 0x5E
    #define DEC_AZURILLDOLL 0x5F
    #define DEC_SKITTYDOLL 0x60
    #define DEC_SWABLUDOLL 0x61
    #define DEC_GULPINDOLL 0x62
    #define DEC_LOTADDOLL 0x63
    #define DEC_SEEDOTDOLL 0x64
    #define DEC_PIKACUSHION 0x65
    #define DEC_ROUNDCUSHION 0x66
    #define DEC_KISSCUSHION 0x67
    #define DEC_ZIGZAGCUSHION 0x68
    #define DEC_SPINCUSHION 0x69
    #define DEC_DIAMONDCUSHION 0x6A
    #define DEC_BALLCUSHION 0x6B
    #define DEC_GRASSCUSHION 0x6C
    #define DEC_FIRECUSHION 0x6D
    #define DEC_WATERCUSHION 0x6E
    #define DEC_SNORLAXDOL 0x6F
    #define DEC_RHYDONDOLL 0x70
    #define DEC_LAPRASDOLL 0x71
    #define DEC_VENUSAURDOLL 0x72
    #define DEC_CHARIZARDDOLL 0x73
    #define DEC_BLASTOISEDOLL 0x74
    #define DEC_WAILMERDOLL 0x75
    #define DEC_REGIROCKDOLL 0x76
    #define DEC_REGICEDOLL 0x77
    #define DEC_REGISTEELDOLL 0x78

    Attacks Header File
    Spoiler:
    #define ATK_NONE 0x0
    #define ATK_POUND 0x1
    #define ATK_KARATECHOP 0x2
    #define ATK_DOUBLESLAP 0x3
    #define ATK_COMETPUNCH 0x4
    #define ATK_MEGAPUNCH 0x5
    #define ATK_PAYDAY 0x6
    #define ATK_FIREPUNCH 0x7
    #define ATK_ICEPUNCH 0x8
    #define ATK_THUNDERPUNCH 0x9
    #define ATK_SCRATCH 0xA
    #define ATK_VICEGRIP 0xB
    #define ATK_GUILLOTINE 0xC
    #define ATK_RAZORWIND 0xD
    #define ATK_SWORDSDANCE 0xE
    #define ATK_CUT 0xF
    #define ATK_GUST 0x10
    #define ATK_WINGATTACK 0x11
    #define ATK_WHIRLWIND 0x12
    #define ATK_FLY 0x13
    #define ATK_BIND 0x14
    #define ATK_SLAM 0x15
    #define ATK_VINEWHIP 0x16
    #define ATK_STOMP 0x17
    #define ATK_DOUBLEKICK 0x18
    #define ATK_MEGAKICK 0x19
    #define ATK_JUMPKICK 0x1A
    #define ATK_ROLLINGKICK 0x1B
    #define ATK_SANDATTACK 0x1C
    #define ATK_HEADBUTT 0x1D
    #define ATK_HORNATTACK 0x1E
    #define ATK_FURYATTACK 0x1F
    #define ATK_HORNDRILL 0x20
    #define ATK_TACKLE 0x21
    #define ATK_BODYSLAM 0x22
    #define ATK_WRAP 0x23
    #define ATK_TAKEDOWN 0x24
    #define ATK_THRASH 0x25
    #define ATK_DOUBLEEDGE 0x26
    #define ATK_TAILWHIP 0x27
    #define ATK_POISONSTING 0x28
    #define ATK_TWINEEDLE 0x29
    #define ATK_PINMISSILE 0x2A
    #define ATK_LEER 0x2B
    #define ATK_BITE 0x2C
    #define ATK_GROWL 0x2D
    #define ATK_ROAR 0x2E
    #define ATK_SING 0x2F
    #define ATK_SUPERSONIC 0x30
    #define ATK_SONICBOOM 0x31
    #define ATK_DISABLE 0x32
    #define ATK_ACID 0x33
    #define ATK_EMBER 0x34
    #define ATK_FLAMETHROWER 0x35
    #define ATK_MIST 0x36
    #define ATK_WATERGUN 0x37
    #define ATK_HYDROPUMP 0x38
    #define ATK_SURF 0x39
    #define ATK_ICEBEAM 0x3A
    #define ATK_BLIZZARD 0x3B
    #define ATK_PSYBEAM 0x3C
    #define ATK_BUBBLEBEAM 0x3D
    #define ATK_AURORABEAM 0x3E
    #define ATK_HYPERBEAM 0x3F
    #define ATK_PECK 0x40
    #define ATK_DRILLPECK 0x41
    #define ATK_SUBMISSION 0x42
    #define ATK_LOWKICK 0x43
    #define ATK_COUNTER 0x44
    #define ATK_SEISMICTOSS 0x45
    #define ATK_STRENGTH 0x46
    #define ATK_ABSORB 0x47
    #define ATK_MEGADRAIN 0x48
    #define ATK_LEECHSEED 0x49
    #define ATK_GROWTH 0x4A
    #define ATK_RAZORLEAF 0x4B
    #define ATK_SOLARBEAM 0x4C
    #define ATK_POISONPOWDER 0x4D
    #define ATK_STUNSPORE 0x4E
    #define ATK_SLEEPPOWDER 0x4F
    #define ATK_PETALDANCE 0x50
    #define ATK_STRINGSHOT 0x51
    #define ATK_DRAGONRAGE 0x52
    #define ATK_FIRESPIN 0x53
    #define ATK_THUNDERSHOCK 0x54
    #define ATK_THUNDERBOLT 0x55
    #define ATK_THUNDERWAVE 0x56
    #define ATK_THUNDER 0x57
    #define ATK_ROCKTHROW 0x58
    #define ATK_EARTHQUAKE 0x59
    #define ATK_FISSURE 0x5A
    #define ATK_DIG 0x5B
    #define ATK_TOXIC 0x5C
    #define ATK_CONFUSION 0x5D
    #define ATK_PSYCHIC 0x5E
    #define ATK_HYPNOSIS 0x5F
    #define ATK_MEDITATE 0x60
    #define ATK_AGILITY 0x61
    #define ATK_QUICKATTACK 0x62
    #define ATK_RAGE 0x63
    #define ATK_TELEPORT 0x64
    #define ATK_NIGHTSHADE 0x65
    #define ATK_MIMIC 0x66
    #define ATK_SCREECH 0x67
    #define ATK_DOUBLETEAM 0x68
    #define ATK_RECOVER 0x69
    #define ATK_HARDEN 0x6A
    #define ATK_MINIMIZE 0x6B
    #define ATK_SMOKESCREEN 0x6C
    #define ATK_CONFUSERAY 0x6D
    #define ATK_WITHDRAW 0x6E
    #define ATK_DEFENSECURL 0x6F
    #define ATK_BARRIER 0x70
    #define ATK_LIGHTSCREEN 0x71
    #define ATK_HAZE 0x72
    #define ATK_REFLECT 0x73
    #define ATK_FOCUSENERGY 0x74
    #define ATK_BIDE 0x75
    #define ATK_METRONOME 0x76
    #define ATK_MIRRORMOVE 0x77
    #define ATK_SELFDESTRUCT 0x78
    #define ATK_EGGBOMB 0x79
    #define ATK_LICK 0x7A
    #define ATK_SMOG 0x7B
    #define ATK_SLUDGE 0x7C
    #define ATK_BONECLUB 0x7D
    #define ATK_FIREBLAST 0x7E
    #define ATK_WATERFALL 0x7F
    #define ATK_CLAMP 0x80
    #define ATK_SWIFT 0x81
    #define ATK_SKULLBASH 0x82
    #define ATK_SPIKECANNON 0x83
    #define ATK_CONSTRICT 0x84
    #define ATK_AMNESIA 0x85
    #define ATK_KINESIS 0x86
    #define ATK_SOFTBOILED 0x87
    #define ATK_HIJUMPKICK 0x88
    #define ATK_GLARE 0x89
    #define ATK_DREAMEATER 0x8A
    #define ATK_POISONGAS 0x8B
    #define ATK_BARRAGE 0x8C
    #define ATK_LEECHLIFE 0x8D
    #define ATK_LOVELYKISS 0x8E
    #define ATK_SKYATTACK 0x8F
    #define ATK_TRANSFORM 0x90
    #define ATK_BUBBLE 0x91
    #define ATK_DIZZYPUNCH 0x92
    #define ATK_SPORE 0x93
    #define ATK_FLASH 0x94
    #define ATK_PSYWAVE 0x95
    #define ATK_SPLASH 0x96
    #define ATK_ACIDARMOR 0x97
    #define ATK_CRABHAMMER 0x98
    #define ATK_EXPLOSION 0x99
    #define ATK_FURYSWIPES 0x9A
    #define ATK_BONEMERANG 0x9B
    #define ATK_REST 0x9C
    #define ATK_ROCKSLIDE 0x9D
    #define ATK_HYPERFANG 0x9E
    #define ATK_SHARPEN 0x9F
    #define ATK_CONVERSION 0xA0
    #define ATK_TRIATTACK 0xA1
    #define ATK_SUPERFANG 0xA2
    #define ATK_SLASH 0xA3
    #define ATK_SUBSTITUTE 0xA4
    #define ATK_STRUGGLE 0xA5
    #define ATK_SKETCH 0xA6
    #define ATK_TRIPLEKICK 0xA7
    #define ATK_THIEF 0xA8
    #define ATK_SPIDERWEB 0xA9
    #define ATK_MINDREADER 0xAA
    #define ATK_NIGHTMARE 0xAB
    #define ATK_FLAMEWHEEL 0xAC
    #define ATK_SNORE 0xAD
    #define ATK_CURSE 0xAE
    #define ATK_FLAIL 0xAF
    #define ATK_CONVERSION2 0xB0
    #define ATK_AEROBLAST 0xB1
    #define ATK_COTTONSPORE 0xB2
    #define ATK_REVERSAL 0xB3
    #define ATK_SPITE 0xB4
    #define ATK_POWDERSNOW 0xB5
    #define ATK_PROTECT 0xB6
    #define ATK_MACHPUNCH 0xB7
    #define ATK_SCARYFACE 0xB8
    #define ATK_FAINTATTACK 0xB9
    #define ATK_SWEETKISS 0xBA
    #define ATK_BELLYDRUM 0xBB
    #define ATK_SLUDGEBOMB 0xBC
    #define ATK_MUDSLAP 0xBD
    #define ATK_OCTAZOOKA 0xBE
    #define ATK_SPIKES 0xBF
    #define ATK_ZAPCANNON 0xC0
    #define ATK_FORESIGHT 0xC1
    #define ATK_DESTINYBOND 0xC2
    #define ATK_PERISHSONG 0xC3
    #define ATK_ICYWIND 0xC4
    #define ATK_DETECT 0xC5
    #define ATK_BONERUSH 0xC6
    #define ATK_LOCKON 0xC7
    #define ATK_OUTRAGE 0xC8
    #define ATK_SANDSTORM 0xC9
    #define ATK_GIGADRAIN 0xCA
    #define ATK_ENDURE 0xCB
    #define ATK_CHARM 0xCC
    #define ATK_ROLLOUT 0xCD
    #define ATK_FALSESWIPE 0xCE
    #define ATK_SWAGGER 0xCF
    #define ATK_MILKDRINK 0xD0
    #define ATK_SPARK 0xD1
    #define ATK_FURYCUTTER 0xD2
    #define ATK_STEELWING 0xD3
    #define ATK_MEANLOOK 0xD4
    #define ATK_ATTRACT 0xD5
    #define ATK_SLEEPTALK 0xD6
    #define ATK_HEALBELL 0xD7
    #define ATK_RETURN 0xD8
    #define ATK_PRESENT 0xD9
    #define ATK_FRUSTRATION 0xDA
    #define ATK_SAFEGUARD 0xDB
    #define ATK_PAINSPLIT 0xDC
    #define ATK_SACREDFIRE 0xDD
    #define ATK_MAGNITUDE 0xDE
    #define ATK_DYNAMICPUNCH 0xDF
    #define ATK_MEGAHORN 0xE0
    #define ATK_DRAGONBREATH 0xE1
    #define ATK_BATONPASS 0xE2
    #define ATK_ENCORE 0xE3
    #define ATK_PURSUIT 0xE4
    #define ATK_RAPIDSPIN 0xE5
    #define ATK_SWEETSCENT 0xE6
    #define ATK_IRONTAIL 0xE7
    #define ATK_METALCLAW 0xE8
    #define ATK_VITALTHROW 0xE9
    #define ATK_MORNINGSUN 0xEA
    #define ATK_SYNTHESIS 0xEB
    #define ATK_MOONLIGHT 0xEC
    #define ATK_HIDDENPOWER 0xED
    #define ATK_CROSSCHOP 0xEE
    #define ATK_TWISTER 0xEF
    #define ATK_RAINDANCE 0xF0
    #define ATK_SUNNYDAY 0xF1
    #define ATK_CRUNCH 0xF2
    #define ATK_MIRRORCOAT 0xF3
    #define ATK_PSYCHUP 0xF4
    #define ATK_EXTREMESPEED 0xF5
    #define ATK_ANCIENTPOWER 0xF6
    #define ATK_SHADOWBALL 0xF7
    #define ATK_FUTURESIGHT 0xF8
    #define ATK_ROCKSMASH 0xF9
    #define ATK_WHIRLPOOL 0xFA
    #define ATK_BEATUP 0xFB
    #define ATK_FAKEOUT 0xFC
    #define ATK_UPROAR 0xFD
    #define ATK_STOCKPILE 0xFE
    #define ATK_SPITUP 0xFF
    #define ATK_SWALLOW 0x100
    #define ATK_HEATWAVE 0x101
    #define ATK_HAIL 0x102
    #define ATK_TORMENT 0x103
    #define ATK_FLATTER 0x104
    #define ATK_WILLOWISP 0x105
    #define ATK_MEMENTO 0x106
    #define ATK_FACADE 0x107
    #define ATK_FOCUSPUNCH 0x108
    #define ATK_SMELLINGSALT 0x109
    #define ATK_FOLLOWME 0x10A
    #define ATK_NATUREPOWER 0x10B
    #define ATK_CHARGE 0x10C
    #define ATK_TAUNT 0x10D
    #define ATK_HELPINGHAND 0x10E
    #define ATK_TRICK 0x10F
    #define ATK_ROLEPLAY 0x110
    #define ATK_WISH 0x111
    #define ATK_ASSIST 0x112
    #define ATK_INGRAIN 0x113
    #define ATK_SUPERPOWER 0x114
    #define ATK_MAGICCOAT 0x115
    #define ATK_RECYCLE 0x116
    #define ATK_REVENGE 0x117
    #define ATK_BRICKBREAK 0x118
    #define ATK_YAWN 0x119
    #define ATK_KNOCKOFF 0x11A
    #define ATK_ENDEAVOR 0x11B
    #define ATK_ERUPTION 0x11C
    #define ATK_SKILLSWAP 0x11D
    #define ATK_IMPRISON 0x11E
    #define ATK_REFRESH 0x11F
    #define ATK_GRUDGE 0x120
    #define ATK_SNATCH 0x121
    #define ATK_SECRETPOWER 0x122
    #define ATK_DIVE 0x123
    #define ATK_ARMTHRUST 0x124
    #define ATK_CAMOUFLAGE 0x125
    #define ATK_TAILGLOW 0x126
    #define ATK_LUSTERPURGE 0x127
    #define ATK_MISTBALL 0x128
    #define ATK_FEATHERDANCE 0x129
    #define ATK_TEETERDANCE 0x12A
    #define ATK_BLAZEKICK 0x12B
    #define ATK_MUDSPORT 0x12C
    #define ATK_ICEBALL 0x12D
    #define ATK_NEEDLEARM 0x12E
    #define ATK_SLACKOFF 0x12F
    #define ATK_HYPERVOICE 0x130
    #define ATK_POISONFANG 0x131
    #define ATK_CRUSHCLAW 0x132
    #define ATK_BLASTBURN 0x133
    #define ATK_HYDROCANNON 0x134
    #define ATK_METEORMASH 0x135
    #define ATK_ASTONISH 0x136
    #define ATK_WEATHERBALL 0x137
    #define ATK_AROMATHERAPY 0x138
    #define ATK_FAKETEARS 0x139
    #define ATK_AIRCUTTER 0x13A
    #define ATK_OVERHEAT 0x13B
    #define ATK_ODORSLEUTH 0x13C
    #define ATK_ROCKTOMB 0x13D
    #define ATK_SILVERWIND 0x13E
    #define ATK_METALSOUND 0x13F
    #define ATK_GRASSWHISTLE 0x140
    #define ATK_TICKLE 0x141
    #define ATK_COSMICPOWER 0x142
    #define ATK_WATERSPOUT 0x143
    #define ATK_SIGNALBEAM 0x144
    #define ATK_SHADOWPUNCH 0x145
    #define ATK_EXTRASENSORY 0x146
    #define ATK_SKYUPPERCUT 0x147
    #define ATK_SANDTOMB 0x148
    #define ATK_SHEERCOLD 0x149
    #define ATK_MUDDYWATER 0x14A
    #define ATK_BULLETSEED 0x14B
    #define ATK_AERIALACE 0x14C
    #define ATK_ICICLESPEAR 0x14D
    #define ATK_IRONDEFENSE 0x14E
    #define ATK_BLOCK 0x14F
    #define ATK_HOWL 0x150
    #define ATK_DRAGONCLAW 0x151
    #define ATK_FRENZYPLANT 0x152
    #define ATK_BULKUP 0x153
    #define ATK_BOUNCE 0x154
    #define ATK_MUDSHOT 0x155
    #define ATK_POISONTAIL 0x156
    #define ATK_COVET 0x157
    #define ATK_VOLTTACKLE 0x158
    #define ATK_MAGICALLEAF 0x159
    #define ATK_WATERSPORT 0x15A
    #define ATK_CALMMIND 0x15B
    #define ATK_LEAFBLADE 0x15C
    #define ATK_DRAGONDANCE 0x15D
    #define ATK_ROCKBLAST 0x15E
    #define ATK_SHOCKWAVE 0x15F
    #define ATK_WATERPULSE 0x160
    #define ATK_DOOMDESIRE 0x161
    #define ATK_PSYCHOBOOST 0x162

    Mart Items Header File
    Spoiler:
    #define MART_END 0x0
    #define MART_MASTERBALL 0x1
    #define MART_ULTRABALL 0x2
    #define MART_GREATBALL 0x3
    #define MART_POKEBALL 0x4
    #define MART_SAFARIBALL 0x5
    #define MART_NETBALL 0x6
    #define MART_DIVEBALL 0x7
    #define MART_NESTBALL 0x8
    #define MART_REPEATBALL 0x9
    #define MART_TIMERBALL 0xA
    #define MART_LUXURYBALL 0xB
    #define MART_PREMIERBALL 0xC
    #define MART_POTION 0xD
    #define MART_ANTIDOTE 0xE
    #define MART_BURNHEAL 0xF
    #define MART_ICEHEAL 0x10
    #define MART_AWAKENING 0x11
    #define MART_PARLYZHEAL 0x12
    #define MART_FULLRESTORE 0x13
    #define MART_MAXPOTION 0x14
    #define MART_HYPERPOTION 0x15
    #define MART_SUPERPOTION 0x16
    #define MART_FULLHEAL 0x17
    #define MART_REVIVE 0x18
    #define MART_MAXREVIVE 0x19
    #define MART_FRESHWATER 0x1A
    #define MART_SODAPOP 0x1B
    #define MART_LEMONADE 0x1C
    #define MART_MOOMOOMILK 0x1D
    #define MART_ENERGYPOWDER 0x1E
    #define MART_ENERGYROOT 0x1F
    #define MART_HEALPOWDER 0x20
    #define MART_REVIVALHERB 0x21
    #define MART_ETHER 0x22
    #define MART_MAXETHER 0x23
    #define MART_ELIXIR 0x24
    #define MART_MAXELIXIR 0x25
    #define MART_LAVACOOKIE 0x26
    #define MART_BLUEFLUTE 0x27
    #define MART_YELLOWFLUTE 0x28
    #define MART_REDFLUTE 0x29
    #define MART_BLACKFLUTE 0x2A
    #define MART_WHITEFLUTE 0x2B
    #define MART_BERRYJUICE 0x2C
    #define MART_SACREDASH 0x2D
    #define MART_SHOALSALT 0x2E
    #define MART_SHOALSHELL 0x2F
    #define MART_REDSHARD 0x30
    #define MART_BLUESHARD 0x31
    #define MART_YELLOWSHARD 0x32
    #define MART_GREENSHARD 0x33











    #define MART_HPUP 0x3F
    #define MART_PROTEIN 0x40
    #define MART_IRON 0x41
    #define MART_CARBOS 0x42
    #define MART_CALCIUM 0x43
    #define MART_RARECANDY 0x44
    #define MART_PPUP 0x45
    #define MART_ZINC 0x46
    #define MART_PPMAX 0x47

    #define MART_GUARDSPEC 0x49
    #define MART_DIREHIT 0x4A
    #define MART_XATTACK 0x4B
    #define MART_XDEFEND 0x4C
    #define MART_XSPEED 0x4D
    #define MART_XACCURACY 0x4E
    #define MART_XSPECIAL 0x4F
    #define MART_POKEDOLL 0x50
    #define MART_FLUFFYTAIL 0x51

    #define MART_SUPERREPEL 0x53
    #define MART_MAXREPEL 0x54
    #define MART_ESCAPEROPE 0x55
    #define MART_REPEL 0x56






    #define MART_SUNSTONE 0x5D
    #define MART_MOONSTONE 0x5E
    #define MART_FIRESTONE 0x5F
    #define MART_THUNDERSTONE 0x60
    #define MART_WATERSTONE 0x61
    #define MART_LEAFSTONE 0x62




    #define MART_TINYMUSHROOM 0x67
    #define MART_BIGMUSHROOM 0x68

    #define MART_PEARL 0x6A
    #define MART_BIGPEARL 0x6B
    #define MART_STARDUST 0x6C
    #define MART_STARPIECE 0x6D
    #define MART_NUGGET 0x6E
    #define MART_HEARTSCALE 0x6F









    #define MART_ORANGEMAIL 0x79
    #define MART_HARBORMAIL 0x7A
    #define MART_GLITTERMAIL 0x7B
    #define MART_MECHMAIL 0x7C
    #define MART_WOODMAIL 0x7D
    #define MART_WAVEMAIL 0x7E
    #define MART_BEADMAIL 0x7F
    #define MART_SHADOWMAIL 0x80
    #define MART_TROPICMAIL 0x81
    #define MART_DREAMMAIL 0x82
    #define MART_FABMAIL 0x83
    #define MART_RETROMAIL 0x84
    #define MART_CHERIBERRY 0x85
    #define MART_CHESTOBERRY 0x86
    #define MART_PECHABERRY 0x87
    #define MART_RAWSTBERRY 0x88
    #define MART_ASPEARBERRY 0x89
    #define MART_LEPPABERRY 0x8A
    #define MART_ORANBERRY 0x8B
    #define MART_PERSIMBERRY 0x8C
    #define MART_LUMBERRY 0x8D
    #define MART_SITRUSBERRY 0x8E
    #define MART_FIGYBERRY 0x8F
    #define MART_WIKIBERRY 0x90
    #define MART_MAGOBERRY 0x91
    #define MART_AGUAVBERRY 0x92
    #define MART_IAPAPABERRY 0x93
    #define MART_RAZZBERRY 0x94
    #define MART_BLUKBERRY 0x95
    #define MART_NANABBERRY 0x96
    #define MART_WEPEARBERRY 0x97
    #define MART_PINAPBERRY 0x98
    #define MART_POMEGBERRY 0x99
    #define MART_KELPSYBERRY 0x9A
    #define MART_QUALOTBERRY 0x9B
    #define MART_HONDEWBERRY 0x9C
    #define MART_GREPABERRY 0x9D
    #define MART_TAMATOBERRY 0x9E
    #define MART_CORNNBERRY 0x9F
    #define MART_MAGOSTBERRY 0xA0
    #define MART_RABUTABERRY 0xA1
    #define MART_NOMELBERRY 0xA2
    #define MART_SPELONBERRY 0xA3
    #define MART_PAMTREBERRY 0xA4
    #define MART_WATMELBERRY 0xA5
    #define MART_DURINBERRY 0xA6
    #define MART_BELUEBERRY 0xA7
    #define MART_LIECHIBERRY 0xA8
    #define MART_GANLONBERRY 0xA9
    #define MART_SALACBERRY 0xAA
    #define MART_PETAYABERRY 0xAB
    #define MART_APICOTBERRY 0xAC
    #define MART_LANSATBERRY 0xAD
    #define MART_STARFBERRY 0xAE
    #define MART_ENIGMABERRY 0xAF



    #define MART_BRIGHTPOWDER 0xB3
    #define MART_WHITEHERB 0xB4
    #define MART_MACHOBRACE 0xB5
    #define MART_EXPSHARE 0xB6
    #define MART_QUICKCLAW 0xB7
    #define MART_SOOTHEBELL 0xB8
    #define MART_MENTALHERB 0xB9
    #define MART_CHOICEBAND 0xBA
    #define MART_KINGSROCK 0xBB
    #define MART_SILVERPOWDER 0xBC
    #define MART_AMULETCOIN 0xBD
    #define MART_CLEANSETAG 0xBE
    #define MART_SOULDEW 0xBF
    #define MART_DEEPSEATOOTH 0xC0
    #define MART_DEEPSEASCALE 0xC1
    #define MART_SMOKEBALL 0xC2
    #define MART_EVERSTONE 0xC3
    #define MART_FOCUSBAND 0xC4
    #define MART_LUCKYEGG 0xC5
    #define MART_SCOPELENS 0xC6
    #define MART_METALCOAT 0xC7
    #define MART_LEFTOVERS 0xC8
    #define MART_DRAGONSCALE 0xC9
    #define MART_LIGHTBALL 0xCA
    #define MART_SOFTSAND 0xCB
    #define MART_HARDSTONE 0xCC
    #define MART_MIRACLESEED 0xCD
    #define MART_BLACKGLASSES 0xCE
    #define MART_BLACKBELT 0xCF
    #define MART_MAGNET 0xD0
    #define MART_MYSTICWATER 0xD1
    #define MART_SHARPBEAK 0xD2
    #define MART_POISONBARB 0xD3
    #define MART_NEVERMELTICE 0xD4
    #define MART_SPELLTAG 0xD5
    #define MART_TWISTEDSPOON 0xD6
    #define MART_CHARCOAL 0xD7
    #define MART_DRAGONFANG 0xD8
    #define MART_SILKSCARF 0xD9
    #define MART_UPGRADE 0xDA
    #define MART_SHELLBELL 0xDB
    #define MART_SEAINCENSE 0xDC
    #define MART_LAXINCENSE 0xDD
    #define MART_LUCKYPUNCH 0xDE
    #define MART_METALPOWDER 0xDF
    #define MART_THICKCLUB 0xE0
    #define MART_STICK 0xE1




























    #define MART_REDSCARF 0xFE
    #define MART_BLUESCARF 0xFF
    #define MART_PINKSCARF 0x100
    #define MART_GREENSCARF 0x101
    #define MART_YELLOWSCARF 0x102
    #define MART_MACHBIKE 0x103
    #define MART_COINCASE 0x104
    #define MART_ITEMFINDER 0x105
    #define MART_OLDROD 0x106
    #define MART_GOODROD 0x107
    #define MART_SUPERROD 0x108
    #define MART_SSTICKET 0x109
    #define MART_CONTESTPASS 0x10A

    #define MART_WAILMERPAIL 0x10C
    #define MART_DEVONGOODS 0x10D
    #define MART_SOOTSACK 0x10E
    #define MART_BASEMENTKEY 0x10F
    #define MART_ACROBIKE 0x110
    #define MART_POKEBLOCKCASE 0x111
    #define MART_LETTER 0x112
    #define MART_EONTICKET 0x113
    #define MART_REDORB 0x114
    #define MART_BLUEORB 0x115
    #define MART_SCANNER 0x116
    #define MART_GOGOGGLES 0x117
    #define MART_METEORITE 0x118
    #define MART_RM1KEY 0x119
    #define MART_RM2KEY 0x11A
    #define MART_RM4KEY 0x11B
    #define MART_RM6KEY 0x11C
    #define MART_STORAGEKEY 0x11D
    #define MART_ROOTFOSSIL 0x11E
    #define MART_CLAWFOSSIL 0x11F
    #define MART_DEVONSCOPE 0x120
    #define MART_TM01 0x121
    #define MART_TM02 0x122
    #define MART_TM03 0x123
    #define MART_TM04 0x124
    #define MART_TM05 0x125
    #define MART_TM06 0x126
    #define MART_TM07 0x127
    #define MART_TM08 0x128
    #define MART_TM09 0x129
    #define MART_TM10 0x12A
    #define MART_TM11 0x12B
    #define MART_TM12 0x12C
    #define MART_TM13 0x12D
    #define MART_TM14 0x12E
    #define MART_TM15 0x12F
    #define MART_TM16 0x130
    #define MART_TM17 0x131
    #define MART_TM18 0x132
    #define MART_TM19 0x133
    #define MART_TM20 0x134
    #define MART_TM21 0x135
    #define MART_TM22 0x136
    #define MART_TM23 0x137
    #define MART_TM24 0x138
    #define MART_TM25 0x139
    #define MART_TM26 0x13A
    #define MART_TM27 0x13B
    #define MART_TM28 0x13C
    #define MART_TM29 0x13D
    #define MART_TM30 0x13E
    #define MART_TM31 0x13F
    #define MART_TM32 0x140
    #define MART_TM33 0x141
    #define MART_TM34 0x142
    #define MART_TM35 0x143
    #define MART_TM36 0x144
    #define MART_TM37 0x145
    #define MART_TM38 0x146
    #define MART_TM39 0x147
    #define MART_TM40 0x148
    #define MART_TM41 0x149
    #define MART_TM42 0x14A
    #define MART_TM43 0x14B
    #define MART_TM44 0x14C
    #define MART_TM45 0x14D
    #define MART_TM46 0x14E
    #define MART_TM47 0x14F
    #define MART_TM48 0x150
    #define MART_TM49 0x151
    #define MART_TM50 0x152
    #define MART_HM01 0x153
    #define MART_HM02 0x154
    #define MART_HM03 0x155
    #define MART_HM04 0x156
    #define MART_HM05 0x157
    #define MART_HM06 0x158
    #define MART_HM07 0x159
    #define MART_HM08 0x15A


    #define MART_OAKSPARCEL 0x15D
    #define MART_POKEFLUTE 0x15E
    #define MART_SECRETKEY 0x15F
    #define MART_BIKEVOUCHER 0x160
    #define MART_GOLDTEETH 0x161
    #define MART_OLDAMBER 0x162
    #define MART_CARDKEY 0x163
    #define MART_LIFTKEY 0x164
    #define MART_HELIXFOSSIL 0x165
    #define MART_DOMEFOSSIL 0x166
    #define MART_SILPHSCOPE 0x167
    #define MART_BICYCLE 0x168
    #define MART_TOWNMAP 0x169
    #define MART_VSSEEKER 0x16A
    #define MART_FAMECHECKER 0x16B
    #define MART_TMCASE 0x16C
    #define MART_BERRYPOUCH 0x16D
    #define MART_TEACHYTV 0x16E
    #define MART_TRIPASS 0x16F
    #define MART_RAINBOWPASS 0x170
    #define MART_TEA 0x171
    #define MART_MYSTICTICKET 0x172
    #define MART_AURORATICKET 0x173
    #define MART_POWDERJAR 0x174
    #define MART_RUBY 0x175
    #define MART_SAPPHIRE 0x176
    #define MART_MAGMAEMBLEM 0x177
    #define MART_OLDSEAMAP 0x178

    #define DEC_SMALLDESK 0x1
    #define DEC_POKEMONDESK 0x2
    #define DEC_HEAVYDESK 0x3
    #define DEC_RAGGEDDESK 0x4
    #define DEC_COMFORTDESK 0x5
    #define DEC_PRETTYDESK 0x6
    #define DEC_BRICKDESK 0x7
    #define DEC_CAMPDESK 0x8
    #define DEC_HARDDESK 0x9
    #define DEC_SMALLCHAIR 0xA
    #define DEC_POKEMONCHAIR 0xB
    #define DEC_HEAVYCHAIR 0xC
    #define DEC_PRETTYCHAIR 0xD
    #define DEC_COMFORTCHAIR 0xE
    #define DEC_RAGGEDCHAIR 0xF
    #define DEC_BRICKCHAIR 0x10
    #define DEC_CAMPCHAIR 0x11
    #define DEC_HARDCHAIR 0x12
    #define DEC_REDPLANT 0x13
    #define DEC_TROPICALPLANT 0x14
    #define DEC_PRETTYFLOWERS 0x15
    #define DEC_COLORFULPLANT 0x16
    #define DEC_BIGPLANT 0x17
    #define DEC_GORGEOUSPLANT 0x18
    #define DEC_REDBRICK 0x19
    #define DEC_YELLOWBRICK 0x1A
    #define DEC_REDBALLOON 0x1B
    #define DEC_BLUEBALLOON 0x1C
    #define DEC_YELLOWBALLOON 0x1D
    #define DEC_REDTENT 0x1F
    #define DEC_BLUETENT 0x20
    #define DEC_SOLIDBOARD 0x21
    #define DEC_SLIDE 0x22
    #define DEC_FENCELENGTH 0x23
    #define DEC_FENCEWIDTH 0x24
    #define DEC_TIRE 0x25
    #define DEC_STAND 0x26
    #define DEC_MUDBALL 0x27
    #define DEC_BREAKABLEDOOR 0x28
    #define DEC_SANDORNAMENT 0x29
    #define DEC_SILVERSHIELD 0x2A
    #define DEC_GOLDSHIELD 0x2B
    #define DEC_GLASSORNAMENT 0x2C
    #define DEC_ROUNDTV 0x2E
    #define DEC_CUTETV 0x2F
    #define DEC_GLITTERMAT 0x30
    #define DEC_JUMPMAT 0x31
    #define DEC_SPINMAT 0x32
    #define DEC_CLOWNOTEMAT 0x33
    #define DEC_DNOTEMAT 0x34
    #define DEC_ENOTEMAT 0x35
    #define DEC_FNOTEMAT 0x36
    #define DEC_GNOTEMAT 0x37
    #define DEC_ANOTEMAT 0x38
    #define DEC_BNOTEMAT 0x39
    #define DEC_CHIGHNOTEMAT 0x3A
    #define DEC_SURFMAT 0x3B
    #define DEC_THUNDERMAT 0x3C
    #define DEC_FIREBLASTMAT 0x3D
    #define DEC_POWDERSNOWMAT 0x3E
    #define DEC_ATTRACTMAT 0x3F
    #define DEC_FISSUREMAT 0x40
    #define DEC_SPIKESMAT 0x41
    #define DEC_BALLPOSTER 0x42
    #define DEC_GREENPOSTER 0x43
    #define DEC_REDPOSTER 0x44
    #define DEC_BLUEPOSTER 0x45
    #define DEC_CUTEPOSTER 0x46
    #define DEC_PIKAPOSTER 0x47
    #define DEC_LONGPOSTER 0x48
    #define DEC_SEAPOSTER 0x49
    #define DEC_SKYPOSTER 0x4A
    #define DEC_KISSPOSTER 0x4B
    #define DEC_PICHUDOLL 0x4C
    #define DEC_PIKACHUDOLL 0x4D
    #define DEC_MARILLDOLL 0x4E
    #define DEC_TOGEPIDOLL 0x4F
    #define DEC_CYNDAQUILDOLL 0x50
    #define DEC_CHIKORITADOLL 0x51
    #define DEC_TOTODILEDOLL 0x52
    #define DEC_JIGGLYPUFFDOLL 0x53
    #define DEC_MEOWTHDOLL 0x54
    #define DEC_CLEFAIRYDOLL 0x55
    #define DEC_DITTODOLL 0x56
    #define DEC_SMOOCHUMDOLL 0x57
    #define DEC_TREECKODOLL 0x58
    #define DEC_TORCHICDOLL 0x59
    #define DEC_MUDKIPDOLL 0x5A
    #define DEC_DUSKULLDOLL 0x5B
    #define DEC_WYNAUTDOLL 0x5C
    #define DEC_BALTOYDOLL 0x5D
    #define DEC_KECLEONDOLL 0x5E
    #define DEC_AZURILLDOLL 0x5F
    #define DEC_SKITTYDOLL 0x60
    #define DEC_SWABLUDOLL 0x61
    #define DEC_GULPINDOLL 0x62
    #define DEC_LOTADDOLL 0x63
    #define DEC_SEEDOTDOLL 0x64
    #define DEC_PIKACUSHION 0x65
    #define DEC_ROUNDCUSHION 0x66
    #define DEC_KISSCUSHION 0x67
    #define DEC_ZIGZAGCUSHION 0x68
    #define DEC_SPINCUSHION 0x69
    #define DEC_DIAMONDCUSHION 0x6A
    #define DEC_BALLCUSHION 0x6B
    #define DEC_GRASSCUSHION 0x6C
    #define DEC_FIRECUSHION 0x6D
    #define DEC_WATERCUSHION 0x6E
    #define DEC_SNORLAXDOL 0x6F
    #define DEC_RHYDONDOLL 0x70
    #define DEC_LAPRASDOLL 0x71
    #define DEC_VENUSAURDOLL 0x72
    #define DEC_CHARIZARDDOLL 0x73
    #define DEC_BLASTOISEDOLL 0x74
    #define DEC_WAILMERDOLL 0x75
    #define DEC_REGIROCKDOLL 0x76
    #define DEC_REGICEDOLL 0x77
    #define DEC_REGISTEELDOLL 0x78


    __________________
    x
    Luna <3
    Reply With Quote
      #16    
    Old October 13th, 2017 (2:43 AM).
    EddyHg80's Avatar
    EddyHg80 EddyHg80 is offline
       
      Join Date: Jan 2014
      Age: 20
      Gender: Male
      Posts: 29
      Hi I just wanted to link you the Emerald flag and var list made by Dizzy Egg!

      https://www.pokecommunity.com/showthread.php?p=9600980#post9600980

      Btw awesome work
      Reply With Quote
        #17    
      Old October 13th, 2017 (11:41 AM). Edited November 27th, 2017 by Avara.
      Avara's Avatar
      Avara Avara is offline
      Author Of Tales
      • Moderator
       
      Join Date: Dec 2011
      Location: Avlar
      Gender: Female
      Nature: Adamant
      Posts: 662
      Give, Take & Check For Money

      To check if your player has a certain amount of money, we use the checkmoney command like so:
      Quote:
      Originally Posted by Avara View Post
      checkmoney 0x[Amount In Hex] 0x0
      compare LASTRESULT 0x1
      if [More/Less/EqualTo] goto @pointer
      For the [More/Less/EqualTo] part, remember this from the item section?
      Quote:
      Originally Posted by Avara View Post
      0x0 = Lower Than
      0x1 = Equal To
      0x2 = Greater Than
      0x3 = Lower Than or Equal To
      0x4 = Greater Than or Equal To
      These apply here too - meaning if the player has what we want them to have, we goto @pointer. What if we wanted to check if a player has less than the amount specified? Here's a fuller example:
      Quote:
      Originally Posted by Avara View Post
      #org @start
      lock
      faceplayer
      checkmoney 0x2710 0x0
      compare LASTRESULT 0x1
      if 0x0 goto @HasCorrectAmount
      msgbox @IncorrectAmountMsg 0x6
      release
      end

      #org @HasCorrectAmount
      msgbox @HasCorrectAmountMsg 0x6
      release
      end

      #org @HasCorrectAmountMsg
      = Oh, you don't have very much\nmoney.

      #org @IncorrectAmountMsg
      = Wow, you have lots of money!
      Let's pretend this is a script for an obnoxious rich kid NPC. If the player has more than or exactly $10,000 (0x2710), our rich kid will mention how rich. If the player has less than that (if 0x0, our rich kid will make a snarky comment about their perceived lack of money =P

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      To give your player a certain amount of money, the givemoney command is extremely straightforward.
      Quote:
      Originally Posted by Avara
      givemoney 0x[Amount In Hex] 0x0
      Let's give our player $10,000 so he can be as well off as Obnoxious Rich Kid from earlier:
      Quote:
      Originally Posted by Avara
      givemoney 0x2710 0x0
      Okay, now your player is now pretty comfortable financially. Let's take it all away from them again using paymoney, which is set up just the same.
      Quote:
      Originally Posted by Avara
      paymoney 0x[Amount In Hex] 0x0
      As you can probably guess, this makes the player pay up the specified amount. Before you use this command in a script, I recommend you actually check if the player has the desired amount that you want to be taken from them in the first place.
      Quote:
      Originally Posted by Avara
      #org @main
      lock
      faceplayer
      checkmoney 0x2710 0x0
      compare LASTRESULT 0x1
      if 0x4 goto @MoneyCanBeTaken
      [...]

      #org @MoneyCanBeTaken
      paymoney 0x2710 0x0
      [...]
      -----------------------------------------------------------------------------------------------------------------------------------------------------
      Pokémarts, as we know, show the player's amount of money then update it when an item is purchased and money is taken, complete with a sound effect. What if we wanted to replicate that, minus the list of buyable items? I'll start by explaining how to show the player's money:
      Quote:
      Originally Posted by Avara
      showmoney 0x[X-Co-ord] 0x[Y-Co-ord] 0x0
      The X and Y co-ordinates pertain to the position of the box on the screen. Hiding the money box is also just a single line:
      Quote:
      Originally Posted by Avara
      hidemoney 0x[X-Co-ord] 0x[Y-Co-ord]
      The following is a script for a NPC who sells... eh, Heart Scales or something.
      Quote:
      Originally Posted by Avara
      #org @main
      lock
      faceplayer
      showmoney 0x0 0x0 0x0
      msgbox @OfferMsg 0x5
      compare 0x800D 0x1
      if 0x1 goto @AcceptedOffer
      msgbox @DeclinedMsg 0x6
      hidemoney 0x0 0x0
      release
      end

      #org @AcceptedOffer
      checkmoney 0x1F4 0x0
      compare LASTRESULT 0x1
      if 0x4 goto @Transaction
      msgbox @IncorrectAmountMsg 0x6
      hidemoney 0x0 0x0
      release
      end

      #org @NoRoom
      msgbox @NoRoomMsg 0x6
      hidemoney 0x0 0x0
      release
      end

      #org @Transaction
      checkitemroom 0x6F 0x1
      compare LASTRESULT 0x0
      if 0x1 goto @NoRoom
      paymoney 0x1F4 0x0
      sound 0x58
      updatemoney 0x0 0x0 0x0
      msgbox @TransactionMsg 0x6
      additem 0x6F 0x1
      hidemoney 0x0 0x0
      release
      end

      #org @OfferMsg
      = Hi! Would you like to buy a Heart\nScale for [$]500?

      #org @IncorrectAmountMsg
      = Oh, you can't afford one.

      #org @DeclinedMsg
      = Not interested?

      #org @NoRoomMsg
      = You don't have room for it.

      #org @TransactionMsg
      = Thank you!\nPlease come again!
      First, we display their money in the top left-hand corner of the screen and ask the player whether or not they'd like to buy an incredibly useful Heart Scale. If the player decines this incredible offer the money display box closes, our script ends and they are free to go. If the player says "Yes", the script will goto @AcceptedOffer then check if they have $500 (0x1F4). If they can't afford it, the script will also close everything and end. Having the required amount of $$$ takes us to @Transaction, where as long as the player has enough space for the item in their bag, we can go ahead with the exchange - if their bag is full the script will close. sound 0x58 plays a mart transaction noise as the player's money updates. We use additem as opposed to giveitem here, as it adds the item to the player's bag silently.

      -----------------------------------------------------------------------------------------------------------------------------------------------------
      Coins

      Coins are used mainly in the Game Corner of the canon games, but since we're ROM hacking, you could use them for anything. Coin commands are very similar to the ones for money, so they don't require too much explanation, hopefully! To show, update and hide the box which shows the player's coins:
      Quote:
      Originally Posted by Avara
      showcoins 0x[X-Co-ord] 0x[Y-Co-ord]
      Quote:
      Originally Posted by Avara
      updatecoins 0x[X-Co-ord] 0x[Y-Co-ord]
      Quote:
      Originally Posted by Avara
      hidecoins 0x[X-Co-ord] 0x[Y-Co-ord]
      If you want to add coins to the player's Coin Case, you only need one short line.
      Quote:
      Originally Posted by Avara
      givecoins 0x[Amount In Hex]
      Practically the same for taking coins away, just a different command name:
      Quote:
      Originally Posted by Avara
      removecoins 0x[Amount In Hex]
      -----------------------------------------------------------------------------------------------------------------------------------------------------
      Pokémarts

      So, we now know how to check, give and take amounts of money, plus coins. Since we referred to Marts earlier, why don't we cover those to tie up the money stuff?

      Quote:
      Originally Posted by Avara
      #dynamic 0x800000

      #org @main
      lock
      faceplayer
      preparemsg @MartGreetingMsg
      waitmsg
      pokemart @MartItemsList
      msgbox @MartLeavingMsg 0x6
      release
      end

      #org @MartGreetingMsg
      = Welcome!\pHow may I help you?

      #org @MartLeavingMsg
      = Please come again!

      #org @MartItemsList
      #raw word 0x4
      #raw word 0xD
      #raw word 0xE
      #raw word 0x12
      #raw word 0x11
      #raw word 0x0
      Alternatively, if you make use of the stdmart.rbh header file I made, you could have this instead:
      Quote:
      Originally Posted by Avara
      #dynamic 0x800000
      #include stdmart.rbh

      #org @main
      lock
      faceplayer
      preparemsg @MartGreetingMsg
      waitmsg
      pokemart @MartItemsList
      msgbox @MartLeavingMsg 0x6
      release
      end

      #org @MartGreetingMsg
      = Welcome!\pHow may I help you?

      #org @MartLeavingMsg
      = Please come again!

      #org @MartItemsList
      #raw MART_POKEBALL
      #raw MART_POTION
      #raw MART_ANTIDOTE
      #raw MART_PARLYZHEAL
      #raw MART_AWAKENING
      #raw MART_END
      __________________
      x
      Luna <3
      Reply With Quote
        #18    
      Old October 13th, 2017 (12:26 PM). Edited 3 Weeks Ago by Avara.
      Avara's Avatar
      Avara Avara is offline
      Author Of Tales
      • Moderator
       
      Join Date: Dec 2011
      Location: Avlar
      Gender: Female
      Nature: Adamant
      Posts: 662
      Battle Scripts

      First, we're going to learn how to make a wild Pokémon battle, useful for legendary encounters and such. We'll cover trainer battles a little later! The wildbattle command is set up like this:
      Quote:
      Originally Posted by Avara
      wildbattle 0x[Pokémon] 0x[Level In Hex] 0x[Held Item]
      Imagine we wanted to battle a level 50 Milotic holding Mystic Water:
      Quote:
      Originally Posted by Avara
      #dynamic 0x800000

      #org @main
      ...
      wildbattle 0x149 0x32 0xD1
      ...
      0x149 is Milotic's ID, 0x32 is 50 in hex, and 0xD1 is the item Mystic Water's ID. Click here for Pokémon/Item hex IDs if needed.

      Wild Battle Result Check: [FR]
      Spoiler:
      wildbattle 0x[Pokémon] 0x[Level In Hex] 0x[Held Item]
      special2 LASTRESULT 0xB4
      compare LASTRESULT 0x1
      if 0x1 goto @DefeatedPointer
      compare LASTRESULT 0x4
      if 0x1 goto @RanPointer
      hidesprite LASTTALKED
      setflag 0x[OW's Person ID in A-Map]
      release
      end


      Wild Battle Result Check: [EM]
      Spoiler:
      wildbattle 0x[Pokémon] 0x[Level In Hex] 0x[Held Item]
      special2 LASTRESULT 0xB7
      compare LASTRESULT 0x1
      if 0x1 goto @DefeatedPointer
      compare LASTRESULT 0x4
      if 0x1 goto @RanPointer
      hidesprite LASTTALKED
      setflag 0x[OW's Person ID in A-Map]
      release
      end

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      Next we're going to move on to trainer battles, the command for these isn't as straightforward as it seems at first glance.
      Quote:
      Originally Posted by Avara
      trainerbattle 0x[Type Of Battle] 0x[Trainer's ID in Hex] 0x0
      You can find a trainer's hex ID in any trainer editing tool, but what do I mean by "type of battle"? I'm going to list these one at a time. As I'm covering both FireRed[FR] and Emerald[EM], keep in mind that FR has the VS Seeker whereas EM has the Match Call function instead, so some types of trainer battle may not work correctly in a certain ROM.

      trainerbattle 0x0 [FR] [EM]

      This battle type is exactly the same in FR as it is in EM, used for standard trainer battles. Here's an example script:
      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x0 0x001 0x0 @EncounterText @DefeatText
      msgbox @AfterBattle 0x6
      end

      #org @EncounterText
      = I challenge you!

      #org @DefeatText
      = You beat me[.]

      #org @AfterBattle
      = I'll say this after you've\nbattled me.
      We're just using Trainer ID 0x001 for the sake of consistency.

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x1 [FR] [EM]

      0x1 is used for Gym Leaders in both FR and EM. If you open up a Gym Leader's script in your ROM of choice, you'll be able to see that there's quite a bit going on, such as setting or clearing special flag(s). For this example script, we don't have any of that, just a basic Gym Battle that ends in the player receiving a Badge and TM as a reward for winning:
      Quote:
      Originally Posted by Avara
      #org @start
      lock
      faceplayer
      checkflag 0x231
      if 0x1 goto @Defeated
      trainerbattle 0x1 0x001 0x0 @EncounterText @DefeatText @WonPointer
      release
      end

      #org @Defeated
      msgbox @AfterBattle 0x6
      release
      end

      #org @WonPointer
      msgbox @BadgeInfomsg 0x6
      checkitemroom 0x142 0x1
      compare LASTRESULT 0x0
      if 0x1 goto @BagFull
      additem 0x142 0x1
      msgbox @ReceivedTMmsg 0x4
      closeonkeypress
      setflag 0x231
      msgbox @TMInfomsg 0x6
      release
      end

      #org @BagFull
      msgbox @BagFullmsg 0x6
      release
      end

      #org @EncounterText
      = I challenge you!

      #org @DefeatText
      = You beat me[.]

      #org @AfterBattle
      = I'll say this after you've\nbattled me.

      #org @BadgeInfomsg
      = Please, take the X Badge and this\nTM!

      #org @ReceivedTMmsg
      = [player] received TMX\nfrom the Gym Leader.

      #org @TMInfomsg
      = TM01 contains X move!

      #org @BagFullmsg
      = You don't have enough space in\nyour bag.
      Just like before, we've got pointers for the initial encounter text, the message that displays when you win the battle and for after the battle. Although the Gen III games have special flags set aside for Badge functionality, I used 0x231 here for the sake of easiness, as well as Trainer ID 0x001 again. Notice that beside @DefeatText we have @WonPointer which contains the section of the script that rewards the player. If you've been paying close attention or have scripting experience already, you should know what everything else is for by now!

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x2 [EM]

      This battle type isn't used in FireRed. It's used with the PokéNav's Match Call rematches - see the Emerald section of trainerbattle 0x5.

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x3 [FR] [EM]

      0x3 is unique in that it allows the script to continue once the player wins the battle, as opposed to displaying a few messages and ending.
      Quote:
      Originally Posted by Avara
      ...
      trainerbattle 0x3 0x001 0x0 @DefeatText
      ...

      #org @DefeatText
      = You beat me[.]
      Substitute the "..."'s for whatever you like and that's pretty much it! All you need is a trainer ID and a pointer for the defeat text.

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x4 [FR] [EM]

      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x4 0x001 0x0 @EncounterText @DefeatText @OnlyOnePoke
      msgbox @AfterBattle 0x6
      end

      #org @EncounterText
      = We challenge you!

      #org @DefeatText
      = You beat us[.]

      #org @AfterBattle
      = We'll say this after you've\nbattled us.

      #org @OnlyOnePoke
      = You can't double battle with only\none Pokémon!
      The trainerbattle commands concerning double battles have a nice built-in check - if the player only has one party member, the battle won't happen.

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x5 [FR] [EM]

      0x5 has different uses depending on your ROM. In FireRed, it's used for VS Seeker rematches.
      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x0 0x001 0x0 @EncounterText1 @DefeatText
      special2 LASTRESULT 0x39
      compare LASTRESULT 0x1
      if 0x1 goto @RematchPointer
      msgbox @AfterBattle 0x6
      end

      #org @RematchPointer
      trainerbattle 0x5 0x001 0x0 @EncounterText2 @DefeatText
      msgbox @AfterBattle 0x6
      end

      #org @EncounterText1
      = I challenge you!

      #org @EncounterText2
      = I challenge you again!

      #org @DefeatText
      = You beat me[.]

      #org @AfterBattle
      = I'll say this after you've\nbattled me.
      The first part closely resembles a standard trainer battle, using trainerbattle 0x0 and its usual parameters. The special2 LASTRESULT 0x39 and the following couple of lines correspond to the VS Seeker - don't worry too much about that for now! @RematchPointer contains, as labelled, our rematch - which is set up exactly the same as a standard battle, except we've used trainerbattle 0x5 as our prefix instead.

      In Emerald, we don't have the VS Seeker - we've got Match Call instead. For single rematches, we'd need a script like this:
      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x2 0x001 0x0 @EncounterText1 @DefeatText1 @NavPointer
      special2 LASTRESULT 0x3C
      compare LASTRESULT 0x1
      if 0x1 goto @RematchPointer
      msgbox @AfterBattle 0x6
      release
      end

      #org @NavPointer
      special 0x207
      waitmovement 0x0
      msgbox @PokenavMsg 0x6
      setvar 0x8004 0x001
      special 0x1E9
      registernav 0x001
      release
      end

      #org @RematchPointer
      trainerbattle 0x5 0x001 0x0 @EncounterText2 @DefeatText2
      msgbox @AfterBattle 0x6
      end

      #org @EncounterText1
      = I challenge you!

      #org @DefeatText1
      = You beat me[.]

      #org @PokenavMsg
      = Do you have a PokéNav?

      #org @EncounterText2
      = I challenge you again!

      #org @DefeatText2
      = You beat me again[.]

      #org @AfterBattle
      = I'll say this after you've\nbattled me.
      Again, we're focusing mainly on the battle stuff, so don't worry too much about what the specials are there for. Notice that we've used trainerbattle 0x2 for the first part, which otherwise looks like a standard battle script; only we've got @NavPointer at the end to allow this trainer to be registered in the player's PokéNav. Our @RematchPointer looks the same as a standard trainer battle, only with 0x5 as the battle type instead of 0x0.

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x6 [EM]

      Do you remember how trainerbattle 0x1, commonly used for Gym Leaders, allowed you to go to an extra pointer after the defeat text("You beat me..."), but before the default final message("I'll say this after you've battled me")? Trainerbattle 0x6 also allows for this in double battles. In EM it's used often with Gabby&Ty. It has no known use in FireRed.
      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x6 0x001 0x0 @EncounterText @DefeatText @OnlyOnePoke @ExtraPointer
      msgbox @AfterBattle 0x6
      release
      end

      #org @EncounterText
      = We challenge you!

      #org @DefeatText
      = You beat us[.]

      #org @AfterBattle
      = We'll say this after you've\nbattled us.

      #org @OnlyOnePoke
      = You can't double battle with only\none Pokémon!

      #org @ExtraPointer
      ...
      Seems familiar by now, right? At least, I hope it does =P

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x7 [FR] [EM]
      This type of trainerbattle has different uses in either ROM. In FR 0x7 tied to the VS Seeker, this time for double battle rematches! It's used in conjunction with trainerbattle 0x4, like this:
      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x4 0x001 0x0 @EncounterText1 @DefeatText @OnlyOnePoke
      special2 LASTRESULT 0x39
      compare LASTRESULT 0x1
      if 0x1 goto @RematchPointer
      msgbox @AfterBattle 0x6
      end

      #org @RematchPointer
      trainerbattle 0x7 0x001 0x0 @EncounterText2 @DefeatText @OnlyOnePoke
      msgbox @AfterBattle 0x6
      end

      #org @EncounterText1
      = We challenge you!

      #org @EncounterText2
      = We challenge you again!

      #org @DefeatText
      = You beat us[.]

      #org @AfterBattle
      = We'll say this after you've\nbattled us.

      #org @OnlyOnePoke
      = You can't double battle with only\none Pokémon!
      In Emerald, trainerbattle 0x7 is used for double battle rematches through Match Call.

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      trainerbattle 0x8 [EM]

      The only instance I can think of for trainerbattle 0x8 is Tate & Liza's Gym - seeing as all the Gym Leaders have double battle rematches in EM, it's used with 0x7. So, it's a double Gym battle followed by a double battle rematch, I suppose.
      Quote:
      Originally Posted by Avara
      #org @start
      trainerbattle 0x8 0x001 0x0 @EncounterText1 @DefeatText @OnlyOnePoke @ExtraPointer
      special2 LASTRESULT 0x3C
      compare LASTRESULT 0x1
      if 0x1 goto @RematchPointer
      msgbox @AfterBattle 0x6
      release
      end

      #org @ExtraPointer
      fanfare 0x171
      preparemsg @ReceivedBadgemsg
      waitmsg
      waitfanfare
      ...
      release
      end

      #org @RematchPointer
      trainerbattle 0x7 0x001 0x0 @EncounterText2 @DefeatText @OnlyOnePoke
      msgbox @AfterBattle 0x6
      end

      #org @EncounterText1
      = We challenge you!

      #org @EncounterText2
      = We challenge you again!

      #org @DefeatText
      = You beat us[.]

      #org @AfterBattle
      = We'll say this after you've\nbattled us.

      #org @OnlyOnePoke
      = You can't double battle with only\none Pokémon!

      #org @ReceivedBadgemsg
      = [player] received the X Badge\nfrom the Gym Leaders.
      -----------------------------------------------------------------------------------------------------------------------------------------------------

      -----------------------------------------------------------------------------------------------------------------------------------------------------

      __________________
      x
      Luna <3
      Reply With Quote
        #19    
      Old October 13th, 2017 (12:27 PM). Edited 3 Weeks Ago by Avara.
      Avara's Avatar
      Avara Avara is offline
      Author Of Tales
      • Moderator
       
      Join Date: Dec 2011
      Location: Avlar
      Gender: Female
      Nature: Adamant
      Posts: 662
      Display Pokémon Sprite

      The showpokepic command is set up like this:
      Quote:
      Originally Posted by Avara
      showpokepic 0x[Pokémon ID] 0x[X-Co-ord On Screen] 0x[Y-Co-ord On Screen]
      Let's use it in a script.
      Quote:
      Originally Posted by Avara
      #org @start
      lock
      faceplayer
      showpokepic 0x4 0xA 0x3
      msgbox @msg 0x4
      closeonkeypress
      hidepokepic
      release
      end

      #org @msg
      = I'm looking for this Pokémon.
      0x4 is the ID for Charmander, 0xA 0x3 places the box containing the sprite in the middle of the screen so that it ends up looking like this:

      __________________
      x
      Luna <3
      Reply With Quote
        #20    
      Old October 13th, 2017 (12:33 PM). Edited October 13th, 2017 by DizzyEgg.
      DizzyEgg's Avatar
      DizzyEgg DizzyEgg is offline
         
        Join Date: Feb 2014
        Location: Poland
        Age: 20
        Gender: Male
        Nature: Quiet
        Posts: 716
        It's such a nice tutorial, you must have put lot of work into that. Why tho, I'm sure XSE will get replaced soon.
        __________________
        Support Pokeruby!

        My works:
        Battle Engine Upgrade
        Pokemon Expansion
        Items/TMs/Tutors Expansion
        Various Features(Evo Methods, BW Repel, Levels Above 100, Trainers with EV, Nature Colored Stats)

        Emerald Features:
        Form Changes (KDS)
        Reply With Quote
          #21    
        Old October 13th, 2017 (1:53 PM). Edited October 13th, 2017 by Avara.
        Avara's Avatar
        Avara Avara is offline
        Author Of Tales
        • Moderator
         
        Join Date: Dec 2011
        Location: Avlar
        Gender: Female
        Nature: Adamant
        Posts: 662
        Quote:
        Originally Posted by DizzyEgg View Post
        It's such a nice tutorial, you must have put lot of work into that. Why tho, I'm sure XSE will get replaced soon.
        Cheers! From what little I've seen from messing around with script-related stuff in pokeruby it seems like a lot of it is fairly similar to XSE command wise. I didn't have too much trouble following it seeing as I already know this part, so I figured if people can pick this up in the meantime it might still be beneficial to them in some way later down the line! When the disassembly is done I'd be happy to take on the task of making the tutorial for scripting via that too if that's something that would be needed =)
        __________________
        x
        Luna <3
        Reply With Quote
          #22    
        Old October 13th, 2017 (2:23 PM). Edited October 13th, 2017 by Avara.
        Avara's Avatar
        Avara Avara is offline
        Author Of Tales
        • Moderator
         
        Join Date: Dec 2011
        Location: Avlar
        Gender: Female
        Nature: Adamant
        Posts: 662
        sethealingplace

        You'll notice that all Pokémon Centers host a level script containing something along these lines:


        What does this do? On entering the building, this script runs to make sure the player respawns at the last-visited Pokémon Center on white-out.

        sethealingplace IDs: [FR]
        Spoiler:
        0x01 = Player's House
        0x02 = Viridian City
        0x03 = Pewter City
        0x04 = Cerulean City
        0x05 = Lavender Town
        0x06 = Vermilion City
        0x07 = Celadon City
        0x08 = Fuchsia City
        0x09 = Cinnabar Island
        0x0A = Indigo Plateau/Pokemon League Entrance
        0x0B = Saffron City
        0x0C = Route 4/Mt. Moon Entrance
        0x0D = Route 10/Rock Tunnel Entrance
        0x0E = One Island
        0x0F = Two Island
        0x10 = Three Island
        0x11 = Four Island
        0x12 = Five Island
        0x13 = Seven Island
        0x14 = Six Island


        sethealingplace IDs: [EM]
        Spoiler:
        0x01 = Player's Room (male)
        0x02 = Player's Room (female)
        0x03 = Petalburg City
        0x04 = Slateport City
        0x05 = Mauville City
        0x06 = Rustboro City
        0x07 = Fortree City
        0x08 = Lilycove City
        0x09 = Mossdeep City
        0x0A = Sootopolis City
        0x0B = Ever Grande City (Victory Road)
        0x0C = Littleroot Town (left)
        0x0D = Littleroot Town (right)
        0x0E = Oldale Town
        0x0F = Dewford Town
        0x10 = Lavaridge Town
        0x11 = Fallarbor Town
        0x12 = Verdanturf Town
        0x13 = Pacifidlog Town
        0x14 = Ever Grande City (Pokemon League)
        0x15 = Southern Island
        0x16 = Battle Frontier


        __________________
        x
        Luna <3
        Reply With Quote
          #23    
        Old November 12th, 2017 (11:40 AM).
        Sakakii Sakakii is offline
           
          Join Date: Nov 2017
          Posts: 3
          I like this tutorial, will you do more?
          Reply With Quote
            #24    
          Old November 27th, 2017 (6:54 AM). Edited 4 Weeks Ago by Avara.
          Avara's Avatar
          Avara Avara is offline
          Author Of Tales
          • Moderator
           
          Join Date: Dec 2011
          Location: Avlar
          Gender: Female
          Nature: Adamant
          Posts: 662
          Weather

          Manipulating weather in the overworld is easy; all you need are these two lines in your script:
          Quote:
          Originally Posted by Avara
          setweather 0x[Weather]
          doweather
          We use setweather to define the weather type we'd like and doweather to activate it. For example, here's the kind of script we'd need to make it start raining:
          Quote:
          Originally Posted by Avara
          #org @start
          lock
          faceplayer
          msgbox @msg1 0x6
          setweather 0x3
          doweather
          msgbox @msg2 0x6
          release
          end

          #org @msg1
          = What a lovely day!

          #org @msg2
          = Oh[.] I spoke too soon.
          The following spoiler contains a list of weather types, accompanied by gifs that show how they look in-game:
          Spoiler:

          0x0 - Indoors (None)

          0x1 - Clouds in Water Reflection (can look strange)

          0x2 - Regular Weather

          0x3 - Raining

          0x4 - Light Snow

          0x5 - Storm (occasional lightning)

          0x6 - Steady Mist

          0x7 - Volcanic Ash

          0x8 - Sandstorm

          0x9 - Thick Fog

          0xA - Light Mist

          0xB - Overcast

          0xC - Strong Sun [EM]

          0xD - Heavy Thunderstorm

          0xE - Underwater Mist

          0xF - Alternating Strong Sun/Heavy Storm [EM]


          __________________
          x
          Luna <3
          Reply With Quote
            #25    
          Old November 27th, 2017 (7:34 AM). Edited 4 Weeks Ago by Avara.
          Avara's Avatar
          Avara Avara is offline
          Author Of Tales
          • Moderator
           
          Join Date: Dec 2011
          Location: Avlar
          Gender: Female
          Nature: Adamant
          Posts: 662
          Changing Map Tiles

          The "setmaptile" command, as you could probably guess, allows you to change a map's tiles. This is commonly used in the canon games for puzzles - such as Cinnabar's mansion where you interact with statues to open doors - but it can be used for anything, really.
          Quote:
          Originally Posted by Avara
          setmaptile 0x[X-Coordinate] 0x[Y-Coordinate] 0x[Block Number] 0x[Passable? - 0x0 = Passable, 0x1 = Not Passable]
          Your map editor should show the X and Y co-ordinates of the tile you want to change when you hover over it, same with the block number when selecting from the block palette. If you're using AdvanceMap, this data is shown at the bottom of the screen.
          In this example, I'm just going to make some flowers appear when you talk to someone in an unedited Emerald ROM. Nothing too fancy!
          Quote:
          Originally Posted by Avara
          #org @main
          lock
          faceplayer
          checkflag 0x250
          if 0x1 goto @done
          msgbox @msg1 0x6
          setmaptile 0x08 0x08 0x04 0x0
          setmaptile 0x09 0x08 0x04 0x0
          setmaptile 0x0A 0x08 0x04 0x0
          setmaptile 0x0B 0x08 0x04 0x0
          special 0x91
          setflag 0x250
          release
          end

          #org @done
          msgbox @msg2 0x6
          release
          end

          #org @msg1
          = Bellsprout, use Growth!

          #org @msg2
          = Aren't Grass-type Pokémon great?
          These X and Y co-ordinates are for the tiles between Brendan & May's homes in Littleroot Town. In vanilla Emerald, block number 0x04 is the one containing default flowers. I used 0x0 for the last bit, so that the flowers don't block the player's path. What's the special 0x91 for? This refreshes the map so that we can see the changes we've made. If you're hacking FR, you'll need special 0x8E to refresh the map instead of 0x91. I've also setflag 0x250 so that the script doesn't repeat itself - although you could use a var instead if you wanted.


          Yay, it works! But what about when we exit the map? The flowers are gone! We used a flag, so the player can't talk to the NPC to make the flowers grow again. How do we make this a permanent change? We need a second script for the map header.
          Quote:
          Originally Posted by Avara
          #org @start
          checkflag 0x250
          if 0x1 call @pointer
          end

          #org @pointer
          setmaptile 0x08 0x08 0x04 0x0
          setmaptile 0x09 0x08 0x04 0x0
          setmaptile 0x0A 0x08 0x04 0x0
          setmaptile 0x0B 0x08 0x04 0x0
          return
          All this does is call @pointer which shows our flower tiles if flag 0x250 is set. We want to add this to the map's header so that the script runs immediately upon entering the map.
          To do this, first compile a similar script to the one above and take a note of its offset. Add a "setmaptile" script as shown then paste your offset in the "Script Offset" box if you're using AdvanceMap:


          Test again, and this time when you talk to the NPC to make the flowers grow, the map will be changed permanently.

          __________________
          x
          Luna <3
          Reply With Quote
          Reply

          Quick Reply

          Join the conversation!

          Create an account to post a reply in this thread, participate in other discussions, and more!

          Create a PokéCommunity Account

          Sponsored Links
          Thread Tools

          Posting Rules
          You may not post new threads
          You may not post replies
          You may not post attachments
          You may not edit your posts

          BB code is On
          Smilies are On
          [IMG] code is On
          HTML code is Off

          Forum Jump


          All times are GMT -8. The time now is 5:27 PM.