Advertiser Content

Development ASM Resource Thread Page 31

Started by esperance September 19th, 2014 3:13 PM
  • 281481 views
  • 1489 replies

jiangzhengwenjzw

now working on pokefirered

Male
Seen 1 Hour Ago
Posted 3 Weeks Ago
176 posts
7.2 Years
This is, indeed, an awesome hack and I had implemented it so great thanks FBI, but, I have a little suggestion about this hack, I don't know if it can be implemented by setting value in a certain var or whatever, it would be cool if we can set or change the Xpos and Ypos of the multibox and extend the height of it.
I've done some features in this post

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.3 Years
I've done some features in this post
Oh. I didn't notice it, cool
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.

Xencleamas

Suddenly lurking in the shadows...

Male
Asgard
Seen January 21st, 2019
Posted August 7th, 2018
460 posts
5.8 Years
I dunno if someone already done this before, but... can I request for a routine that disables the registering of Pokemon into Pokedex, both Seen and Caught? It is just like when you encounter some such species in Battle Frontier/Subway/Maison, and PWT, then it will not register to Pokedex.

Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
Seen November 20th, 2016
Posted November 20th, 2016
420 posts
4.8 Years
Since people will be coming up with Mega Evolution hacks soon, I was wondering if there is a way to store all 40+ Mega stones in the bag. Would it be possible to hack the TM case and make something like a 'Mega Stone case', which can hold these stones?
I don't know the logistics of essentially creating a brand new pocket, but it isn't really necessary. You can just expand the regular items pocket. The bigger cost is finding 4 bytes for each unique item. I personally used JPAN's save research (not the "save block hack").

Lunos

Random Uruguayan User

Male
Montevideo (Uruguay)
Seen 48 Minutes Ago
Posted 2 Hours Ago
2,121 posts
11.2 Years
Hi Guys.
I wanted to know if it would be somehow possible an ASM Routine to change the Main Character Overworld permanently, until you trigger another ASM which reverts that.

Example:
Item 1: Calls the 1st ASM which would change your Overworld permanently for another one, the main girl character for example.

Item 2: Reverts what the first item did by triggering a 2nd asm.

Would that be possible?
I've just learned some hours ago, how to trigger a script through an item and the single idea of having clothes as Key Items sounds wonderful <3

But the method with the Write Bytes to Offset is kinda "Meh", because it disappear when you refresh the map or use a warp, and it would be very annoying to put the whole WBtO thing in every single warp of the game >_< ..

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.3 Years
Hi Guys.
I wanted to know if it would be somehow possible an ASM Routine to change the Main Character Overworld permanently, until you trigger another ASM which reverts that.

Example:
Item 1: Calls the 1st ASM which would change your Overworld permanently for another one, the main girl character for example.

Item 2: Reverts what the first item did by triggering a 2nd asm.

Would that be possible?
I've just learned some hours ago, how to trigger a script through an item and the single idea of having clothes as Key Items sounds wonderful <3

But the method with the Write Bytes to Offset is kinda "Meh", because it disappear when you refresh the map or use a warp, and it would be very annoying to put the whole WBtO thing in every single warp of the game >_< ..
one of JPAN Routine does that
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.

Lunos

Random Uruguayan User

Male
Montevideo (Uruguay)
Seen 48 Minutes Ago
Posted 2 Hours Ago
2,121 posts
11.2 Years
I don't know the logistics of essentially creating a brand new pocket, but it isn't really necessary. You can just expand the regular items pocket. The bigger cost is finding 4 bytes for each unique item. I personally used JPAN's save research (not the "save block hack").
4 Bytes for more than 50 items, gg well played.
A brand new pocket TM Case like sounds way too more organized.

ON:
My previous question still stands since i wasn't able to find JPAN's routine xD

Touched

Resident ASMAGICIAN

Male
Seen February 1st, 2018
Posted October 19th, 2017
626 posts
5.4 Years
Hi Guys.
I wanted to know if it would be somehow possible an ASM Routine to change the Main Character Overworld permanently, until you trigger another ASM which reverts that.

Example:
Item 1: Calls the 1st ASM which would change your Overworld permanently for another one, the main girl character for example.

Item 2: Reverts what the first item did by triggering a 2nd asm.

Would that be possible?
I've just learned some hours ago, how to trigger a script through an item and the single idea of having clothes as Key Items sounds wonderful <3

But the method with the Write Bytes to Offset is kinda "Meh", because it disappear when you refresh the map or use a warp, and it would be very annoying to put the whole WBtO thing in every single warp of the game >_< ..
Dunno if this will help you, but

Multiple Characters


Despite gender being binary in the games, there is actually an entire byte set aside for it in the second saveblock. You can change this byte with a simple ASM routine, e.g.

Spoiler:

	.align 2
	.thumb

