Blah
Free supporter
- 1,924
- Posts
- 12
- Years
- Unknown Island
- Seen Feb 19, 2025
Thank you for this thread it helps so many people even though I've only used a couple of these ams routines because I haven't fully understood asm too much I thank you for this thread! :)
Thanks. Though I would like to point out, to use them all you really need to know is how to insert them and what they do. I've documented a guide on how to insert for beginners (it's a link in the FAQ first post). If you don't understand something or don't see how some routine works, feel free to ask!
:3Yes. Just yes. Nothing more. Nothing less.
For the first thing, sorry, I was thinking of another link back there. Thanks.
As for the second thing, I meant pick from random which of an enemy trainer's first pokemon he or she will send out first, like if he or she has a rattata, a pidgey, and a charmander in his team, than I want to make it so that the game selects which of these he or she will send out first. I could hackishly create multiple entries in A-Trainer, but is there a way for the game to pick one of an enemy trainer's pokemon to be sent out first?
EDIT: Well, the trainer name screen screen comes up and makes the change when I callasm 0x09FC91, but I seem to come back to the map with the start menu active and my character still being able to move, but at least the name changes.
I'm still not understanding the incentive to randomizing the starting Pokemon. I suppose it would be a small bit of "game change" if someone were to play your hack more than once, but the feature seems a little useless to me :/
The battle system needs its own thread. It's amazing, I'll definitely be writing a few addons for it.
Also, won't it be more user-friendly to put the addons into a table? That way you never need to recompile.
Yeah it definitely could, and should read off of a table. I'll have to redo that little bit :x
Battle Modes addon: Delete fainted Pokemon
For those hackers who like minigames, this routine will delete Pokemon who have fainted in battle. There's a few things that need to happen for this effect to occur.
1) Pokemon who die in battle must be deleted
2) Eggs are spared
3) Pokemon who die outside of battle must be deleted (Poison or another similar effect)
However, if you put this in turn basis, you will NEED to make another routine to delete the Player's party if he/she loses the match. This is because the turn counter isn't reached on the last turn the player loses :x
If you're lazy like me you can just put this routine in as a battle by move addon and cover the whiteout case. Which is actually fine. It's rather fast, because it deletes the Pokemon as they die, so the worse case scenario is unforeseeable. And if a Pokemon dies it will only need to loop 5 times only doing operations on one of the 5 loops. If you're curious looping a maximum of 21 times is the worst case scenario (all 6 of your Pokemon die in 1 turn i.e never, and even if that did happen it'd be done in less .25 seconds). So it's fine to put in the battle by move section without expecting the game to lag.
How to insert:
Insert as addon to battle modes battle by move.
You will notice that near the start of the routine there is some commented out code (denoted by a prefix "@" symbol). That's for a flag check. Change [flag/4] = your flag/4 in hex if you want to toggle by flag. Of course the normal battle mode toggle flag should be used as well.
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {r0-r5, lr}
@mov r0, #0x[flag/4]
@lsl r0, r0, #0x2
@ldr r3, =(0x806E6D0 +1)
@bl linker
@cmp r0, #0x0
@beq end
ldr r0, =(0x2023E8A)
ldrb r0, [r0]
cmp r0, #0x0
beq realEnd
mov r5, #0x0
loop:
ldr r0, =(0x2024029)
ldrb r4, [r0]
cmp r5, r4
beq end
ldr r0, =(0x2024284)
mov r1, #0x64
mul r1, r1, r5 @slot
add r0, r0, r1 @address
mov r1, #0x39 @C_HP
ldr r3, =(0x803FBE8 +1)
bl linker
cmp r0, #0x0
beq adjustSlots
skip:
add r5, r5, #0x1
b loop
adjustSlots:
cmp r5, #0x5
bge writeLastZero
mov r2, #0x5
sub r2, r2, r5
mov r0, #0x64
mul r2, r2, r0 @size
mov r1, r5
mul r1, r1, r0
ldr r0, =(0x2024284)
add r0, r0, r1 @dest
mov r1, #0x64
add r1, r0, r1 @src
ldr r3, =(0x8040B08 +1)
bl linker
writeLastZero:
ldr r0, =(0x2024478)
mov r1, #0x0
mov r2, #0x64
ldr r3, =(0x81E5ED8 +1)
bl linker
correctCounters:
ldr r0, =(0x2024029)
ldrb r1, [r0]
sub r1, r1, #0x1
strb r1, [r0]
next:
mov r5, #0x0
b loop
end:
ldr r0, =(0x2024029)
ldrb r0, [r0]
cmp r0, #0x0
bne realEnd
mov r0, #0x5E
lsl r0, r0, #0x4
ldr r3, =(0x806E6A8 +1)
bl linker
b realEnd
linker:
bx r3
realEnd:
pop {r0-r5, pc}
.align 2
Usage:
If you opted to use a flag, set it to allow further battles to delete Pokemon as they faint. If you didn't just sit back and let the unicorns inside the game do the rest.
Last edited: