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

Code: ASM Resource Thread

Spoiler:

Two questions: 1) to apply the routine, do I have alter or insert it at any specific point because I'm confused as to how I'd apply it. I am assuming I'd insert it anywhere and then just callasm to that location but not sure if that meets the intent

2) not sure if I'm getting the test script correct, seeing as you're using a different scripting program than I. For XSE, if you use checkitem, you have to do a compare LASTRESULT command i.e:

Spoiler:

The game ends up saying I have 7873 rare candy instead of 1.
 
Two questions: 1) to apply the routine, do I have alter or insert it at any specific point because I'm confused as to how I'd apply it. I am assuming I'd insert it anywhere and then just callasm to that location but not sure if that meets the intent

2) not sure if I'm getting the test script correct, seeing as you're using a different scripting program than I. For XSE, if you use checkitem, you have to do a compare LASTRESULT command i.e:

Spoiler:

The game ends up saying I have 7873 rare candy instead of 1.

This sort of answers both questions, but you just need to assemble the routine and insert it at a random location like you've done, and then you go to the location commented on the routine, 0xD6794, and write the following bytes: 00 4A 10 47 XX+1 XX XX XX

So, for the offset you gave, you would write 00 4A 10 47 C1 1E F6 08. As for the script itself, inserting the routine where I said should modify how the checkitem command works, so callasm is not required. checkitem also doesn't require a LASTRESULT check as it already returns 0 or 1 to the place which 'if' checks, anyway. So, in short, you just need to remove the callasm and compare lines and it should work properly (once you've also done the byte changes).

If the routine does have problems following this I won't be able to help as I don't have access to my computer - this post was from my phone (which explains if there are any typos lmao).
 
Updated light ball to raise Pikachu's attack:

Spoiler:

It's possible to have this feature in Emerald, too?
Maybe by adapting the above routine (changing offsets)?
 
It's possible to have this feature in Emerald, too?
Maybe by adapting the above routine (changing offsets)?

It is already done by kleenexfeu in this thread. You can navigate to that post via the first page of this thread.
 
It is already done by kleenexfeu in this thread. You can navigate to that post via the first page of this thread.

In the first page there's nothing related to Emerald, but I found this post in another thread:

https://www.pokecommunity.com/showpost.php?p=8756677&postcount=682

I think it's the right one.

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

EDIT: I have also another little problem.

I succesfully managed to implement this in Fire Red (non-US version)

Spoiler:


However I can't make it work in Leaf Green. I corrected all 0x08__ offsets but the game crashes when I view the Pokémon stats page.
I didn't touch 0x02__ offsets, need to correct them also?
 
Last edited:
Feebas Fishing Tiles in Fire Red

I'm learning arm/thumb, and I thought implementing the Feebas tiles mechanic from R/S/E for Fire Red would be a good exercise. Everything is documented at the top of this routine. You just need to follow the instructions. The Feebas tile locations are determined by your trainer id and secret id, so they don't ever change.

The code below will set Feebas fishing tiles in the pond in the middle of Celadon City. A trainer id/secret id pair of 0xf61cf69b results in the following tiles being "Feebas tiles", with a 75% encounter rate:

[PokeCommunity.com] ASM Resource Thread


Code:
@ Feebas Routine
@ by ShantyTown
@
@ You'll need to do 2 steps to insert this Feebas routine into your ROM.
@ 1. Compile and insert this file into the ROM, and remember its ROM address.
@ 2. Overwrite the 8 bytes at address 0x82b64 with these 8 bytes:
@     00 4A 97 46 XX XX XX XX
@     (Replace "XX XX XX XX" with the ROM address of the routine you inserted in the first step.) 
@
@     For example, if you inserted it at ROM address 0x800480, it would look like this:
@     00 4A 97 46 80 04 80 08
@
@ This routine enables 1-8 fishing tiles in a single map to contain Feebas. (Defaults to 6 tiles)
@ To customize this for your ROM, make changes to the constants at the bottom of this file:
@    You must define a rectanglular sub-area of the map where Feebas can appear.
@       For example, for the pond in Celadon City, we would define the sides of the rectangular area as
@              Left   side of rectangle = 0x18
@              Right  side of rectangle = 0x1d
@              Top    side of rectangle = 0x15
@              Bottom side of rectangle = 0x17
@
@ NOTE: If the rectangle's area is larger than 255 tiles, then some of the bottom tiles won't be able to contin Feebas.
@

.text
.align 2
.thumb
.thumb_func