@ Set gender from value in script var 0x8000
set_gender_byte:
	ldr r0, saveblock2_trainerdata
	ldr r0, [r0]
	ldr r1, variable
	ldrb r1, [r1]
	strb r1, [r0, #8] 	@ gender
	bx lr
	
	.align 2
saveblock2_trainerdata:	.word 0x0300500C
variable: .word 0x020370B8 	@ script var 0x8000

Set it to zero for male and one for female. Use another byte for another for another character

Note, this will break the script checkgender command! In order to restore it, you should first call checkgender, copy the value it returns in 0x800D to another unused var. Then set the gender using the above. Then you can restore it properly.

Lastly, apply this hook (untested):

Spoiler:

	.align 2
	.thumb
	
@ 00 48 00 47 XX + 1 XX XX 08 at 0x05C7E8 (0805C7E8 via r0)
character_table_hook:
	lsr r0, #0x18
	cmp r1, #2 		@ check gender < 2
	blo character_table_normal

	@@ Load custom table
	adr r3, character_table_custom
	sub r1, #2		@ (gender - 2) * 6
	lsl r2, r1, #2
	sub r2, r1
	lsl r2, #1
	add r3, r2
	add r0, r3
	ldrb r0, [r1]
	bx lr

character_table_normal:
	lsl r0, #1
	add r1, r0
	add r1, r2
	ldrb r0, [r1]	
	bx lr

	.align 2
	@@ Select overworld numbers for your new character
character_table_custom:
	.byte 0 		@ walking
	.byte 1			@ biking
	.byte 2			@ sitting (surfing)
	.byte 3			@ vs seeker/pokeball
	.byte 4			@ fishing
	.byte 5			@ vs seeker/pokeball

You'll need to customise that table at the bottom. Each character you want must have its own 6 byte entry, even if you don't plan on using all the frames. The example entry above is a duplicate male character. Just change the bytes to the overworld sprites of your new character (the same in advance map when chooses a sprite for an NPC). Keep in mind you'll need running frames for the target character.

This probably will only refresh when you change map, so use the next hack.

Instant NPC sprite switch


This is related to the last hack, but can be more useful for a less permanent change. It can also work on other NPCs. Callasm as usual with the NPC person number in 0x8000 (same ID you use with applymovement - and 0xFF for the player) and the target sprite (the sprite index you'd use in advance map) in 0x8001.

Spoiler:

	.align 2
	.thumb

instant_npc_frame_switch:
	push {r4-r6, lr}
	sub sp, #4
	
	ldr r4, variables

	@@ Determine npc state id from person id	
	ldr r3, saveblock1_mapdata
	ldr r3, [r3]
	ldrb r0, [r4]	@ person/local ID from var 0x8000
	ldrb r1, [r3, #5] @ current map
	ldrb r2, [r3, #4]	@ current bank
	mov r3, sp
	ldr r5, npc_id_by_local_id_and_map_ret_success
	bl call_via_r5
	cmp r0, #0 		@ failure check
	bne instant_npc_frame_switch_return

	@@ Get npc_state
	mov r0, sp
	ldrb r1, [r0] 		@ npc_id
	lsl r0, r1, #3		@ npc_states + 0x24 * npc_id
	add r0, r1
	lsl r0, #2
	ldr r1, npc_states
	add r6, r0, r1

	@@ Change Sprite
	mov r0, r6 		@ npc_state
	ldrb r1, [r4, #2]	@ sprite index from var 0x8001
	ldr r5, npc_change_sprite
	bl call_via_r5

	@@ Update direction to prevent graphical artifacts
	mov r0, r6
	ldrb r1, [r0, #0x18]	@ npc direction
	lsr r1, #4
	ldr r5, npc_turn
	bl call_via_r5
	
instant_npc_frame_switch_return:	
	add sp, #4
	pop {r4-r6, pc}

call_via_r5:
	bx r5

	.align 2
variables: .word 0x020370B8 	@ script var 0x8000
saveblock1_mapdata: .word 0x03005008
npc_states: .word 0x02036E38	
npc_change_sprite: .word 0x081507BC + 1
npc_turn: .word 0x0805F218 + 1
npc_id_by_local_id_and_map_ret_success:	.word 0x0805DF84 + 1

A Pokemon that is discriminated!
Support squirtle and make it everyone's favourite.

Spherical Ice

Age 21
Bristol, UK
Seen 1 Hour Ago
Posted September 24th, 2019
5,254 posts
12 Years
I don't know where it is either. Perhaps you can ask daniilS via VM or something.




1) For forced evolution, I don't know what you're really talking about. You mean just make a Pokemon evolve without giving the player time to hit the "b" button? I'll look into Pokemon evolution sure.

2) I haven't seen it so VMing me it would be nice. Anyways this is rather easy, I've done it before. I'll post the results at the bottom of this post.

3) Skipping the introduction was already done by Knizz. There's a post in the research and development section's quick research thread.


Preventing TMs from being consumed on use



Quick research:
TMs are deleted in two places. The first place is in their own function. When called from the bag, after use the TM has it's own deletion mechanism. The second way is from the bag, after you use a TM the bag attempts to delete it as well. Well, the solution is quite simple. There's two ways to do this, either go to 0809A1D8 call your own function there which checks if the item is a TM, and if it is, just jump to the end. Or much more simply you just remove the parts from the bag and tm function that deletes the TM (Which is what I did). The former way is a way you can make another item you have unconsumable.

To insert:
Do the byte changes below
0x124F78: 00 00 00 00
0x125C80: 00 00 00 00

Make it Ungivable:
insert that at 0x1326B8: 00 00 17 E0

Make it consumable after animation:
Insert: 00 00 00 00 at 0x124F78

To remove the quantities showing up in the bag:

Compile and insert into free space:
Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
	cmp r5, #0x0
	bne end
	ldr r3, =(0x8131EFE +1)
	bx r3

end:
	mov r0, r7
	mov r1, #0x8
	mov r2, r4
	ldr r6, =(0x81335B0 +1)
	bl link
	ldr r3, =(0x8131EFE +1)
	bx r3

link:
	bx r6

.align 2


Here's a compiled version:
00 2D 01 D1 05 4B 18 47 38 1C 08 21 22 1C 04 4E 00 F0 02 F8 01 4B 18 47 30 47 C0 46 FF 1E 13 08 B1 35 13 08
Now navigate to 0x131EF4 and insert:
00 48 00 47 XX XX XX 08
Where XX XX XX is the pointer to where you assembled the routine +1

Now navigate to 0x131EA5 and change the byte to E0

Unsellable:
Basically for the TMs, you can still sell them to vendors. To change this, you need to modify each TM individually. It's unfortunate, but the game checks if an item can be sold my comparing it's market price to zero. If it's strictly greater than zero, then you can sell it to a vendor, seems to be the rule. So to make TMs unsellable you need to set their market prices individually to zero.
I can't use my own checks to disguise the TMs as unique because the sell routine in shops are used for ALL items including potions, berries, TMs, and other items like nuggets.


Present :3
To make TMs ungivable when chosen through the Pokémon -> Give menu, navigate to 0x13288D and change the byte to E0.

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.3 Years
I think that's very simple. You can see a palette pointer table at 0x5C8FDC and that's the palettes for elites and champion (first 5 entries). You can modify them by using APE (all not LZ77 compressed).
There will be boy player & girl player palette after that, but please ignore them as they're not used at all.


/*=============================================================================================================================*/


Things in the spoiler below are something need help and it may be better in the ASM help thread.
Spoiler:

Enhancement of scrolling multichoice box (special 0x158)


/*=================================================================================================*/
Actually, I've encountered a problem in hacking this special function, and it will be shown in the end of the post.
/*=================================================================================================*/
What's this:

The reason why I rewrote the function is that I don't want to mess up the original special function, and it's more clear for people to read it.

How to use:
Firstly we should use FBI's way to build some tables.


Then we need to compile and insert this useless interesting function:
.thumb
.align 2
initialize_func:
push {r4, r5, lr}
ldr r0, =0x809D6D5
ldr r1, =0x81119D5
bl call_via_r1
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #1
beq back
mov r0, pc
add r0, #0x43
mov r1, #8
ldr r2, =0x0807741D
bl call_via_r2
lsl r0, r0, #0x18
lsr r5, r0, #0x18
lsl r0, r5, #2
add r0, r0, r5
lsl r0, r0, #3
ldr r1, =0x03005090
add r3, r0, r1
mov r2, #0
ldr r1, =0x020370B8
ldrh r0, [r1]
strh r0, [r3, #8] @row_quantity
ldrh r0, [r1, #2]
strh r0, [r3, #0xA] @option_quantity
ldrh r0, [r1, #0x12]
strh r0, [r3, #0x12] @bottom_red_arrow_Y_coordinate
ldrh r0, [r1, #4]
strh r0, [r3, #0xC] @X_coordinate
ldrh r0, [r1, #6]
strh r0, [r3, #0xE] @Y_coordinate
mov r0, #8
strh r0, [r3, #0x10]
mov r0, #0
strh r0, [r3, #0x14]
strh r5, [r3, #0x26]
ldrh r0, [r1, #8]
strh r0, [r3, #0x16]
ldrh r0, [r1, #0xA]
strh r0, [r3, #0x18]
back:
pop {r4, r5, pc}
main_func: 
push {r4-r7, lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, sp, #0x20
lsl r0, r0, #0x18
lsr r7, r0, #0x18
lsl r0, r7, #2
add r0, r0, r7
lsl r0, r0, #3
ldr r1, =0x03005090
add r5, r0, r1
ldr r1, =0x03000F28
mov r0, #1
strb r0, [r1]
ldr r0, =0x2039A18
ldr r1, =0x2039A0E
ldrh r1, [r1]
strh r1, [r0]
ldr r4, =0x2039A14
mov r1, #0xA
ldrsh r0, [r5, r1]
lsl r0, r0, #3
ldr r1, =0x8002BB1
bl call_via_r1
str r0, [r4]
ldr r2, =0x80CBA7D
bl call_via_r2
mov r6, #0
mov r4, #0
mov r2, #0xA
ldrsh r0, [r5, r2]
lsl r3, r7, #2
mov r10, r3
add r1, sp, #0x18
mov r9, r1
cmp r6, r0
bge .L_0
ldr r2, table
ldr r1, =0x020370B8
ldrh r1, [r1, #0xC]
lsl r1, r1, #0x2
add r2, r2, r1
ldr r2, [r2]
mov r8, r2
.L_1:
ldr r0, =0x2039A14
ldr r0, [r0]
lsl r3, r4, #3
add r3, r3, r0
lsl r2, r4, #2
add r2, r8
ldr r1, [r2]
str r1, [r3]
str r4, [r3, #4]
mov r0, #2
mov r2, #0
push {r4}
ldr r4, =0x8005ED5
bl call_via_r4
pop {r4}
cmp r0, r6
ble .L_2
add r6, r0, #0
.L_2:
add r0, r4, #1
lsl r0, r0, #0x18
lsr r4, r0, #0x18
mov r3, #0xA
ldrsh r0, [r5, r3]
cmp r4, r0
blt .L_1
.L_0:
mov r0, r6
add r0, #9
cmp r0, #0
bge .L_3
add r0, #7
.L_3:
asr r0, r0, #3
add r2, r0, #1
strh r2, [r5, #0x10]
mov r1, #0xC
ldrsh r0, [r5, r1]
mov r3, #0x10
ldrsh r1, [r5, r3]
add r0, r0, r1
cmp r0, #0x1D
ble .L_4
mov r0, #0x1D
sub r0, r0, r2
strh r0, [r5, #0xC]
.L_4:
ldrb r2, [r5, #0xC]
ldrb r3, [r5, #0xE]
ldr r1, =0x020370B8
ldrh r0, [r1, #0xE]
str r0, [sp] @width
ldrh r0, [r1, #0x10]
str r0, [sp, #4] @height
mov r0, #0xF
str r0, [sp, #8] @palette?
mov r0, #0x38
str r0, [sp, #0xC]
add r0, sp, #0x10
mov r1, #0
ldr r4, =0x0810FE51
bl call_via_r4
ldr r0, [sp, #0x10]
ldr r1, [sp, #0x14]
str r0, [sp, #0x18]
str r1, [sp, #0x1C]
mov r0, r9
ldr r4, =0x08003CE5
bl call_via_r4
lsl r0, r0, #0x18
lsr r0, r0, #0x18
strh r0, [r5, #0x22]
mov r1, #0
ldr r4, =0x80F7751
bl call_via_r4
ldr r4, =0x3005360
ldrh r0, [r5, #0xA]
strh r0, [r4, #0xC]
ldrh r0, [r5, #8]
strh r0, [r5, #0xE]
ldrh r0, [r5, #0x22]
strb r0, [r4, #0x10]
mov r0, r7
ldr r1, =0x80CBCC1
bl call_via_r1
ldrh r1, [r5, #0x16]
ldrh r2, [r5, #0x18]
mov r0, r4
ldr r3, =0x8106FF9
bl call_via_r3
lsl r0, r0, #0x18
lsr r0, r0, #0x18
strh r0, [r5, #0x24]
ldrh r0, [r5, #0x22]
lsl r0, r0, #0x18
lsr r0, r0, #0x18
ldr r1, =0x8003FA1
bl call_via_r1
ldrh r0, [r5, #0x22]
lsl r0, r0, #0x18
lsr r0, r0, #0x18
mov r1, #3
ldr r3, =0x8003F21
bl call_via_r3
ldr r1, =0x03005090
mov r2, r10
add r0, r2, r7
lsl r0, r0, #3
add r0, r0, r1
ldr r1, =0x80CBB29
str r1, [r0]
add sp, sp, #0x20
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7, pc}
call_via_r1:
bx r1
call_via_r2:
bx r2
call_via_r3:
bx r3
call_via_r4:
bx r4
.align 2
table: .word 0x8[offset_of_your_table]
Absolutely, we should change the table offset in the routine correspondingly.

otherwise you can use this compiled version instead:
30 B5 6D 48 6D 49 00 F0 D0 F8 00 06 00 0E 01 28 
21 D0 78 46 43 30 08 21 69 4A 00 F0 C7 F8 00 06 
05 0E A8 00 40 19 C0 00 66 49 43 18 00 22 66 49 
08 88 18 81 48 88 58 81 48 8A 58 82 88 88 98 81 
C8 88 D8 81 08 20 18 82 00 20 98 82 DD 84 08 89 
D8 82 48 89 18 83 30 BD F0 B5 57 46 4E 46 45 46 
E0 B4 88 B0 00 06 07 0E B8 00 C0 19 C0 00 55 49 
45 18 56 49 01 20 08 70 55 48 56 49 09 88 01 80 
55 4C 0A 21 68 5E C0 00 54 49 00 F0 8E F8 20 60 
53 4A 00 F0 8B F8 00 26 00 24 0A 22 A8 5E BB 00 
9A 46 06 A9 89 46 86 42 20 DA 42 4A 46 49 89 89 
89 00 52 18 12 68 90 46 47 48 00 68 E3 00 1B 18 
A2 00 42 44 11 68 19 60 5C 60 02 20 00 22 10 B4 
44 4C 00 F0 6D F8 10 BC B0 42 00 DD 06 1C 60 1C 
00 06 04 0E 0A 23 E8 5E 84 42 E5 DB 30 1C 09 30 
00 28 00 DA 07 30 C0 10 42 1C 2A 82 0C 21 68 5E 
10 23 E9 5E 40 18 1D 28 02 DD 1D 20 80 1A A8 81 
2A 7B AB 7B 2C 49 C8 89 00 90 08 8A 01 90 0F 20 
02 90 38 20 03 90 04 A8 00 21 2F 4C 00 F0 40 F8 
04 98 05 99 06 90 07 91 48 46 2C 4C 00 F0 38 F8 
00 06 00 0E 68 84 00 21 29 4C 00 F0 31 F8 29 4C 
68 89 A0 81 28 89 E8 81 68 8C 20 74 38 1C 26 49 
00 F0 23 F8 E9 8A 2A 8B 20 1C 24 4B 00 F0 1F F8 
00 06 00 0E A8 84 68 8C 00 06 00 0E 20 49 00 F0 
14 F8 68 8C 00 06 00 0E 03 21 1E 4B 00 F0 0F F8 
0C 49 52 46 D0 19 C0 00 40 18 1B 49 01 60 08 B0 
38 BC 98 46 A1 46 AA 46 F0 BD 08 47 10 47 18 47 
20 47 C0 46 [pointer_to_your_table] D5 D6 09 08 
D5 19 11 08 1D 74 07 08 90 50 00 03 B8 70 03 02 
28 0F 00 03 18 9A 03 02 0E 9A 03 02 14 9A 03 02 
B1 2B 00 08 7D BA 0C 08 D5 5E 00 08 51 FE 10 08 
E5 3C 00 08 51 77 0F 08 60 53 00 03 C1 BC 0C 08 
F9 6F 10 08 A1 3F 00 08 21 3F 00 08 29 BB 0C 08
Parameters:
0x8000: row_quantity
0x8001: option_quantity
0x8002: X_coordinate
0x8003: Y_coordinate
0x8004: start_option_No.
0x8005: arrow_position_in_current_box
0x8006: which_box_to_show?
0x8007: width
0x8008: height
0x8009:bottom_red_arrow_Y_coordinate
A script like this is required to use this hack: (I use XSE)
#org @specialhack
lock
setvar 0x8000 0x1
setvar 0x8001 0x7
setvar 0x8002 0xA
setvar 0x8003 0x5
setvar 0x8004 0x0
setvar 0x8005 0x0
setvar 0x8006 0x0
setvar 0x8007 0x8
setvar 0x8008 0x2
setvar 0x8009 0xA
callasm 0x8[offset of the function + 1]
waitstate
release
end
Yes, you're right. The problem which is apparently shown in front of you is that I failed to control "top_red_arrow_Y_coordinate". So I use an alternative way, which means that you can change variable 0x8009 to adjust the position of the bottom red arrow to make them symmetric. As the function is very easy, I hope that someone can modify this function so it will work better.
I dunno why it happens, how will I show the other choices?


this is the script that I made
Spoiler:

#org 0x8ECED1
lock
setvar 0x8000 0xA
setvar 0x8001 0xA
setvar 0x8002 0x20
setvar 0x8003 0x1
setvar 0x8004 0x0
setvar 0x8005 0x0
setvar 0x8006 0x0
setvar 0x8007 0x8
setvar 0x8008 0xF
setvar 0x8009 0xF
callasm 0x9800001
waitstate
release
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.
Age 25
Male
Seen August 31st, 2019
Posted August 31st, 2019
455 posts
6.4 Years
Battle End Move Target Held Items (FR):-

Loader Routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func
.global targetitemloader

CheckOutcome:
       ldr r1, .Outcome
       ldrb r0, [r1]
       mov r1, #0x29
       and r0, r1
       cmp r0, #0x0
       bne NoEffect

GetTargetItemEffect:
       ldr r1, .BattleData
       ldr r0, .TargetBank
       ldrb r2, [r0, #0x0]
       mov r0, #0x58
       mul r0, r2
       add r6, r0, r1 /*save Target Data in r6 for quick access*/
       ldrh r0, [r6, #0x2E]
       mov r7, r0     /*save Item Buffer in r7 for quick access*/
       bl EffectGetter

CheckTable:
       ldr r3, .TableLoc
Loop:       
       ldrb r2, [r3, #0x0]
       cmp r2, #0xFF
       beq NoEffect
       cmp r2, r0
       beq EntryFound
       add r3, #0x8
       b Loop

EntryFound:
       ldr r0, [r3, #0x4]
       bx r0

NoEffect:
       ldr r0, .Return
       bx r0

EffectGetter:
       ldr r2, =0x809A924+1
       bx r2

.align 2
.Outcome: .word 0x02023DCC
.BattleData: .word 0x02023BE4
.TargetBank: .word 0x02023D6C
.TableLoc: .word 0x08730060
.Return: .word 0x080237C8+1
Table at x730060 should contain 8 byte entries in the format: [Held Item Effect (byte)] 0 0 0 [HeldItem ASM Pointer + 1 in litte endian format](4 bytes) and must be terminated by a FF

Table at xTTTTTT:
C4 33 02 08 A0 34 02 08 5C 35 02 08 80 35 02 08 98 35 02 08 C0 35 02 08 E4 35 02 08 8C 36 02 08 02 37 02 08 38 37 02 08 D8 37 02 08 XX+1 XX XX 08 CC 36 02 08 EC 36 02 08 1C 38 02 08 60 38 02 08 40 3A 02 08 28 3B 02 08 B4 3B 02 08
where 0xXXXXXX is the pointer to the loader routine.

At x23378: insert pointer to 0x8TTTTTT
At x23366, x23BC0, x23bd6, x23be0 & x23bec: insert 0x12 (i.e. New No. Of End Move Table Entries)
At x1d6ABC, x1d6ad7, x1d6d48, x1d7661, x1d7b76, x1d7b8e, x1d7cd8, x1d839a, x1d94e6, x1d9500 & x1d9517: insert 49 02 11 (No. Of Entries - 1).
In custom battle scripts for Rototiller, Flower Shield etc. and the updated Multi-target moves like Surf, Discharge etc. replace each occurence of cmd49 0x2 0x10 with cmd49 0x2 0x11.



Rocky Helmet:-
Spoiler:

Routine:
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global rockyhelmet

CheckMagicGuard:
      ldr r1, .BattleStruct
      ldr r0, .UserBank
      ldrb r2, [r0, #0x0]
      mov r0, #0x58
      mul r0, r2
      add r3, r0, r1
      ldrb r0, [r3]
      cmp r0, #0x73 /*Magic Guard*/
      beq NoRocky

HPCheck:
      ldrh r0, [r3, #0x8]
      cmp r0, #0x0
      beq NoRocky

CheckDamage:
      ldr r2, .DamageStruct
      ldr r0, .UserBank
      add r0, #0x1
      ldrb r1, [r0, #0x0]
      lsl r0, r1, #0x2
      add r0, r0, r1
      lsl r1, r0, #0x2
      add r0, r2, #0x4
      add r0, r1, r0
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq NoRocky

CheckContactMove:
      ldr r1, .CurrMove
      ldr r2, .MoveData
      ldrh r1, [r1]
      lsl r0, r1, #1
      add r0, r0, r1
      lsl r0, r0, #2
      add r0, r0, r2
      ldrb r0, [r0, #0x8]
      lsl r0, r0, #0x1F
      cmp r0, #0x0
      beq NoRocky

SetRecoilDamageAndScript:
      ldrh r0, [r3, #0xC]
      mov r1, #0x6 
      ldr r2, .Divider
      bl SubRoutCall
      cmp r0, #0x0
      bne NoZero
      mov r0, #0x1

NoZero:
      ldr r1, .Damage
      strh r0, [r1]       
      ldr r2, .ScriptPusher
      bl SubRoutCall
      ldr r1, .ScriptPointer
      ldr r0, .RockyHelmetBS
      str r0, [r1]
      ldr r1, .StringArguement 
      ldr r0, .StringOffset
      str r0, [r1]
      ldr r1, .ItemBuffer
      strh r7, [r1]
      ldr r2, .ReturnPass
      bx r2

SubRoutCall:
      mov pc, r2

NoRocky:
      ldr r2, .ReturnFail
      bx r2

.align 2
.Damage: .word 0x2023D50
.DamageStruct: .word 0x02023ECC
.CurrMove: .word 0x02023D4A
.BattleStruct: .word 0x02023C04
.UserBank: .word 0x02023D6B
.ScriptPointer: .word 0x02023D74
.StringArguement: .word 0x0203C020
.ItemBuffer: .word 0x02023D68
.StringOffset: .word 0x8DDDDDD
.RockyHelmetBS: .word 0x08AAAAAA
.ScriptPusher: .word 0x8017544+1
.Divider: .word 0x081E4018+1
.ReturnPass: .word 0x080236FC+1
.ReturnFail: .word 0x080237C8+1
.MoveData: .word 0x08250C04


Battle Script at AAAAAA:
Spoiler:

35 D0 3D 02 02 00 01 10 00 0B 01 0C 01 10 84 01 12 40 00 19 01 00 00 00 00 00 3C


Battle String at DDDDDD:
FD 10 B4 E7 00 FD 16 FE DC E9 E6 E8 00 FD 0F AB FF


Weakness Policy:-
Spoiler:


Routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func
.global weaknesspolicy

CheckSuperEffectiveness:
      ldr r1, .Outcome
      ldrb r0, [r1]
      mov r2, #0x2
      and r0, r2
      cmp r0, #0x0
      beq NoPolicy

CheckDamage:
      ldr r2, .DamageStruct
      ldr r0, .UserBank
      add r0, #0x1
      ldrb r1, [r0, #0x0]
      lsl r0, r1, #0x2
      add r0, r0, r1
      lsl r1, r0, #0x2
      add r0, r2, #0x4
      add r0, r1, r0
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq NoPolicy

CheckTargetHP:
      ldrh r0, [r6, #0x28]
      cmp r0, #0x0
      beq NoPolicy

CheckTargetSubstitute:
      ldr r0, [r6, #0x50]
      mov r1, #0x1
      lsl r1, r1, #0x18
      and r0, r1
      cmp r0, #0x0
      bne NoPolicy

SetPolicyScript:
      ldr r2, .ScriptPusher
      bl SubRoutCall
      ldr r1, .ScriptPointer
      ldr r0, .WeaknessPolicyBS
      str r0, [r1]
      ldr r1, .ItemBuffer
      strh r7, [r1]
      ldr r2, .ReturnPass

SubRoutCall:
      mov pc, r2

NoPolicy:
      ldr r2, .ReturnFail
      bx r2

.align 2
.Outcome: .word 0x02023DCC
.DamageStruct: .word 0x02023ECC
.BattleStruct: .word 0x02023BE4
.UserBank: .word 0x02023D6B
.ScriptPointer: .word 0x02023D74
.ItemBuffer: .word 0x02023D68
.WeaknessPolicyBS: .word 0x08AAAAAA
.ScriptPusher: .word 0x8017544+1
.ReturnPass: .word 0x080236FC+1
.ReturnFail: .word 0x080237C8+1


Battle Script at AAAAAA:
Spoiler:

#dynamic 0x730400
#freespacebyte 0xFF

#org @start
jumpifstat 0x0 0x3 0x1 0xC @attack2
jumpifstat 0x0 0x0 0x4 0xC @ret

#org @attack2
removeitem 0x0
setbyte 0x2023FDF 0x0
playstatchangeanimation 0x0 0x12 0x0
setbyte 0x2023FDE 0x21
statbuffchange 0x0 false @spatk2
jumpifbyte 0x0 0x2023E87 0x2 @spatk2
setword 0x2023C020 0x8DDDDDD
printstring 0x184
waitmessage 0x40

#org @spatk2
setbyte 0x2023FDE 0x24
statbuffchange 0x0 false @ret
jumpifbyte 0x0 0x2023E87 0x2 @ret
setword 0x2023C020 0x8DDDDDD
printstring 0x184
waitmessage 0x40

#org @ret
return


Battle String at DDDDDD:
FD 10 B4 E7 00 FD 16 00 E7 DC D5 E6 E4 E0 ED FE E6 D5 DD E7 D9 D8 00 DD E8 E7 00 FD 00 AB FF


Knock Off Ban-list Hook:-
Spoiler:


Good place to put logic to prevent removal of specific Mega Stone on a Mega-evolving mon, or Plates on a Multitype mon.
Also prevents loss of Weakness Policy due to a Super-Effective Knock Off.

.text
.align 2
.thumb
.thumb_func
.global knockoffbanlist

CheckStickyHold:
      add r0, #0x20
      ldrb r2, [r0]
      cmp r2, #0x3C
      beq Sticky

CheckItem:
      ldrh r0, [r1, #0x2E]
      cmp r0, #0x0
      beq NoItem

BanList:
      push {r3-r4,r7}
      mov r3, r0

CheckOutcome:
      ldr r1, .Outcome
      ldrb r0, [r1]
      mov r2, #0x2
      and r0, r2
      cmp r0, #0x0
      beq CheckOthers

CheckWeaknessPolicy:
      mov r0, r3
      bl GetEffect
      cmp r0, #0xKK
      beq PopBeforeFail

CheckOthers:
     /* Write you code here for Non-Removable Mega Stones,  etc.*/
RemovableItem:
      pop {r3-r4,r7}
      ldr r0, =0x0802105E+1
      bx r0

PopBeforeFail:
      pop {r3-r4,r7}

NoItem:
      ldr r0, =0x080210EC+1
      bx r0

Sticky:
      ldr r0, =0x08021030+1
      bx r0

GetEffect:
      ldr r1, =0x0809A924+1
      bx r1

.align 2
.Outcome: .word 0x02023DCC
/*KK is the effect byte of Weakness Policy*/
/*At x21028: 00 4A 10 47 XX+1 XX XX 08*/

jiangzhengwenjzw

now working on pokefirered

Male
Seen 1 Hour Ago
Posted 3 Weeks Ago
176 posts
7.2 Years
I dunno why it happens, how will I show the other choices?
this is the script that I made
Spoiler:

#org 0x8ECED1
lock
setvar 0x8000 0xA
setvar 0x8001 0xA
setvar 0x8002 0x20
setvar 0x8003 0x1
setvar 0x8004 0x0
setvar 0x8005 0x0
setvar 0x8006 0x0
setvar 0x8007 0x8
setvar 0x8008 0xF
setvar 0x8009 0xF
callasm 0x9800001
waitstate
release
end
I've seen your post, but I'm not sure about what occurred. Currently I'm very busy so I can't test it, but when I have time, I will try to redo the function. I can only suggest you to reduce the value of var_8000 to some value like 7 or 4 now, as the original game uses them.

EdgeZard X

Seen March 13th, 2018
Posted October 21st, 2016
35 posts
4.3 Years
Hi,

I have some requests for Fire Red 1.0 (if they're possible using ASM)

- increasing the EV limit for vitamins from 100 to 252 (since 255 is redundant)
- changing the number of Pokémon affected by Soul Dew (in this case, to four Pokémon (the two extra Pokémon have indexes 0x20b and 0x20c))
- changing Exp Share to give 50% Exp to the holding Pokémon regardless of how much Pokémon are holding it (I'm not sure if this has already been done or not)
CHALA CHALLA KA HAPPY MEAL TIME!

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.3 Years
Hey everybody , I just want to ask is there any way to restrict main player from adding a certain pokemon in PC storage system ( ROM base : Pokemon Emerald)
It can be done via script
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.

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.3 Years
I don't think you can do it with a script :/
Maybe you can share how?
there's a code in Eme that can checkthe index number of a Pokémon right, by just editng the PC script before the player presses deposit, then it will do the trick, butvif he wants a set-up where the player enters to deposit Pokemon PC and then when he puts his pokemon on a certain box, a script will pop-up saying "it cannot be placed here" or something, then it really needs an asm routine XD
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.

Desinishon

Banned

Age 21
Male
East Blue
Seen June 12th, 2019
Posted April 28th, 2019
5,030 posts
4.3 Years
there's a code in Eme that can checkthe index number of a Pokémon right, by just editng the PC script before the player presses deposit, then it will do the trick, butvif he wants a set-up where the player enters to deposit Pokemon PC and then when he puts his pokemon on a certain box, a script will pop-up saying "it cannot be placed here" or something, then it really needs an asm routine XD
No I don't want " it cannot be placed here" like something I just want to restrict him from adding a pokemon like first u say with a certain code, can you elaborate it to me how to do . I just started hacking emerald recently .

(P.S: plz sorry for my late reply and thanks for helping me out)
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.4 Years
Battle End Move Target Held Items (FR):-

Loader Routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func
.global targetitemloader

CheckOutcome:
       ldr r1, .Outcome
       ldrb r0, [r1]
       mov r1, #0x29
       and r0, r1
       cmp r0, #0x0
       bne NoEffect

GetTargetItemEffect:
       ldr r1, .BattleData
       ldr r0, .TargetBank
       ldrb r2, [r0, #0x0]
       mov r0, #0x58
       mul r0, r2
       add r6, r0, r1 /*save Target Data in r6 for quick access*/
       ldrh r0, [r6, #0x2E]
       mov r7, r0     /*save Item Buffer in r7 for quick access*/
       bl EffectGetter

CheckTable:
       ldr r3, .TableLoc
Loop:       
       ldrb r2, [r3, #0x0]
       cmp r2, #0xFF
       beq NoEffect
       cmp r2, r0
       beq EntryFound
       add r3, #0x8
       b Loop

EntryFound:
       ldr r0, [r3, #0x4]
       bx r0

NoEffect:
       ldr r0, .Return
       bx r0

EffectGetter:
       ldr r2, =0x809A924+1
       bx r2

.align 2
.Outcome: .word 0x02023DCC
.BattleData: .word 0x02023BE4
.TargetBank: .word 0x02023D6C
.TableLoc: .word 0x08730060
.Return: .word 0x080237C8+1
Table at x730060 should contain 8 byte entries in the format: [Held Item Effect (byte)] 0 0 0 [HeldItem ASM Pointer + 1 in litte endian format](4 bytes) and must be terminated by a FF

Table at xTTTTTT:
C4 33 02 08 A0 34 02 08 5C 35 02 08 80 35 02 08 98 35 02 08 C0 35 02 08 E4 35 02 08 8C 36 02 08 02 37 02 08 38 37 02 08 D8 37 02 08 XX+1 XX XX 08 CC 36 02 08 EC 36 02 08 1C 38 02 08 60 38 02 08 40 3A 02 08 28 3B 02 08 B4 3B 02 08
where 0xXXXXXX is the pointer to the loader routine.

At x23378: insert pointer to 0x8TTTTTT
At x23366, x23BC0, x23bd6, x23be0 & x23bec: insert 0x12 (i.e. New No. Of End Move Table Entries)
At x1d6ABC, x1d6ad7, x1d6d48, x1d7661, x1d7b76, x1d7b8e, x1d7cd8, x1d839a, x1d94e6, x1d9500 & x1d9517: insert 49 02 11 (No. Of Entries - 1).
In custom battle scripts for Rototiller, Flower Shield etc. and the updated Multi-target moves like Surf, Discharge etc. replace each occurence of cmd49 0x2 0x10 with cmd49 0x2 0x11.



Rocky Helmet:-
Spoiler:

Routine:
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global rockyhelmet

CheckMagicGuard:
      ldr r1, .BattleStruct
      ldr r0, .UserBank
      ldrb r2, [r0, #0x0]
      mov r0, #0x58
      mul r0, r2
      add r3, r0, r1
      ldrb r0, [r3]
      cmp r0, #0x73 /*Magic Guard*/
      beq NoRocky

HPCheck:
      ldrh r0, [r3, #0x8]
      cmp r0, #0x0
      beq NoRocky

CheckDamage:
      ldr r2, .DamageStruct
      ldr r0, .UserBank
      add r0, #0x1
      ldrb r1, [r0, #0x0]
      lsl r0, r1, #0x2
      add r0, r0, r1
      lsl r1, r0, #0x2
      add r0, r2, #0x4
      add r0, r1, r0
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq NoRocky

CheckContactMove:
      ldr r1, .CurrMove
      ldr r2, .MoveData
      ldrh r1, [r1]
      lsl r0, r1, #1
      add r0, r0, r1
      lsl r0, r0, #2
      add r0, r0, r2
      ldrb r0, [r0, #0x8]
      lsl r0, r0, #0x1F
      cmp r0, #0x0
      beq NoRocky

SetRecoilDamageAndScript:
      ldrh r0, [r3, #0xC]
      mov r1, #0x6 
      ldr r2, .Divider
      bl SubRoutCall
      cmp r0, #0x0
      bne NoZero
      mov r0, #0x1

NoZero:
      ldr r1, .Damage
      strh r0, [r1]       
      ldr r2, .ScriptPusher
      bl SubRoutCall
      ldr r1, .ScriptPointer
      ldr r0, .RockyHelmetBS
      str r0, [r1]
      ldr r1, .StringArguement 
      ldr r0, .StringOffset
      str r0, [r1]
      ldr r1, .ItemBuffer
      strh r7, [r1]
      ldr r2, .ReturnPass
      bx r2

SubRoutCall:
      mov pc, r2

NoRocky:
      ldr r2, .ReturnFail
      bx r2

.align 2
.Damage: .word 0x2023D50
.DamageStruct: .word 0x02023ECC
.CurrMove: .word 0x02023D4A
.BattleStruct: .word 0x02023C04
.UserBank: .word 0x02023D6B
.ScriptPointer: .word 0x02023D74
.StringArguement: .word 0x0203C020
.ItemBuffer: .word 0x02023D68
.StringOffset: .word 0x8DDDDDD
.RockyHelmetBS: .word 0x08AAAAAA
.ScriptPusher: .word 0x8017544+1
.Divider: .word 0x081E4018+1
.ReturnPass: .word 0x080236FC+1
.ReturnFail: .word 0x080237C8+1
.MoveData: .word 0x08250C04


Battle Script at AAAAAA:
Spoiler:

35 D0 3D 02 02 00 01 10 00 0B 01 0C 01 10 84 01 12 40 00 19 01 00 00 00 00 00 3C


Battle String at DDDDDD:
FD 10 B4 E7 00 FD 16 FE DC E9 E6 E8 00 FD 0F AB FF


Weakness Policy:-
Spoiler:


Routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func
.global weaknesspolicy

CheckSuperEffectiveness:
      ldr r1, .Outcome
      ldrb r0, [r1]
      mov r2, #0x2
      and r0, r2
      cmp r0, #0x0
      beq NoPolicy

CheckDamage:
      ldr r2, .DamageStruct
      ldr r0, .UserBank
      add r0, #0x1
      ldrb r1, [r0, #0x0]
      lsl r0, r1, #0x2
      add r0, r0, r1
      lsl r1, r0, #0x2
      add r0, r2, #0x4
      add r0, r1, r0
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq NoPolicy

CheckTargetHP:
      ldrh r0, [r6, #0x28]
      cmp r0, #0x0
      beq NoPolicy

CheckTargetSubstitute:
      ldr r0, [r6, #0x50]
      mov r1, #0x1
      lsl r1, r1, #0x18
      and r0, r1
      cmp r0, #0x0
      bne NoPolicy

SetPolicyScript:
      ldr r2, .ScriptPusher
      bl SubRoutCall
      ldr r1, .ScriptPointer
      ldr r0, .WeaknessPolicyBS
      str r0, [r1]
      ldr r1, .ItemBuffer
      strh r7, [r1]
      ldr r2, .ReturnPass

SubRoutCall:
      mov pc, r2

NoPolicy:
      ldr r2, .ReturnFail
      bx r2

.align 2
.Outcome: .word 0x02023DCC
.DamageStruct: .word 0x02023ECC
.BattleStruct: .word 0x02023BE4
.UserBank: .word 0x02023D6B
.ScriptPointer: .word 0x02023D74
.ItemBuffer: .word 0x02023D68
.WeaknessPolicyBS: .word 0x08AAAAAA
.ScriptPusher: .word 0x8017544+1
.ReturnPass: .word 0x080236FC+1
.ReturnFail: .word 0x080237C8+1


Battle Script at AAAAAA:
Spoiler:

#dynamic 0x730400
#freespacebyte 0xFF

#org @start
jumpifstat 0x0 0x3 0x1 0xC @attack2
jumpifstat 0x0 0x0 0x4 0xC @ret

#org @attack2
removeitem 0x0
setbyte 0x2023FDF 0x0
playstatchangeanimation 0x0 0x12 0x0
setbyte 0x2023FDE 0x21
statbuffchange 0x0 false @spatk2
jumpifbyte 0x0 0x2023E87 0x2 @spatk2
setword 0x2023C020 0x8DDDDDD
printstring 0x184
waitmessage 0x40

#org @spatk2
setbyte 0x2023FDE 0x24
statbuffchange 0x0 false @ret
jumpifbyte 0x0 0x2023E87 0x2 @ret
setword 0x2023C020 0x8DDDDDD
printstring 0x184
waitmessage 0x40

#org @ret
return


Battle String at DDDDDD:
FD 10 B4 E7 00 FD 16 00 E7 DC D5 E6 E4 E0 ED FE E6 D5 DD E7 D9 D8 00 DD E8 E7 00 FD 00 AB FF


Knock Off Ban-list Hook:-
Spoiler:


Good place to put logic to prevent removal of specific Mega Stone on a Mega-evolving mon, or Plates on a Multitype mon.
Also prevents loss of Weakness Policy due to a Super-Effective Knock Off.

.text
.align 2
.thumb
.thumb_func
.global knockoffbanlist

CheckStickyHold:
      add r0, #0x20
      ldrb r2, [r0]
      cmp r2, #0x3C
      beq Sticky

CheckItem:
      ldrh r0, [r1, #0x2E]
      cmp r0, #0x0
      beq NoItem

BanList:
      push {r3-r4,r7}
      mov r3, r0

CheckOutcome:
      ldr r1, .Outcome
      ldrb r0, [r1]
      mov r2, #0x2
      and r0, r2
      cmp r0, #0x0
      beq CheckOthers

CheckWeaknessPolicy:
      mov r0, r3
      bl GetEffect
      cmp r0, #0xKK
      beq PopBeforeFail

CheckOthers:
     /* Write you code here for Non-Removable Mega Stones,  etc.*/
RemovableItem:
      pop {r3-r4,r7}
      ldr r0, =0x0802105E+1
      bx r0

PopBeforeFail:
      pop {r3-r4,r7}

NoItem:
      ldr r0, =0x080210EC+1
      bx r0

Sticky:
      ldr r0, =0x08021030+1
      bx r0

GetEffect:
      ldr r1, =0x0809A924+1
      bx r1

.align 2
.Outcome: .word 0x02023DCC
/*KK is the effect byte of Weakness Policy*/
/*At x21028: 00 4A 10 47 XX+1 XX XX 08*/
Awesome !

I have a question though, are you sure that hook would be enough for Arceus plates and the mega stones ? Because I saw three more check for sticky hold for the moves like thief, trick and I don't remember the last.
Age 25
Male
Seen August 31st, 2019
Posted August 31st, 2019
455 posts
6.4 Years
Awesome !

I have a question though, are you sure that hook would be enough for Arceus plates and the mega stones ? Because I saw three more check for sticky hold for the moves like thief, trick and I don't remember the last.
Yes, this will be not sufficient. There are total of 3 checks IIRC: knock off, thief and trick.
A good trick would be to create a custom bl to determine removability of an item then refer
the bl from these three locations + knock off multiplier in the damagecalc function.

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.3 Years

OAM routines

Could it be possible to load other tables of OAMs? Like the Pokémon Icon, arrows or a table of sprites? It would be cool if it does that, and 256x512 Sprite, I hope, should be also implemented on this routine.
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.
Seen November 20th, 2016
Posted November 20th, 2016
420 posts
4.8 Years
.text
.align 2
.thumb
.thumb_func


main:
    push {r0-r4, lr}
    ldr r1, =(0x20370C0) @var 0x8004
    ldrb r1, [r1]
    mov r2, #0x64
    mul r1, r1, r2
    ldr r0, =(0x2024284)
    add r0, r0, r1 @slot
    mov r4, r0 @save slot
    mov r1, #0x2E
    ldr r3, =(0x803FBE8 +1)
    bl linker
    cmp r0, #0x1
    beq setZero
    mov r0, #0x1
    b setNew

setZero:
    mov r0, #0x0
    
setNew:
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    ldr r2, =(0x20370D0) @set inverse
    strb r0, [r2]
    mov r0, r4
    mov r1, #0x2E
    ldr r3, =(0x804037C +1)
    bl linker
    pop {r0-r4, pc}

linker:
    bx r3

.align 2
This should prevent the ability be changed, if the Pokémon doesnt have a secound one, but sadly it gets swapped too ("--------- Pokémon has no ability.")
Anyone have a idea how to fix this?
After the conditional branch to set the ability bit to zero, instead of automatically setting to one, use getattr again to check for species with r1 set to 0xB. Then check to make sure a (non-zero) ability exists in the second slot of the species. Alternatively, you could literally change the second ability of every mon with only one ability to match the first slot. But that won't directly produce an "error" return which would probably be useful for an ability capsule or something similar.
Age 25
Male
Seen August 31st, 2019
Posted August 31st, 2019
455 posts
6.4 Years
First Side Routine Rewrite
A rewrite of the pokemon turn order comparison routine during battles. It does not add any new features but decomposes the routine into a routine with 3 sub-modules which makes it easier to add new speed altering abilities and items (hooking in the original one required to make dual checks).

The rewrite also avoids redundant calculations. For example, if move priorities do not match then no need to calculate and compare effective speeds of the banked mons.
One of the sub-module returns the effective speed of the banked mon so it can readily used for accurate base power calculation of Gyro Ball and Electro Ball.


Spoiler:

.text
.align 2
.thumb
.thumb_func
.global bc_firstside_rewrite_hack
.org 0x14cD8

@MIf the modifed routine crosses x150A8 a hook will be required.
@Current Length: x220 bytes. Ends at x14f08

Main:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
add sp, #-0x4
lsl r0, r0, #0x18
lsr r0, r0, #0x18 @Bank1
mov r9, r0
lsl r1, r1, #0x18
lsr r1, r1, #0x18
mov r10, r1 @Bank2
mov r0, #0x0
str r0, [sp, #0x0]

TurnModeCheck:
cmp r2, #0x0
bne SpeedCheck

CheckPriority:
mov r0, r9
bl LoadSelectionPriority
lsl r0, r0, #0x18
asr r3, r0, #0x18
mov r8, r3
mov r0, r10
bl LoadSelectionPriority
lsl r0, r0, #0x18
asr r4, r0, #0x18
mov r3, r8
cmp r3, r4
beq SpeedCheck
cmp r3, r4
bge Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
b Exit

SpeedCheck:
mov r0, r9
bl BracketAlteration
mov r8, r0
mov r0, r10
bl BracketAlteration
mov r4, r0
mov r3, r8
cmp r3, r4
beq LoadBankSpeeds
cmp r3, r4
bge Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
b Exit

LoadBankSpeeds:
mov r0, r9
bl GetSpeed
mov r8, r0
mov r0, r10
bl GetSpeed
mov r4, r0
mov r3, r8
cmp r3, r4
bne NoTie
bl 0x44EC8
mov r1, #0x1
and r0, r1
cmp r0, #0x0
bne Exit
mov r2, #0x2 @Speed Tied
str r2, [sp, #0x0]
b Exit

NoTie:
cmp r3, r4 @This can be Reversed for Trick Room
bcs Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]

Exit:
ldr r0, [sp, #0x0]
add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
LoadSelectionPriority:
mov r3, r0

LoadMenuChoice:
ldr r0, .MenuChoice
add r1, r3, r0
mov r0, #0x0
ldrb r1, [r1]
cmp r1, #0x0
bne Exit2

FightOptionChosen:
ldr r0, .ProtectStruct
lsl r1, r3, #0x4
add r1, r1, r0
ldrb r0, [r1]
lsl r0, r0, #0x1D
cmp r0, #0x0
bge LoadMoveIndex

Struggle:
mov r4, #0xA5
b LoadPriority

LoadMoveIndex:
ldr r0, .DP08_Pointer
ldr r0, [r0, #0x0]
add r0, r3
add r0, #0x80
ldrb r0, [r0] @Moveset Slot No. Chosen
lsl r0, r0, #0x1
mov r1, #0x58
mul r1, r3
add r0, r0, r1
ldr r1, .BattleStruct
add r0, r0, r1
ldrh r4, [r0, #0xC]

LoadPriority:
ldr r2, .MoveData
lsl r0, r4, #0x1
add r0, r0, r4
lsl r0, r0, #0x2
add r0, r0, r2
ldrb r0, [r0, #0x7]
@Gale Wings And Prankster can be added here easily

Exit2:
bx lr

.align 2
.MenuChoice: .word 0x02023D7C
.ProtectStruct: .word 0x02023E8C
.DP08_Pointer: .word 0x02023FE8
.BattleStruct: .word 0x02023Be4
.MoveData: .word 0x08250c04


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
BracketAlteration: @Return 1 if Quick Claw activates, otherwise 0. Can be called in the

use of Quick Claw Message Battle Script
push {lr}
mov r7, #0x0
mov r3, r0
mov r1, #0x58
ldr r0, .BattleStruct2
mul r1, r3
add r4, r0, r1

CheckItem:
ldrh r0, [r4, #0x2e]
cmp r0, #0xAF
bne LoadItemEffect

EnigmaBerry:
ldr r1, .EnigmaRamArea
lsl r0, r3, #0x3
sub r0, r0, r3
lsl r0, r0, #0x2
add r0, r0, r1
ldrb r6, [r0, #0x7]
ldrb r5, [r0, #0x1A]
b QuickClawCheck

LoadItemEffect:
bl 0x09A924
lsl r0, r0, #0x18
lsr r6, r0, #0x18
ldrh r0, [r4, #0x2e]
bl 0x09A948
lsl r0, r0, #0x18
lsr r5, r0, #0x18

QuickClawCheck: @Can be expanded to include Custap Berry, Lagging Tail, Stall
cmp r6, #0x1A
bne Exit3

LoadActivationChance:
ldr r0, .RandomNoLoc
ldrh r4, [r0]
lsl r0, r5, #0x10
sub r0, r0, r5
mov r1, #0x64
bl 0x1E4018
cmp r4, r0
bge Exit3
mov r7, #0x1

Exit3:
mov r0, r7

PopRegister:
pop {r1}
bx r1

.align 2
.BattleStruct2: .word 0x2023Be4
.RandomNoLoc: .word 0x2023E80
.EnigmaRamArea: .word 0x2023F54

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
@The speed BL that can be used for Gyro Ball and Electro Ball.
@All speed abilities will go here

GetSpeed:

push {lr}
add sp, #-0x4
mov r7, r0
mov r5, #0x58
ldr r6, .BattleStruct3
mul r5, r7
add r6, r5, r6
mov r5, #0x1
str r0, [sp, #0x0]

CloudNineCheck:
mov r0, #0x13
mov r1, #0x0
mov r2, #0xD
mov r3, #0x0
bl 0x019F18
lsl r0, r0, #0x18
cmp r0, #0x0
bne CheckStat

AirLockCheck:
mov r0, #0x0
str r0, [sp, #0x0]
mov r0, #0x13
mov r1, #0x0
mov r2, #0x4D
mov r3, #0x0
bl 0x019F18
lsl r0, r0, #0x18
cmp r0, #0x0
bne CheckStat

LoadWeather:
ldr r4, .WeatherFlags
ldrh r4, [r4]
add r2, r2, r6
add r2, #0x20
ldrb r2, [r2]

CheckRain:
mov r0, #0x7
and r0, r4
cmp r0, #0x0
beq CheckSunlight
cmp r2, #0x21
beq WeatherBoost

CheckSunlight:
mov r0, #0x60
and r0, r4
cmp r0, #0x0
beq CheckStat
cmp r2, #0x22
bne CheckStat

WeatherBoost:
mov r5, #0x2

CheckStat:
MultiplySpeedAccToStat:
ldrh r3, [r6, #0x6]
mul r5, r3 @Speed
ldr r2, .StatFactors
ldrb r1, [r6, #0x1B]
lsl r1, r1, #0x1
add r2, r1, r2
ldrb r0, [r2]
mul r0, r5
ldrb r1, [r2, #0x1]
bl 0x1E4018
mov r4, r0 @Speed

CheckItem2:
ldrh r0, [r6, #0x2e]
cmp r0, #0xAF
bne LoadItemEffect2

EnigmaBerry2:
ldr r1, .EnigmaRamArea2
lsl r0, r7, #0x3
sub r0, r0, r3
lsl r0, r0, #0x2
add r0, r0, r1
ldrb r0, [r0, #0x7]
b MachoCheck

LoadItemEffect2:
bl 0x09a924
lsl r0, r0, #0x18
lsr r0, r0, #0x18

MachoCheck:
cmp r0, #0x18
bne ParalysisCheck
lsr r4, r4, #0x1

ParalysisCheck:
ldr r0, [r6, #0x4C]
mov r1, #0x40
and r0, r1
cmp r0, #0x0
beq Exit4
lsr r4, r4, #0x2

Exit4:
mov r0, r4
add sp, #0x4
pop {r1}
bx r1

.align 2
.BattleStruct3: .word 0x2023Be4
.WeatherFlags: .word 0x2023F1c
.StatFactors: .word 0x825DEAD
.EnigmaRamArea2: .word 0x2023F54
Advertiser Content