The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Code ASM Resource Thread (https://www.pokecommunity.com/showthread.php?t=339153)

Pokemon_XY December 16th, 2015 4:53 AM

Quote:

Originally Posted by Lance32497 (Post 9036925)
Code:

  • Wild Pokemon Custom Moves
    •The reason why it needs to be edited because there are times that var 8000 is used in an event plus the wild battle thing, it automatically sets pokemon move whatever value is stored in that var. It would be good if it can be toggleabe by flag or var.


http://www.pokecommunity.com/showpost.php?p=8942634&postcount=739

Lance32497 December 16th, 2015 2:17 PM

Quote:

Originally Posted by Pokemon_XY (Post 9036987)

thanks, gonna try tis' one

Spherical Ice December 21st, 2015 7:59 AM

Nature-affected stats colouring routines [FR]:


CLICK FOR EMERALD

This is probably the least efficient way to do this, but it works.

Attack:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x137134

ldr r1, [r2]
ldrb r2,[r1,#4]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq red
cmp r0, #2 @ Brave
beq red
cmp r0, #3 @ Adamant
beq red
cmp r0, #4 @ Naughty
beq red
cmp r0, #5 @ Bold
beq blue
cmp r0, #10 @ Timid
beq blue
cmp r0, #15 @ Modest
beq blue
cmp r0, #20 @ Calm
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x0813713c+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Defense:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x137158

ldr r1, [r2]
ldrb r2,[r1,#6]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq blue
cmp r0, #5 @ Nold
beq red
cmp r0, #7 @ Relaxed
beq red
cmp r0, #8 @ Impish
beq red
cmp r0, #9 @ Lax
beq red
cmp r0, #11 @ Hasty
beq blue
cmp r0, #16 @ Mild
beq blue
cmp r0, #21 @ Gentle
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137162+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Special Attack:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x13717C

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#8]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #3 @ Adamant
beq blue
cmp r0, #8 @ Impish
beq blue
cmp r0, #13 @ Jolly
beq blue
cmp r0, #15 @ Modest
beq red
cmp r0, #16 @ Mild
beq red
cmp r0, #17 @ Quiet
beq red
cmp r0, #19 @ Rash
beq red
cmp r0, #23 @ Careful
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137188+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Special Defense:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x1371A4

ldr r1, [r2]
ldrb r2,[r1,#0xA]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #4 @ Naughty
beq blue
cmp r0, #9 @ Lax
beq blue
cmp r0, #14 @ Naive
beq blue
cmp r0, #19 @ Rash
beq blue
cmp r0, #20 @ Calm
beq red
cmp r0, #21 @ Gentle
beq red
cmp r0, #22 @ Sassy
beq red
cmp r0, #23 @ Careful
beq red

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371AE+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Speed:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x1371C8

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#0xC]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #2 @ Brave
beq blue
cmp r0, #7 @ Relaxed
beq blue
cmp r0, #10 @ Timid
beq red
cmp r0, #11 @ Hasty
beq red
cmp r0, #13 @ Jolly
beq red
cmp r0, #14 @ Naive
beq red
cmp r0, #17 @ Quiet
beq blue
cmp r0, #22 @ Sassy
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371d4+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Reverting the font colour back to black:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at 081371F0

ldr r1, [r2]
ldrb r2,[r1,#0xE]
add r2,#0xF
lsl r2,r2,#0x18
lsr r2,r2,#0x18
ldr r6, blackfont
ldr r1, =(0x081371FA+1)
bx r1

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00


where XX XX XX XX is the location of each routine +1.

This colours the stat increased by the Pokémon's nature red, and the stat that is decreased blue.

http://i.imgur.com/8IfVLeT.pnghttp://i.imgur.com/ltTHc6K.png

Edit: Updated 23/12/2015, the old routines had a few errors that I forgot to update after making changes to my ROM. I've also confirmed what bluefont should be in a vanilla ROM. Enjoy!

DoesntKnowHowToPlay December 21st, 2015 9:21 AM

I've noticed significant demand for working Dawn Stone evolutions, specifically ones that require the mon to be a specific gender. My bad if this is already posted somewhere but here y'all go:

Code:

.org 0x4318e
lsl r0, r0, #0x0
ldr r2, .MethodAddr
bx r2

.MethodAddr: .word 0x085B2521 #UPDATE THIS TO MAIN FUNCTION OFFSET+1

.org 0x5B2520 #UPDATE THIS TO MOST CONVENIENT FREE SPACE IN YOUR HACK
cmp r0, #0x7
beq StandardStone
cmp r0, #0x14 #UPDATE THIS
beq MaleStone
cmp r0, #0x15 #UPDATE THIS
beq FemaleStone
b NoEvo

MaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0x0
beq StandardStone
b NoEvo

FemaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0xFE
beq StandardStone
b NoEvo

StandardStone:
ldrh r0, [r1, #0x2]
cmp r0, r9
beq Finish

NoEvo:
ldr r2, .NoEvoReturn
bx r2

DetermineGender:
ldr r2, .DetermineGenderFunc
bx r2

Finish:
ldr r2, .EvoReturn
bx r2

.NoEvoReturn: .word 0x08043199
.EvoReturn: .word 0x0804317d
.DetermineGenderFunc: .word 0x0803f78d


Change the values in the lines marked UPDATE THIS to the indexes of male stone evos and female stone evos. Leave their entries blank in the general evolution table; stone evolutions function differently from level-up evolutions.

Adke December 21st, 2015 11:52 AM

Hi~
I've been trying for a few weeks to make an asm routine were you store the species of a party pokemon in a var, but i've had no success.

Could anyone help me with this? ^^

Spherical Ice December 22nd, 2015 5:33 AM

checkitem hack to store quantity in 0x8008


This is probably a relatively esoteric hack, but I found a use for it so I might as well share it. When using the checkitem command, it will now buffer the quantity of said item into the variable 0x8008, and then behaves as usual for the regular usage of the command.

The reason I made this was to do something like the following dummy script:

Code:

checkitem ITEM_BLUESHARD 0x1
if B_< goto @none
buffernumber 0x0 0x8008
msgbox @string1 0x6
...

#org @string1
= You have [buffer1] Blue Shards.


It will always buffer to 0x8008, but you can change the RAM loc in the routine if you want it to be some other variable.

Code:

.thumb

@ 00 4A 10 47 XX+1 XX XX XX at 08099f88

lsl r0,r0,#0x10
lsr r0,r0,#0x10
ldr r2, =(0x020370C8) @ RAM location of 0x8008
strh r0, [r2]
ldr r2, =(0x08099f58+1)
cmp r0, r5
bcs branch
ldr r2, =(0x08099f90+1)

branch:
bx r2



Shogun January 1st, 2016 6:54 AM

Quote:

Originally Posted by Spherical Ice (Post 9043890)

Nature-affected stats colouring routines [FR]:


This is probably the least efficient way to do this, but it works.

Attack:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x137134

ldr r1, [r2]
ldrb r2,[r1,#4]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq red
cmp r0, #2 @ Brave
beq red
cmp r0, #3 @ Adamant
beq red
cmp r0, #4 @ Naughty
beq red
cmp r0, #5 @ Bold
beq blue
cmp r0, #10 @ Timid
beq blue
cmp r0, #15 @ Modest
beq blue
cmp r0, #20 @ Calm
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x0813713c+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Defense:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x137158

ldr r1, [r2]
ldrb r2,[r1,#6]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq blue
cmp r0, #5 @ Nold
beq red
cmp r0, #7 @ Relaxed
beq red
cmp r0, #8 @ Impish
beq red
cmp r0, #9 @ Lax
beq red
cmp r0, #11 @ Hasty
beq blue
cmp r0, #16 @ Mild
beq blue
cmp r0, #21 @ Gentle
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137162+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Special Attack:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x13717C

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#8]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #3 @ Adamant
beq blue
cmp r0, #8 @ Impish
beq blue
cmp r0, #13 @ Jolly
beq blue
cmp r0, #15 @ Modest
beq red
cmp r0, #16 @ Mild
beq red
cmp r0, #17 @ Quiet
beq red
cmp r0, #19 @ Rash
beq red
cmp r0, #23 @ Careful
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137188+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Special Defense:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x1371A4

ldr r1, [r2]
ldrb r2,[r1,#0xA]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #4 @ Naughty
beq blue
cmp r0, #9 @ Lax
beq blue
cmp r0, #14 @ Naive
beq blue
cmp r0, #19 @ Rash
beq blue
cmp r0, #20 @ Calm
beq red
cmp r0, #21 @ Gentle
beq red
cmp r0, #22 @ Sassy
beq red
cmp r0, #23 @ Careful
beq red

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371AE+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Speed:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at x1371C8

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#0xC]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #2 @ Brave
beq blue
cmp r0, #7 @ Relaxed
beq blue
cmp r0, #10 @ Timid
beq red
cmp r0, #11 @ Hasty
beq red
cmp r0, #13 @ Jolly
beq red
cmp r0, #14 @ Naive
beq red
cmp r0, #17 @ Quiet
beq blue
cmp r0, #22 @ Sassy
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371d4+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00


Reverting the font colour back to black:
Code:

.thumb
@ 00 49 08 47 XX XX XX XX at 081371F0

ldr r1, [r2]
ldrb r2,[r1,#0xE]
add r2,#0xF
lsl r2,r2,#0x18
lsr r2,r2,#0x18
ldr r6, blackfont
ldr r1, =(0x081371FA+1)
bx r1

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00


where XX XX XX XX is the location of each routine +1.

This colours the stat increased by the Pokémon's nature red, and the stat that is decreased blue.

http://i.imgur.com/8IfVLeT.pnghttp://i.imgur.com/ltTHc6K.png

Edit: Updated 23/12/2015, the old routines had a few errors that I forgot to update after making changes to my ROM. I've also confirmed what bluefont should be in a vanilla ROM. Enjoy!


I don't know why but for me it doesn't works.
I've replaced the XX XX XX XX with the following pointers for each routines
Spoiler:
All these offsets are +1 offsets and same things for pointers

Attack : Offset CFAEC1 >>> pointer C1 AE CF 08

Defense : Offset CFAE41 >>> pointer 41 AE CF 08

Sp.atk : Offset CFADA1 >>> pointer A1 AD CF 08

Sp.Def : Offset CFAD21 >>> pointer 21 AD CF 08

Speed : Offset CFACA1 >>> pointer A1 AC CF 08

reverting font : Offset CFAE21 >>> pointer 21 AE CF 08


After that, I have replace the two last lines for each of them except for the last one (reverting font) with that :
Spoiler:
redfont: .word 0x0847C825 @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x0834F840 @ ROM location that contains: 00 07 0A 00


I've test it with a calm bulbasaur but everything stay black. No blue colour or red colour.

azurile13 January 1st, 2016 3:12 PM

Quote:

Originally Posted by maxcollet72 (Post 9058647)
I don't know why but for me it doesn't works.
I've replaced the XX XX XX XX with the following pointers for each routines
Spoiler:
All these offsets are +1 offsets and same things for pointers

Attack : Offset CFAEC1 >>> pointer C1 AE CF 08

Defense : Offset CFAE41 >>> pointer 41 AE CF 08

Sp.atk : Offset CFADA1 >>> pointer A1 AD CF 08

Sp.Def : Offset CFAD21 >>> pointer 21 AD CF 08

Speed : Offset CFACA1 >>> pointer A1 AC CF 08

reverting font : Offset CFAE21 >>> pointer 21 AE CF 08


After that, I have replace the two last lines for each of them except for the last one (reverting font) with that :
Spoiler:
redfont: .word 0x0847C825 @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x0834F840 @ ROM location that contains: 00 07 0A 00


I've test it with a calm bulbasaur but everything stay black. No blue colour or red colour.

Quote:

Originally Posted by DarkPsychic (Post 9059107)
When trying to figure out a problem, always state what rom you are modding...
Aslo I can tell you that you didn't do +1 with your reverse Hex...
ergo "Attack : Offset CFAEC1 >>> pointer C1 AE CF 08" should look like
"Attack : Offset CFAEC1 >>> pointer C2 AE CF 08"

That isn't how it works either. The asm itself needs to be halfword aligned for the opcodes. The +1 is to branch in THUMB mode. Therefore, on top of the opcodes not being aligned, you'd be branching to 0x08CFAEC2 in ARM (which also makes no sense because ARM is four bytes per instruction). The problem is that the bin should be pasted at 0xCFAEC0.

Shogun January 2nd, 2016 12:07 AM

Quote:

Originally Posted by azurile13 (Post 9059204)
That isn't how it works either. The asm itself needs to be halfword aligned for the opcodes. The +1 is to branch in THUMB mode. Therefore, on top of the opcodes not being aligned, you'd be branching to 0x08CFAEC2 in ARM (which also makes no sense because ARM is four bytes per instruction). The problem is that the bin should be pasted at 0xCFAEC0.

No. I've found my error. It was in the line about the redfont and the bluefont offsets but now here is the result
http://i1382.photobucket.com/albums/ah255/maxcollet/Pokemon%20Cloud%20White344_zpsuzz7asy1.png

Aethestode January 4th, 2016 7:58 AM

The Toggling Runaway doesn't seem to work.

MrDollSteak January 6th, 2016 11:57 PM

Quote:

Originally Posted by Aethestode (Post 9062790)
The Toggling Runaway doesn't seem to work.

It's fixed now! Thanks for alerting me to that.

Lance32497 January 7th, 2016 6:12 AM

Guys, I really really need this routine, I know it wouldn't be hard for you, I got a bug on my rom and I made a lot of changes in that. The bug is the TM and HM, it doesn't really work properly.
https://z-1-scontent-hkg3-1.xx.fbcdn.net/hphotos-xpa1/v/t1.0-9/12509093_940209062713817_3331187354503156368_n.jpg?oh=492d3fcdee3d2c15f1e97f95d93ec4a8&oe=5702763F
So my request is a routine that checks if that pokemon can learn a certain move, var 8004 fpr the Pokemon Specie and var 8005 for the move to check, then that routine will check the table of learnable moves of that Pokèmon.

azurile13 January 8th, 2016 11:51 AM

Quote:

Originally Posted by Lance32497 (Post 9066776)
Guys, I really really need this routine, I know it wouldn't be hard for you, I got a bug on my rom and I made a lot of changes in that. The bug is the TM and HM, it doesn't really work properly.
https://z-1-scontent-hkg3-1.xx.fbcdn.net/hphotos-xpa1/v/t1.0-9/12509093_940209062713817_3331187354503156368_n.jpg?oh=492d3fcdee3d2c15f1e97f95d93ec4a8&oe=5702763F
So my request is a routine that checks if that pokemon can learn a certain move, var 8004 fpr the Pokemon Specie and var 8005 for the move to check, then that routine will check the table of learnable moves of that Pokèmon.

I'd say fixing the TM bag would be the better option, but
Code:

        ldr r3, var8004
        ldrh r0, [r3, #0x0]
        lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
        ldr r1, tm_compatibility
        add r0, r1
        ldrh r2, [r3, #0x2]        @var8005
        lsr r1, r2, #0x3 @I assume “move” is tm number, not the actual move index?
        ldrb r0, [r0, r1]
        lsl r2, r2, #0x1D
        lsr r2, r2, #0x1D
        lsr r0, r0, r2
        lsl r0, r0, #0x1F
        lsr r0, r0, #0x1F
        strh r0, [r3, 0x0]        @store back in var8004, or wherever
        bx lr
.align
var8004:                .word 0x Donotknowoffsetoffthetopofmyhead
tm_compatibility:        .word 0x WhereverYouPutIt



Lance32497 January 8th, 2016 3:18 PM

Quote:

Originally Posted by azurile13 (Post 9068327)
I'd say fixing the TM bag would be the better option, but
Code:

        ldr r3, var8004
        ldrh r0, [r3, #0x0]
        lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
        ldr r1, tm_compatibility
        add r0, r1
        ldrh r2, [r3, #0x2]        @var8005
        lsr r1, r2, #0x3 @I assume “move” is tm number, not the actual move index?
        ldrb r0, [r0, r1]
        lsl r2, r2, #0x1D
        lsr r2, r2, #0x1D
        lsr r0, r0, r2
        lsl r0, r0, #0x1F
        lsr r0, r0, #0x1F
        strh r0, [r3, 0x0]        @store back in var8004, or wherever
        bx lr
.align
var8004:                .word 0x Donotknowoffsetoffthetopofmyhead
tm_compatibility:        .word 0x WhereverYouPutIt



Thank you very much, this is helpful indeed. Anyway I expanded the number of TM so do I have to change some values there? And
var 8004 is the Pokèmon number and Var 8005 is the TM Number, let's say TM32, it would be 20, then, in var 8004, it will state whether it's 1,l earnable or 0, not learnable

azurile13 January 8th, 2016 3:58 PM

Quote:

Originally Posted by Lance32497 (Post 9068566)
Thank you very much, this is helpful indeed. Anyway I expanded the number of TM so do I have to change some values there? And
var 8004 is the Pokèmon number and Var 8005 is the TM Number, let's say TM32, it would be 20, then, in var 8004, it will state whether it's 1,l earnable or 0, not learnable

I'm guessing that you meant to say "TM32, it would be 0x20" which would be almost correct. TM indexing starts at zero, so the index for TM01 is 0x00, TM02 is 0x01, ..., TM32 is 0x1F (31 decimal). The answer to the TM expansion depends on exactly what your TM compatibility table looks like, specifically how long an entry is for a species. In the regular game, the table is 8 bytes long (64 bits) so I used the instruction
Code:

lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes


Because that shift is multiplying species index by eight.
As for var8004 at the end of routine, yes. After the routine, var8004 will contain 0 for incompatible and 1 for compatible.

Lance32497 January 8th, 2016 4:42 PM

Quote:

Originally Posted by azurile13 (Post 9068612)
I'm guessing that you meant to say "TM32, it would be 0x20" which would be almost correct. TM indexing starts at zero, so the index for TM01 is 0x00, TM02 is 0x01, ..., TM32 is 0x1F (31 decimal). The answer to the TM expansion depends on exactly what your TM compatibility table looks like, specifically how long an entry is for a species. In the regular game, the table is 8 bytes long (64 bits) so I used the instruction
Code:

lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes


Because that shift is multiplying species index by eight.
As for var8004 at the end of routine, yes. After the routine, var8004 will contain 0 for incompatible and 1 for compatible.

The new compatibility contains 16 bytes, (128 bits) soI'll make it
Code:

lsl r0, r0, #0x4


I got it now, thanks a lot.

Aruaruu January 9th, 2016 12:10 AM

Could anyone port the Ability Switching to Emerald? Unless I missed it somewhere...
http://www.pokecommunity.com/showpost.php?p=8533505&postcount=278

Lance32497 January 9th, 2016 12:37 AM

Quote:

Originally Posted by Aruaruu (Post 9069042)
Could anyone port the Ability Switching to Emerald? Unless I missed it somewhere...
http://www.pokecommunity.com/showpost.php?p=8533505&postcount=278

I haven't tested it yet

Ability switching: EMERALD



Very simple, it turned out to not have to adjust the PID.

How to insert:

Just compile the following routine into free space:

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r4, lr}
        ldr r1, =(0x20270C0) @var 0x8004
        ldrb r1, [r1]
        mov r2, #0x64
        mul r1, r1, r2
        ldr r0, =(0x2024190)
        add r0, r0, r1 @slot
        mov r4, r0 @save slot
        mov r1, #0x2E
        ldr r3, =(0x806a518 +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, =(0x20270D0) @set inverse
        strb r0, [r2]
        mov r0, r4
        mov r1, #0x2E
        ldr r3, =(0x8008b44 +1)
        bl linker
        pop {r0-r4, pc}

linker:
        bx r3

.align 2




Usage:

Set in variable 0x8004 the slot number of the Pokemon who's ability you want to swap. Note that Pokemon with only 1 ability won't have their abilities swapped.

Aruaruu January 9th, 2016 2:02 AM

Quote:

Originally Posted by Lance32497 (Post 9069069)
I haven't tested it yet

Ability switching: EMERALD



Very simple, it turned out to not have to adjust the PID.

How to insert:

Just compile the following routine into free space:

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r4, lr}
        ldr r1, =(0x20270C0) @var 0x8004
        ldrb r1, [r1]
        mov r2, #0x64
        mul r1, r1, r2
        ldr r0, =(0x2024190)
        add r0, r0, r1 @slot
        mov r4, r0 @save slot
        mov r1, #0x2E
        ldr r3, =(0x806a518 +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, =(0x20270D0) @set inverse
        strb r0, [r2]
        mov r0, r4
        mov r1, #0x2E
        ldr r3, =(0x8008b44 +1)
        bl linker
        pop {r0-r4, pc}

linker:
        bx r3

.align 2




Usage:

Set in variable 0x8004 the slot number of the Pokemon who's ability you want to swap. Note that Pokemon with only 1 ability won't have their abilities swapped.

Tried it with a dual ability Pokemon and didn't change.
=\ Any ideas?

Lance32497 January 9th, 2016 5:43 AM

Quote:

Originally Posted by Aruaruu (Post 9069107)
Tried it with a dual ability Pokemon and didn't change.
=\ Any ideas?

I'll try to look at that, perhaps one of the addresses is incorrect.

Quote:

Originally Posted by azurile13 (Post 9068327)
I'd say fixing the TM bag would be the better option, but
Code:

        ldr r3, var8004
        ldrh r0, [r3, #0x0]
        lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
        ldr r1, tm_compatibility
        add r0, r1
        ldrh r2, [r3, #0x2]        @var8005
        lsr r1, r2, #0x3 @I assume “move” is tm number, not the actual move index?
        ldrb r0, [r0, r1]
        lsl r2, r2, #0x1D
        lsr r2, r2, #0x1D
        lsr r0, r0, r2
        lsl r0, r0, #0x1F
        lsr r0, r0, #0x1F
        strh r0, [r3, 0x0]        @store back in var8004, or wherever
        bx lr
.align
var8004:                .word 0x Donotknowoffsetoffthetopofmyhead
tm_compatibility:        .word 0x WhereverYouPutIt



Tried this one, but it doesn't work correctly, I modified the routine because it doesn't compile to my compiler
Spoiler:

Code:

.align 2
.thumb

main:
        ldr r3, var8004
        ldrh r0, [r3, #0x0]
        lsl r0, r0, #0x4 @assuming length of tm compatibility is still 8 bytes
        ldr r1, tm_compatibility
        add r0, r1
        ldrh r2, [r3, #0x2]        @var8005
        lsr r1, r2, #0x3 @I assume “move” is tm number, not the actual move index?
        ldrb r0, [r0, r1]
        lsl r2, r2, #0x1D
        lsr r2, r2, #0x1D
        lsr r0, r0, r2
        lsl r0, r0, #0x1F
        lsr r0, r0, #0x1F
        strh r0, [r3, 0x0]        @store back in var8004, or wherever
        bx lr

.align 2

var8004:                .word 0x20370C0
tm_compatibility:        .word 0x9859940




I changed that to 4 since I had expanded the TM and HM, then, this is my script:
Spoiler:

Code:

'---------------
#org 0x8213AD
setvar 0x8004 0x14E
setvar 0x8005 0x1F
callasm 0x9921521
compare 0x8004 0x0
if 0x1 goto 0x88213D1
msgbox 0x88213E0 MSG_NORMAL '"yes"
end

'---------------
#org 0x8213D1
msgbox 0x88213DB MSG_NORMAL '"no"
end

'---------
' Strings
'---------
#org 0x8213E0
= yes

#org 0x8213DB
= no



Var 8004 being the index number of Flygon
and Var 8005 being the TM index which is TM 32 Double Team, it always jumps to YES even though I unchecked it.

azurile13 January 9th, 2016 11:43 AM

Quote:

Originally Posted by Lance32497 (Post 9069221)
I'll try to look at that, perhaps one of the addresses is incorrect.



Tried this one, but it doesn't work correctly, I modified the routine because it doesn't compile to my compiler
Spoiler:

Code:

.align 2
.thumb

main:
        ldr r3, var8004
        ldrh r0, [r3, #0x0]
        lsl r0, r0, #0x4 @assuming length of tm compatibility is still 8 bytes
        ldr r1, tm_compatibility
        add r0, r1
        ldrh r2, [r3, #0x2]        @var8005
        lsr r1, r2, #0x3 @I assume “move” is tm number, not the actual move index?
        ldrb r0, [r0, r1]
        lsl r2, r2, #0x1D
        lsr r2, r2, #0x1D
        lsr r0, r0, r2
        lsl r0, r0, #0x1F
        lsr r0, r0, #0x1F
        strh r0, [r3, 0x0]        @store back in var8004, or wherever
        bx lr

.align 2

var8004:                .word 0x20370C0
tm_compatibility:        .word 0x9859940




I changed that to 4 since I had expanded the TM and HM, then, this is my script:
Spoiler:

Code:

'---------------
#org 0x8213AD
setvar 0x8004 0x14E
setvar 0x8005 0x1F
callasm 0x9921521
compare 0x8004 0x0
if 0x1 goto 0x88213D1
msgbox 0x88213E0 MSG_NORMAL '"yes"
end

'---------------
#org 0x8213D1
msgbox 0x88213DB MSG_NORMAL '"no"
end

'---------
' Strings
'---------
#org 0x8213E0
= yes

#org 0x8213DB
= no



Var 8004 being the index number of Flygon
and Var 8005 being the TM index which is TM 32 Double Team, it always jumps to YES even though I unchecked it.

Wait, I don't even see what you changed with my routine besides putting actual numbers in the literal pool.
Also, you saying you "unchecked it" makes me think you were modifying compatibility with a tool. But I don't think any tools currently out even support expanding TMs. You most likely had to expand the table by hand. Did you actually change the length of the compatibility table from 8 bytes per pokemon to 16 bytes?

Lance32497 January 9th, 2016 3:17 PM

Quote:

Originally Posted by azurile13 (Post 9069581)
Wait, I don't even see what you changed with my routine besides putting actual numbers in the literal pool.
Also, you saying you "unchecked it" makes me think you were modifying compatibility with a tool. But I don't think any tools currently out even support expanding TMs. You most likely had to expand the table by hand. Did you actually change the length of the compatibility table from 8 bytes per pokemon to 16 bytes?

I made lsl r0, r0, #0x3 to lsl r0, r0, #0x4, and about the tool that supports expansion of TM, D&D Editor of Dark Zeta does that

Dontreadthi January 11th, 2016 8:13 PM

I have tried all weekend and I cant get it. If anyone has the time, Id like some help with the following:
ASM script to check and see if a Pokemon has any moves left in the Pokemon Relearner.

Things I know:
Special 0xDB pulls up a selection to select a pokemon
0x8005 stores 0 if the pokemon has no moves to learn (From Two Island Move relearner)

Not that great at finding code with breakpoints... So i need some help to intercept the above so that when I call the ASM script it will take in the party position and output if there is a move or not. (Basically special DB without thee selection screen + Waitstate)

Thanks

NewDenverCity January 12th, 2016 4:15 AM

Quote:

Originally Posted by Dontreadthi (Post 9072616)
I have tried all weekend and I cant get it. If anyone has the time, Id like some help with the following:
ASM script to check and see if a Pokemon has any moves left in the Pokemon Relearner.

Things I know:
Special 0xDB pulls up a selection to select a pokemon
0x8005 stores 0 if the pokemon has no moves to learn (From Two Island Move relearner)

Not that great at finding code with breakpoints... So i need some help to intercept the above so that when I call the ASM script it will take in the party position and output if there is a move or not. (Basically special DB without thee selection screen + Waitstate)

Thanks

I'm not sure why you'd want this, as without special 0xDB you'd always be searching the first pokemon in your party. On top of that, you'd probably end up storing the results back into a var anyway. If the special and 0x8005 works, why fix something that's not broken?

Dontreadthi January 12th, 2016 5:31 PM

Well it's not broken but its inconvenient. I have the party position of the pokemon already from previous code, but then to ask the user to select the pokemon in question again is redundant.

Maybe I did a poor job in explaining. What I am after is to mimic the above special 0xDB but skip the selection screen and instead input the variable for party position. I can do most of the work. Just need help locating where the code is located in the ROM. Then I can make a hook & catch.

Joexv January 12th, 2016 8:23 PM

Quote:

Originally Posted by Dontreadthi (Post 9073680)
Well it's not broken but its inconvenient. I have the party position of the pokemon already from previous code, but then to ask the user to select the pokemon in question again is redundant.

Maybe I did a poor job in explaining. What I am after is to mimic the above special 0xDB but skip the selection screen and instead input the variable for party position. I can do most of the work. Just need help locating where the code is located in the ROM. Then I can make a hook & catch.

Well you wouldn't really need any hooks. Just copy the special 0xDB routine and modify it to instead read from a variable rather then the selection. I would help by giving a maybe offset to start with but idb isnt working for me right now.

azurile13 January 12th, 2016 9:58 PM

Quote:

Originally Posted by Dontreadthi (Post 9073680)
Well it's not broken but its inconvenient. I have the party position of the pokemon already from previous code, but then to ask the user to select the pokemon in question again is redundant.

Maybe I did a poor job in explaining. What I am after is to mimic the above special 0xDB but skip the selection screen and instead input the variable for party position. I can do most of the work. Just need help locating where the code is located in the ROM. Then I can make a hook & catch.

I don't get what you're looking for, but you can find the pointer to any special routine with the table and some maths. For FireRed, the special table is at 0x0815FD60.

EdgeZard X January 13th, 2016 2:14 AM

Hi,

Is making the move tutors reusable doable via ASM, or is there just a specific flag that gets set in their routines that needs to be removed?

Aruaruu January 13th, 2016 2:22 AM

Quote:

Originally Posted by EdgeZard X (Post 9074091)
Hi,

Is making the move tutors reusable doable via ASM, or is there just a specific flag that gets set in their routines that needs to be removed?

Its a flag in their script.

EdgeZard X January 13th, 2016 3:16 AM

Quote:

Originally Posted by Aruaruu (Post 9074093)
Its a flag in their script.

I see, I guess I'll have to find all the move tutors and remove the flag condition.

......and fix their text because I changed what most of them teach.

Now I have another question concerning the Dawn Stone routine that was posted here, since my ROM contains all the Gen 4 evolutions and I wasn't sure on how I'd correctly work Gallade/Froslass:

Spoiler:
"Change the values in the lines marked UPDATE THIS to the indexes of male stone evos and female stone evos. Leave their entries blank in the general evolution table; stone evolutions function differently from level-up evolutions."


Does the "indexes" refer to the indexes of the Pokémon that evolve by Dawn Stone (Kirlia, Snorunt), or the indexes of Pokémon that have evolved from Dawn Stone (Gallade, Froslass)?

And....

Spoiler:
".org 0x4318e
lsl r0, r0, #0x0
ldr r2, .MethodAddr
bx r2

.MethodAddr: .word 0x085B2521 #UPDATE THIS TO MAIN FUNCTION OFFSET+1


What does it mean by main function, and what does the 0x4318e refer to?

DeliPunch January 23rd, 2016 2:15 PM

Could someone make a asm thingy for emerald that advances the rtc by game time times 2 or 3? for when you don't actually have an rtc (flashcarts)

Angry_Bird404 February 13th, 2016 9:50 AM

I don't know if anyone's been working on this lately, but I've been itching to share this.

FireRed lacks a system that uses a Region Dex order seperate from the National Dex. If you were to have a Region Dex and a National Dex, your National Dex would look unprofessional. What I'm putting here is my work towards a Region Dex system for FireRed. I would like to stress however that it is both unoptimized and unfinished, but I really wanted to release this.

The current routines
Spoiler:

Loading the right species
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
mov r4, r8
lsl r0, r4, #0x10
lsr r5, r0, #0x10
add r4, #0x1
ldr r0, .HoennDex
lsl r5, r5, #0x1
add r0, r0, r5
ldrh r0, [r0]
mov r5, r0
ldr r0, .return
bx r0

.align 2

.HoennDex: .word 0x08252216
.nationaltoindex: .word 0x08043200+1
.return: .word 0x08103574+1


Insert 00 48 00 47 xx xx xx 08 at 0x10356C


Correct numbering
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

lsr r4, r4, #0x18
lsl r6, r6, #0x18
lsr r6, r6, #0x18
ldr r1, .indextonatdex
bl Linker
mov r2, r0
ldr r1, .dexarea
add r1, r1, #0xa
ldrb r1, [r1]
cmp r1, #0x1
beq regionnumber
mov r0, r2
b GoBack

Linker:
bx r1

GoBack:
ldr r2, .return
bx r2

regionnumber:
mov r0, #0x0
ldr r1, .HoennDex

Loop:
mov r0, r3
lsl r3, r3, #0x1
add r1, r1, r3
ldrh r3, [r1]
add r0, r0, #0x1
cmp r1, r2
bne Loop
b GoBack

.align 2

.HoennDex: .word 0x08252324
.indextonatdex: .word 0x08043298+1
.flagcheck: .word 0x0806e6d0+1
.return: .word 0x08104a6a+1


Insert 00 4A 10 47 xx xx xx 08 at 0x104A60


Fixing the end of the region dex
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
push {r2}
mov r2, #0x0
ldr r1, .HoennDex

loop:
lsl r0, r2, #0x1
add r0, r0, r1
ldrh r0, [r0]
add r2, #0x1
cmp r0, r5
bne loop

lastpart:
ldr r1, =0x100 /*Put the length of your Region Dex here, this supports beyond 256*/
mov r10, r2
pop {r2}
str r2, [r3, #4]
mov r8, r9
mov r0, r8
cmp r0, r1
ble jump
ldr r1, .return2
bx r1

jump:
ldr r1, .return
bx r1

.align 2

.HoennDex: .word 0x08252324
.return: .word 0x0810356c+1
.return2: .word 0x08103906+1


Insert 00 49 08 47 xx xx xx 08 at 0x1035F0


To-Do list
Fix counting the Region Dex for things like the start screen and talking to the Professor
Displaying the Region Dex number when you don't have the National Dex on the summary screen
Making searches and habitat lists use Region Dex numbers before the National Dex


Send me a PM if you're interested in fixing up what's left.

azurile13 February 13th, 2016 10:25 AM

Cool. Seems very useful so people don't do the "national dex at start" all the time :) But in "Loading the right species," I assume the "bx r1" is meant to be a bl linker? You're never going to reach the mov r5, r0 and return :P

EDIT: meant to quote AngryBird

Angry_Bird404 February 13th, 2016 10:30 AM

Quote:

Originally Posted by azurile13 (Post 9117195)
Cool. Seems very useful so people don't do the "national dex at start" all the time :) But in "Loading the right species," I assume the "bx r1" is meant to be a bl linker? You're never going to reach the mov r5, r0 and return :P

I know you misquoted me but thanks! I actually put in an outdated version by accident. The correct version doesn't even call the routine in the first place. I'll fix it right away.

Aligatueur February 18th, 2016 6:07 PM

Hey !
So first I want to say, I've really a bad level. I know HOW to put the routine on ROM, and to be honnest, I'm too stupid to understand ALL the routine things. But here's my "little story"

So, I wanted to do a FR 1/256 Shiny Rate for myself, because i want to relax a little from always Shiny Hunting like a crazy guy. But it's really a IMPORTANT project for me. I've found this asm thread, found what I wanted. So i've started to learn ASM, but to be honnest not the "what this means" thing. But here's my problem :

I did my 1/256 rom. It's working. No problem. Except one (but after speaking with an other guy who did the same he has the same problem) : The gender (or the nature for his case) is always the same. In my case i always have female Shiny. I really would like to keep the random of Gender + Nature for my 1/256 Shiny (like in my 4G/5G 1/256 hack-rom)

So I'd to know if somebody can find the way to fix this. For information :

I use these :

http://www.pokecommunity.com/showpost.php?p=8531430&postcount=249
First the RNNG.
http://www.pokecommunity.com/showpost.php?p=8531480&postcount=251
After this one, for the Shiny Pokémon PID Generation (and may be it's the problem ?)

and finally my "own" Shiny Rate script :

Spoiler:
Quote:

.text
.align 2
.thumb
.thumb_func


main:
push {r0-r3}

normal:
mov r0, #0x1
lsl r0, r0, #0x8

calcChance:
ldr r1, =(0x20370B8)
strh r0, [r1]
ldr r2, .random
bl linker
cmp r0, #0x0
bne end
mov r0, #0xFF
ldr r1, =(0x20370BC)
strb r0, [r1]
ldr r1, =(0x20370B8)
mov r0, #0x0
strh r0, [r1]

end:
pop {r0-r3}
sub SP, SP, #0x20
mov r7, r0
ldr r4, [SP, #0x40]
ldr r4, [SP, #0x48]
mov r5, #0xE
ldr r6, =(0x803DAD8 +1)
bx r6

linker:
bx r2


.align 2

.random:
.word 0x8800001


Any help ?
Thank you !

Trainer 781 February 19th, 2016 5:09 AM

Sitrus Berry Update:
Spoiler:

Restore 25% of maximum HP.

FireRed:-
Spoiler:

Item Use Effect:
Code:

.text
.align 2
.thumb
.thumb_func
.global sitrusoverworld

Main:

  ldr r1, [sp, #0xC]  @ItemIndex
  cmp r1, #0x8E @Sirtus
  bne Skip
  lsr r0, r0, #0x1  @HP to Restore

Skip:
  cmp r0, #0x0
  bne Exit
  mov r0, #0x1

Exit:
  ldr r1, =0x8041CA4+1
  bx r1

@@At x2528B8: FE 00
@@At x41C94: 00 49 08 47 XX+1 XX XX 08


Hold Item Effect:
Code:

.text
.align 2
.thumb
.thumb_func
.global sitruspinch

Main:

  ldrh r1, [r2, #0x2E]  @ItemIndex
  ldrh r3, [r2, #0x28]
  mov r5, r9
  cmp r1, #0x8E @Sitrus
  bne NotZero
  ldrh r0, [r2, #0x2C]
  lsr r5, r0, #0x2  @HP to Restore
  cmp r5, #0x0
  bne NotZero
  mov r5, #0x1

NotZero:
  str r5, [r4]
  ldr r1, =0x801BF08+1
  bx r1

@At x1BF00: 00 49 08 47 XX+1 XX XX 08




Emerald:-
Spoiler:

Item Use Effect:
Code:

.text
.align 2
.thumb
.thumb_func
.global sitrusoverworld

Main:

  ldr r1, [sp, #0xC]  @ItemIndex
  cmp r1, #0x8E @Sirtus
  bne Skip
  lsr r0, r0, #0x1  @HP to Restore

Skip:
  cmp r0, #0x0
  bne Exit
  mov r0, #0x1

Exit:
  ldr r1, =0x806C610+1
  bx r1

@@At x31E54C: FE 00
@@At x6C600: 00 49 08 47 XX+1 XX XX 08


Hold Item Effect:
Code:

.text
.align 2
.thumb
.thumb_func
.global sitruspinch

Main:

  ldrh r1, [r2, #0x2E]  @ItemIndex
  ldrh r3, [r2, #0x28]
  mov r5, r9
  cmp r1, #0x8E @Sitrus
  bne NotZero
  ldrh r0, [r2, #0x2C]
  lsr r5, r0, #0x2  @HP to Restore
  cmp r5, #0x0
  bne NotZero
  mov r5, #0x1

NotZero:
  str r5, [r4]
  ldr r1, =0x804478C+1
  bx r1

@At x44784: 00 49 08 47 XX+1 XX XX 08





Berry Activation Update:
Spoiler:

Activates consumable berries as soon as possible (end move or a certain multi-hit strike) after the required consumption condition is met, consistent to later generations, rather than activating on End Turn.

Emerald:-
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
.global endmoveberries

.include "T:/asdS/thumb/bsmacros.asm"
@@http://www.pokecommunity.com/showpost.php?p=9062722&postcount=332
@@ Paste all the content from the 'BS Macro & Defines' Spoiler in this link to a new blank ASM file and include its path.

.equ RomAreaOffset, 0x8000000
.equ BerryLoc, 0xE10000
.equ ContraryID, 0x7F
.equ GluttonyID, 0x53
.equ BattleData, 0x2024084
.equ Sitrus, 0x8E
.equ Return, 0x08045674+1
.equ Return2, 0x0804582A+1
.equ ItemBuffer, 0x2024208
.equ ScriptPointer, 0x2024214
.equ ScriptPusher, 0x803FAFC+1
.equ MiscBufferCountersArea, 0x2024474
.equ Bank_F, 0x202420F
.equ ActiveBank, 0x2024064
.equ Damage, 0x20241F0
.equ NoOfBattlers, 0x202406C
.equ UserBank, 0x202420B
.equ TargetPartner, 0x202420E
.equ BattleOutcome, 0x2022F58
.equ Divider, 0x82e7540+1
.equ ConfuseAccToNature, 0x806e880+1
.equ RNG, 0x806F5CC+1
.equ DivMod, 0x82E7Be0+1
.equ OranHealBSLoc, OranHealBS+RomAreaOffset
.equ HealAndConfuseBSLoc, HealAndConfuseBS+RomAreaOffset
.equ FocusBerryBSLoc, FocusBerryBS+RomAreaOffset
.equ StatRaiseBSLoc, StatRaiseBS+RomAreaOffset

.org 0x45280
    mov r7, #0x0
    ldr r0, =NoOfBattlers
    ldrb r0, [r0]
    cmp r7, r0
    bcc CheckBankHP
    b 0x4582A

CheckBankHP:
    ldr r1, =BattleData
    mov r8, r1
    mov r0, #0x58
    mul r0, r7
    add r0, r0, r1
    ldrh r2, [r0, #0x28]
    cmp r2, #0x0
    bne HasHP
    b 0x45674

HasHP:
    ldr r4, =ItemBuffer
    ldrh r0, [r0, #0x2E]
    strh r0, [r4]
    bl 0xD74DC
    lsl r0, r0, #0x18
    lsr r5, r0, #0x18
    sub r0, r5, #1
    cmp r0, #0x1B
    bls LoadBerryTable
    b 0x45674

LoadBerryTable:
    lsl r0, r0, #2
    ldr r1, BerryTableLoc
    add r0, r0, r1
    ldr r3, [r0]
    ldrh r0, [r4]
    bl 0xD7500
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r9, r0
    mov pc, r3

.align 2
BerryTableLoc: .word BerryLoc+RomAreaOffset

.align 2
.pool

.org BerryLoc
.word HPRestoreBerry+RomAreaOffset @Oran, Sitrus, Berry Juice
.word 0x8045354  @Cheri Berry
.word 0x8045444  @Chesto Berry
.word 0x8045390  @Pecha Berry
.word 0x80453CC  @Rawst Berry
.word 0x8045408  @Aspear Berry
.word 0x8045674      @Leppa Berry
.word 0x804548C  @Persim Berry
.word 0x8045520  @Lum Berry
.word HPRestoreConfuseBerry+RomAreaOffset @Figy
.word HPRestoreConfuseBerry+RomAreaOffset @Wiki
.word HPRestoreConfuseBerry+RomAreaOffset @Mago
.word HPRestoreConfuseBerry+RomAreaOffset @Aguav
.word HPRestoreConfuseBerry+RomAreaOffset @Iapapa
.word StatRaiseBerry+RomAreaOffset @Leichi
.word StatRaiseBerry+RomAreaOffset @Ganlon
.word StatRaiseBerry+RomAreaOffset @Salac
.word StatRaiseBerry+RomAreaOffset @Petaya
.word StatRaiseBerry+RomAreaOffset @Apicot
.word LansatBerry+RomAreaOffset @Lansat
.word StarfBerry+RomAreaOffset @Starf
.word 0x8045674
.word 0x8045614 @White Herb
.word 0x8045674
.word 0x8045674
.word 0x8045674
.word 0x8045674
.word 0x80454C8 @Mental Herb

@@@@@@@@@@@@@@@Oran

.align 2
HPRestoreBerry:
    mov r1, r8
    mov r0, #0x58
    mul r0, r7
    add r2, r0, r1
    ldrh r1, [r2, #0x2C]
    ldrh r3, [r2, #0x28]
    lsr r0, r1, #1
    cmp r3, r0
    bls RestoreHP
    b Quit

RestoreHP:
    ldrh r0, [r4]
    ldr r4, =Damage
    mov r5, r9
    cmp r0, #Sitrus  @Sitrus
    bne NotZero
    ldrh r0, [r2, #0x2C]
    lsr r5, r0, #0x2
    cmp r5, #0x0
    bne NotZero
    mov r5, #0x1

NotZero:
    add r0, r3, r5
    cmp r0, r1
    ble NegDamage
    sub r5, r1, r3

NegDamage:
    neg r5, r5
    str r5, [r4]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =OranHealBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit

.align 2
.pool

@@@@@@@@@@@@@@@@@@@@@@@@@@
HPRestoreConfuseBerry:
    mov r0, r5
    sub r0, #0xA
    mov r10, r0
    mov r0, #0x58
    mov r1, r7
    mul r1, r0
    str r1, [sp, #0x18]
    mov r4, r1
    add r4, r8
    ldrh r0, [r4, #0x2C]
    ldrh r1, [r4, #0x28]
    lsr r0, r0, #0x1
    cmp r1, r0
    bls RestoreHPAttemptConfuse
    b Quit

RestoreHPAttemptConfuse:
    ldr r1, =BattleOutcome
    mov r0, #0xFD
    strb r0, [r1]
    mov r0, #0x8
    strb r0, [r1, #0x1]
    mov r0, r10
    strb r0, [r1, #0x2]
    mov r0, #0xFF
    strb r0, [r1, #0x3]
    ldr r5, =Damage
    ldrh r0, [r4, #0x2C]
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    str r0, [r5]
    cmp r0, #0x0
    bne NotZeroWiki
    mov r0, #0x1
    str r0, [r5]

NotZeroWiki:
    ldrh r2, [r4, #0x28]
    ldr r0, [r5]
    add r0, r2, r0
    ldrh r1, [r4, #0x2C]
    cmp r0, r1
    ble CheckConfusion
    sub r0, r1, r2
    str r0, [r5]

CheckConfusion:
    ldr r0, [r5]
    neg r0, r0
    str r0, [r5]
    mov r0, r8
    add r0, #0x48
    ldr r2, [sp, #0x18]
    add r0, r2, r0
    ldr r0, [r0]
    mov r1, r10
    ldr r6, =ConfuseAccToNature
    bl Linker
    lsl r0, r0, #0x10
    blt BerryConfuse
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =OranHealBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit

BerryConfuse:
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =HealAndConfuseBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit
.align 2
.pool

@@@@@@@@@@@@@@@@@@
StatRaiseBerry:
    mov r0, r5
    sub r0, #0xF
    mov r10, r0
    mov r0, #0x58
    mul r0, r7
    mov r3, r8
    add r5, r0, r3
    ldrh r4, [r5, #0x28]
    ldrh r0, [r5, #0x2C]

GluttonyCheck:
    mov r2, #0x20
    add r2, r2, r5
    ldrb r2, [r2]
    cmp r2, #GluttonyID
    bne CheckPinchActivation
    lsl r0, r0, #0x1

CheckPinchActivation:
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    cmp r4, r0
    bls CheckForContrary
    b Quit

CheckForContrary:
    mov r6, #0xC
    cmp r2, #ContraryID
    bne NoContrary_Re
    mov r6, #0x0

NoContrary_Re:
    mov r0, r10
    add r0, #0x19
    add r0, r0, r5
    ldrb r0, [r0]
    cmp r0, r6
    bne BoostStat
    b Quit

BoostStat:
    ldr r1, =BattleOutcome
    mov r2, #0xFD
    strb r2, [r1]
    mov r0, #5
    strb r0, [r1, #0x1]
    mov r0, r10
    add r0, #0x1
    strb r0, [r1, #0x2]
    mov r0, #0xFF
    strb r0, [r1, #0x3]
    ldr r0, =TargetPartner
    strb r7, [r0]
    ldr r1, =MiscBufferCountersArea
    mov r0, r10
    add r0, #0x11
    strb r0, [r1, #0x1A]
    sub r0, r0, #0x2
    strb r0, [r1, #0x10]
    mov r0, #0x0
    strb r0, [r1, #0x11]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =StatRaiseBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit
.align 2
.pool

@@@@@@@@@@@@@Lansat Berry:
LansatBerry:
    mov r0, #0x58
    mul r0, r7
    mov r3, r8
    add r5, r0, r3
    ldrh r4, [r5, #0x28]
    ldrh r0, [r5, #0x2C]

GluttonyCheck_Lansat:
    mov r2, #0x20
    add r2, r2, r5
    ldrb r2, [r2]
    cmp r2, #GluttonyID
    bne CheckPinchActivation_Lansat
    lsl r0, r0, #0x1

CheckPinchActivation_Lansat:
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    cmp r4, r0
    bls CheckFocus
    b Quit 

CheckFocus:
    ldr r2, [r5, #0x50]
    mov r3, #0x80
    lsl r3, r3, #0xD
    mov r0, r2
    and r0, r3
    cmp r0, #0x0
    beq SetFocus
    b Quit   

SetFocus:
    orr r2, r3
    str r2, [r5, #0x50]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =FocusBerryBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit
.align 2
.pool

@@@@@@@@@@@@@@@
StarfBerry:
    mov r0, #0x58
    mul r0, r7
    mov r3, r8
    add r5, r0, r3
    ldrh r4, [r5, #0x28]
    ldrh r0, [r5, #0x2C]

GluttonyCheck_Starf:
    mov r2, #0x20
    add r2, r2, r5
    ldrb r2, [r2]
    cmp r2, #GluttonyID
    bne CheckPinchActivation_Starf
    lsl r0, r0, #0x1

CheckPinchActivation_Starf:
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    cmp r4, r0
    bgt Quit

CheckStats:
    mov r6, #0xC
    cmp r2, #ContraryID
    bne NoContrary
    mov r6, #0x0

NoContrary:
    mov r0, #0x0
    mov r10, r0
    add r0, r5, #0x1
    mov r1, r8
    add r1, #0x18
    add r0, r0, r1
    ldrb r0, [r1]
    lsl r0, r0, #0x18
    asr r0, r0, #0x18
    cmp r0, r6
    bne RaisableStat
    mov r0, r8
    add r0, #0x19
    add r1, r5, r0

Loop:
    add r1, #1
    add r2, #1
    add r10, r2
    mov r3, r10
    cmp r3, #0x4
    bgt Quit
    ldrb r0, [r1]
    cmp r0, r6
    beq Loop

RaisableStat:
    mov r0, #0x58
    mov r0, r7
    add r4, r0, r7
    ldr r5, =0x202409C
    mov r9, r6

StatSelect:
    ldr r6, =RNG
    bl Linker
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r1, #0x5
    ldr r6, =DivMod
    bl Linker
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r10, r0
    add r0, r0, r4
    add r0, r0, r5
    ldrb r0, [r0]
    lsl r0, r0, #0x18
    asr r0, r0, #0x18
    mov r6, r9
    cmp r0, r6
    beq StatSelect

BoostRandomStat:
    ldr r1, =BattleOutcome
    mov r2, #0xFD
    strb r2, [r1]
    mov r0, #5
    strb r0, [r1, #0x1]
    mov r0, r10
    add r0, #0x1
    strb r0, [r1, #0x2]
    mov r0, #0xFF
    strb r0, [r1, #0x3]
    ldr r0, =TargetPartner
    strb r7, [r0]
    ldr r1, =MiscBufferCountersArea
    mov r0, r10
    add r0, #0x21
    strb r0, [r1, #0x1A]
    add r0, #6
    strb r0, [r1, #0x10]
    mov r0, #0x0
    strb r0, [r1, #0x11]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =StatRaiseBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]

SetupBuffersAndExit:
    ldr r0, =MiscBufferCountersArea
    strb r7, [r0, #0x17]
    ldr r0, =Bank_F
    strb r7, [r0]
    ldr r4, =ActiveBank
    strb r7, [r4]

Quit2:
    ldr r1, =Return2
    bx r1

Quit:
    ldr r1, =Return
    bx r1

Linker:
    bx r6

.align 2
.pool

SwapBanks:
    ldr r1, =UserBank
    ldrb r0, [r1]
    ldr r3, =Bank_F
    ldrb r2, [r3]
    strb r0, [r3]
    strb r2, [r1]
    bx lr
.align 2
.pool

@@@@OranBerryBS:
OranHealBS:
playanimation 0xA 0x7 0x0

printstring 0x12A

waitmessage 0x40

orword 0x2024280 0x100

graphicalhpupdate 0xA

datahpupdate 0xA

removeitem 0xA
return
.align 2

@@@@
HealAndConfuseBS:
playanimation 0xA 0x7 0x0

printstring 0x12A

waitmessage 0x40

orword 0x2024280 0x100

graphicalhpupdate 0xA

datahpupdate 0xA

printstring 0x144
waitmessage 0x40

callasm SwapBanks+RomAreaOffset+1
setbyte 0x2024335 0x47
seteffecttarget
callasm SwapBanks+RomAreaOffset+1
removeitem 0xA
return

@@@@
FocusBerryBS:
playanimation 0xA 0x7 0x0

printstring 0x146

waitmessage 0x40

removeitem 0xA
return

.align 2
@@@@@@@
StatRaiseBS:
playanimation 0xA 0x7 0x0
callasm SwapBanks+RomAreaOffset+1
statbuffchange 0x41 StatRaiseAnimation+RomAreaOffset

StatRaiseAnimation:
callasm SwapBanks+RomAreaOffset+1
setbyte 0x2024337 0x4
playanimation 0x2 0x1 0x2024484

printfromtable 0x85CC89C

waitmessage 0x40
removeitem 0xA
return




Pheonix x February 20th, 2016 10:54 AM

If it is possible can somebody make a asm for sprite switching for gogoat system.

leyn09 February 22nd, 2016 12:40 AM

May I request an asm for expert belt and focus sash if it's possible? Thanksss!

Trainer 781 February 22nd, 2016 1:48 AM

Quote:

Originally Posted by leyn09 (Post 9128978)
May I request an asm for expert belt and focus sash if it's possible? Thanksss!

Expert belt is in the ability resource thread along with Solid Rock.

lesleyrs March 6th, 2016 4:31 AM

has anyone ever thought about seperate pokemon storage systems for each region? Or would that be an insane amount of work?

I think itd be really cool

Logan March 6th, 2016 5:28 AM

Quote:

Originally Posted by random321 (Post 9149593)
has anyone ever thought about seperate pokemon storage systems for each region? Or would that be an insane amount of work?

I think itd be really cool

Why not just rename all your boxes region names and put the relevant Pokemon in there?

BluRose March 6th, 2016 5:41 AM

Quote:

Originally Posted by random321 (Post 9149593)
has anyone ever thought about seperate pokemon storage systems for each region? Or would that be an insane amount of work?

I think itd be really cool

an insane amount of work
this is so because of the RAM it takes up
even with jpan's saveblock hack, you can add like, what another box and a half? it's not a lot, but it take up a lot of RAM

lesleyrs March 6th, 2016 7:01 AM

Quote:

Originally Posted by BluRose (Post 9149650)
an insane amount of work
this is so because of the RAM it takes up
even with jpan's saveblock hack, you can add like, what another box and a half? it's not a lot, but it take up a lot of RAM

would still be an option to split up the boxes, its not about having extra space but i think itd be cool to kinda start over in a new region and getting a new starter instead of just rushing through the game with your pokemons that you used in the elite 4

in the anime ash was only able to bring over a few pokemon i think?

NewDenverCity March 6th, 2016 12:26 PM

Quote:

Originally Posted by random321 (Post 9149747)
would still be an option to split up the boxes, its not about having extra space but i think itd be cool to kinda start over in a new region and getting a new starter instead of just rushing through the game with your pokemons that you used in the elite 4

in the anime ash was only able to bring over a few pokemon i think?

As hashtag said, you should just rename your boxes.


Yes, but that's the anime; the hardware just can't support what you're trying to do.

Deokishisu March 6th, 2016 10:52 PM

Quote:

Originally Posted by NewDenverCity (Post 9150101)
As hashtag said, you should just rename your boxes.


Yes, but that's the anime; the hardware just can't support what you're trying to do.

I'm pretty sure that he wants the existing number of boxes divided up and separated so that they can only be accessed from certain regions (so basically, when a variable is set to this, only allow access to the first half of the PC. When a variable is set to that, only allow access to the second half of the PC.) Sort of a more elegant way to keep the player out of their main region's boxes than just locking the PC entirely, like Game Freak did at the beginning of the Sevii Islands plotline.

Blah March 7th, 2016 5:33 AM

I like PokeMMO's solution to this. They made the player put all their Pokemon into the PC and started the second region fresh. Then when you tried to withdraw from the PC, it'd only let you withdraw Pokemon of certain levels depending on how many gyms you had defeated in the second region.
Finding a reason to logically explain that phenomenon to the player might be harder than actually implementing it.

Pokemon_XY March 7th, 2016 7:17 AM

Directly Send a Pokemon to PC


It's just a simple hook but I haven't tested it yet.
Routine:
Code:

.thumb
.align 2
@Please place a hook at 0x8040b46 (00 00 00 48 00 47 [pointer+1 to this routine])
.equ flag_num, 0x250 @here you define your flag number
.equ flag_check, 0x806E6D1
.equ count_pokemon, 0x8040C3D
.equ pkmn_addr, 0x2024284
ldr r0, =flag_num
ldr r1, =flag_check
bl call_r1
cmp r0, #1
beq loc_8040b80
ldr r1, =count_pokemon
bl call_r1
mov r5, r0
cmp r0, #6
beq loc_8040b80
mov r1, #100
mul r0, r1
ldr r4, =pkmn_addr
add r4, r0, r4
ldr r0, =0x8040B63
bx r0

loc_8040b80:
ldr r1, =0x8040b81
call_r1:
bx r1


Please finish the hook and define the flag index as said in the comment above.

Usage:
Code:

//CODES
setflag 0x250 //the flag index is what you've set in the routine
givepokemon 0x1 0x1 0x0 0x0 0x0 0x0
clearflag 0x250
//CODES


Note:
It's also compatible with my custom givepokemon here: http://www.pokecommunity.com/showpost.php?p=8942634&postcount=739

Lance32497 March 9th, 2016 5:04 AM

I think it would be an easier work if, after the player finishes the league and plans to start his/her journey on a new region, he/she will hand over all of his/her pokèmon, both on PC and party, to the professor or whoever is in charge there. So basicaly, a routine that erases all Pokèmon on the storage and party.

Logan March 9th, 2016 5:29 AM

Quote:

Originally Posted by Lance32497 (Post 9154422)
I think it would be an easier work if, after the player finishes the league and plans to start his/her journey on a new region, he/she will hand over all of his/her pokèmon, both on PC and party, to the professor or whoever is in charge there. So basicaly, a routine that erases all Pokèmon on the storage and party.

It'd probably be better to send them into storage so you can access them again when the game finishes (maybe to trade) or use them later on (Elite4?)

Substitute Doll March 9th, 2016 5:01 PM

how about a way to make no pokemon in your team or storage, but it stores it in the RAM?

Joexv March 9th, 2016 6:21 PM

Quote:

Originally Posted by Deltakirby (Post 9155234)
how about a way to make no pokemon in your team or storage, but it stores it in the RAM?

That would take up a hella amount of RAM. It may be possible with Jpans save block hack, but if you consider that each team consists of 600 bytes and then multiply that by region(up to 6 if we go official games) thats 0xE10 bytes of RAM.

And looking at his hack it doesnt free up enough space in one place for something of this size
Quote:

Originally Posted by Jpan
0x0203C000 to 0x0203C0CC
0x0203C0CC to 0x0203C324
0x0203C324 to 0x0203CEC4

So maybe one or possibly even two times you could do that. But that still leaves all the Pokemon in the PC.

EDIT: And even compressing the Pokemon(removing current/total hp) wouldn't help enough to fit something like this.

thedarkdragon11 March 9th, 2016 7:01 PM

Quote:

Originally Posted by BluRose (Post 9149650)
an insane amount of work
this is so because of the RAM it takes up
even with jpan's saveblock hack, you can add like, what another box and a half? it's not a lot, but it take up a lot of RAM

Just curious, is RAM expansion not possible?

BluRose March 10th, 2016 5:09 AM

Quote:

Originally Posted by thedarkdragon11 (Post 9155423)
Just curious, is RAM expansion not possible?

i believe it's possible (i say this due to jambo wanting to have done it to create extra saveable space), but it breaks all compatibility with flashcarts and possibly has some other problems
i'm no expert on it so you might want to get a second opinion but yeah

Blah March 10th, 2016 5:48 AM

Quote:

Originally Posted by Deltakirby (Post 9155234)
how about a way to make no pokemon in your team or storage, but it stores it in the RAM?

This would be slightly easier than segregating the PC boxes, however, in the end it's the same amount of work. You still need to put said block of RAM into a save block.

Quote:

Originally Posted by thedarkdragon11 (Post 9155423)
Just curious, is RAM expansion not possible?

Nope.

Quote:

Originally Posted by BluRose (Post 9156038)
i believe it's possible (i say this due to jambo wanting to have done it to create extra saveable space), but it breaks all compatibility with flashcarts and possibly has some other problems
i'm no expert on it so you might want to get a second opinion but yeah

No, you can't expand the amount of RAM on the GBA. The GBA has 256KB of EWRAM, and a very low amount of that is used reasonably by FR. You're confusing saveblock space with EWRAM space ;)

BluRose March 10th, 2016 6:29 AM

Quote:

Originally Posted by FBI (Post 9156069)
Spoiler:
This would be slightly easier than segregating the PC boxes, however, in the end it's the same amount of work. You still need to put said block of RAM into a save block.

Nope.

No, you can't expand the amount of RAM on the GBA. The GBA has 256KB of EWRAM, and a very low amount of that is used reasonably by FR. You're confusing saveblock space with EWRAM space ;)

oh, goodness
sorry darkdragon, i'm at school and was just sort of reading it without really thinking haha

thedarkdragon11 March 10th, 2016 6:04 PM

Quote:

Originally Posted by FBI (Post 9156069)
This would be slightly easier than segregating the PC boxes, however, in the end it's the same amount of work. You still need to put said block of RAM into a save block.



Nope.



No, you can't expand the amount of RAM on the GBA. The GBA has 256KB of EWRAM, and a very low amount of that is used reasonably by FR. You're confusing saveblock space with EWRAM space ;)

That's sad... So there really is no way to expand the storage or add another one with the same size...

Wesley FG March 11th, 2016 1:26 PM

Plz someone can re-upload "The Infamous JPAN Save Block Hack" ?
it is download be attchment, but not work since pokecommunity are hacked.

Phantom Phoenix March 12th, 2016 8:47 AM

Quote:

Originally Posted by Wesley FG (Post 9158342)
Plz someone can re-upload "The Infamous JPAN Save Block Hack" ?
it is download be attchment, but not work since pokecommunity are hacked.

www.pokecommunity.com/attachment.php?attachmentid=78074&d=1456384694

I think its the save block hack of Jpan.

this attachment was originally posted by BlackWhiteRobin.I am not totally sure its the save block hack as I haven't used it.but it was posted by him in my thread in beginner lounge.

AkameTheBulbasaur March 12th, 2016 9:05 PM

Quote:

Originally Posted by FBI (Post 8509300)

Wild Pokemon With custom attacks


I had some earlier issues with Custom Move routine, namely that it would cause every Pokemon to just use Struggle regardless of if I'd set the vars or not. After a couple conversations with FBI I've finally gotten it to work for me.

FBI requested me to post this fix here, so I will be sharing his routine with permission.

The first is the actual routine itself:
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
push {r0-r3}
mov r0, #0xFF
lsl r0, r0, #0x1
add r0, r0, #0xB6
ldr r3, =(0x806E6D0 +1)
bl linker
mov r5, r0
pop {r0-r3}
cmp r5, #0x0
beq default_moves
ldr r5, VAR
mov r4, #0x0

loop:
mov r1, r5
ldrb r0, [r0]
cmp r0, #0x0
beq default_moves
mov r0, #0x2
mul r0, r0, r4
add r1, r1, r0
ldrh r1, [r1]
mov r0, r8
ldr r3, =(0x803E8B0 +1)
bl linker
add r4, r4, #0x1
cmp r4, #0x4
bne loop

noCrash:
lsl r0, r0, #0x10
mov r1, r9
lsr r5, r1, #0x10
ldr r3, [sp]
ldr r1, = (0x803EA60 +1)
cmp r0, r9
bne linkerone
ldr r1, = (0x803EA56 +1)
bx r1


default_moves:
ldr r3, =(0x803E8B0 +1)
bl linker
b noCrash

linkerone:
bx r1

linker:
bx r3

.align 2

VAR:
.word 0x020370B8


The second is simply a hook to this routine:
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
ldr r5, =(0x8YYYYYY +1)
bx r5

.align 2


Assemble the first routine in free space. In the second routine, replace YYYYYY with the offset of the first routine (don't add one, the second routine adds one for you when you assemble it). After assembling both, copy and paste the second hook routine at 0x03EA48 (it should be eight bytes long and end with a pointer to the first routine). Then write "00 00" to 0x03EA46.

To enable custom moves, set the flag 0x2B4. To disable it, just clear the flag. If you want to use a different flag, just subtract 1FE from the number flag you want to use and put that number (in hex) after the "add r0, r0," in the .main routine. For example, if you wanted flag 200 to be the toggle flag, you would put "#0x2" after the "add r0, r0,". You shouldn't increase it by higher than 0xFF.

Otherwise its use is exactly the same as in the original post, just with a flag used to toggle it instead of a var.

EDIT: I've noticed a really tiny bug where the last move (var 0x8003) will actually use the move that is one below it in index order. For example, if you put 0x15D (Dragon Dance), in game the Pokemon will have 0x15C (Leaf Blade) in that slot. Just add one to the index number of the last move and it will be fine. Otherwise everything works exactly how it's meant to.

DOUBLE EDIT: The above bug only applies if you used the Shiny Pokemon hack where setting the var 0x8003 makes the pokemon you battle/get shiny. Var 0x8003 is also for the last move, so I believe if you have both this and the shiny hack then you'll need to do that. I could be wrong but I believe that's the case.

Quote:

How to use:
Variables 0x8000 to 0x8003 are the 4 custom attacks you want inserted.
So to set the first attack of the wild Pokemon to firepunch, I would setvar 0x8000 0x7.

Here's a present :3
http://i.imgur.com/LjzUa9a.png

EDIT: Attacks must be between 0x0-0xFFFF
EDIT AGAIN:
I've had issues getting this to work on FlashCart. The game would say "Pokemon used !" and then crash. Not sure if this was just me or not, but I'd be careful if you use this in a hack that you'd want to be FlashCart compatible without further testing.

I want to stress that I did not make this routine. I just tested it. FBI requested that I post the fix here after I finished testing it. All credit goes to him and not me.

Pokemon_XY March 12th, 2016 11:01 PM

Quote:

Originally Posted by AkameTheBulbasaur (Post 9160784)
I had some earlier issues with Custom Move routine, namely that it would cause every Pokemon to just use Struggle regardless of if I'd set the vars or not. After a couple conversations with FBI I've finally gotten it to work for me.
FBI requested me to post this fix here, so I will be sharing his routine with permission.
I want to stress that I did not make this routine. I just tested it. FBI requested that I post the fix here after I finished testing it. All credit goes to him and not me.

I've made routines including these features:):
http://www.pokecommunity.com/showpost.php?p=8942634&postcount=739

Anyway, nice work for you to post the fixed code!

Wesley FG March 13th, 2016 8:29 PM

Color Stats Based on Nature
someone know the values of the offsets of this routine for EMERALD ?
or can do it for EMERALD, it is very usefull.

Lance32497 March 14th, 2016 7:42 PM

My request is an ASM that will let you give or take on your current amount of money using var..
For example
Code:

callasm 0xDEADBEEF
setvar 0x8000 0x500


then 500 will be given or deducted on you, it will be useful for banks and stuffs

thedarkdragon11 March 14th, 2016 8:55 PM

Is it possible to disable access to the menu (not sure with the term, but the menu which has Pokédex, Bag, Save, Option, etc.) in a specific map name?

Just wondering because I'm imagining the mechanics of a fake Eon Flute/Soaring in the Sky for GBA games...

AkameTheBulbasaur March 15th, 2016 6:27 AM

Is there a way to disable using the bag during a battle (like in the Battle Fronteir) in Fire Red? I know it's possible in Emerald but I don't remember if Fire Red ever has a battle type like that.

DoesntKnowHowToPlay March 15th, 2016 7:29 AM

Link battles disable it. My machine with all of my notes is not currently behaving so I have no offsets for you, but try putting a breakpoint on the battle type (0x02022b4c) before opening the bag in battle.

Spherical Ice March 15th, 2016 7:41 AM

Quote:

Originally Posted by AkameTheBulbasaur (Post 9164782)
Is there a way to disable using the bag during a battle (like in the Battle Fronteir) in Fire Red? I know it's possible in Emerald but I don't remember if Fire Red ever has a battle type like that.

Quote:

Originally Posted by DoesntKnowHowToPlay (Post 9164846)
Link battles disable it. My machine with all of my notes is not currently behaving so I have no offsets for you, but try putting a breakpoint on the battle type (0x02022b4c) before opening the bag in battle.

http://pastebin.com/bHmFB5SX This routine lets you disable the bag when a flag is set. I didn't write it, though, I think it was daniilS. You just assemble it and insert it at x143D4.

DizzyEgg March 15th, 2016 10:18 AM

Quote:

Originally Posted by Wesley FG (Post 9162422)
Color Stats Based on Nature
someone know the values of the offsets of this routine for EMERALD ?
or can do it for EMERALD, it is very usefull.

FR has different stat summary screen display from Emerald, so you can't really change offsets. You're in luck though, as I wrote a routine that does that in EM.
LeftStats color change:
Spoiler:

Code:

.text
.thumb
.thumb_func
.align 2

main:
    push {r5}
    sub sp, sp, #0x20
    ldr r0, [r4] @pokemon summary pointer
    add r0, #0xA3 @poke nature
    ldrb r1, [r0]
    ldr r0, nature_stat_table
    lsl r2, r1, #2
    add r2, r1, r2 @multiply by 5
    add r2, r2, r0 @r2 contains nature info
    ldr r3, left_stats_string
    mov r1, sp
    mov r5, #0

handle_hp:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #6
    bne handle_hp
    add r3, #6
    add r1, #6
    mov r5, #0

handle_atk:
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_atk
    cmp r0, #0xFF
    bne copy_atk
    bl blue_font
    b copy_atk

red_font_atk:
    bl red_font

copy_atk:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_atk
    add r3, #3
    add r1, #3
    mov r5, #0

handle_def:
    add r2, #1
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_def
    cmp r0, #0xFF
    beq blue_font_def
    bl default_font
    b copy_def

red_font_def:
    bl red_font
    b copy_def

blue_font_def:
    bl blue_font

copy_def:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_def

copy_string:
    ldr r0, displayed_string
    mov r1, sp
    ldr r2, special_f7_string_fct
    bl callvia_r2

return:
    mov r0, r9
    add sp, sp, #0x20
    pop {r5}
    ldr r2, =(0x081C37A8 + 1)
    b callvia_r2

blue_font: @FC 01 07
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    mov r0, #7 @color of the lowered stat
    strb r0, [r1]
    add r1, #1
    bx lr

red_font: @FC 01 05
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    mov r0, #5 @color of the raised stat
    strb r0, [r1]
    add r1, #1
    bx lr

default_font: @FC 01 01
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    strb r0, [r1]
    add r1, #1
    bx lr

callvia_r2:
    bx r2

.align 2

nature_stat_table: .word 0x0831E818
left_stats_string: .word 0x0861CE82
displayed_string: .word 0x02021FC4
special_f7_string_fct: .word 0x081AFC29

@at 0x1C379E insert: 00 00 00 4A 10 47 XX+1 XX XX 08 where XX is the address of the inserted routine



RightStats color change:
Spoiler:

Code:

.text
.thumb
.thumb_func
.align 2

main:
    push {r5}
    sub sp, sp, #0x20
    ldr r0, [r4] @pokemon summary pointer
    add r0, #0xA3 @poke nature
    ldrb r1, [r0]
    ldr r0, nature_stat_table
    lsl r2, r1, #2
    add r2, r1, r2 @multiply by 5
    add r2, r2, r0 @r2 contains nature info
    add r2, #3 @r2 contains beg of spatk stat
    ldr r3, right_stats_string
    mov r1, sp
    mov r5, #0

handle_spatk:
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_spatk
    cmp r0, #0xFF
    bne copy_spatk
    bl blue_font
    b copy_spatk

red_font_spatk:
    bl red_font

copy_spatk:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_spatk
    add r3, #3
    add r1, #3
    mov r5, #0

handle_spdef:
    add r2, #1
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_spdef
    cmp r0, #0xFF
    beq blue_font_spdef
    bl default_font
    b copy_spdef

red_font_spdef:
    bl red_font
    b copy_spdef

blue_font_spdef:
    bl blue_font

copy_spdef:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_spdef
    add r3, #3
    add r1, #3
    mov r5, #0

handle_spd:
    sub r2, #2
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_spd
    cmp r0, #0xFF
    beq blue_font_spd
    bl default_font
    b copy_spd

red_font_spd:
    bl red_font
    b copy_spd

blue_font_spd:
    bl blue_font

copy_spd:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_spd
    add r3, #3
    add r1, #3

return:
    ldr r0, displayed_string
    mov r1, sp
    ldr r2, special_f7_string_fct
    bl callvia_r2
    add sp, sp, #0x20
    pop {r5}
    ldr r2, =(0x081C386C + 1)
    bx r2

blue_font: @FC 01 07
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    mov r0, #7 @color of the lowered stat
    strb r0, [r1]
    add r1, #1
    bx lr

red_font: @FC 01 05
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    mov r0, #5 @color of the raised stat
    strb r0, [r1]
    add r1, #1
    bx lr

default_font: @FC 01 01
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    strb r0, [r1]
    add r1, #1
    bx lr

callvia_r2:
    bx r2   

.align 2

nature_stat_table: .word 0x0831E818
right_stats_string: .word 0x0861CE8E
displayed_string: .word 0x02021FC4
special_f7_string_fct: .word 0x081AFC29

@at 0x1C3864 insert 00 4A 10 47 XX+1 XX XX 08



Image:


Also, for anyone hacking Emerald. If there's an ASM feature that you'd like to have in your hack but is not present here, let me know. I've got some time, so who knows, I may help.

STikER March 18th, 2016 7:01 AM

Okay, I made animated Pokémon sprites in FireRed using a method from this thread: http://www.pokecommunity.com/showthread.php?t=320333
Now I want to disable animation for certain Pokémon (Castform). Is there any way to do this with ASM?

azurile13 March 18th, 2016 1:35 PM

Quote:

Originally Posted by Angry_Bird404 (Post 9117157)
I don't know if anyone's been working on this lately, but I've been itching to share this.

FireRed lacks a system that uses a Region Dex order seperate from the National Dex. If you were to have a Region Dex and a National Dex, your National Dex would look unprofessional. What I'm putting here is my work towards a Region Dex system for FireRed. I would like to stress however that it is both unoptimized and unfinished, but I really wanted to release this.

The current routines
Spoiler:

Loading the right species
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
mov r4, r8
lsl r0, r4, #0x10
lsr r5, r0, #0x10
add r4, #0x1
ldr r0, .HoennDex
lsl r5, r5, #0x1
add r0, r0, r5
ldrh r0, [r0]
mov r5, r0
ldr r0, .return
bx r0

.align 2

.HoennDex: .word 0x08252216
.nationaltoindex: .word 0x08043200+1
.return: .word 0x08103574+1


Insert 00 48 00 47 xx xx xx 08 at 0x10356C


Correct numbering
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

lsr r4, r4, #0x18
lsl r6, r6, #0x18
lsr r6, r6, #0x18
ldr r1, .indextonatdex
bl Linker
mov r2, r0
ldr r1, .dexarea
add r1, r1, #0xa
ldrb r1, [r1]
cmp r1, #0x1
beq regionnumber
mov r0, r2
b GoBack

Linker:
bx r1

GoBack:
ldr r2, .return
bx r2

regionnumber:
mov r0, #0x0
ldr r1, .HoennDex

Loop:
mov r0, r3
lsl r3, r3, #0x1
add r1, r1, r3
ldrh r3, [r1]
add r0, r0, #0x1
cmp r1, r2
bne Loop
b GoBack

.align 2

.HoennDex: .word 0x08252324
.indextonatdex: .word 0x08043298+1
.flagcheck: .word 0x0806e6d0+1
.return: .word 0x08104a6a+1


Insert 00 4A 10 47 xx xx xx 08 at 0x104A60


Fixing the end of the region dex
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
push {r2}
mov r2, #0x0
ldr r1, .HoennDex

loop:
lsl r0, r2, #0x1
add r0, r0, r1
ldrh r0, [r0]
add r2, #0x1
cmp r0, r5
bne loop

lastpart:
ldr r1, =0x100 /*Put the length of your Region Dex here, this supports beyond 256*/
mov r10, r2
pop {r2}
str r2, [r3, #4]
mov r8, r9
mov r0, r8
cmp r0, r1
ble jump
ldr r1, .return2
bx r1

jump:
ldr r1, .return
bx r1

.align 2

.HoennDex: .word 0x08252324
.return: .word 0x0810356c+1
.return2: .word 0x08103906+1


Insert 00 49 08 47 xx xx xx 08 at 0x1035F0


To-Do list
Fix counting the Region Dex for things like the start screen and talking to the Professor
Displaying the Region Dex number when you don't have the National Dex on the summary screen
Making searches and habitat lists use Region Dex numbers before the National Dex


Send me a PM if you're interested in fixing up what's left.

This post motivated me to create an actual regional dex instead of just giving a national dex at the start, so thanks :D I've added some extra routines to do things like display the correct regional dex number in summary screens, displaying dex info on capture, and having the proper regional dex count. New hooks:
Code:

.thumb
.align

.equ number_of_mons_in_regional_dex,        300        //or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex,        721

data_on_capture_hook:        //0x08106B84 via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0
        bne capture_display_return
        ldr r0, add_task_no_capture_display
        bx r0

capture_display_return:
        ldr r0, add_task_capture_display
        bx r0

habitat_dex_regional_limit_hook:        //0x08106810 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x1
        beq habitat_dex_regional_limit_return        //valid
        mov r0, r4
        bl species_to_regional_dex_number
        cmp r0, #0x0
        beq habitat_dex_regional_limit_return        //not in regional dex, return 0
        mov r0, #0x1

habitat_dex_regional_limit_return:
        pop {r4}
        pop {r1}
        bx r1

dex_seeable_mon_hook:        //0x08043F90 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq only_regional_numbered
//national
        mov r0, r4
        bl species_to_national_dex_number_1
        b dex_seeable_mon_check_valid_species

only_regional_numbered:
        mov r0, r4
        bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
        cmp r0, #0x0
        bne dex_seeable_mon_return
        ldr r0, full_halfword

dex_seeable_mon_return:
        pop {r4}
        pop {r1}
        bx r1
.align
full_halfword:        .word 0xFFFF

dex_evolution_fix_hook:        //0x080CE91A via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0        //not in regional dex, invalid
        beq dex_evolution_failure
        ldr r0, dex_evolution_success_return
        bx r0

dex_evolution_failure:
        mov r0, #0x11
        strh r0, [r5, #0x8]
        mov r2, #0x1
        ldr r1, dex_evolution_failure_return
        bx r1

dex_display_counts_hook:        //0x08104BBC via r2
        //r0: mode
        push {lr}
        cmp r1, #0x0
        beq call_regional_count
        bl national_pokedex_count
        b dex_display_counts_return

call_regional_count:
        bl dex_regional_count_hook

dex_display_counts_return:
        pop {pc}

dex_regional_count_hook:        //0x08088EDC via r1
        push {r4-r6, lr}
        mov r6, r0        //mode
        mov r4, #0x1        //loop
        mov r5, #0x0        //counter

dex_regional_count_loop:
        lsl r0, r4, #0x1        //loop times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]        //req species
        mov r1, r6        //mode
        mov r2, #0x1        //input is SPECIES
        bl dex_flag_check
        add r5, r5, r0
        add r4, #0x1
        ldr r0, regional_dex_limit
        cmp r4, r0
        blo dex_regional_count_loop
        mov r0, r5
        pop {r4-r6, pc}

dex_display_hook:        //0x0810352C via r1
        ldr r1, regional_dex_limit
        cmp r0, #0x0
        beq store_dex_limit_and_return
        ldr r1, national_dex_limit

store_dex_limit_and_return:
        str r1, [sp, #0x0]
        ldr r0, regional_dex_limit_return
        bx r0

regional_dex_hook:        //0x0810356C via r0
        mov r4, r8
        add r4, #0x1
        lsl r0, r4, #0x1        //index times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]
        bl species_to_national_dex_number_1
        mov r5, r0
        mov r1, #0x0
        ldr r2, regional_dex_hook_return
        bx r2

store_last_dex_seen_hook:        //0x081035B4 via r1
        str r0, [r2]
        mov r10, r4
        mov r4, r3
        ldr r0, def_store_string_dex_number
        bx r0

lazy_regional_dex_end_hook:        //0x081035F4 via r0
        mov r0, r8
        ldr r1, regional_dex_limit
        cmp r0, r1
        blo regional_dex_hook
        ldr r0, end_dex_display_return
        bx r0

display_regional_num_hook:        //0x08104A66 via r1
        mov r5, r0        //save species
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq use_regional_dex_ordering
        ldr r1, dex_malloc_ptr
        ldr r1, [r1]
        add r1, #0x42
        ldrb r1, [r1]
        cmp r1, #0x0        //check if looking at regional dex
        beq use_regional_dex_ordering
        mov r0, r5
        bl species_to_national_dex_number_1
        b display_dex_number_return

use_regional_dex_ordering:
        mov r0, r5
        bl species_to_regional_dex_number       

display_dex_number_return:
        mov r5, r0
        ldr r0, dex_number_display_return
        bx r0

species_to_regional_dex_number:
        adr r3, regional_dex_order
        mov r2, r0        //req species
        mov r0, #0x0        //loop counter
find_regional_number_loop:
        lsl r1, r0, #0x1
        ldrh r1, [r3, r1]
        cmp r1, r2
        beq species_to_regional_dex_return
        add r0, #0x1
        ldr r1, regional_dex_limit
        cmp r0, r1
        bls find_regional_number_loop
        mov r0, #0x0        //not in dex: set number to 0
species_to_regional_dex_return:
        bx lr

species_to_national_dex_number_1:
        ldr r1, f_species_to_nat_dex
        bx r1
.align
f_species_to_nat_dex:        .word 0x08043298 + 1

haz_national_dex_bool:
        ldr r0, f_haz_national_check
        bx r0
.align
f_haz_national_check:        .word 0x0806E25C + 1

dex_flag_check:
        ldr r3, f_dex_flag_check
        bx r3
.align
f_dex_flag_check:        .word 0x08104AB0 + 1

national_pokedex_count:
        ldr r1, f_national_pokedex_count
        bx r1
.align
f_national_pokedex_count:        .word 0x08088E8C + 1

.align
add_task_no_capture_display:        .word 0x08106B90 + 1
add_task_capture_display:        .word 0x08106BA4 + 1
dex_evolution_success_return:        .word 0x080CE948 + 1
dex_evolution_failure_return:        .word 0x080CE924 + 1
regional_dex_limit:        .word number_of_mons_in_regional_dex
national_dex_limit:        .word number_of_mons_in_national_dex
regional_dex_limit_return:        .word 0x0810353a + 1
regional_dex_hook_return:        .word 0x08103578 + 1
def_store_string_dex_number:        .word 0x081035D6 + 1
end_dex_display_return:        .word 0x08103906 + 1
dex_malloc_ptr:                        .word 0x0203ACF0
dex_number_display_return:        .word 0x08104A70 + 1

regional_dex_order:
.short 0x0000
.short CHIKORITA
.short BAYLEEF
.short MEGANIUM
etc


For anyone using Touched's scripts/ASMAGIX:
Code:

data_on_capture_hook                08106B84        1
dex_seeable_mon_hook                08043F90        1
dex_evolution_fix_hook                080CE91A        1
dex_display_counts_hook                08104BBC        2
dex_regional_count_hook                08088EDC        1
dex_display_hook                0810352C        1
regional_dex_hook                0810356C        0
store_last_dex_seen_hook        081035B4        1
lazy_regional_dex_end_hook        081035F4        0
display_regional_num_hook        08104A66        1
habitat_dex_regional_limit_hook        08106810        1



STikER March 19th, 2016 4:58 AM

Quote:

Originally Posted by azurile13 (Post 9169525)
Code:

.thumb
.align

.equ number_of_mons_in_regional_dex,        300        //or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex,        721

data_on_capture_hook:        //0x08106B84 via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0
        bne capture_display_return
        ldr r0, add_task_no_capture_display
        bx r0

capture_display_return:
        ldr r0, add_task_capture_display
        bx r0

habitat_dex_regional_limit_hook:        //0x08106810 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x1
        beq habitat_dex_regional_limit_return        //valid
        mov r0, r4
        bl species_to_regional_dex_number
        cmp r0, #0x0
        beq habitat_dex_regional_limit_return        //not in regional dex, return 0
        mov r0, #0x1

habitat_dex_regional_limit_return:
        pop {r4}
        pop {r1}
        bx r1

dex_seeable_mon_hook:        //0x08043F90 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq only_regional_numbered
//national
        mov r0, r4
        bl species_to_national_dex_number_1
        b dex_seeable_mon_check_valid_species

only_regional_numbered:
        mov r0, r4
        bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
        cmp r0, #0x0
        bne dex_seeable_mon_return
        ldr r0, full_halfword

dex_seeable_mon_return:
        pop {r4}
        pop {r1}
        bx r1
.align
full_halfword:        .word 0xFFFF

dex_evolution_fix_hook:        //0x080CE91A via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0        //not in regional dex, invalid
        beq dex_evolution_failure
        ldr r0, dex_evolution_success_return
        bx r0

dex_evolution_failure:
        mov r0, #0x11
        strh r0, [r5, #0x8]
        mov r2, #0x1
        ldr r1, dex_evolution_failure_return
        bx r1

dex_display_counts_hook:        //0x08104BBC via r2
        //r0: mode
        push {lr}
        cmp r1, #0x0
        beq call_regional_count
        bl national_pokedex_count
        b dex_display_counts_return

call_regional_count:
        bl dex_regional_count_hook

dex_display_counts_return:
        pop {pc}

dex_regional_count_hook:        //0x08088EDC via r1
        push {r4-r6, lr}
        mov r6, r0        //mode
        mov r4, #0x1        //loop
        mov r5, #0x0        //counter

dex_regional_count_loop:
        lsl r0, r4, #0x1        //loop times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]        //req species
        mov r1, r6        //mode
        mov r2, #0x1        //input is SPECIES
        bl dex_flag_check
        add r5, r5, r0
        add r4, #0x1
        ldr r0, regional_dex_limit
        cmp r4, r0
        blo dex_regional_count_loop
        mov r0, r5
        pop {r4-r6, pc}

dex_display_hook:        //0x0810352C via r1
        ldr r1, regional_dex_limit
        cmp r0, #0x0
        beq store_dex_limit_and_return
        ldr r1, national_dex_limit

store_dex_limit_and_return:
        str r1, [sp, #0x0]
        ldr r0, regional_dex_limit_return
        bx r0

regional_dex_hook:        //0x0810356C via r0
        mov r4, r8
        add r4, #0x1
        lsl r0, r4, #0x1        //index times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]
        bl species_to_national_dex_number_1
        mov r5, r0
        mov r1, #0x0
        ldr r2, regional_dex_hook_return
        bx r2

store_last_dex_seen_hook:        //0x081035B4 via r1
        str r0, [r2]
        mov r10, r4
        mov r4, r3
        ldr r0, def_store_string_dex_number
        bx r0

lazy_regional_dex_end_hook:        //0x081035F4 via r0
        mov r0, r8
        ldr r1, regional_dex_limit
        cmp r0, r1
        blo regional_dex_hook
        ldr r0, end_dex_display_return
        bx r0

display_regional_num_hook:        //0x08104A66 via r1
        mov r5, r0        //save species
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq use_regional_dex_ordering
        ldr r1, dex_malloc_ptr
        ldr r1, [r1]
        add r1, #0x42
        ldrb r1, [r1]
        cmp r1, #0x0        //check if looking at regional dex
        beq use_regional_dex_ordering
        mov r0, r5
        bl species_to_national_dex_number_1
        b display_dex_number_return

use_regional_dex_ordering:
        mov r0, r5
        bl species_to_regional_dex_number       

display_dex_number_return:
        mov r5, r0
        ldr r0, dex_number_display_return
        bx r0

species_to_regional_dex_number:
        adr r3, regional_dex_order
        mov r2, r0        //req species
        mov r0, #0x0        //loop counter
find_regional_number_loop:
        lsl r1, r0, #0x1
        ldrh r1, [r3, r1]
        cmp r1, r2
        beq species_to_regional_dex_return
        add r0, #0x1
        ldr r1, regional_dex_limit
        cmp r0, r1
        bls find_regional_number_loop
        mov r0, #0x0        //not in dex: set number to 0
species_to_regional_dex_return:
        bx lr

species_to_national_dex_number_1:
        ldr r1, f_species_to_nat_dex
        bx r1
.align
f_species_to_nat_dex:        .word 0x08043298 + 1

haz_national_dex_bool:
        ldr r0, f_haz_national_check
        bx r0
.align
f_haz_national_check:        .word 0x0806E25C + 1

dex_flag_check:
        ldr r3, f_dex_flag_check
        bx r3
.align
f_dex_flag_check:        .word 0x08104AB0 + 1

national_pokedex_count:
        ldr r1, f_national_pokedex_count
        bx r1
.align
f_national_pokedex_count:        .word 0x08088E8C + 1

.align
add_task_no_capture_display:        .word 0x08106B90 + 1
add_task_capture_display:        .word 0x08106BA4 + 1
dex_evolution_success_return:        .word 0x080CE948 + 1
dex_evolution_failure_return:        .word 0x080CE924 + 1
regional_dex_limit:        .word number_of_mons_in_regional_dex
national_dex_limit:        .word number_of_mons_in_national_dex
regional_dex_limit_return:        .word 0x0810353a + 1
regional_dex_hook_return:        .word 0x08103578 + 1
def_store_string_dex_number:        .word 0x081035D6 + 1
end_dex_display_return:        .word 0x08103906 + 1
dex_malloc_ptr:                        .word 0x0203ACF0
dex_number_display_return:        .word 0x08104A70 + 1

regional_dex_order:
.short 0x0000
.short CHIKORITA
.short BAYLEEF
.short MEGANIUM
etc



Is a pointer needed for this? Or is it should be inserted on certain offset?

Quote:

Originally Posted by Angry_Bird404 (Post 9117157)
Correct numbering
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

lsr r4, r4, #0x18
lsl r6, r6, #0x18
lsr r6, r6, #0x18
ldr r1, .indextonatdex
bl Linker
mov r2, r0
ldr r1, .dexarea
add r1, r1, #0xa
ldrb r1, [r1]
cmp r1, #0x1
beq regionnumber
mov r0, r2
b GoBack

Linker:
bx r1

GoBack:
ldr r2, .return
bx r2

regionnumber:
mov r0, #0x0
ldr r1, .HoennDex

Loop:
mov r0, r3
lsl r3, r3, #0x1
add r1, r1, r3
ldrh r3, [r1]
add r0, r0, #0x1
cmp r1, r2
bne Loop
b GoBack

.align 2

.HoennDex: .word 0x08252324
.indextonatdex: .word 0x08043298+1
.flagcheck: .word 0x0806e6d0+1
.return: .word 0x08104a6a+1


Insert 00 4A 10 47 xx xx xx 08 at 0x104A60

I cannot compile your routine "Correct numbering". It says there is an error in line 12: invalid offset, value too big (0xFFFFFFFC)
Maybe there should be an offset for .dexarea?

azurile13 March 19th, 2016 12:23 PM

Quote:

Originally Posted by Ollie11 (Post 9170302)
Is a pointer needed for this? Or is it should be inserted on certain offset?



I cannot compile your routine "Correct numbering". It says there is an error in line 12: invalid offset, value too big (0xFFFFFFFC)
Maybe there should be an offset for .dexarea?

Whoa, the notifications I got for this post. There are eleven pointers needed for this :D ctrl + F for "via" and for each of those routines, you need to create a hook.
For example, with data_on_capture_hook, the comment after the label means to insert

ldr r1, =(wherever in free space the routine is + 1)
bx r1
.align

at 0x106B84

STikER March 19th, 2016 12:43 PM

Quote:

Originally Posted by azurile13 (Post 9170684)
Whoa, the notifications I got for this post. There are eleven pointers needed for this :D ctrl + F for "via" and for each of those routines, you need to create a hook.
For example, with data_on_capture_hook, the comment after the label means to insert

ldr r1, =(wherever in free space the routine is + 1)
bx r1
.align

at 0x106B84

Oh, now I get it. It's so simple! Thanks, your routine is great!
So, if it says "via r2" I need to insert this:
ldr r2, =(offset + 2)
bx r2
.align

Right?

DizzyEgg March 20th, 2016 1:50 AM

Pokemon Emerald Multichoice Scrolling Box

So, the mechanic for that is already implemented, we just have to repoint some tables. So let's get down to work.
First, there's a table at 0x085B2CF0. Each entry is a pointer to text to be displayed in the box. One set consist of 16 options. This is important. Anyway, repoint to free space and change pointers to this table. It ends at 0x085B3030.

Now, there's a jumptable at 0x0813A168. It ends at 0x0813A19C. It has 12 entries, repoint it to free space. Now for every new set of options you want to add, you have to add a routine like this:
Spoiler:

Code:

.text
.thumb
.thumb_func
.align 2

main:
    mov r0, #5
    strh r0, [r3, #8] @how many are displayed
    mov r0, #8
    strh r0, [r3, #0xA] @how many are in total
    mov r0, #1
    strh r0, [r3, #0xC] @X coordinate
    mov r0, #1
    strh r0, [r3, #0xE] @Y coordinate
    mov r0, #9
    strh r0, [r3, #0x10] @unkown
    mov r0, #0xA
    strh r0, [r3, #0x12] @box height, should be displayed * 2
    mov r0, #0
    strh r0, [r3, #0x14] @unkown
    strh r4, [r3, #0x26] @task id, don't change it
    pop {r4}
    pop {r0}
    bx r0




Note that you can change parameters in those routines. Play with them and see which ones look the best for you. Now, every routine like that above, goes at the end of the repointed jumptable. There are 12-in game sets, so you'll start with 13. Change the byte at 0x813A148 to the amount of all sets.

One more thing, even though the table of pointers to text can only hold 16 pointers, it doesn't mean you're limited to only that many options. You can go to 126 max, because 127 is treated as hitting B. How? Well, in the routine above set how many in total to the amount you want and ignore occupied slots. For example if you want your set to have 50 options, divide it by 16, so you get 3 and some remainder. That means this set occupies 4 places in the jumptable, like this:
XX XX XX 08 00 00 00 00 00 00 00 00 00 00 00 00 NEW SET GOES HERE

Using it in a script is easy, just do this:
setvar 0x8004 slot in the jumptable (starts at 13, since 12 are already occupied in-game)
special 0x1BE
waitstate
Result is stored in the 0x800D. First option chosen is 0, second is 1, and so on. Hitting B be is 0x7F.
compare 0x800D 0x0
if 0x1 goto @first_option
....
compare 0x800D 0x7F
if 0x1 goto @chose_cancel

I hope everything's understandable. :)

Splash March 20th, 2016 7:20 AM

Quote:

Originally Posted by KDS (Post 9125115)
Sitrus Berry Update:
Spoiler:

Restore 25% of maximum HP.

Emerald:-
Spoiler:

Item Use Effect:
Code:

.text
.align 2
.thumb
.thumb_func
.global sitrusoverworld

Main:

  ldr r1, [sp, #0xC]  @ItemIndex
  cmp r1, #0x8E @Sirtus
  bne Skip
  lsr r0, r0, #0x1  @HP to Restore

Skip:
  cmp r0, #0x0
  bne Exit
  mov r0, #0x1

Exit:
  ldr r1, =0x806C610+1
  bx r1

@@At x31E54D: FE
@@At x6C600: 00 49 08 47 XX+1 XX XX 08


Hold Item Effect:
Code:

.text
.align 2
.thumb
.thumb_func
.global sitruspinch

Main:

  ldrh r1, [r2, #0x2E]  @ItemIndex
  ldrh r3, [r2, #0x28]
  mov r5, r9
  cmp r1, #0x8E @Sitrus
  bne NotZero
  ldrh r0, [r2, #0x2C]
  lsr r5, r0, #0x2  @HP to Restore
  cmp r5, #0x0
  bne NotZero
  mov r5, #0x1

NotZero:
  str r5, [r4]
  ldr r1, =0x804478C+1
  bx r1

@At 08044784: 00 49 08 47 XX+1 XX XX 08





Berry Activation Update:
Spoiler:

Activates consumable berries as soon as possible (end move or a certain multi-hit strike) after the required consumption condition is met, consistent to later generations, rather than activating on End Turn.

Emerald:-
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
.global endmoveberries

.include "T:/asdS/thumb/bsmacros.asm"
@@http://www.pokecommunity.com/showpost.php?p=9062722&postcount=332
@@ Paste all the content from the 'BS Macro & Defines' Spoiler in this link to a new blank ASM file and include its path.

.equ RomAreaOffset, 0x8000000
.equ BerryLoc, 0xE10000
.equ ContraryID, 0x7F
.equ GluttonyID, 0x53
.equ BattleData, 0x2024084
.equ Sitrus, 0x8E
.equ Return, 0x08045674+1
.equ Return2, 0x0804582A+1
.equ ItemBuffer, 0x2024208
.equ ScriptPointer, 0x2024214
.equ ScriptPusher, 0x803FAFC+1
.equ MiscBufferCountersArea, 0x2024474
.equ Bank_F, 0x202420F
.equ ActiveBank, 0x2024064
.equ Damage, 0x20241F0
.equ NoOfBattlers, 0x202406C
.equ UserBank, 0x202420B
.equ TargetPartner, 0x202420E
.equ BattleOutcome, 0x2022F58
.equ Divider, 0x82e7540+1
.equ ConfuseAccToNature, 0x806e880+1
.equ RNG, 0x806F5CC+1
.equ DivMod, 0x82E7Be0+1
.equ OranHealBSLoc, OranHealBS+RomAreaOffset
.equ HealAndConfuseBSLoc, HealAndConfuseBS+RomAreaOffset
.equ FocusBerryBSLoc, FocusBerryBS+RomAreaOffset
.equ StatRaiseBSLoc, StatRaiseBS+RomAreaOffset

.org 0x45280
    mov r7, #0x0
    ldr r0, =NoOfBattlers
    ldrb r0, [r0]
    cmp r7, r0
    bcc CheckBankHP
    b 0x4582A

CheckBankHP:
    ldr r1, =BattleData
    mov r8, r1
    mov r0, #0x58
    mul r0, r7
    add r0, r0, r1
    ldrh r2, [r0, #0x28]
    cmp r2, #0x0
    bne HasHP
    b 0x45674

HasHP:
    ldr r4, =ItemBuffer
    ldrh r0, [r0, #0x2E]
    strh r0, [r4]
    bl 0xD74DC
    lsl r0, r0, #0x18
    lsr r5, r0, #0x18
    sub r0, r5, #1
    cmp r0, #0x1B
    bls LoadBerryTable
    b 0x45674

LoadBerryTable:
    lsl r0, r0, #2
    ldr r1, BerryTableLoc
    add r0, r0, r1
    ldr r3, [r0]
    ldrh r0, [r4]
    bl 0xD7500
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r9, r0
    mov pc, r3

.align 2
BerryTableLoc: .word BerryLoc+RomAreaOffset

.align 2
.pool

.org BerryLoc
.word HPRestoreBerry+RomAreaOffset @Oran, Sitrus, Berry Juice
.word 0x8045354  @Cheri Berry
.word 0x8045444  @Chesto Berry
.word 0x8045390  @Pecha Berry
.word 0x80453CC  @Rawst Berry
.word 0x8045408  @Aspear Berry
.word 0x8045674      @Leppa Berry
.word 0x804548C  @Persim Berry
.word 0x8045520  @Lum Berry
.word HPRestoreConfuseBerry+RomAreaOffset @Figy
.word HPRestoreConfuseBerry+RomAreaOffset @Wiki
.word HPRestoreConfuseBerry+RomAreaOffset @Mago
.word HPRestoreConfuseBerry+RomAreaOffset @Aguav
.word HPRestoreConfuseBerry+RomAreaOffset @Iapapa
.word StatRaiseBerry+RomAreaOffset @Leichi
.word StatRaiseBerry+RomAreaOffset @Ganlon
.word StatRaiseBerry+RomAreaOffset @Salac
.word StatRaiseBerry+RomAreaOffset @Petaya
.word StatRaiseBerry+RomAreaOffset @Apicot
.word LansatBerry+RomAreaOffset @Lansat
.word StarfBerry+RomAreaOffset @Starf
.word 0x8045674
.word 0x8045614 @White Herb
.word 0x8045674
.word 0x8045674
.word 0x8045674
.word 0x8045674
.word 0x80454C8 @Mental Herb

@@@@@@@@@@@@@@@Oran

.align 2
HPRestoreBerry:
    mov r1, r8
    mov r0, #0x58
    mul r0, r7
    add r2, r0, r1
    ldrh r1, [r2, #0x2C]
    ldrh r3, [r2, #0x28]
    lsr r0, r1, #1
    cmp r3, r0
    bls RestoreHP
    b Quit

RestoreHP:
    ldrh r0, [r4]
    ldr r4, =Damage
    mov r5, r9
    cmp r0, #Sitrus  @Sitrus
    bne NotZero
    ldrh r0, [r2, #0x2C]
    lsr r5, r0, #0x2
    cmp r5, #0x0
    bne NotZero
    mov r5, #0x1

NotZero:
    add r0, r3, r5
    cmp r0, r1
    ble NegDamage
    sub r5, r1, r3

NegDamage:
    neg r5, r5
    str r5, [r4]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =OranHealBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit

.align 2
.pool

@@@@@@@@@@@@@@@@@@@@@@@@@@
HPRestoreConfuseBerry:
    mov r0, r5
    sub r0, #0xA
    mov r10, r0
    mov r0, #0x58
    mov r1, r7
    mul r1, r0
    str r1, [sp, #0x18]
    mov r4, r1
    add r4, r8
    ldrh r0, [r4, #0x2C]
    ldrh r1, [r4, #0x28]
    lsr r0, r0, #0x1
    cmp r1, r0
    bls RestoreHPAttemptConfuse
    b Quit

RestoreHPAttemptConfuse:
    ldr r1, =BattleOutcome
    mov r0, #0xFD
    strb r0, [r1]
    mov r0, #0x8
    strb r0, [r1, #0x1]
    mov r0, r10
    strb r0, [r1, #0x2]
    mov r0, #0xFF
    strb r0, [r1, #0x3]
    ldr r5, =Damage
    ldrh r0, [r4, #0x2C]
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    str r0, [r5]
    cmp r0, #0x0
    bne NotZeroWiki
    mov r0, #0x1
    str r0, [r5]

NotZeroWiki:
    ldrh r2, [r4, #0x28]
    ldr r0, [r5]
    add r0, r2, r0
    ldrh r1, [r4, #0x2C]
    cmp r0, r1
    ble CheckConfusion
    sub r0, r1, r2
    str r0, [r5]

CheckConfusion:
    ldr r0, [r5]
    neg r0, r0
    str r0, [r5]
    mov r0, r8
    add r0, #0x48
    ldr r2, [sp, #0x18]
    add r0, r2, r0
    ldr r0, [r0]
    mov r1, r10
    ldr r6, =ConfuseAccToNature
    bl Linker
    lsl r0, r0, #0x10
    blt BerryConfuse
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =OranHealBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit

BerryConfuse:
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =HealAndConfuseBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit
.align 2
.pool

@@@@@@@@@@@@@@@@@@
StatRaiseBerry:
    mov r0, r5
    sub r0, #0xF
    mov r10, r0
    mov r0, #0x58
    mul r0, r7
    mov r3, r8
    add r5, r0, r3
    ldrh r4, [r5, #0x28]
    ldrh r0, [r5, #0x2C]

GluttonyCheck:
    mov r2, #0x20
    add r2, r2, r5
    ldrb r2, [r2]
    cmp r2, #GluttonyID
    bne CheckPinchActivation
    lsl r0, r0, #0x1

CheckPinchActivation:
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    cmp r4, r0
    bls CheckForContrary
    b Quit

CheckForContrary:
    mov r6, #0xC
    cmp r2, #ContraryID
    bne NoContrary_Re
    mov r6, #0x0

NoContrary_Re:
    mov r0, r10
    add r0, #0x19
    add r0, r0, r5
    ldrb r0, [r0]
    cmp r0, r6
    bne BoostStat
    b Quit

BoostStat:
    ldr r1, =BattleOutcome
    mov r2, #0xFD
    strb r2, [r1]
    mov r0, #5
    strb r0, [r1, #0x1]
    mov r0, r10
    add r0, #0x1
    strb r0, [r1, #0x2]
    mov r0, #0xFF
    strb r0, [r1, #0x3]
    ldr r0, =TargetPartner
    strb r7, [r0]
    ldr r1, =MiscBufferCountersArea
    mov r0, r10
    add r0, #0x11
    strb r0, [r1, #0x1A]
    sub r0, r0, #0x2
    strb r0, [r1, #0x10]
    mov r0, #0x0
    strb r0, [r1, #0x11]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =StatRaiseBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit
.align 2
.pool

@@@@@@@@@@@@@Lansat Berry:
LansatBerry:
    mov r0, #0x58
    mul r0, r7
    mov r3, r8
    add r5, r0, r3
    ldrh r4, [r5, #0x28]
    ldrh r0, [r5, #0x2C]

GluttonyCheck_Lansat:
    mov r2, #0x20
    add r2, r2, r5
    ldrb r2, [r2]
    cmp r2, #GluttonyID
    bne CheckPinchActivation_Lansat
    lsl r0, r0, #0x1

CheckPinchActivation_Lansat:
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    cmp r4, r0
    bls CheckFocus
    b Quit 

CheckFocus:
    ldr r2, [r5, #0x50]
    mov r3, #0x80
    lsl r3, r3, #0xD
    mov r0, r2
    and r0, r3
    cmp r0, #0x0
    beq SetFocus
    b Quit   

SetFocus:
    orr r2, r3
    str r2, [r5, #0x50]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =FocusBerryBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]
    b SetupBuffersAndExit
.align 2
.pool

@@@@@@@@@@@@@@@
StarfBerry:
    mov r0, #0x58
    mul r0, r7
    mov r3, r8
    add r5, r0, r3
    ldrh r4, [r5, #0x28]
    ldrh r0, [r5, #0x2C]

GluttonyCheck_Starf:
    mov r2, #0x20
    add r2, r2, r5
    ldrb r2, [r2]
    cmp r2, #GluttonyID
    bne CheckPinchActivation_Starf
    lsl r0, r0, #0x1

CheckPinchActivation_Starf:
    mov r1, r9
    ldr r6, =Divider
    bl Linker
    cmp r4, r0
    bgt Quit

CheckStats:
    mov r6, #0xC
    cmp r2, #ContraryID
    bne NoContrary
    mov r6, #0x0

NoContrary:
    mov r0, #0x0
    mov r10, r0
    add r0, r5, #0x1
    mov r1, r8
    add r1, #0x18
    add r0, r0, r1
    ldrb r0, [r1]
    lsl r0, r0, #0x18
    asr r0, r0, #0x18
    cmp r0, r6
    bne RaisableStat
    mov r0, r8
    add r0, #0x19
    add r1, r5, r0

Loop:
    add r1, #1
    add r2, #1
    add r10, r2
    mov r3, r10
    cmp r3, #0x4
    bgt Quit
    ldrb r0, [r1]
    cmp r0, r6
    beq Loop

RaisableStat:
    mov r0, #0x58
    mov r0, r7
    add r4, r0, r7
    ldr r5, =0x202409C
    mov r9, r6

StatSelect:
    ldr r6, =RNG
    bl Linker
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r1, #0x5
    ldr r6, =DivMod
    bl Linker
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r10, r0
    add r0, r0, r4
    add r0, r0, r5
    ldrb r0, [r0]
    lsl r0, r0, #0x18
    asr r0, r0, #0x18
    mov r6, r9
    cmp r0, r6
    beq StatSelect

BoostRandomStat:
    ldr r1, =BattleOutcome
    mov r2, #0xFD
    strb r2, [r1]
    mov r0, #5
    strb r0, [r1, #0x1]
    mov r0, r10
    add r0, #0x1
    strb r0, [r1, #0x2]
    mov r0, #0xFF
    strb r0, [r1, #0x3]
    ldr r0, =TargetPartner
    strb r7, [r0]
    ldr r1, =MiscBufferCountersArea
    mov r0, r10
    add r0, #0x21
    strb r0, [r1, #0x1A]
    add r0, #6
    strb r0, [r1, #0x10]
    mov r0, #0x0
    strb r0, [r1, #0x11]
    ldr r6, =ScriptPusher
    bl Linker
    ldr r1, =ScriptPointer
    ldr r0, =StatRaiseBSLoc
    str r0, [r1]
    mov r0, #0x1
    str r0, [sp, #0xC]

SetupBuffersAndExit:
    ldr r0, =MiscBufferCountersArea
    strb r7, [r0, #0x17]
    ldr r0, =Bank_F
    strb r7, [r0]
    ldr r4, =ActiveBank
    strb r7, [r4]

Quit2:
    ldr r1, =Return2
    bx r1

Quit:
    ldr r1, =Return
    bx r1

Linker:
    bx r6

.align 2
.pool

SwapBanks:
    ldr r1, =UserBank
    ldrb r0, [r1]
    ldr r3, =Bank_F
    ldrb r2, [r3]
    strb r0, [r3]
    strb r2, [r1]
    bx lr
.align 2
.pool

@@@@OranBerryBS:
OranHealBS:
playanimation 0xA 0x7 0x0

printstring 0x12A

waitmessage 0x40

orword 0x2024280 0x100

graphicalhpupdate 0xA

datahpupdate 0xA

removeitem 0xA
return
.align 2

@@@@
HealAndConfuseBS:
playanimation 0xA 0x7 0x0

printstring 0x12A

waitmessage 0x40

orword 0x2024280 0x100

graphicalhpupdate 0xA

datahpupdate 0xA

printstring 0x144
waitmessage 0x40

callasm SwapBanks+RomAreaOffset+1
setbyte 0x2024335 0x47
seteffecttarget
callasm SwapBanks+RomAreaOffset+1
removeitem 0xA
return

@@@@
FocusBerryBS:
playanimation 0xA 0x7 0x0

printstring 0x146

waitmessage 0x40

removeitem 0xA
return

.align 2
@@@@@@@
StatRaiseBS:
playanimation 0xA 0x7 0x0
callasm SwapBanks+RomAreaOffset+1
statbuffchange 0x41 StatRaiseAnimation+RomAreaOffset

StatRaiseAnimation:
callasm SwapBanks+RomAreaOffset+1
setbyte 0x2024337 0x4
playanimation 0x2 0x1 0x2024484

printfromtable 0x85CC89C

waitmessage 0x40
removeitem 0xA
return




Any chance of a firered port?

Trainer 781 March 20th, 2016 9:57 AM

Quote:

Originally Posted by Splash (Post 9171717)
Any chance of a firered port?

Can do, if there is a need.

jirachiwishmaker March 22nd, 2016 2:41 AM

Quote:

Originally Posted by KDS (Post 9171914)
Can do, if there is a need.

The Item Use Effect routine of Sitrus Berry Updates does not working anymore. Could you fix it, please?

Trainer 781 March 22nd, 2016 4:53 AM

Quote:

Originally Posted by jirachiwishmaker (Post 9174428)
The Item Use Effect routine of Sitrus Berry Updates does not working anymore. Could you fix it, please?

I have updated it yesterday. Check the latest version.

jirachiwishmaker March 22nd, 2016 5:44 AM

Quote:

Originally Posted by KDS (Post 9174525)
I have updated it yesterday. Check the latest version.

Thank you very much{:3}

leyn09 April 2nd, 2016 8:56 PM

Quote:

Originally Posted by KDS (Post 8985476)
Battle End Move Target Held Items (FR):-

Loader Routine:
Spoiler:

Code:

.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:
Code:

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:
Code:

.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:

Code:

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:
Code:

FD 10 B4 E7 00 FD 16 FE DC E9 E6 E8 00 FD 0F AB FF




Weakness Policy:-
Spoiler:


Routine:
Spoiler:

Code:

.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:

Code:

#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:
Code:

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.

Code:

.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*/



What would be the consequence if I didn't edit those custom battle script moves?

Also, it seems that BSP is not recognizing "removeitem" command as valid. Tried to remove it but the Weakness Policy doesn't seem to work properly

Trainer 781 April 3rd, 2016 5:10 AM

Quote:

Originally Posted by leyn09 (Post 9188969)
What would be the consequence if I didn't edit those custom battle script moves?

Also, it seems that BSP is not recognizing "removeitem" command as valid. Tried to remove it but the Weakness Policy doesn't seem to work properly

Most probably, things like Conversion and Mirror Move will fail on those custom battle script moves.
For removeitem, check the Natural Gift move implementation in move resource thread.

Spherical Ice April 5th, 2016 8:03 AM

Finally got around to refactoring my Bug-Catching Contest scripts / code, and decided to make it publicly available on GitHub. Check it out here: https://github.com/sphericalice/Bug-Catching-Contest

It's not an exact clone of how the HG/SS contest works, but it's good enough (& the beauty of source code is you're free to improve it)!

leyn09 April 5th, 2016 10:21 PM

Quote:

Originally Posted by KDS (Post 9189280)
Most probably, things like Conversion and Mirror Move will fail on those custom battle script moves.
For removeitem, check the Natural Gift move implementation in move resource thread.

Hey, thanks! Btw, I'm having some issues with battle end routine application. It works perfectly fine but when the pinch berry triggers, it freeze or not continue at all.

Ayonn- April 8th, 2016 4:35 AM

Quote:

Originally Posted by FBI (Post 8540240)

Getting IVs and EVs



The routines are very similar so I ended up just combining the two routines into one. Basically given a slot number of a Pokemon in 0x8004, the routines will return the EVs or IVs, respectively, into the vars 0x8005-0x800A with 0x8003 as the IV/EV switch.


How to insert:

Compile and insert the following routine into free space:

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r5, lr}
        mov r4, #0x0

loop:
        cmp r4, #0x5
        bhi end
        ldr r0, =(0x20370C0) @var 0x8004 = slot number
        ldrb r0, [r0]
        mov r1, #0x1
        mul r1, r1, r4
        ldr r3, =(0x20370BE)
        ldrb r3, [r3]
        cmp r3, #0x0
        beq EVs
        add r1, r1, #0x27 @IV
        b continue

EVs:
        add r1, r1, #0x1A

continue:
        ldr r2, =(0x803FBE8 +1)
        bl linker
        mov r1, r0
        @get var
        ldr r2, =(0x20370C2) @using vars 0x8005-0x800A
        mov r0, #0x2
        mul r0, r0, r4
        add r2, r2, r0
        strb r1, [r2] @store IV in var
        add r4, r4, #0x1
        b loop

linker:
        bx r2

end:
        pop {r0-r5, pc}

.align 2




Compiled version:
Code:

3F B5 00 24 05 2C 14 D8 0A 48 00 78 01 21 61 43 09 4B 1B 78 00 2B FF D0 1A 31 08 4A 00 F0 08 F8 01 1C 07 4A 02 20 60 43 12 18 11 70 01 34 E9 E7 10 47 3F BD C0 70 03 02 BE 70 03 02 E9 FB 03 08 C2 70 03 02


Usage:
setvar 0x8003 0x[anything except 0 = IV, 0 = EV]
setvar 0x8004 0x[slot number 0 to 5]
callasm 0x[this routine +1]

The variables will be:
0x8005: HP IV/EV
0x8006: Atk IV/EV
0x8007: Def IV/EV
0x8008: Spd IV/EV
0x8009: S.atk IV/EV
0x800A: S.def IV/EV


I didn't really understand what it does can you explain me please ?

BLAx501! April 8th, 2016 5:02 AM

Quote:

Originally Posted by Ayonn- (Post 9195339)
I didn't really understand what it does can you explain me please ?

There's no better explanation than the one at the top of the post you've quoted...

With this routine you can get the EV/IV of a chosen Pokemon from your party.

One var acts as a switch to get EV or IV depending on its value, the next one stores the position of the Pokemon you want to get the data from your team (so it can be easily implemented via a special I don't remember). After that, each value is stored on a different variable so you can easily access each of them

Ayonn- April 8th, 2016 5:40 AM

Quote:

Originally Posted by BLAx501! (Post 9195359)
There's no better explanation than the one at the top of the post you've quoted...

With this routine you can get the EV/IV of a chosen Pokemon from your party.

One var acts as a switch to get EV or IV depending on its value, the next one stores the position of the Pokemon you want to get the data from your team (so it can be easily implemented via a special I don't remember). After that, each value is stored on a different variable so you can easily access each of them

Okaaaay thank you, I just didn't understand the first because english is not my first language, sorry ><

DOES ANYONE KNOW THE SPECIAL PLEASE ?

Trainer 781 April 9th, 2016 11:22 PM

Quote:

Originally Posted by leyn09 (Post 9192656)
Hey, thanks! Btw, I'm having some issues with battle end routine application. It works perfectly fine but when the pinch berry triggers, it freeze or not continue at all.

Which pinch berry did you activate?
Which battle end routine are you refering to? The one for cmd49 ( used by weakness policy, rocky helmet etc.)?

leyn09 April 10th, 2016 7:14 PM

Quote:

Originally Posted by KDS (Post 9197703)
Which pinch berry did you activate?
Which battle end routine are you refering to? The one for cmd49 ( used by weakness policy, rocky helmet etc.)?

Yes. The cmd49. It was not actually pinch berries but the activation of healing berries (mago and sitrus for ex.). I haven't tested the stat boosting but I'll test it later. Though, rocky helmet is working fine.

EDIT: I also added your damage reduction berry routine. I wonder if it affect this. Tho, it doesn't work in my game (due to the setword command, i think. I just leave the setword command FA as is)

Trainer 781 April 11th, 2016 6:25 AM

Quote:

Originally Posted by leyn09 (Post 9198731)
Yes. The cmd49. It was not actually pinch berries but the activation of healing berries (mago and sitrus for ex.). I haven't tested the stat boosting but I'll test it later. Though, rocky helmet is working fine.

EDIT: I also added your damage reduction berry routine. I wonder if it affect this. Tho, it doesn't work in my game (due to the setword command, i think. I just leave the setword command FA as is)

Activation of healing berries and cmd49 are called at different locations and use different counters. I don't think they should affect each other.

Damage reduction berry also does not affect this. You might need to adjust the of setword command if your game is freezing.

Did you insert the toxic orb routine?

leyn09 April 11th, 2016 9:37 AM

Quote:

Originally Posted by KDS (Post 9199264)
Activation of healing berries and cmd49 are called at different locations and use different counters. I don't think they should affect each other.

Damage reduction berry also does not affect this. You might need to adjust the of setword command if your game is freezing.

Did you insert the toxic orb routine?

No. I haven't put it yet. healing berries are working fine before putting the battle end routine command. So, what could be the problem? when the healing berry activates, it just stops to its text "Foe ????'s xxxx berry restored its health but the music is still playing. Btw, I'm using Mrdollsteak's rom and JPAN patch.

DarkPsychic April 12th, 2016 12:40 AM

Can someone re-post JPAN's number input box for Fire Red?

Also since I am here maybe a newer "input box" for more than just numbers but all the characters, custom input options would make for interesting menu options...
After playing with the Debug Ruby version I realized how in depth the menu and input system can really be...

Thank you for any help or advice....

Trainer 781 April 13th, 2016 11:38 PM

Quote:

Originally Posted by leyn09 (Post 9199490)
No. I haven't put it yet. healing berries are working fine before putting the battle end routine command. So, what could be the problem? when the healing berry activates, it just stops to its text "Foe ????'s xxxx berry restored its health but the music is still playing. Btw, I'm using Mrdollsteak's rom and JPAN patch.

Not sure what is causing this. I'll look into it later.

leyn09 April 14th, 2016 6:26 AM

Quote:

Originally Posted by KDS (Post 9202824)
Not sure what is causing this. I'll look into it later.

Thanks KDS! Oh, btw. Were your healing berries working just fine when you implemented it to your hack/test rom?

Trainer 781 April 14th, 2016 8:40 AM

Quote:

Originally Posted by leyn09 (Post 9203066)
Thanks KDS! Oh, btw. Were your healing berries working just fine when you implemented it to your hack/test rom?

Not yet.

Ayonn- April 16th, 2016 7:01 AM

Quote:

Originally Posted by FBI (Post 8540240)

Getting IVs and EVs



The routines are very similar so I ended up just combining the two routines into one. Basically given a slot number of a Pokemon in 0x8004, the routines will return the EVs or IVs, respectively, into the vars 0x8005-0x800A with 0x8003 as the IV/EV switch.


How to insert:

Compile and insert the following routine into free space:

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r5, lr}
        mov r4, #0x0

loop:
        cmp r4, #0x5
        bhi end
        ldr r0, =(0x20370C0) @var 0x8004 = slot number
        ldrb r0, [r0]
        mov r1, #0x1
        mul r1, r1, r4
        ldr r3, =(0x20370BE)
        ldrb r3, [r3]
        cmp r3, #0x0
        beq EVs
        add r1, r1, #0x27 @IV
        b continue

EVs:
        add r1, r1, #0x1A

continue:
        ldr r2, =(0x803FBE8 +1)
        bl linker
        mov r1, r0
        @get var
        ldr r2, =(0x20370C2) @using vars 0x8005-0x800A
        mov r0, #0x2
        mul r0, r0, r4
        add r2, r2, r0
        strb r1, [r2] @store IV in var
        add r4, r4, #0x1
        b loop

linker:
        bx r2

end:
        pop {r0-r5, pc}

.align 2




Compiled version:
Code:

3F B5 00 24 05 2C 14 D8 0A 48 00 78 01 21 61 43 09 4B 1B 78 00 2B FF D0 1A 31 08 4A 00 F0 08 F8 01 1C 07 4A 02 20 60 43 12 18 11 70 01 34 E9 E7 10 47 3F BD C0 70 03 02 BE 70 03 02 E9 FB 03 08 C2 70 03 02


Usage:
setvar 0x8003 0x[anything except 0 = IV, 0 = EV]
setvar 0x8004 0x[slot number 0 to 5]
callasm 0x[this routine +1]

The variables will be:
0x8005: HP IV/EV
0x8006: Atk IV/EV
0x8007: Def IV/EV
0x8008: Spd IV/EV
0x8009: S.atk IV/EV
0x800A: S.def IV/EV

is it possible to display the Iv / EV in a script thanks to this ? If yes, how ?

BLAx501! April 17th, 2016 6:36 AM

Quote:

Originally Posted by Ayonn- (Post 9205700)
is it possible to display the Iv / EV in a script thanks to this ? If yes, how ?

You need to use buffernumber

Ayonn- April 17th, 2016 7:44 AM

Quote:

Originally Posted by BLAx501! (Post 9206932)
You need to use buffernumber

Do you have any example ? I never used that ....

BLAx501! April 17th, 2016 8:16 AM

Quote:

Originally Posted by Ayonn- (Post 9206999)
Do you have any example ? I never used that ....

Here you are, it's just a c&p from Diegoisawesome XSE tutorial

Quote:

Buffernumber

This is just used to display a number stored in a variable. It's set up like this:
buffernumber [buffer#] [Variable]
The downside of this command is that it can only display numbers from 0-65535 [Hex = 0x0 - I'll show an example. We're going to put the number 50000 in [buffer1].
Code:

setvar 0x800D 0xC350
buffernumber 0x00 0x800D
msgbox @1 0x6
.... .... ....

#org @1
= Account Balance: \hB7: [buffer1]


That's all there is to it.

Ayonn- April 17th, 2016 1:20 PM

Quote:

Originally Posted by BLAx501! (Post 9207048)
Here you are, it's just a c&p from Diegoisawesome XSE tutorial

Thank you very much for the help!

Ayonn- April 19th, 2016 6:34 AM

I have a suggestion, when we see the resume screen a pokemon, is it possible to add a page with the IV/EVs ?

BLAx501! April 19th, 2016 1:26 PM

I'm not sure if it's done yet or not, but... Would it be possible to have a routine that acts like a warp but enables you to choose bank, map and possition via variables instead of fixed parameters like the actual commando on XSE (and similar)


All times are GMT -8. The time now is 8:46 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.