- 10
- Posts
- 8
- Years
- Seen Apr 23, 2018
I want to know how it would be to create mysterious gifts
Roaming Pokemon!
So if I want to use this in Emerald...is it simply a matter of changing offsets? Would the ASM part be the same?
01 49 08 47 C0 46 XX XX XX 08
Also, roaming mechanics already exist in Emerald.
No, you can't just port things from one game to another. Also, roaming mechanics already exist in Emerald.
Answer me. Now.
Answer what?
Why is it relevant that roaming mechanics are already in Emerald, when they're also already in FR?
There is a way to call a script with ASM? I want to make something like this:
If a flag is set do something, if not set show a message.
What's the command I use on a routine to make it work?
[PLAIN]
.text
.align 2
.thumb
.thumb_func
main:
push {r0-r1, lr}
ldr r0, .SCRIPT_ADDRESS
ldr r1, =(0x8069AE4 +1)
bl linkerTwo
pop {r0-r1, pc}
linkerTwo:
bx r1
.align 2
.SCRIPT_ADDRESS:
.word 0x8[script_location +1]
[/PLAIN]
Well, you could manage that by simply using scripts, but if you insist on using ASM:
Code:[PLAIN] .text .align 2 .thumb .thumb_func main: push {r0-r1, lr} ldr r0, .SCRIPT_ADDRESS ldr r1, =(0x8069AE4 +1) bl linkerTwo pop {r0-r1, pc} linkerTwo: bx r1 .align 2 .SCRIPT_ADDRESS: .word 0x8[script_location +1] [/PLAIN]
FBI made this routine as a reply to something I asked some time ago on the ASM Help Thread. You just have to compile it, modifying the code to add your script location, insert the code on an aligned offset (is it said that way? xDD) and then callasm the routine offset + 1 as usual.
Hope this helps :D
Pok?mon Ruby and Sapphire introduced a feature where if you bought 10 or more Pok? Balls in the Mart, you would get a free Premier Ball.
Sadly, this feature was removed in FRLG, and so I tried to port it the best I could.
First, insert this text somewhere using XSE or something and write down the offset of where you inserted it:
After that, assemble this routine in a word-aligned offset (ends in 0, 4, 8 or C)Code:I'll throw in a Premier Ball, too.
(But first, replace the XXXXXX with the offset of where you inserted the Premier Ball message):
Spoiler:
.thumb
main:
push {r4-r7, lr}
lsl r0, r0, #0x18
lsr r5, r0, #0x18
lsl r0, r5, #2
add r0, r0, r5
lsl r0, r0, #3
ldr r1, taskspriv
add r4, r0, r1
mov r0, #4
ldr r7, rboxid_tilemap_update
bl linkr7
ldrh r0, [r4, #0xA] @ItemID
ldrh r1, [r4, #2] @Amount
mov r6, r1
lsl r6, r6, #0x10
add r6, r0
ldr r7, bag_add_item
bl linkr7
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #1
bne fullbag
ldr r1, hereyouare
ldr r2, sub_809BF0C
mov r0, r5
bl displaymsg
mov r0, r5
mov r0, r6
lsl r0, #0x10
lsr r0, #0x10
cmp r0, #0x4 @Pokeball ID
beq boughtball
next:
ldrh r0, [r4, #0xA]
ldrh r1, [r4, #2]
mov r2, #1
ldr r7, sub_809C09C
bl linkr7
b end
boughtball:
lsr r6, #0x10
mov r1, r6
cmp r1, #0x9 @if player bought over 9 pokeballs, attempt to add premierball
bhi tryadding
b next
tryadding:
mov r0, #0xC @premier ball ID
mov r1, #0x1 @amount of premier balls
ldr r7, bag_add_item
bl linkr7
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #1
bne next @if no room for premier ball, skip to next
ldr r1, message
ldr r2, sub_809BF0C
mov r0, r5
bl displaymsg
b next
fullbag:
ldr r1, bagisfull
ldr r2, sub_809BF98
mov r0, r5
bl displaymsg
end:
pop {r4-r7}
pop {r0}
bx r0
displaymsg:
ldr r7, displayadress
linkr7:
bx r7
.align 2
taskspriv: .word 0x03005098
rboxid_tilemap_update: .word 0x08003FA0 +1
bag_add_item: .word 0x0809A084 +1
sub_809BF98: .word 0x0809BF98 +1
sub_809BF0C: .word 0x0809BF0C +1
sub_809C09C: .word 0x0809C09C +1
displayadress: .word 0x0813F75C +1
bagisfull: .word 0x08416861
hereyouare: .word 0x084167E7
message: .word 0x08XXXXXX
After inserting the routine, navigate to 0x3DF0B4 and put the pointer to it, +1. (If I inserted the routine at 0x725030 I would put 31 50 72 08)
And that's it!
Pok?mon Ruby and Sapphire introduced a feature where if you bought 10 or more Pok? Balls in the Mart, you would get a free Premier Ball.
Sadly, this feature was removed in FRLG, and so I tried to port it the best I could.
First, insert this text somewhere using XSE or something and write down the offset of where you inserted it:
Code:Here you are!\nI'll throw in a Premier Ball, too.
Sorry then.
I'm still learning.
tryadding:
mov r0, #0xC @premier ball ID
mov r1, #0x1 @amount of premier balls
ldr r7, bag_add_item
bl linkr7
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #1
bne next @if no room for premier ball, skip to next
ldr r1, hereyouare
ldr r2, sub_809BF0C
mov r0, r5
bl displaymsg
[B]ldr r1, message
ldr r2, sub_809BF0C
mov r0, r5
bl displaymsg[/B]
b next
REUSABLE BALLS IN EMERALD
gracias a familiawerneck
routine with byte changesif y'all want to see specific equivalent addresses:Spoiler:Code:.text .align 2 .thumb @ FE3AA - 00 21 @ 56818 - 00 48 00 47 XX+1 XX XX XX main: bl deleteball mov r9, r4 mov r10, r5 @ added because emerald pop {r4-r7} pop {r0} bx r0 deleteball: ldr r0, var_800E @ last_used_item_maybe ldrh r0, [r0] mov r1, #1 ldr r2, =(0x80D6AA5) bx r2 .align 2 var_800E: .word 0x0203CE7C
have a nice day~Spoiler:Code:[bpre] 2D924 - atkF0 - near end 9A1D8 - bag_remove_item A1E30 - pokeball + 0x24 0203AD30 - var 800E [bpee] 56818 - atkF0 - near end D6AA4 - bag_remove_item FE3AA - pokeball + 0x26 0203CE7C - last_used_item_maybe
.text
.align 2
.thumb
@ FE3AA - 00 21
@ 56818 - 00 48 00 47 XX+1 XX XX XX
main:
bl delete_item_if_pokeball
b finish
deleteball:
@ r0 already contains last_used_item.
mov r1, #1
ldr r2, .bag_remove_item
bx r2
delete_item_if_pokeball:
ldr r0, .last_used_item
ldrh r0, [r0]
@ checks that the item id is premier ball or lower
cmp r0, #0xC
bls deleteball
@ support for custom pokeballs can be added like so:
@ cmp r0, #CUSTOM_BALL_ID
@ beq deleteball
finish:
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2
.last_used_item:
.word 0x0203CE7C
.bag_remove_item:
.word 0x080D6AA4|1
oh xDI fixed this so it doesn't delete the fishing rod in the safari zone, among other glitches. It'll now verify that the item is a ball of some kind before it deletes it.
The code looks strange. I'm guessing it could be improved somehow, but it works:
Code:.text .align 2 .thumb @ FE3AA - 00 21 @ 56818 - 00 48 00 47 XX+1 XX XX XX main: bl delete_item_if_pokeball bl finish deleteball: @ r0 already contains last_used_item. mov r1, #1 ldr r2, .bag_remove_item bx r2 delete_item_if_pokeball: ldr r0, .last_used_item ldrh r0, [r0] @ checks that the item id is premier ball or lower cmp r0, #0xC bls deleteball @ support for custom pokeballs can be added like so: @ cmp r0, #CUSTOM_BALL_ID @ beq deleteball finish: mov r9, r4 mov r10, r5 pop {r4-r7} pop {r0} bx r0 .align 2 .last_used_item: .word 0x0203CE7C .bag_remove_item: .word 0x080D6AA4|1
.text
.align 2
.thumb
.thumb_func
.global rivalnamingingame
main:
push {r0-r4,lr}
ldr r0, place
str r0, [sp, #0x4]
ldr r1, ramlocation
ldr r1, [r1, #0x0]
ldr r0, standard
add r1, r1, r0
mov r0, #0x4
mov r2, #0x0
mov r3, #0x0
bl place2
ldr r1, ramlocation
ldr r1, [r1, #0x0]
ldr r0, standard
add r1, r1, r0
ldrb r0, [r1, #0x0]
cmp r0, #0xFF
beq failsafe
cmp r0, #0x0
beq failsafe
return:
pop {r0-r4}
pop {pc}
place2:
ldr r4, actualroutine
bx r4
failsafe:
ldr r0, rivalname
loop:
ldrb r2, [r0, #0x0]
strb r2, [r1, #0x0]
cmp r2, #0xFF
beq return
add r0, #0x1
add r1, #0x1
b loop
.align 2
place: .word 0x080568E1
ramlocation: .word 0x03005008
standard: .word 0x00003A4C
actualroutine: .word 0x0809D955
rivalname: .word 0x08FFFFFF @default name if left blank