• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: Move Resource Thread

180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
It does, but I edited it again since my post.

Got it to work now after the swapping of EndBS and LowerBothBS.

Congrats on your first ASM! I've had many hours of rage not getting Close Combat to lower the single Defense or Sp. Def. stats properly after one reaches -6, so your effort is definitely appreciated!

Hopefully I'll have time to learn some asm soon, too, so I can contribute more to the forum and to my own hack.

EDIT: Also, for those who want the Close Combat asm for Emerald:

Spoiler:
 
Last edited:

Tlachtli

Crit happens.
267
Posts
12
Years
Hey Tlachtli, currently porting this to Fire Red, only thing I'm having trouble with, is what exactly 0x2024200 does, and what it corresponds to. My guess is either its 0x2023D50 (existing damage) or 0x2023D60 (which I'm not entirely sure what's purpose is). Would you mind sharing what specifically that byte does?

That's just an arbitrary, unused halfword I recycle as a temp variable in my ASMs and battle scripts. I can't say I'm 100% certain it's safe, but I watched it over the course of several battles and never saw it get used/changed by anything. Any halfword (or in this case, just a byte) that doesn't get used during battle and is cleared afterword will work fine.

In this case, I'm using it as a flag to check if the move's initial animation has already been played. If it cycles through all the targets and never sets the flag (because it never found a valid target and thus played the animation) then it knows to print the "But it failed" message.
 
5,256
Posts
16
Years
Brine effect for FireRed, requires the callasm command as usual:

Battle Script:
Code:
[FONT="Courier New"]#dynamic 0x800000
#freespacebyte 0xFF

#org @start
callasm 0x8AABBCC +1
goto 0x8[B]1D6926[/B][/FONT]

ASM at AABBCC:
Code:
[FONT="Courier New"].text
.align 2
.thumb
.thumb_func
.global brine

