- 2
- Posts
- 9
- Years
- Seen Apr 22, 2017
Hmm, I've been asked to do this before and it's quite the common request. However, it's so easy and straight forward, I'm always left wondering why people don't do it themselves. Then I remember, even if it's easy for me, I guess it's not as easy if you don't know what to do :P
Trainer Capture toggle by Pokeball
What this does right now, if check if the thrown Pokeball is a masterball. If it is, allow capture. If it's not a masterball then the normal "trainer has blocked the ball" will occur. To change which ball toggles the capture look at my comments in the code and change 0x1 - masterball to something else of your choice.
Spoiler:
Taken from XSE:
#define ITEM_MASTERBALL 0x1
#define ITEM_ULTRABALL 0x2
#define ITEM_GREATBALL 0x3
#define ITEM_POKEBALL 0x4
#define ITEM_SAFARIBALL 0x5
#define ITEM_NETBALL 0x6
#define ITEM_DIVEBALL 0x7
#define ITEM_NESTBALL 0x8
#define ITEM_REPEATBALL 0x9
#define ITEM_TIMERBALL 0xA
#define ITEM_LUXURYBALL 0xB
#define ITEM_PREMIERBALL 0xC
How to insert:
Compile and insert the following routine into freespace:
Spoiler:
Code:.text .align 2 .thumb .thumb_func main: ldr r0, .Ball ldrb r0, [r0] cmp r0, #0x1 @masterball beq capture mov r0, #0x0 mov r1, #0x5 ldr r3, =(0x800E194 +1) bl linker ldr r0, =(0x802D4A0 +1) bx r0 capture: ldr r0, =(0x802D4B4 +1) bx r0 linker: bx r3 .align 2 .Ball: .word 0x2023D68
Here is a compiled version:
Code:06 48 00 78 01 28 06 D0 00 20 05 21 04 4B 00 F0 04 F8 04 48 00 47 04 48 00 47 18 47 68 3D 02 02 95 E1 00 08 A1 D4 02 08 B5 D4 02 08
Now navigate to 0x2D498 and insert the following:
Where XX XX XX is the reverse hex pointer +1 of where you inserted the routine.Code:00 48 00 47 XX XX XX 08
Usage:
No usage! It's all done with the power of ASMAGIX!
Works great. I've set my script up to also check flag 0x203, if it's set stealing is disabled. I found that I need this ability because capturing a trainer's Pokemon ends the trainer battle immediately. This is my first ASM attempt, apologizes if I made any mistakes. The code works properly in my testing.
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {r1-r3}
ldr r0, .Ball
ldrb r0, [r0]
cmp r0, #0x1 @masterball
beq checkflag
b nocap
checkflag:
mov r0, #0xFF
lsl r0, r0, #0x1
add r0, r0, #0x5
ldr r3, =(0x806E6D0 +1)
bl linker
cmp r0, #0x0
beq capture
nocap:
pop {r1-r3}
mov r0, #0x0
mov r1, #0x5
ldr r3, =(0x800E194 +1)
bl linker
ldr r0, =(0x802D4A0 +1)
bx r0
capture:
pop {r1-r3}
ldr r0, =(0x802D4B4 +1)
bx r0
linker:
bx r3
.align 2
.Ball:
.word 0x2023D68
Compiled version below. Swap out the XX with the Pokeball item number, 01 for a Masterball.
Spoiler:
Code:
0eb4 0c48 0078 XX28 00d0 07e0 ff20 4000
0530 094b 00f0 0df8 0028 07d0 0ebc 0020
0521 064b 00f0 05f8 0548 0047 0ebc 0548
0047 1847 683d 0202 d1e6 0608 95e1 0008
a1d4 0208 b5d4 0208
Last edited: