Pokemon Fire Red Hacked Engine For Dummies
Pokémon Engine hacks and additions tutorial
By: Turtl3skulll
While working with JPAN's hacked engine, I've noticed a lot of the instructions are very poorly written; many assume you know every little thing that is going on, and thus a lot of examples are completely voided. I've began rewritting his manual in a friendlier way, one which (hopefully) any beginner with scripting knowledge may be able to look at and understand without the need of carefully reading every word of the document and having to put one-and-one together to figure out an example that was briefly talked about before that is needed.
I will attempt to update the manual to make it as user friendly as possible, and include every special as soon as I get it fully working.
I'll use this format:
NAME OF SPECIAL & ITS NUMBER
BRIEF DESCRIPTION
A SCRIPT EXAMPLE
EXTRA NOTES ON IT
DISCLAIMER: I will not include everything the original manual had. These will be examples of how to script the specials he created, and therefore they will not be explained in full detail, that's what his manual is for & you may look at that for in-depth explanation on his code.
If anything is wrong, needs more explaining, or I missed a special and you know how to explain it feel free to tell me & I'll add it onto this. Hope this helps some of you out :)
Multichoice boxes
Spoiler:
Multichoice boxes have 2 special, being special 0x24 and special 0x25
They contains 7 boxes to use, ranging from 0x20 – 0x25, which define how many choices you wish to have.
0x20 – 2 Choices
0x21 – 3 Choices
0x22 – 4 Choices
0x23 – 5 Choices
0x24 – 6 Choices
0x25 – 7 Choices
Special 0x25 - Load Pointer from Script Bank
Spoiler:
Special 0x25 uses pointers given in the script to load the data into the multichoice boxes
Uses Setvar 0x8006 --multichoice slot Example Special 0x25:
Spoiler:
For 2 choices:
Spoiler:
#org @start
lock
setvar 0x8006 0x0 ------------------'sets 1st choice slot
loadpointer 0x0 @1 -----------------'loads '@1' to the 1st choice slot
special 0x25 -----------------------'prepares the 1st choice slot to be shown
setvar 0x8006 0x1 -----------------'sets 2nd choice slot
loadpointer 0x0 @2 -----------------'loads '@2' to the 2nd choice slot
special 0x25 ------------------------'prepares the 2nd choice slot to be shown
Multichoice 0x0 0x0 0x20 0x0 --------'the 3rd 0xYY, is which box you'll use; 0x20-0x25, accordingly. Rest are filler
release
end
#org @1
= Choice 1 'This is the text which will appear in choice slot 1
#org @2
= Choice 2 'This is the text which will appear in choice slot 2
To add a 3rd or 4th choice you just add another 'setvar 0x8006 0xYY' another 'loadpointer 0x0 @something' and 'special 0x25', as shown below, as well as changing the Multichoice from 0x20 to the box with the desired choice amount.
Special 0x24 uses pre-defined variables to load the data into the multichoice boxes
It uses:
Spoiler:
Setvar 0x8004 --to load the lower half of a pointer (B in 0xAAAABBBB)
Setvar 0x8005 --to load the upper half of a pointer (A in 0xAAAABBBB)
Setvar 0x8006 --multichoice slot
Example Special 0x24:
Spoiler:
#org @start
lock setvar 0x8004 0x3848 ------'The pointer is 08803848, this takes the lower half setvar 0x8005 0x0880 ------'The pointer is 08803848, this take the upper half
setvar 0x8006 0x0
loadpointer 0x0 0x0203f4a0
special 0x24 setvar 0x8004 0x383f ------'The pointer is 0880383f, this takes the lower half setvar 0x8005 0x0880 –----The pointer is 0880383f, this take the upper half
setvar 0x8006 0x1
loadpointer 0x0 0x0203f4a0
special 0x24
multichoice 0x0 0x0 0x20 0x0
release
end
#org 0x803848
= Text 1
#org 0x80383f
= Text 2
The max number of choices allowed are 7, if you attempt to load 'Setvar 0x8006 0x7' or higher (which would be 8 choices) it will fail.
Every single loadpointer must be pointed to some offset whether or not it contains text, else game will crash.
Multichoice box text must be under 20 characters to be properly displayed, and According to JPAN will not display special characters such as the \v\hxx or coloring, but its worked fine for me.
Runtime Trainer Customization
Spoiler:
The trainer OW, trainer backsprite, and Trainer card can now be changed.
The variables below contain the variable to use according to what you wish to change:
Spoiler:
Variable Changes
0x4054 Standing & Walking
0x4055 Bike
0x4056 Sitting (Surfing)
0x4057 VS Seeker
0x4058 Fishing
0x4059 VS Seeker on Bike
Examples:
Spoiler:
Trainer Sprite
Spoiler:
#org @start setvar 0x4054 0x025----------'variable 4054 will change the standing and walking sprite’s, 0x25 can be found in Advance Map, under "Picture no:" just convert that number in the box to hex, to use that sprite. callasm 0x805BE61------------'Changes the sprite instantly, and allows the script to continue
end--------------------------'0x025 will change to the little girl; this can be changed according to the OW you want to become, Example: 0x87 will change the OW to the Lapras OW.
For the sprite to change, a new map must be entered, or you can just call the ASM routine in this example script (Credit to diegoisawesome for finding this routine).
Trainer Card
Spoiler:
For Boy
Spoiler:
#org @start
setvar 0x4060 0x8
end
For Girl
Spoiler:
#org @start
setvar 0x4061 0x8
end
0x8 is just the image that will replace the original
Trainer cards use variables 0x4060 for boys and 0x4061 for girls.
To switch back to the original hero/heroine you use 0x87 & 0x88 accordingly.
Trainer Backsprites
Spoiler:
This is practically its own little tutorial and thus I won't explain, since it requires changing palletes and images, if anyone wants to make a tutorial of this or has made their own, let me know and I'll link to your tutorial.
Poke-Decrypt Specials:
Spoiler:
The following specials are used to change a Pokémon's internals, such as EV/IV Pokeball, capture location, Ribons, and Pokerus.
Special 0x6 – Pokemon Decrypt/encrypt
Spoiler:
A toggle to open and close a Pokemon's 'DNA' to alter, alone its useless therefore I'll explain a few more specials and then I'll give an example.
BufferPartyPokemon
Spoiler:
Bufferpartypokemon 0x0 0x0
Explanation:
The first 0x0 chooses the pokemon to buffer from slots 1-6 (0x0 – 0x05)
The second 0x0 is the buffers that will be used.
Examples:
#org @start
Bufferpartypokemon 0x0 0x0 -----‘buffers 1st pokemon, & the buffer set to \v\h02; the buffer in the script MUST have 2 added when using it as “\v\h0X”, thus this one will be \v\h02 since our pointer is 0x0
Bufferpartypokemon 0x1 0x1 -----‘buffers 2nd pokemon, & the buffer set to \v\h03
Bufferpartypokemon 0x2 0x2 -----‘buffers 3rd pokemon, & the buffer set to \v\h04; \v\h04 (0x2) is the max amount of pokemon to buffer, no more than 3 pokemon can be buffered at a time, after this, the game will load, the rival name and some other things.
Msgbox @hi 0x6
end
‘strings
#org @hi
= \v\h02, then \v\h03 ‘meaning it’ll be read [buffer1], then [buffer2]
Read & Check Specials
The Read & Check will use their specials as 'special2 0x8005 0xZZ'
Spoiler:
Special 0x7 – Read EV/Contest Stats
Spoiler:
Read Evs
Uses Setvar 0x8005 0xY
The 'Y' being the following stats:
Spoiler:
0x0 HP
0x1 Attack
0x2 Defense
0x3 Speed
0x4 Special Attack
0x5 Special Defense
0x6 Coolness
0x7 Beauty
0x8 Cuteness
0x9 Smartness
0xa Toughness
0xb Luster
Else Fails (F400)
Example:
Spoiler:
#org @start
Bufferpartypokemon 0x0 0x0------'fetches pokemon in slot 1
setvar 0x8004 0x0 ---------------'stores (0x0) slot 1 Pokemon to variable 0x8004; replace 0x0 with 1-5 to pick which pokemon slot to use, 0 being the 1st and 5 being 6th pokemon
special 0x6 ----------------------'Open the pokemon to edit setvar 0x8005 0x6 ---------------'sets the var to the “coolness” stat special2 0x8006 0x7 --------------'reads EV/Stat (This case a Stat) and WRITES its value to var 0x8006 0x7 to read for later. compare 0x8006 0x80 ------------'compares the Pokemon's coolness to 0x80;
if 0x0 goto @fail
msgbox @coolest 0x6
special 0x6 ----------------------'Closes the Pokemon and saves its changes
release
end
#org @fail
msgbox @not_cool 0x6
special 0x6 ----------------------'Closes and saves pokemon if not cool enough, pokemon MUST always be closed before ending the script
release
end
#org @coolest
= That \v\h02 is the Coolest \npokémon I've ever seen!
#org @not_cool
= That \v\h02 of yours is lame. ---'\v\h02 is the special text to load whatever is stored at [buffer1].
Special 0x8 – read IVs
Spoiler:
Reads the IVs
Uses Setvar 0x8005 0xY
The 'Y' being the following stats:
Spoiler:
0x0 HP
0x1 Attack
0x2 Defense
0x3 Speed
0x4 Special Attack
0x5 Special Deffense
Else Fails
Example:
Spoiler:
This is exactly the same as special 0x7.
The only difference is Setvar 0x8005 must be set below 6. given 0x5 is the last stat that can be checked.
The compare must also be change to anything between 0x0 to 0x1F (0-31), Since IVs go to 31 max.
Special 0x9 – Check Ribbon Flags
Spoiler:
Checks Flags
Uses Setvar 0x8005 0xY
The 'Y' being the following stats:
Spoiler:
0x0 to 0x1F – Active flags, not named in FireRed
Else Fail
Returns the Value and status of flag (0 or 1)
Only one flag has a name, and it’s the champion’s flag (key 0xf), awarded at register Hall of Fame special.
Example
Spoiler:
Same as special 0x8, just change the special to 0x9
Uses 0x0 to 0x1F for Setvar 0x8005
The compare 0x8006 must be set to 0x1
Special 0xa – Check Pokerus Timer
Spoiler:
Does not take any arugments
Returns Timer value (0xF – 0x0) or 0x10 if the Pokemon is immune.
Example:
Spoiler:
#org @start
lock
Bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 special2 0x8005 0xa
compare 0x8005 0x10 –--------'0x10 means it had the sickness, but not anymore
if 0x1 goto @fine compare 0x8005 0x0 –----------'zero means it never got the sickness
if 0x1 goto @fine
buffernumber 0x1 0x8005------'Buffers the number returned to \v\h03
msgbox @sick 0x6
special 0x6
release
end
#org @fine
message @good 0x6
special 0x6
release
end
#org @sick
= Your \v\h02 is sick.\nIt will take \v\h03 cycles to heal.
#org @good
= That's the healtiest \v\h02\nI've ever seen!
Special 0xb - Check Pokeball
Spoiler:
Does not take any arguments
Returns the Item value of the Pokeball its stored in.
Example:
Spoiler:
#org @start
lock
Bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 special2 0x8005 0xb
compare 0x8005 0x0 ----------'When Pokemons are hatched their Pokeball value is 0; this checks for that.
if 0x1 goto @none
bufferitem 0x1 0x8005 --------'buffers the Pokeball value to \v\h03.
msgbox @ball 0x6
special 0x6
release
end
#org @none
message @hatched 0x6
special 0x6
release
end
#org @ball
= Your \v\h02 is kept in a\n\v\h03.
#org @hatched
= You hatched your \v\h02?\nI'm impressed!
Special 0xc - Check Capture Location
Spoiler:
Does not take any arguments
Returns the location where the pokemon was captured or hatched.
Example:
Spoiler:
You'd need to know the Location table to work this one, so no example.
Special 0xd - Check Happiness
Spoiler:
Does not take any arguments
Returns the Pokemon Happiness.
Example:
Spoiler:
#org @start
lock
Bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 special2 0x8005 0xd
compare 0x8005 0x0
if 0x1 goto @none
buffernumber 0x1 0x8005 --------'buffers the happiness number to \v\h03.
msgbox @happy 0x6
special 0x6
release
end
#org @none
message @hate 0x6
special 0x6
release
end
#org @happy
= Your \v\h02 happiness is \n\v\h03.
#org @hate
= Your \v\h02 hates you.
Special 0xe – Check Pokemon Held Item
Spoiler:
Does not take any arguments
Returns the Pokemons held item.
Example:
Spoiler:
#org @start
lock
Bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 special2 0x8005 0xe
compare 0x8005 0x0
if 0x1 goto @none
bufferitem 0x1 0x8005 --------'buffers the Pokemon's Item to \v\h03.
msgbox @item 0x6
special 0x6
release
end
#org @none
message @no_item 0x6
special 0x6
release
end
#org @item
= Your \v\h02 has \n\v\h03.
#org @no_item
= Your \v\h02 isn't holding an item
Write & Editor Specials
The Write & Editor Specials will use their specials as 'special 0xZZ'
Spoiler:
Special 0xF – EV/Contest Stat Editor
Spoiler:
Used to change a Pokemon's EV values, useful for contests
Uses Setvar 0x8005 0xY
The 'Y' being the following stats:
Spoiler:
0x0 HP
0x1 Attack
0x2 Defense
0x3 Speed
0x4 Special Attack
0x5 Special Deffense
0x6 Coolness
0x7 Beauty
0x8 Cuteness
0x9 Smartness
0xa Toughness
0xb Luster
Else Fails (F400)
Uses Setvar 0x8006 0x0ZZ or Setvar 0x8006 0x1ZZ
The 'ZZ' being the number by which the EV will increase or decrease
the 0 before the ZZ means add, while the 1 means subtract; therefore 0A would add 10 Evs while 1A would subtract 10EVs
Example:
Spoiler:
Stat Editor (PLAIN SCRIPT)
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 setvar 0x8005 0x3 ‘reads stat of speed setvar 0x8006 0x80 'adds 0x80 Evs to speed special 0xf 'special to make code work
special 0x6
release
end
Special 0x10 – IV Stat Editor
Spoiler:
Used to change a Pokemon's IV values.
Uses Setvar 0x8005 0xY
The 'Y' being the following stats:
Spoiler:
0x0 HP
0x1 Attack
0x2 Defense
0x3 Speed
0x4 Special Attack
0x5 Special Deffense
Uses Setvar 0x8006 0x0ZZ
The 'ZZ' Being the value of the IV it will replace. This will not add or subtract from the original, only replace the current IV with the one told to use.
Example:
Spoiler:
Stat Editor (PLAIN SCRIPT)
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0x3 ‘reads stat of speed
setvar 0x8006 0xa 'Make Speed EV 10 special 0x10 'special to make code work
special 0x6
release
end
Special 0x11 – Ribbon Flag set/clear
Special 0x12 – Pokerus Set/Immunize
Spoiler:
Sets or removes Pokerus
Uses Setvar 0x8005 0xY
The 'Y' being the following cylces:
Spoiler:
0x0 = make pokémon good or remove immunization
0x1 to 0xf = Make Pokémon sick
0xf = 15 cycles ; 0x1 = 1 cycles ; 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9, a=10, b=11, c=12, d=13, e=14
0x10 or Elese = immunize pokémon
Example:
Spoiler:
Gives Pokerus
Spoiler:
#Org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 setvar 0x8005 0xf ----------'Sets Pokerus to 15 cycles special 0x12
special 0x6
release
end
Removes Pokerus
Spoiler:
Org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0x0 ----------'Sets Pokerus to 0 cycles
special 0x12
special 0x6
release
end
Makes Immune To Pokerus
Spoiler:
Org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0x10 ---------'Sets Pokemon to be immune from Pokerus
special 0x12
special 0x6
release
end
Special 0x13 – Increase/Decrease Happiness
Spoiler:
Used to increase/decrease Pokemon Happiness
Uses Setvar 0x8005 0xY
The 'Y' being the following:
Spoiler:
0x0 to 0xFF = Adds Happiness
0x100 to 0x1ff = Subtracts Happiness
Example Increase:
Spoiler:
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0xA ----------'Increases Happiness by 10
special 0x13
special 0x6
release
end
Example Decrease:
Spoiler:
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0x1A ----------'Decreases Happiness by 10 special 0x13
special 0x6
release
end
Special 0x14 – Change Ball
Spoiler:
Change the Pokeball a Pokemon is stored at
Uses Setvar 0x8005 0xY
The 'Y' being the following Pokeballs:
#Org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6 setvar 0x8005 0xC ----------'Sets Pokemon's currnt Pokeball to Premier Ball special 0x14
special 0x6
release
end
Special 0x15 – Give Held Item
Spoiler:
Gives a selected Pokemon an item
Uses Setvar 0x8005 0xY
The 'Y' being the Item ID
Example:
Spoiler:
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0xX –------'The X can be replace with the item ID special 0x15
special 0x6
Special 0x16 – Change Pokemon Species
Spoiler:
Changes selected Pokemon Species
Uses Setvar 0x8005 0xY
The 'Y' being the Pokemon ID
Example:
Spoiler:
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0xX –------'The X can be replace with the Pokemon ID special 0x16
special 0x6
DISCLAIMER: The species switched to MUST have the same EXP curve as the current or game will crash upon looking at the POKEMON screen.
According to JPAN entering a battle fixes this issue, but haven't tested it.
Special 0x17 – Change Pokemon Attacks
Spoiler:
Changes selected Pokemon Attacks
Uses Setvar 0x8005 0xY
The 'Y' being the Slot number 0-5
Uses Setvar 0x8006 0xZZ
The 'ZZ' being the attack number, 0x0 can be used to erase the attack
Example:
Spoiler:
#org @start
bufferpartypokemon 0x0 0x0
setvar 0x8004 0x0
special 0x6
setvar 0x8005 0xX –------'The X can be replace with the attack ID special 0x17
special 0x6
This code can (and usually should) be used in conjunction with another special, this one original from the game. Special 0xdc not only accesses the pokémon slot at 0x8004 (the one used at the decryption code) and opens the status screen’s Attack screen, and the chosen attack is saved in 0x8005
This code will automatically check for empty slots first, and then, if all are occupied
replace the slot with the given attack. It also restores that attack PP fully, and removes
all PPup slots used.
Special 0x18 - Check Pokemon Species
Spoiler:
Check (compares) the species of a pokemon and return a yes or no
Uses Special2 LASTRESULT 0x18 Example:
Spoiler:
#org @start
special 0x9f ----------------------------'pokemon select screen
waitstate
compare 0x8004 0x6 --------------'compares if 'b' is pressed (cancel)
if 0x1 goto @cancel
special 0x6
special2 LASTRESULT 0x18 ------'calls special 18 (apparently 'special2' not 'special')
compare LASTRESULT 0xYY -----'compares to 0xYY; YY being pokemon number
if 0x1 goto @yes
special 0x6
release
end
This will just compare a pokemon and give back the result. It will NOT tell you the pokemon species, or do anything else. Use this as an if statement with a pokemon instead of a question.
Credits for script: Lance32497.
Party Specials
Spoiler:
Party Specials seem to always fail me, all status flags equal sleep & hp does not check correctly, I will keep looking, but the scripts should be the correct way of doing it
setting it to 7 equals 1 pokemon appearing, 0E(14) equals 2, etc. Multiply by number of pokemon to appear like this
Example:
Spoiler:
#org @start
setvar 0x8004 0x5 '---- set status to frozen
setvar 0x8005 0x7 '---- set turns for 1 pokemon special 0x52
Special 0x53 - Status inducer canceller
Spoiler:
Cancels special 52
takes no argument; it can be placed in any script as is.
Special 0x54 -Permanent Status Inducer
Spoiler:
Permanently applies status effect to all encountered pokemon
Uses 0x8004 same key as special 0x52
Example:
Spoiler:
#org @start
setvar 0x8004 0x6 '----Set status to Paralysis
special 0x54
release
end
DISCLAMIER:
Spoiler:
there is a bug with this one, that if you use a healing function (special 0x0), one that creates pokémon (givepokemon, giveegg, special 0x1bb…) or simply withdraw a pokémon from the box, the Status creating routine is activated, the same one I changed to create the Status always on effect. As such, perfectly healthy pokémon enter the pokecenter and come out poison or paralyzed… -JPAN
Special 0x55 - Permanent Status inducer canceller
Spoiler:
Cancels special 0x54
Works the same as special 0x53
Special 0x62 - Earase Party Pokemon
Spoiler:
Uses 0x8004 0xY 'Slot to delete, 0xf deletes whole party
Examples:
Spoiler:
Example #1 - 1st slot Pokemon:
Spoiler:
#org @start
setvar 0x8004 0x0
special 0x62
release
end
Example #2- Erase full party:
Spoiler:
#org @start
setvar 0x8004 0xf
special 0x62
release
end
Example #3 - Keep 1 Pokemon:
Spoiler:
#org @start
special 0x9f ------------'Pokemon selection screen
waitstate
compare 0x8004 0x6 -------'Checks if 'b' is pressed & cancels action
if 0x4 goto @cancel special 0x6 -------------'Decrypts pokemon to RAM
setvar 0x8004 0xf ------'selects whole party special 0x62 ------------'Deletes whole party setvar 0x8004 0x0 ------'Setvar to 0 special 0x6 -------------'Encrypt Pokemon to 0x8004 0x0; slot 0.
release
end
#org @cancel
release
end
Special 0x63 - Status Checker
Spoiler:
Uses Setvar 0x8004 0xY 'Pokemon Slot
Returns The Status of asked Pokemon
Status Key is same as Special 0x52
#org @start
setvar 0x8004 0x1
special 0x65
msgbox @m 0x2
release
end
#org @m
= Your Pokemon HP is \v\h03.
'HP does not appear to update, just give full HP
Special 0x66 - Change Party HP
Spoiler:
Uses Setvar 0x8004 0xY 'Pokemon Slot
Uses Setvar 0x8005 0xY 'Quantity of HP
Uses Setvar 0x8006 0xY '1 to heal, else to damage
Example:
Spoiler:
#org @start
setvar 0x8004 0xF ----'Entire Party
setvar 0x8005 0xB ----'11 HP
setvar 0x8006 0x0 ----'Damages special 0x66
release
end
Wild Battle Pokemon
Spoiler:
Special 0x51 - Shiny Battle
Spoiler:
Makes the next Pokemon shiny
Example:
Spoiler:
#org @start special 0x51 -------------'Makes Shiny
wildbattle 0x1 0x1 0x0 ----'Starts wild battle to show shiny
release
end
Special 0x56 – Swarm-roaming Pokémon Changer
Spoiler:
Vars Used:
Spoiler:
Uses Setvar x8004
Quote:
This is the only one I will explain, until I practice the others:
0 to 0x3fff-> The number of the Pokemon wanted (Use YAPE to see correct numbers as there is a gap between Celebi and Treecko)
0x4000-> 0x8015: The pokemon number IN the variable stored in 0x8004
0x8000-> 0xfffc: not defined
0xfffd-> specific pokemon stored at a pointer kept in two variables, 0x8008 0x8009.
0xfffe-> specific pokemon stored at a pointer, that must be placed by hand in 0x0203f488
0xffff-> specific pokemon stored at the LoadPointer location
Uses Setvar x8005
Quote:
Chance pokemon will appear out of 65536
0x0-0xffff (0-65536)
50% is 7fff (32767)
Uses Setvar x8006
Quote:
Amount of roaming Pokemon 0x1,0x2,etc.
0x0 means unlimited, will keep appearing
Uses Setvar x8007
Quote:
uses lower and upper halves:
Lower half is location given by:
each bit either being 0 or 1 depending on what you want
Bit 0 = Grass
Bit 1= Surfing
Bit 2 = Tree/rock-smash
Bit 3 = Fishing
1001 (bit 0=1, bit 1=0, bit 2=0, bit 3=1) would make pokemon available on grass and fishing
1110 (bit 0=1, bit 1=1, bit 2=1, bit 3=0) would activate it in grass, surfing, & tree/rock-smash
it must be written in hex though, so 0x9 and 0xE respectively
The Upper half is the pokemon level:
level 80 being 0x50
Example:
Spoiler:
#org @start setvar 0x8004 0x85 ------' sets pokemon to Eevee setvar 0x8005 0xfd70 –--' make the chances of appearance 99% (64880) setvar 0x8006 0x1 -------'Will appear once setvar 0x8007 0x500e –' appear by all except fishing
special 0x56
release
end
You can only replace the level for Roaming codes, that is, only for the ones in that 0x8006 = 1. For swarms, however, you cannot.
Special 0x57 - Swarm-roam Pokemon Canceller
Spoiler:
Cleans Special 0x56 for its next use.
Special 0x58 - Wild Pokémon Data Switch
Spoiler:
Changes the current map's pokemon data to a predefined set you created.
Example:
All script using offset 0x810000
Script by Loadpointer :
Spoiler:
msgbox @change 0x2 loadpointer 0x0 0x810000
special 0x58
release
end
#org @change
= The wild pokemon have been changed.
Script by Vars :
Spoiler:
msgbox @change 0x2 setvar 0x8008 0x0000
setvar 0x8009 0x0881
setvar 0x8005 0x0
setvar 0x8006 0x1
special 0x58
release
end
#org @change
= The wild pokemon have been changed.
Script by writebyteoffset :
Spoiler:
msgbox @change 0x2 writebytetooffset 0x81 0x203F48C
writebytetooffset 0x00 0x203F48D
writebytetooffset 0x00 0x203F48E
writebytetooffset 0x08 0x203F48F
special 0x58
release
end
#org @change
= The wild pokemon have been changed.
Hex edit Part 1:
Spoiler:
At the offset defined in the script (in my case 0x810000) write:
XX 00 00 00 YY YY YY 08
XX - determines location of wild data... such as pokemon appearing in water, grass, tree/rock, and fishing.
table for this:
Spoiler:
Bit 0 = Grass
Bit 1 = Surfing
Bit 2 = Tree/Rock
Bit 3 = Fishing
So activating Grass and Fishing would be 1001 (in binary) so 0x9 in hex.
00 00 00 - filler
YY YY YY - pointer to wild data (in reverse the 08 is already included so you just need the offset in reverse, don't add another 08)
Hex edit Part 2:
Spoiler:
At the offset defined by the "YY's" in part 1 you will need to place the wild pokemon data.
It goes as followed:
AA BB CC 00
AA = Min Level BB = Max Level CC = Pokemon Index Number 00 = filler
For grass wild data you will need to fill up this info 12 times total
For Surfing wild data you will need to fill up this info 5 times total
For Tree/rock wild data you will need to fill up this info 5 times total
For Fishin wild data you will need to fill up this info 10 times total
Example:
For an all Eevee party ranging from level 25-32 in grass: 19 20 85 00 19 20 85 00 19 20 85 00 19 20 85 00
19 20 85 00 19 20 85 00 19 20 85 00 19 20 85 00
19 20 85 00 19 20 85 00 19 20 85 00 19 20 85 00
HUGEEEEE thanks to Lance32497 for helping me figure this one out.
Special 0x59 - Wild Pokémon Data Canceller
Spoiler:
Cancels Special 0x58, by clearing all the data that was changed.
Example:
Spoiler:
#org @start
msgbox @normal 0x2
special 0x59
release
end
#org @normal
= The Pokemon are back to normal
Special 0x97 - Random Grass Battle
Spoiler:
No Arguments
Creates a random grass wild battle
Wild pokémon data (of grass) must exist on that map.
Special 0x98 - Random Water Battle
Spoiler:
No Arguments
Creates a random grass wild battle
Wild pokémon data (of water) must exist on that map.
Special 0x9c - Old Man Battle For All
Spoiler:
The Old Man battle for any Pokemon
Uses Setvar 0x8004 0xY 'being the Pokemon species
Uses Setvar 0x8005 0xY 'being the Pokemon level
Example:
Spoiler:
#org @start setvar 0x8004 0x1 -----' Bulbasaur setvar 0x8005 0xA -----' Pokemon level 10 special 0x9c -----------' The special
release
end
The old man can catch no legendary except for the bird trio, Blissey and a few others in the legendary region.
Speical 0x156 - Ghost Pokemon Battle
Spoiler:
The Old Man battle for any Pokemon
Uses Setvar 0x8004 0xY 'being the Pokemon species
Uses Setvar 0x8005 0xY 'being the Pokemon level
Uses Setvar 0x8006 0xY 'being the held item
Example:
Spoiler:
#org @start setvar 0x8004 0x1 -----' Bulbasaur setvar 0x8005 0xA -----' Pokemon level 10 setvar 0x8006 0x0 -----' No Held Item special 0x9c -----------' The special
release
end
This code also can use all Pokemon legendary except for the bird trio (ask not why), blissey and a few others in the legendary region.
I remind you that this code is originally meant to make a battle with an uncatchable ghost pokémon that has no ghost on its type.
This will also not crash if you don't have the SILPH SCOPE, so it will work w/o it.
Walking Scripts
Spoiler:
Quote:
"Basically, this feature allows you to create your own special scripts that are activated each time you take a step, well, most of the times you take a step.
There are some other scripts that will always run first. The Egg hatching script, the whiteout script or every step-on (green) script will always beat this one into execution, so you have to take these into consideration if you need that script to run all the time (such as calling the walking script before starting a normal step-on one).
Also, this script is, by definition, a blocking script, meaning that every script you make here must end with the release or releaseall commands.
This script is indicated to make some small checks, manipulate the landscape, and the occasional message, like the Phone script in Gold." -JPAN
This special contains a max 4 slots to store the walking scripts into as a table.
They are located 0x1a4e2c.
Only 1 can be executed at a time, they are selected by using:
Quote:
Setvar 0x407e 0x(1-4)
An extra walking script can be set temporarily by setting 0x407e to 0 and loading a pointer to the RAM address 0x0203f4f0, this one will take priority over the ROM table.
Special 0x81 - Load Walking Script Pointer
Spoiler:
Loads the pointer from the loadpointer bank 0 to the 0x0203f4f0 address to allow execution, is also needed for wildbattles to be activated through this.
Instructions:
Spoiler:
Quote:
Instructions to this are:
"First, you have to make the script you want to activate on every step. Once the script is compiled, you open a hex editor and navigate to offset: 0x1a4e2c
There are 4 slots for pointers there. Place the offset (reversed) of the script you want to execute with every step in the first slot.
Then, at whatever point you want the walking script to be active (be it through an event script or a level script) just put:
Code:
setvar 0x407e 0x1 ---'tells game to access 1st pointer at offset 0x1a4e2c
special 0x81 ---------------' starts the script to activate on every step.
So that's how special 0x81 works, in case anyone else was having trouble with the instructions." (Credit to metapod23)
Examples:
Spoiler:
Example #1:
Spoiler:
Master Script
Spoiler:
#org @start
setvar 0x407e 0x1 special 0x81
release
end
Money On Step
Spoiler:
#org @start
givemoney 0xA 0x0 ---------------'Gives $10 on every step
release
end
This example uses the 1st pointer in the offset 0x1a4e2c.
Assuming the offset for the 'Money On Step' script was 0x8003f9, you'd go to a hex editor and in the 1st slot you'd write over '00 00 00 00' with 'f9 03 80 08'
Example #2
Spoiler:
Master Script
Spoiler:
#org @start
setvar 0x407e 0x2 special 0x81
release
end
Random Wild Battle
Spoiler:
#org @start
random 0x64 ----------------------'Creates a random number from 0-100
compare LASTRESULT 0xA ---------'Compares if the number is 10
if 0x0 goto @none ----------------'If not it ends
special 0x97 ----------------------'If it equals 10, it creates a willbattle
releaseall
#org @none
releaseall
This example uses the 2nd pointer in the offset 0x1a4e2c.
Assuming the offset for the 'Random Wild Battle' script was 0x8003d8, you'd go to a hex editor and in the 2nd slot you'd write over '00 00 00 00' with 'd8 03 80 08'
Key Detection Specials
Spoiler:
Detects when a player presses certain keys.
Special 0x2b – AB checker
Spoiler:
No Arguments
Uses special2 0x8006 0xY
The 'Y' being the following:
Spoiler:
0x0 if none is pressed
0x1 if A is pressed
0x2 if B is pressed
0x3 if both are pressed
Example:
Spoiler:
#org @Start
lock special2 0x8006 0x2b ----------'0x2b is the AB Checker compare 0x8006 0x3 -----------'0x3 compares if both A&B are pressed
if 0x0 goto @not_yet
msgbox @did_it 0x6
Uses special2 0x8006 0xY
The 'Y' being the following:
Spoiler:
0x0 if no direction is pressed
0x1 if up is pressed
0x2 if left is pressed
0x3 if down is pressed
0x4 if right is pressed
0x5 if up-left is pressed
0x6 if up-right is pressed
0x7 if down-left is pressed
0x8 if down-right is pressed
Example:
Spoiler:
#org @Start
lock
special2 0x8006 0x2c ----------'0x2c is the D-Pad Checker
compare 0x8006 0x3 -----------'0x3 compares down is pressed
if 0x0 goto @not_yet
msgbox @did_it 0x6
Uses special2 0x8006 0xY
The 'Y' being the following:
Spoiler:
0x0 if none is pressed
0x1 if R is pressed
0x2 if L is pressed
0x3 if both are pressed
Example:
Spoiler:
#org @Start
lock
special2 0x8006 0x2e ----------'0x2e is the R&L Checker
compare 0x8006 0x2-----------'0x2 compares if L is pressed
if 0x0 goto @not_yet
msgbox @did_it 0x6
This Special dumps the keys pressed & returns them to be compared against a specific combination entered.
No Arguments
Returns values? Yes
Spoiler:
0x0 to 0x3ff, one bit per key, following the same key as the GBA specifications, that is
Key per bit, starting at the lowest:
0 A
1 B
2 Select
3 Start
4 Right
5 Left
6 Up
7 Down
8 R
9 L
But what if I want the player to press a wacky combination involving A+B+L, then you would just add them up in a calculator in binary mode:
A | B | Select | Start | Right | Left | Up | Down | R | L
1-|-1-|---0---|--0---|--0---|--0--|--0-|--0---|-0-|1
now you just add it backwards, that would be 1000000011, 0x203 hexadecimal.
Example:
Spoiler:
#org @Start
lock
special2 0x8006 0x2f
compare 0x8006 0x203
if 0x0 goto @not_yet
msgbox @did_it 0x6
release
end
#org @not_yet
msgbox @no_good 0x6
goto @Start
#org @no_good
= You cannot escape this deadly trap!
#org @did_it
= No! You escaped!
Misc.
Spoiler:
SetHealingPlace Difference
Spoiler:
Vars Used:
Spoiler:
Uses Setvar 0x405a 0xmmBB - Map
Spoiler:
mm= Map Number BB= Banks Number
Uses Setvar 0x405b 0xXX - X Position
Uses Setvar 0x405c 0xYY - Y Position
Example:
Spoiler:
#org @healing
Msgbox @heal 0x6
Sethealingplace 0x0 Setvar 0x405a 0x000d -----'map 0, and Bank d =13; Indigo Plateau Setvar 0x405b 0x0d -------'x coordinate of player Setvar 0x405c 0x0c -------'y coordinate of player
Release
End
#org @heal
= I’ll set your healing place here.
Sethealing 0x0 -----‘plays nurse joy Pokecenter Script
Sethealing 0x1 -----'Does NOT play nurse joy Pokecenter Script; useful for bed resting places.
Increasing Max Money Amount
Spoiler:
You can now hold up to 999 999 999 money! That's nearly 1000 times more money!
This was never added to the manual, but JPAN talked about adding this in a future release, i dunno if it was added as of version 1.1, but here it is anyways:
This replaces 7 bytes, and here's how to do it:
Spoiler:
In a Hexeditor goto:
0809fdd4 replace |3f 42 0f 00| with |ff c9 9a 3b|------------------' (999999 for 999999999)
In the following offsets replace that one byte from |06| to |09| ----'(6 digit display for 9 digit display)
0808a006
0809fe52
0809fe62
Done, you should be able to have that much money now.
You should link to the fixes for the engine's bugs. Karatekid has a thread on PHO about it.
That's actually a really good idea, I just wanted to make a tutorial on the specials themselves, but I assume you're right, it would make this better, I'll update it and add those under the "Misc." section. thanks
Also if there are other fixes please let me know, pm them to me or add them here & I'll include them, so far the one posted is the only one I've seen
So I've started using JPAN's engine because it seems like the hack I was working on is broken. (Might as well start over)
I found out I'm able to change IVs, and I want to do so through the pokemon selection menu. I feel like I'm close to being able to, and I understand how most calls work, but I'm having trouble understanding what each variable does, and how it is used in conjunction with other variables. What are the limits to these variables? etc
#org @text1
= \v\h02's potential has\nbeen realized.\pThe stone has become inert.
Any clue what I'm doing wrong? I have successfully made all IVs max, but it only happens to my first pokemon. The only time its worked with the menu, I've had to use the item twice to see results. Its really odd.
I found out I'm able to change IVs, and I want to do so through the pokemon selection menu. I feel like I'm close to being able to, and I understand how most calls work, but I'm having trouble understanding what each variable does, and how it is used in conjunction with other variables. What are the limits to these variables? etc
Not sure what you mean by the limitations the variables have, PM me and I'll be glad to answer what I know about them.
As for what you did wrong, its not with JPAN's code, but with how you're calling the pokemon from their menu, I don't remember how to call them properly, I tried it and ended up changing the stats of everyone in my party XD try using diego's tutorial on XSE and see if you fix the way you called it, I'll look around my scrap codes cuz I think I have the solution there somewhere, if I find it I'll let you know.
Quote:
Originally Posted by Criminon
Any clue what I'm doing wrong? I have successfully made all IVs max, but it only happens to my first pokemon. The only time its worked with the menu, I've had to use the item twice to see results. Its really odd.
Also how do you know it only happened for the 1st pokemon, did you check it with the checking specials? if so, could you post that script too, that may help.
Not sure what you mean by the limitations the variables have, PM me and I'll be glad to answer what I know about them.
As for what you did wrong, its not with JPAN's code, but with how you're calling the pokemon from their menu, I don't remember how to call them properly, I tried it and ended up changing the stats of everyone in my party XD try using diego's tutorial on XSE and see if you fix the way you called it, I'll look around my scrap codes cuz I think I have the solution there somewhere, if I find it I'll let you know.
Also how do you know it only happened for the 1st pokemon, did you check it with the checking specials? if so, could you post that script too, that may help.
I figured it out. It took 6 hours, but I finally understand everything now, and I really appreciate you posting the code. I'll post mine:
Spoiler:
'---------------
#org @start
lock
call @menu
compare 0x8004 0x6
if 0x4 goto @end
special2 0x800B 0xBA
compare 0x8000 0x0 ///this is the variable its stored at when you select your pokemon. this judges which one its based off of and then acts accordingly
if 0x1 goto @one
compare 0x8000 0x1
if 0x1 goto @two
compare 0x8000 0x2
if 0x1 goto @three
compare 0x8000 0x3
if 0x1 goto @four
compare 0x8000 0x4
if 0x1 goto @five
compare 0x8000 0x5
if 0x1 goto @six
'---------------
#org @menu
special 0x9F
waitstate
lock
faceplayer
copyvar 0x8000 0x8004
return
'---------------
#org @end
release
end
'---------------
#org @one
setvar 0x8004 0x0 ///this is the party variable for setting the stuff up.
goto @next
'---------------
#org @next
bufferpokemon 0x0 0x800B
special 0x6
compare 0x8004 0x6
if 0x4 goto @end
goto @next2
'---------------
#org @next2
setvar 0x8005 0x0
setvar 0x8006 0x1F
special 0x10
setvar 0x8005 0x1
setvar 0x8006 0x1F
special 0x10
setvar 0x8005 0x2
setvar 0x8006 0x1F
special 0x10
setvar 0x8005 0x3
setvar 0x8006 0x1F
special 0x10
setvar 0x8005 0x4
setvar 0x8006 0x1F
special 0x10
setvar 0x8005 0x5
setvar 0x8006 0x1F
special 0x10
goto @next3
'---------------
#org @next3
fanfare 0x71
waitfanfare
msgbox @text1 MSG_KEEPOPEN '"[buffer1]'s potential has\nbeen re..."
removeitem 0x3E 0x1 ///this is set up for items. this is the item I used.
closeonkeypress
special 0x6
release
end
'---------
' Strings
'---------
#org @text1
= [buffer1]'s IVs are at max!
I figured it out. It took 6 hours, but I finally understand everything now.
Ok I'm glad you figured it out, sorry for taking a week to answer I was out of town.
If you got the solution I'd like to know it, in the case I ever run into that problem, or need to help someone else with it.
Thanks for posting your code on it, I was always a little confused on if the worked correctly. Thanks for that, I'll use your code to correct anything I've done, thank you!
Ok I'm glad you figured it out, sorry for taking a week to answer I was out of town.
If you got the solution I'd like to know it, in the case I ever run into that problem, or need to help someone else with it.
Thanks for posting your code on it, I was always a little confused on if the worked correctly. Thanks for that, I'll use your code to correct anything I've done, thank you!
No problem! Glad you're using the code! I've tried it with multiple things, including renaming pokemon, etc and it works. I really appreciate you taking the time to explain the other things. I still use this post as a reference.
No problem! Glad you're using the code! I've tried it with multiple things, including renaming pokemon, etc and it works. I really appreciate you taking the time to explain the other things. I still use this post as a reference.
I feel like you're thanking me for things I didn't do, unless you're referring to my original post :P
Also I meant how did you fix your problem with giving the IVs to the selected slot on the pokemon choosing thing, instead of just the 1st/all pokemon in the party.
I feel like you're thanking me for things I didn't do, unless you're referring to my original post :P
Also I meant how did you fix your problem with giving the IVs to the selected slot on the pokemon choosing thing, instead of just the 1st/all pokemon in the party.
I mean on the original post. Thank you for placing everything in one place and giving examples.
And this:
setvar 0x8004 0x1
This controls which slot it gives the stats to. I stuck notes on my code, hopefully that helps.
Didn't see this special on your tut. SPECIAL 0x18: Check Pokémon Specie
If you want to check if the Pokémon in your Party is Pikachu or somewhat, here's the script
Spoiler:
special 0x9F @Opens the pokemon party screen and stores the slot number of the selected pokemon in 0x8004, 0-5, 7 means cancel
waitstate
compare 0x8004 0x7 @Checks if it presses cancel
if 0x1 goto @cancel
special 0x6 @Decrypts pokemon, no need to set variable 0x8004, it is already set in special 0x9f
special2 0x800D 0x18 @Calls Special 0x18 and stores the value in Lastresult
compare 0x800D 0x19 @Compares if lastresult is 19, which is Pikachu's index number
if 0x1 goto @Yes
special 0x6 @Brings the data of pokemon back to its previous data
end
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Didn't see this special on your tut. SPECIAL 0x18: Check Pokémon Specie
If you want to check if the Pokémon in your Party is Pikachu or somewhat, here's the script
I've added it now under 'write & editor', Thank you! :)
I've added it now under 'write & editor', Thank you! :)
I think we may use bufferpokemon 0x0 LASTRESULT after special 0x18
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
I think we may use bufferpokemon 0x0 LASTRESULT after special 0x18
I mean... You can, but it works perfectly without it.
I decided to test both, just in case, and the both do the same so I wouldn't use it just to save some memory (yeah I know like 4 bits matters XD )
Hey, could you explain to me how the special 0x58(Wild Pokemon Data Changer) works? I've read it a few times but I'm clueless about what should be done.
Hey, could you explain to me how the special 0x58(Wild Pokemon Data Changer) works? I've read it a few times but I'm clueless about what should be done.
Sadly I don't know how it works, I tried for a few hours today, but no success...
The closest I got to it working was this:
Spoiler:
This is the script:
Spoiler:
msgbox @change 0x2
setvar 0x8009 0x0890
setvar 0x8008 0x0034
setvar 0x8006 0x1
setvar 0x8005 0x0
special 0x58
release
end
#org @change
= I will change the pokemon now.
The pointer set in 8009 & 8008 is 0x08900000 (why does the script have 34 added to it, I know not, its just how others did it and it changed the pokemon to Sunflora instead of ??????? so yeah...)
The data I added to that offset was:
Spoiler:
0A 0C 01 9A
This was repeated about 12 times
That should make Deoxys levels 10-12
Sadly I don't know how it works, I tried for a few hours today, but no success...
The closest I got to it working was this:
Spoiler:
This is the script:
Spoiler:
msgbox @change 0x2
setvar 0x8009 0x0890
setvar 0x8008 0x0034
setvar 0x8006 0x1
setvar 0x8005 0x0
special 0x58
release
end
#org @change
= I will change the pokemon now.
The pointer set in 8009 & 8008 is 0x08900000 (why does the script have 34 added to it, I know not, its just how others did it and it changed the pokemon to Sunflora instead of ??????? so yeah...)
The data I added to that offset was:
Spoiler:
0A 0C 01 9A
This was repeated about 12 times
That should make Deoxys levels 10-12
Thank you! I'm going to play with it a bit and see what I can do. I now understand what "load pointer" meant.(except that 34)
There are 3 ways to make it works, first is by loadpointer command, Second is by Setting the value to 8008 and 8009 in halves, lower halve in 8008 and upper in 8009 and lastly, by writebytetooffset.
So I'll show you the sample script, let's say the Wild data is stored in 08ABCDEF,
Loadpointer
Spoiler:
By using loadpointer command and bank 0x0, we can change the Wild Data,
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
So what appears in the data, could you give an example of what you would store at your offset
Thanks! that'd be great
Sorry, I can't face my computer so I'm still clueless on what time special is, maybe tonight, anyway,
Here's the Structure 15 00 00 00 3C 96 3C 08
15- Determines if it is Grass, Water, Tree or Fishing Rod? 00 00 00- Fillers 3C 96 3C 08- Pointer to the wild table, this table contains the index number of the pokemon(reversed), let's say lv32 Eevee, Eevee's index number is 85, so you will Write 20 20 00 85
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.