main:
	@ Push registers that were pushed in the original routine.
	push    {r4-r6, lr}

	@ Check if current map is Feebas's map.
	ldr  r3, =(0x2031DBC) @ Address of current map id
	ldrh r3, [r3]         @ r3 = current map id
	ldr r2, =(MAP_ID)     @ r2 = Map Id for Feebas tiles
	cmp r3, r2            @ compare the current map id with Feebas's map id
	bne done              @ jump to "done" if they weren't equal

	push {r0-r2}

	@ Get the player's tile coordinates.
	ldr  r0, =(0x3005008)
	ldr  r2, [r0]         @ r2 = pointer to player's X/Y coordinates
	ldrh r0, [r2]         @ r0 = player's X coordinate
	ldrh r1, [r2, #0x02]  @ r1 = player's Y coordinate

	@ Get the player's facing direction.
	ldr  r2, =(0x2036e58)
	ldrb r2, [r2]   @ r2 = player's facing direction (1 = down, 2 = up, 3 = left, 4 = right)

	@ Get the fishing tile coordinates by getting the tile coordinates in front of the player.
	cmp r2, #0x1
	beq facingDown
	cmp r2, #0x2
	beq facingUp
	cmp r2, #0x3
	beq facingLeft
	b facingRight

gotFishingTileCoords:
	@ At this point, r0 = X, r1 = Y
	bl checkFeebasTile
	cmp r0, #0x0   @ If r0 != 0, then it's a Feebas tile
	beq notFeebas

	@ Set encounter rate.
	ldr r0, .genRandom
	bl linker
	mov r1, #0xff
	and r0, r1
	cmp r0, #ENCOUNTER_RATE
	bgt notFeebas

	pop {r5-r7} @ pop off garbage to get the stack in a good state

	@ Load Feebas id and level.
	ldr r0, =(POKEMON_ID)     @ Load Feebas id into r0
	ldr r1, =(POKEMON_LEVEL)  @ Load level 20 into r1
	ldr r2, =(0x0)            @ Load the fishing data slot(???) into r2

	@ Jump back to original routine where it has calculated the pokemon species and level.
	ldr r3, =0x08082b8e
	mov pc, r3

facingDown:
	@ Add 1 to the player's y coordinate.
	add r1, #0x1
	b gotFishingTileCoords

facingUp:
	@ Subtract 1 from the player's y coordinate.
	sub r1, #0x1
	b gotFishingTileCoords

facingLeft:
	@ Subtract 1 from the player's x coordinate.
	sub r0, #0x1
	b gotFishingTileCoords

facingRight:
	@ Add 1 to the player's x coordinate.
	add r0, #0x1
	b gotFishingTileCoords

checkFeebasTile:
	@ Check if the given tile coordinates are a Feebas tile
	@ r0 = X, r1 = Y
	@ return: r0 != 0x0 if it's a Feebas tile
	@
	@ Algorithm:
	@    Define a rectangular area with width w and height h
	@    This area is an array of length w * h
	@    
	@    Check if the fishing tile is inside the rectangle.  Else return.
	@    Convert the fishing tile coordinates to an index within this array.
	@    Take the secret id/trainer id and combine nybbles to form 8-bit values by sliding to the left.
	@    For each of those values 'v':
	@        If v % (w * h) == array index:
	@            It's a Feebas tile
	@
	push {lr}

	@ Is the fishing tile in the Feebas rectangle?
	cmp r0, #RECT_LEFT
	bmi notFeebasTile
	cmp r0, #RECT_RIGHT
	bgt notFeebasTile
	cmp r1, #RECT_TOP
	bmi notFeebasTile
	cmp r1, #RECT_BOTTOM
	bgt notFeebasTile

	@ Convert tile coordinates to the array index.
	sub r0, r0, #RECT_LEFT
	sub r1, r1, #RECT_TOP
	mov r2, #(RECT_RIGHT - RECT_LEFT + 1)  @ width of rectangle
	mul r1, r1, r2
	add r0, r0, r1     @ r0 = array index for rectangular area

	ldr r1, =(0x0300500C)
	ldr r1, [r1]
	add r1, r1, #0xa
	ldrh r5, [r1]           @ Need to load trainer id and secret id separately because they aren't word-aligned
	mov r6, r5
	add r1, r1, #0x2
	ldrh r6, [r1]
	lsl r5, r5, #0x10
	add r1, r5, r6          @ Load the secret id and trainer id into r1

	mov r2, #((RECT_RIGHT - RECT_LEFT + 1) * (RECT_BOTTOM - RECT_TOP + 1))  @ Rectangle's area
	mov r3, #NUM_TILES

	mov r5, #0xff

checkSlot:
	sub r3, r3, #0x1   @ Decrement the counter
	bmi notFeebasTile  @ Return if the counter hit zero.

	mov r4, r1
	and r4, r5         @ Load lower 8 bits of r1 into r4.
	lsr r1, r1, #0x4   @ Shift r1 4 bits to the right, so a new 8-bit value will be used 
	                   @ in the next loop iteration.

modulus:
	@ Perform r4 % r2
	sub r4, r4, r2
	bmi modulusDone
	b modulus

modulusDone:
	add r4, r4, r2  @ Make the result positive.
	cmp r4, r0
	bne checkSlot

exitCheckFeebasTile:
	ldr r0, =(0x1)
	pop {pc}

notFeebasTile:
	ldr r0, =(0x0)
	pop {pc}

notFeebas:
	pop {r0-r2}
done:
	@ Code that was replaced by the hook in the original routine
	mov     r6, r0
	lsl     r0, r1, #0x18
	lsr     r0, r0, #0x18

	@ Jump back to the original routine after the hook
	ldr r2, =0x08082b6c
	mov pc, r2

linker:
	bx r0

.align 2

.genRandom:
	.word 0x08044ec8 + 1

@ Customizable Constants
.set MAP_ID,       0x0603  @ [ID][Bank] (Default CELADON CITY)
.set RECT_LEFT,      0x18  @ X coordinate of left side of rectangle
.set RECT_RIGHT,     0x1d  @ X coordinate of right side of rectangle
.set RECT_TOP,       0x15  @ Y coordinate of top side of rectangle
.set RECT_BOTTOM,    0x17  @ Y coordinate of bottom side of rectangle
.set NUM_TILES,      0x06  @ Number of Feebas tiles (must be between 1 and 8)
.set POKEMON_ID,    0x148  @ Pokemon Id (Feebas)
.set POKEMON_LEVEL,  0x0f  @ Wild Pokemon level (15)
.set ENCOUNTER_RATE, 0xc0  @ This number is divided by 0xFF to get the encounter rate (0xc0 / 0xff = 75% encounter rate)
 
Last edited:
Did it require different offsets for the hook and return? If so, could you let me know what they were so I can add it to my post?

Oh, I was referring to my previous post, about "Nature-affected stats colouring routines". I didn't fix correctly two offsets. :)
 
How would I implement Sky Battle restrictions in Pokemon Emerald? Restrictions are not quite as simple as 'only flying', since levitating pokemon are allowed and some flying types (like Doduo) wouldn't be allowed due to their inability to fly.

Can I request a script that would cater for this, or at least something as close as possible?

Thanks
 
How would I implement Sky Battle restrictions in Pokemon Emerald? Restrictions are not quite as simple as 'only flying', since levitating pokemon are allowed and some flying types (like Doduo) wouldn't be allowed due to their inability to fly.

Can I request a script that would cater for this, or at least something as close as possible?

Thanks
Wanna port something?
You should also probably experiment with what the Abilities actually are. FBI didn't put it in his list, but it's in there.
 
Hello guys, this is some of my requests.

Allowing variables to be used in wildbattle
•I know this is kinda specific but may serve usefullness in hacking. Can anybody hack the wildbattle command in FireRed so you can use values stored in variable can be used as a specie number. It may be useful to have a random wild battle.

editing and adding button functions in overworld
•Is there a way, well there's really a way, to add button functions on FireRed Rom? Like the AB Button, or any other button that can be added onthe emulator. Or, edit the existing button like select, which loads the registered item, start which accesses menu, or etc.
 
Hello! May I request something?

An item that will mimic Eon Flute into FR/EM (teleportation item)
So I have this idea of a fake "Soaring in the sky" for Gen. 3 games... For the Eon Flute, it will be like the OW Fly animation but with a twist... Once you use the item, it will load the Fly animation with Mega Lati@s sprite and then teleport it into a certain coordinate in a specific map... The map will serve as the fake sky... The coordinates will be based from the map name where the item is used... The player will then be in the Surf mode (or any custom OW) once landed...

Disable Menu and registered item access in a certain map name for FR/EM
This is in line with my idea of a fake "Soaring in the sky"... It will disable the Menu and registered item access in a certain map name (for my idea, it will be in the Sky map)...

Only if they're possible... Thanks a lot!
 
#org @start
call @func
end2

#org @func
playanimation 0x1 0x7 0x0
setword 0x203C020 0x08TTTTTT
printstring 0x184
waitmessage 0x40
orword 0x2023DD0 0x100
graphicalhpupdate 0x1
datahpupdate 0x1
return

How to insert this battlescript or what tool do I use?... Xse wont let me insert this...
 
Would it be possible for someone to update the first post? It hasn't been touched in over half a year, and some really interesting stuff has been posted here since then.

Also, I think there's an issue with this routine:

Party Item Checker:

I wasn't able to get it to work with Hoenn Pokémon. Whether I use their index number or National Dex number (both in hex), the routine fails with them. All Pokémon with an index value up to 0xFF - Kanto and Johto Pokémon, in other words - work just fine.
 
Would it be possible for someone to update the first post? It hasn't been touched in over half a year, and some really interesting stuff has been posted here since then.

Also, I think there's an issue with this routine:

I wasn't able to get it to work with Hoenn Pokémon. Whether I use their index number or National Dex number (both in hex), the routine fails with them. All Pokémon with an index value up to 0xFF - Kanto and Johto Pokémon, in other words - work just fine.
It looks like its because
Code:
found:
	ldr r2, .MON
	strb r5, [r2]
	pop {r0-r6, pc}
	

none:
	ldr r0, .MON
	mov r1, #0x6
	strb r1, [r0]
	pop {r0-r6, pc}
Kanto and Johto work by the fact that setting their var by script also clears the upper byte. But for anything beyond 255, you have it set to 1 or higher for the upper part of the halfword. Just change them to store a halfword instead.
 
Back
Top