main:
push {lr}
ldr r0, targetBank
ldrb r0, [r0]
mov r1, #0x58
mul r0, r1
ldr r1, battleData
add r1, r0
ldrh r0, [r1, #0x2c]
lsr r0, #1
ldrh r2, [r1, #0x28]
cmp r2, r0
bge endasm
mov r2, #0x2
ldr r3, damageMultiplier
strb r2, [r3, #0x0]

endasm:
pop {r0}
bx r0

.align 2
targetBank: .word 0x02023D6C
battleData: .word 0x02023BE4
damageMultiplier: .word 0x02023FD2
[/FONT]

The bolded offset points to this battle script from vanilla FireRed:
Code:
[FONT="Courier New"]#org 0x1D6926
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
seteffectwithchancetarget
faintpokemon 0x0 0x0 0x0
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end

#org 0x1D695E
attackstring
ppreduce
pause 0x20
missmessage
resultmessage
waitmessage 0x40
goto 0x81D694E

#org 0x1D694E
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end[/FONT]
 
Last edited:

BugMania

The Bug Master
32
Posts
10
Years
  • Seen Nov 4, 2016
Brine effect for FireRed, requires the callasm command as usual:

Battle Script:
Code:
[FONT=Courier New]#dynamic 0x800000
#freespacebyte 0xFF

#org @start
callasm 0x8AABBCC +1[/FONT]
ASM at AABBCC:
Code:
[FONT=Courier New].text
.align 2
.thumb
.thumb_func

Start:
ldr r1, .BattleData
ldr r0, .TargetBank
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x28
add r1, r2
ldrb r0, [r1]
ldrb r2, [r1, #0x4]
lsr r2, #1
cmp r0, r2
bgt End
mov r2, #0x2
ldr r3, .DamageMultiplier
strb r2, [r3, #0x0]

End:
ldr r0, .ReturnBS
ldr r1, .ActiveBSPointer
str r0, [r1, #0x0]
bx lr

.align 2
.BattleData:        .word 0x02023BE4
.TargetBank:        .word 0x02023D6C
.ActiveBSPointer:    .word 0x02023D74
.DamageMultiplier:    .word 0x02023FD2
.ReturnBS:        .word 0x08[B]1D6926[/B][/FONT]
The bolded offset points to this battle script from vanilla FireRed:
Code:
[FONT=Courier New]#org 0x1D6926
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
seteffectwithchancetarget
faintpokemon 0x0 0x0 0x0
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end

#org 0x1D695E
attackstring
ppreduce
pause 0x20
missmessage
resultmessage
waitmessage 0x40
goto 0x81D694E

#org 0x1D694E
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end[/FONT]
Great! If I understand correctly, you have found an easier way to do what I had previously shown the way!
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
That's just an arbitrary, unused halfword I recycle as a temp variable in my ASMs and battle scripts. I can't say I'm 100% certain it's safe, but I watched it over the course of several battles and never saw it get used/changed by anything. Any halfword (or in this case, just a byte) that doesn't get used during battle and is cleared afterword will work fine.

In this case, I'm using it as a flag to check if the move's initial animation has already been played. If it cycles through all the targets and never sets the flag (because it never found a valid target and thus played the animation) then it knows to print the "But it failed" message.

Awesome! Thanks Tlachtli. I'm using 02023D60 in this case, as theres nothing specific that it does.

Also I've edited my original post, since I've added Shell Smash to Dragon Dance's BS. As mamamama rightly said +Atk and +Speed is closer to Shell Smash's effect than +Spatk could have been. Anyway here are the new moves! All for Fire Red.

Flower Shield

Spoiler:

Work Up and Growth and Rototiller

Spoiler:

Cotton Guard

Spoiler:


Tail Glow

Spoiler:


Charge

Spoiler:
 
Last edited:
180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
Awesome! Thanks Tlachtli. I'm using 02023D60 in this case, as theres nothing specific that it does.

Also I've edited my original post, since I've added Shell Smash to Dragon Dance's BS. As mamamama rightly said +Atk and +Speed is closer to Shell Smash's effect than +Spatk could have been. Anyway here are the new moves! All for Fire Red.[/CODE][/SPOILER]

I noticed that you use playtstatsanimation 0x0 0xA 0x0 on moves such as Quiver Dance, Coil and Shell Smash. Is there a reason it's always that combination?

I was under the impression you had to add the stats you are raising/lowering together so that the correct colour changes when just one stats is raising.

For example. Dragon Dance has Speed (0x8) and Attack (0x2) so if you add them together you get 0xA and thus one colour is correctly used if the other is already at +6. This would place Coil at 0x46 etc.
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
I noticed that you use playtstatsanimation 0x0 0xA 0x0 on moves such as Quiver Dance, Coil and Shell Smash. Is there a reason it's always that combination?

I was under the impression you had to add the stats you are raising/lowering together so that the correct colour changes when just one stats is raising.

For example. Dragon Dance has Speed (0x8) and Attack (0x2) so if you add them together you get 0xA and thus one colour is correctly used if the other is already at +6. This would place Coil at 0x46 etc.

Oh that may be the case to be honest I just assumed it was 0xA for every multi-stat raising move. Let me look at Calm Mind to see if it also uses 0xA.

EDIT: I've gone through and fixed all of them. Thanks mamamama. Also I've tested them all in my rombase and they all work perfectly now.
EDIT2: My BSP has been compiling incorrectly in areas, for some reason the B_>= command isn't compiling to 0x3 as it should but to 0x0. I'm just going to change some move effects to show this.
 
Last edited:
180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
Oh that may be the case to be honest I just assumed it was 0xA for every multi-stat raising move. Let me look at Calm Mind to see if it also uses 0xA.

If you use a Pokemon with Dragon Dance + Shell Smash against a Zigzagoon with only Fake Tears, start with 2 Dragon Dances, and then go for a Shell Smash you will notice that neither of the defenses will lower when the regular defense should be going down.

I made this script a few weeks ago and cleaned it up a bit using yours as template. This is Quiver Dance and Shell Smash combined with Dragon Dance. I use Dragon Dance because I want the AI to recognize to use it when it wants to outspeed an opponent that is faster. I don't think the AI will act much differently if you choose to combine QDance with Calm Mind (My QDance is pretty much identical to yours).

I've tested this with all kinds of combinations and it should work. Note that this is for Emerald but should be easy to translate using the offsets in Mr. Ds's code. I made this based on the original Dragon Dance and Curse scripts combined.

EDIT: I noticed that my old effect did not pierce through White Smoke so I'm updating it with a fix. I believe yours has the same problem MrDollSteak. You can just change 0x1 TRUE @XX to 0x81 TRUE @XX and playstatanimation to 0x1 0x24 0x9 and it will work properly.

Credit to DoesntKnowHowToPlay's Hammer Arm Script for this fix.
Spoiler:
 
Last edited:

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
If you use a Pokemon with Dragon Dance + Shell Smash against a Zigzagoon with only Fake Tears, start with 2 Dragon Dances, and then go for a Shell Smash you will notice that neither of the defenses will lower when the regular defense should be going down.

The problem with that has been fixed, it was because BSP wasn't compiling the 0x3 byte in the jump properly.

Also here is an animation for Shift Gear using a custom particle.

Code:
00 3D 28 0A 03 28 01 0C 0C 08 19 B4 00 3F 02 XX XX XX 08 02 05 D6 FF E7 FF 00 00 00 00 0F 00 04 0C 02 YY YY YY 08 02 07 07 00 05 00 01 00 00 00 0A 00 00 00 00 00 19 74 00 3F 05 0B 03 0D 08 FF

At offset XXXXXX put
XX 28 XX 28 38 CA 3A 08 F0 1C 23 08 00 00 00 00 24 7A 3E 08 55 8C 0B 08

At offset YYYYYY put
XX 28 XX 28 58 CB 3A 08 F0 1C 23 08 00 00 00 00 F8 7B 3E 08 61 A5 0B 08

Then insert the attached particle particle wherever you want and change the index from XX 28 to your value in the particle table.
 
Last edited:

BugMania

The Bug Master
32
Posts
10
Years
  • Seen Nov 4, 2016
Awesome! Thanks Tlachtli. I'm using 02023D60 in this case, as theres nothing specific that it does.

Also I've edited my original post, since I've added Shell Smash to Dragon Dance's BS. As mamamama rightly said +Atk and +Speed is closer to Shell Smash's effect than +Spatk could have been. Anyway here are the new moves! All for Fire Red.

Flower Shield

Spoiler:

Work Up and Growth and Rototiller

Spoiler:

Cotton Guard

Spoiler:


Tail Glow

Spoiler:


Charge

Spoiler:
Thank you very much! I still do not have time to test, but if you really found the hex for new messages, I'm relieved! My routine had problems when there were battles with link...

Glad that you are now working with asm and hex!{:3}

When I have time, I'll show you how I make an effect run in a end of turn, without using pauses! Also, things like the "toxic spikes!"
 

Trainer 781

Guest
0
Posts
Clubbed Sky Attack (also updated it's message), Freeze Shock (updated it's effect so that electric mons can't be paralysed by it), Ice Burn together due to similar effect. This also requires the battle string loader ASM:

Replace Sky Attack's effect with this one:
Code:
#dynamic 0x[YourOffset]
#freespacebyte 0xFF

#org @moveselect
jumpifhalfword 0x0 0x2023D4A 0xXX @freejshock //replace XX with ID of freeze shock
jumpifhalfword 0x0 0x2023D4A 0xYY @iceburn //replace XX with ID of ice burn
goto @skyattack


#org @skyattack
jumpifsecondarystatus 0x1 0x1000 0x81D6F29
jumpifword 0x4 0x2023DD0 0x200 0x81D6F29
setbyte 0x2023FD3 0x3
call @firstturnsk
goto 0x81D694E

#org @firstturnsk
attackcanceler
attackstring
waitmessage 0x40
ppreduce
attackanimation
waitanimation
orword 0x2023DD0 0x8000000
setbyte 0x2023E85 0x4C
seteffecttarget
copyarray 0x2023E87 0x2023FD3 0x1
setword 0x203C020 0x8A20000
printstring 0x184
waitmessage 0x40
return


#org @freejshock
jumpifsecondarystatus 0x1 0x1000 @executefs
jumpifword 0x4 0x2023DD0 0x200 @executefs
setbyte 0x2023FD3 0x3
call @firstturnfs
goto 0x81D694E

#org @executefs
attackcanceler
setbyte 0x2023E85 0xC
setbyte 0x2023FDC 0x1
clearstatus 0x1
orword 0x2023DD0 0x800
jumpiftype 0x0 0xD 0x81D6927
setbyte 0x2023E85 0x5
goto 0x81D6927

#org @firstturnfs
attackcanceler
attackstring
waitmessage 0x40
ppreduce
attackanimation
waitanimation
orword 0x2023DD0 0x8000000
setbyte 0x2023E85 0x4C
seteffecttarget
copyarray 0x2023E87 0x2023FD3 0x1
setword 0x203C020 0x8A00000
printstring 0x184
waitmessage 0x40
return


#org @iceburn
jumpifsecondarystatus 0x1 0x1000 @executeib
jumpifword 0x4 0x2023DD0 0x200 @executeib
setbyte 0x2023FD3 0x3
call @firstturnib
goto 0x81D694E

#org @executeib
attackcanceler
setbyte 0x2023E85 0xC
setbyte 0x2023FDC 0x1
clearstatus 0x1
orword 0x2023DD0 0x800
setbyte 0x2023E85 0x3
goto 0x81D6927

#org @firstturnib
attackcanceler
attackstring
waitmessage 0x40
ppreduce
attackanimation
waitanimation
orword 0x2023DD0 0x8000000
setbyte 0x2023E85 0x4C
seteffecttarget
copyarray 0x2023E87 0x2023FD3 0x1
setword 0x203C020 0x8A10000
printstring 0x184
waitmessage 0x40
return

String at A20000 (Sky Attack's)
Code:
FD 0F 00 D6 D9 D7 D5 E1 D9 00 D7 E0 E3 D5 DF D9 D8 00 DD E2 00 D5 00 DC D5 E6 E7 DC 00 E0 DD DB DC E8 AB FF

String at A00000 (Freeze Shock's)
Code:
FD 0F 00 D6 D9 D7 D5 E1 D9 00 D7 E0 E3 D5 DF D9 D8 00 DD E2 00 D5 00 DA E6 D9 D9 EE DD E2 DB 00 E0 DD DB DC E8 AB FF

String at A10000 (Ice Burn's)
Code:
FD 0F 00 D6 D9 D7 D5 E1 D9 00 D7 E0 E3 D5 DF D9 D8 00 DD E2 00 D5 00 DA E6 D9 D9 EE DD E2 DB 00 D5 DD E6 AB FF
 
Last edited:

Trainer 781

Guest
0
Posts
Heavy Slam for Fire Red. The script is simple as for Doesnt's ASMs. Use the callasm command just after the pp reducer and before damagecalculator in the script:

The ASM:
Code:
.text
.align 2
.thumb
.thumb_func
.global heavyslam

main:
push {lr}
ldr r0, userBank
ldrb r0, [r0]
ldr r1, battleData
mov r2, #0x58
mul r0, r2
add r3, r0, r1
ldr r0, targetBank
ldrb r0, [r0]
mul r0, r2
add r4, r0, r1
ldrb r5, [r3, #0x0]
ldrb r6, [r4, #0x0]
ldr r1, dexData
mov r2, #0x24
mul r5, r2
add r0, r1, r5
ldrh r5, [r0, #0xE]
mul r6, r2
add r0, r1, r6
ldrh r6, [r0, #0xE]

[B]label1:
ldr r1, floatstoneindex
mov r7, r3
add r7, #0x20
ldrb r7, [r7]
cmp r7, #0xXX
bne label2
lsr r5, #0x1

label2:
cmp r7, #0xYY
bne label3
lsl r5, #0x1

label3:
ldrh r7, [r3, #0x2e]
cmp r7, r1
bne label4
lsr r5, #0x1


label4:
mov r7, r4
add r7, #0x20
ldrb r7, [r7]
cmp r7, #0xXX
bne label5
lsr r6, #0x1

label5:
cmp r7, #0xYY
bne label6
lsl r6, #0x1

label6:
ldrh r7, [r4, #0x2e]
cmp r7, r1
bne label7
lsr r5, #0x1

label7:[/B]
mov r2, #0x5
mul r2, r6
cmp r5, r2
bgt set120
sub r2, r6
cmp r5, r2
bgt set100
sub r2, r6
cmp r5, r2
bgt set80
sub r2, r6
cmp r5, r2
bgt set60
mov r1, #0x28
b end

set60:
mov r1, #0x3C
b end

set80:
mov r1, #0x50
b end

set100:
mov r1, #0x64
b end

set120:
mov r1, #0x78

end:
ldr r2, basePower
strh r1, [r2, #0x0]
pop {r0}
bx r0

.align 2
[B]floatstoneindex: .hword 0xZZZZ[/B]
targetBank: .word 0x02023D6C
userBank: .word 0x02023D6B
battleData: .word 0x02023BE4
basePower: .word 0x02023F50
dexData: .word 0x0844E850

NOTES
1. The bold section of the code is meant to accommodate the weight changes due to Light Metal, Heavy Metal abilities and the item Float Stone because the Weight is directly loaded from the Dex Data in the ROM (even lowkick does).

2. If your ROM don't have anyone of these things remove the bolded section. Otherwise, replace XX with the index of Light Metal, replace YY with the index of Heavy Metal, and replace ZZZZ with the index of Float Stone.

3. If you have expanded the no of pokemons then the value of dexData also needs to be changed to the new location.

4. If someone wants to port it to Emerald, in addition to changing the value of offsets also change the mov r2, #0x24 to mov r2, #0x20 after the ldr r1, dexData, this because in every GBA Rom except Emerald the dex entry for each poke takes 36 bytes, whereas in Emerald it takes 32 bytes.
 
Last edited:
5,256
Posts
16
Years
Petal Blizzard animation for FireRed:

92F0147.gif

Code:
[FONT="Courier New"]00 4F 27
00 97 27
00 AF 27

0A 03 28 01

19 E4 00

3F

02
20 2C 3E 08
82 05 78
00 46
00 05
00 46
00 1E
00 04
01

02
20 2C 3E 08
82 05 73
00 37
00 06
00 3C
00 19
00 04
01

02
20 2C 3E 08
82 05 73
00 3C
00 07
00 3C
00 1E
00

02
AA AA AA 08
82 05 73
00 37
00 0A
00 3C
00 1E
00 04
03

02
AA AA AA 08
82 05 64
00 32
00 04
00 32
00 1A
00 04
01

02
AA AA AA 08
82 05 69
00 19
00 08
00 3C
00 14
00 04
01

02
AA AA AA 08
82 05 73
00 28
00 0A
00 30
00 1E
00 04
03

02
BB BB BB 08
82 05 78
00 1E
00 06
00 2D
00 19
00

02
20 2C 3E 08
82 05 73
00 23
00 0A
00 3C
00 1E
00 04
03

02
BB BB BB 08
82 05 69
00 14
00 08
00 28
00 00
00 04
03

02
20 2C 3E 08
82 05 14
00 FF
00 0F
00 20
00 00
00

02
20 2C 3E 08
82 05 6E
00 0A
00 08
00 20
00 14
00

05

02
08 7C 3E 08
83 04 E0
FF F0
FF 01
00 03
00

19 84 00

3F

03
D1 8C 09 08
02 05
01 00
03 00
00 00
0C 00
01 00

03
D1 8C 09 08
02 05
03 00
03 00
00 00
0C 00
01 00

04 04

02
50 7C 3E 08
83 02 01
00 03
00

19 84 00

3F 04 04

02
50 7C 3E 08
83 02
01 00
03 00

19 84 00

3F 04 04

02
08 7C 3E 08
83 04
20 00
14 00
01 00
03 00

19 84 00

3F 05 0B 03 0D 08[/FONT]

At AAAAAA:
Code:
[FONT="Courier New"]AF 27
AF 27
CC CC CC 08
DD DD DD 08
00 00 00 00
FC 1C 23 08
11 2D 0A 08[/FONT]

At [FONT="Courier New"]CCCCCC[/FONT]:[FONT="Courier New"]
00 00 00 40 00 08 00 00 00[/FONT]

At [FONT="Courier New"]DDDDDD[/FONT]:[FONT="Courier New"]
EE EE EE 08[/FONT]

At [FONT="Courier New"]EEEEEE[/FONT]:[FONT="Courier New"]
00 00 00 00 00 00[/FONT]

At BBBBBB:
Code:
[FONT="Courier New"]AF 27
AF 27
CC CC CC 08
DD DD DD 08
00 00 00 00
FC 1C 23 08
11 2D 0A 08[/FONT]

At [FONT="Courier New"]CCCCCC[/FONT]:[FONT="Courier New"]
00 00 00 20 00 08 00 00 00[/FONT]

At [FONT="Courier New"]DDDDDD[/FONT]:[FONT="Courier New"]
EE EE EE 08[/FONT]

At [FONT="Courier New"]EEEEEE[/FONT]:[FONT="Courier New"]
00 00 04 00 04 00[/FONT]
 
Last edited:

Trainer 781

Guest
0
Posts
Here is the effect for acupressure:
Acupressure (Set the targeting scheme to '2' so that the move it can select any target bank):
Script:
Spoiler:


Asm at GGGGGG:
Spoiler:


ASM at HHHHHH
Spoiler:


ASM at IIIIII:
Spoiler:


The first ASM adjusts the target, if accidentally selected by the player or AI that is out of the range of acupressure i.e opponent's team, to the required range. (If somebody has the knowledge of hacking the targeting scheme then this ASM would not be required).

The seconds ASM checks for maximization of all stats and ally's substitute.

The third ASM randomly selects the boosting byte.
 
Last edited:

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Effect: Ice Fang for Ruby...
Code:
00 01 72 6F 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 21 4D 02 02 08 15 2E 21 4D 02 02 04 15 28 5B 6F 1D 08
 
Last edited:

byrikudouvlog

Romhacker promise
3
Posts
10
Years
i wanna create my own custom moves of the VI GEN too, please, do u know where can i find the hex data of the animations or how can i calculate the hex data?
please, im disperate
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
Here is the effect for acupressure:
Acupressure (Set the targeting scheme to '2' so that the move it can select any target bank):

The first ASM adjusts the target, if accidentally selected by the player or AI that is out of the range of acupressure i.e opponent's team, to the required range. (If somebody has the knowledge of hacking the targeting scheme then this ASM would not be required).

The seconds ASM checks for maximization of all stats and ally's substitute.

The third ASM randomly selects the boosting byte.

The move freezes when it's executed. Also targeting 2 isn't very good, because in single battles you can pick the opponent which isn't ideal.
 
Back
Top