• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Well, if they're good enough they might be able to port any of RSE features to FR

Not even that
It's the wanting of it
And it REALLY doesn't matter the game you build on, CUZ YOU'RE CHANGING IT ANYWAY
It matters the ENGINE and FR's ENGINE is the better one of the 3, and more researched one, so why fight it
 

Trainer 781

Guest
0
Posts
This is my first effect (Psycho shift):
Code:
#dynamic 0xYourOffest
#freespacebyte 0xFF

#include std.bsh

#org @psycoshift
attackcanceler
accuracycheck 0x1D695E 0x0
attackstring
ppreduce
jumpifsecondarystatus BANK_TARGET 0x1000000 0x81D7DF2
jumpifstatus BANK_USER 0x10 @burnandcure
jumpifstatus BANK_USER 0x8 @poisonandcure
jumpifstatus BANK_USER 0x80 @toxicandcure
jumpifstatus BANK_USER 0x40 @paralijeandcure
jumpifstatus BANK_USER 0x7 @sleepandcure
goto 0x81D7DF2

#org @burnandcure
jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
jumpifstatus 0x0 0x10 0x81D7F91
jumpiftype 0x0 0xA 0x81D7E04
jumpifability 0x0 0x29 0x81D7F77
jumpifstatus 0x0 0xFF 0x81D7DF2
jumpifhalverset 0x0 0x20 0x81D8B39
attackanimation
waitanimation
setbyte 0x2023E85 0x3
seteffecttarget
cureifburnedparalysedorpoisoned 0x81D7DF2
cmd98 0x1
goto 0x81D694E

#org @poisonandcure
jumpifability 0x0 0x11 0x81D6E4F
jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
jumpifstatus 0x0 0x8 0x81D6E41
jumpifstatus 0x0 0x80 0x81D6E41
jumpiftype 0x0 0x3 0x81D7E04
jumpiftype 0x0 0x8 0x81D7E04
jumpifstatus 0x0 0xFF 0x81D7DF2
jumpifhalverset 0x0 0x20 0x81D8B39
attackanimation
waitanimation
setbyte 0x2023E85 0x2
seteffecttarget
cureifburnedparalysedorpoisoned 0x81D7DF2
cmd98 0x1
goto 0x81D694E

#org @paralijeandcure
jumpifability 0x0 0x7 0x81D7245
jumpiftype 0x0 0xD 0x81D7E04
jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
cmd6
jumpifbyte 0x4 0x2023DCC 0x29 0x81D7DF2
jumpifstatus 0x0 0x40 0x81D7237
jumpifstatus 0x0 0xFF 0x81D7DF2
jumpifhalverset 0x0 0x20 0x81D8B39
attackanimation
waitanimation
setbyte 0x2023E85 0x5
seteffecttarget
cureifburnedparalysedorpoisoned 0x81D7DF2
cmd98 0x1
goto 0x81D694E

#org @toxicandcure
jumpifability 0x0 0x11 0x81D6E4F
jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
jumpifstatus 0x0 0x8 0x81D6E41
jumpifstatus 0x0 0x80 0x81D6E41
jumpifstatus 0x0 0xFF 0x81D7DF2
jumpiftype 0x0 0x3 0x81D7E04
jumpiftype 0x0 0x8 0x81D7E04
jumpifhalverset 0x0 0x20 0x81D8B39
attackanimation
waitanimation
setbyte 0x2023E85 0x6
seteffecttarget
cureifburnedparalysedorpoisoned 0x81D7DF2
cmd98 0x1
goto 0x81D694E

#org @sleepandcure
jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
jumpifstatus 0x0 0x7 0x81D69B0
jumpifcannotsleep 0x81D69CC
jumpifstatus 0x0 0xFF 0x81D7DF2
jumpifhalverset 0x0 0x20 0x81D8B39
attackanimation
waitanimation
setbyte 0x2023E85 0x1
seteffecttarget
clearstatus 0x1
jumpifbyte 0x0 0x02023D6B 0x0 @slot1
jumpifbyte 0x0 0x02023D6B 0x1 @slot2
jumpifbyte 0x0 0x02023D6B 0x2 @slot3
jumpifbyte 0x0 0x02023D6B 0x3 @slot4

#org @slot1
bicbyte 0x20242D4 0xFF
cmd98 0x1
goto 0x81D694E

#org @slot2
bicbyte 0x202407C 0xFF
cmd98 0x1
goto 0x81D694E

#org @slot3
bicbyte 0x2024338 0xFF
cmd98 0x1
goto 0x81D694E

#org @slot4
bicbyte 0x20240E0 0xFF
cmd98 0x1
goto 0x81D694E

Bugs:
1. Fixed :D. Used cmd98 0x1 to fixed that problem and also placed the cureifburnedparalysedorpoisoned 0x81D7DF2 after setting the status so that you do not get affected by synchronize ability.
2. Fixed :D:D. Earlier, using the clearstatus command I partially managed to cure the user's sleep. But it still displayed the sleep icon.

Therefore the move can effectively shift paralysis, toxic, burn, poison and sleep (Creselia's sleeptalk,rest,psycoshift strategy XD).
 
Last edited:

Trainer 781

Guest
0
Posts
Some more effects:

Freeze Shock/Ice burn
Code:
#dynamic 0x740000
#freespacebyte 0xFF

#org @freezeshock
jumpifsecondarystatus 0x1 0x1000 @execute
jumpifword 0x4 0x2023DD0 0x200 @execute
setbyte 0x2023FD3 0x3
call @firstturn
goto 0x81D694E

#org @execute
attackcanceler
setbyte 0x2023E85 0xC
setbyte 0x2023FDC 0x1
clearstatus 0x1
orword 0x2023DD0 0x800
setbyte 0x2023E85 0x5 (0x3 instead 0x5 for ice burn)
goto 0x81D6927

#org @firstturn
attackcanceler
attackstring
waitmessage 0x40
ppreduce
attackanimation
waitanimation
orword 0x2023DD0 0x8000000
setbyte 0x2023E85 0x4C
seteffecttarget
copyarray 0x2023E87 0x2023FD3 0x1
printstring 0xA5
waitmessage 0x40
return
Set 30% effect accuracy in a move editor like PGE.

Geomancy:
Code:
#dynamic 0x730000
#freespacebyte 0xFF

#org @geomancy
jumpifsecondarystatus 0x1 0x1000 @execute
jumpifword 0x4 0x2023DD0 0x200 @execute
setbyte 0x2023FD3 0x3
call @firstturn
goto 0x81D694E

#org @execute
attackcanceler
setbyte 0x2023E85 0xC
setbyte 0x2023FDC 0x1
clearstatus 0x1
orword 0x2023DD0 0x800
goto @boost

#org @boost
attackstring
ppreduce
jumpifstat 0x1 0x3 0x4 0xC @spattack
jumpifstat 0x1 0x3 0x5 0xC @spattack
jumpifstat 0x1 0x0 0x3 0xC 0x81D85E7
goto @spattack

#org @spattack
attackanimation
waitanimation
setbyte 0x2023FDF 0x0
playstatchangeanimation 0x1 0x30 0x0
setbyte 0x2023FDE 0x24
statbuffchange 0x1 true @spdef
jumpifbyte 0x0 0x2023E87 0x2 @spdef
printfromtable 0x83FE57C
waitmessage 0x40
goto @spdef

#org @spdef
setbyte 0x2023FDE 0x25
statbuffchange 0x1 true @speed
jumpifbyte 0x0 0x2023E87 0x2 @speed
printfromtable 0x83FE57C
waitmessage 0x40
goto @speed

#org @speed
setbyte 0x2023FDE 0x23
statbuffchange 0x1 true 0x81D694E
jumpifbyte 0x0 0x2023E87 0x2 0x81D694E
printfromtable 0x83FE57C
waitmessage 0x40
goto 0x81D694E

#org @firstturn
attackcanceler
attackstring
waitmessage 0x40
ppreduce
attackanimation
waitanimation
orword 0x2023DD0 0x8000000
setbyte 0x2023E85 0x4C
seteffecttarget
copyarray 0x2023E87 0x2023FD3 0x1
printstring 0xA5
waitmessage 0x40
return

These moves display a charging message in their charging turn which can be easily changed by the argument in printstring command.
 

Trainer 781

Guest
0
Posts
Some updated effects for the old moves:

1. Knock off:

This emulates the gen 6 buff for Knock Off. Using pawell and kurapika's Acrobatics' effect and reading the JPAN's incredibly useful Battle Script Thread, I managed to create this. The problem is that to emulate knock off's 1.5 increase when the foe is holding an item, the damage multiplier set to 3 and set to 2 for normal damage. To compensate for this you have to set its base power to 32 or 33 (i.e 65/2 to emulate Gen VI damage nearly) or 'the actual intended base power that you want to keep in you game' divided by 2. Because I am unable to manipulate damage increase in fractions using battle scripts.
Anyways, here is the code.
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @start
jumpifbyte 0x0 0x02023D6C 0x0 @slot1
jumpifbyte 0x0 0x02023D6C 0x1 @slot2
jumpifbyte 0x0 0x02023D6C 0x2 @slot3
jumpifbyte 0x0 0x02023D6C 0x3 @slot4
goto @doubledamage

#org @slot1
jumpifhalfword 0x1 0x02023C12 0x0 @tripledamage
goto @doubledamage

#org @slot2
jumpifhalfword 0x1 0x02023C6A 0x0 @tripledamage
goto @doubledamage

#org @slot3
jumpifhalfword 0x1 0x02023CC2 0x0 @tripledamage
goto @doubledamage

#org @slot4
jumpifhalfword 0x1 0x02023D1A 0x0 @tripledamage
goto @doubledamage

#org @tripledamage
setbyte damagemultiplier 0x3
goto 0x81D8263

#org @doubledamage
setbyte damagemultiplier 0x2
goto 0x81D6900

So it works effectively but the problem is that it displays the half of actual intended power.

2. Blizzard (infinite accuracy in hail and chance to freeze opponent)
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @blizzard
setbyte 0x2023E85 0x4
jumpifhalfword 0x0 weather 0x80 @notmiss
goto 0x81D6900

#org @notmiss
attackcanceler
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

3. Charge (set charge and raise user's sp. def by one stafe)
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @charge
attackcanceler
attackstring
ppreduce
setcharge
attackanimation
waitanimation
printstring 0xA5
waitmessage 0x40
jumpifstat 0x1 0x0 0x5 0xC 0x81D694E
setbyte 0x2023FDE 0x15
statbuffchange 0x1 true 0x81D694E
jumpifbyte 0x0 0x2023E87 0x2 0x81D694E
playstatchangeanimation 0x1 0x30 0x0
printfromtable 0x83FE57C
waitmessage 0x40
goto 0x81D694E

New Effect:
Hex (inflict double damage to a status-ed foe)
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @hex
jumpifstatus 0x0 0x10 @doubledamage 
jumpifstatus 0x0 0x8 @doubledamage
jumpifstatus 0x0 0x80 @doubledamage
jumpifstatus 0x0 0x40 @doubledamage
jumpifstatus 0x0 0x7 @doubledamage
goto 0x81D6900

#org @doubledamage
setbyte damagemultiplier 0x2
goto 0x81D6900
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
So basically this is a RAM versus ROM trade-off.

Then you have chosen poorly.

When writing a script or a programme of any description, the last thing you should be concerned about is the ROM space, as there is 114 times as much ROM space as there is RAM space in a GBA ROM (assuming a 32 meg ROM).

But that isn't even the biggest issue. Your script wastes unnecessary CPU cycles reading from and writing to these RAM addresses, meaning that the CPU has to sit and wait on data to be returned to it from the memory chip. Time where the CPU is idle, not processing anything, but continuing to drain battery power.

In order of importance, it's processor time, ram usage, rom usage. So if you can spare your processor from having to do more, even if it costs a significant amount of ROM space, you should do it.

ETA: Original post changed, so this is largely irrelevant now. Nonetheless, I'll leave it here as a cautionary post.
 
Last edited:

DoesntKnowHowToPlay

Tiny Umbrella with Lots and Lots of Good
265
Posts
12
Years
  • Seen Feb 24, 2024
^this, albeit for somewhat different reasons

I'd like to point out, since a lot of people seem to be unaware, that the AI runs damage calcs to determine move power, but it does not run battle scripts beforehand. Damage-modifying effects like Sacred Sword, Venoshock, Brine, and Acrobatics should be implemented into the damage calc (x3ecec) if you want the AI to be able to use them in the proper context. In the same vein note which effect slot you're putting your scripts in if you want the AI to use them sensibly. While you can't expect the AI to be sane with unused effect slots, you can probably expect it to not be a complete idiot with Quiver Dance if it's mapped to Calm Mind, or Flame Charge that's mapped to Metal Claw.

Also is 0x02FF7D20 even a legal address on the GBA? I thought that part of RAM only went up to x0203FFFF.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Also is 0x02FF7D20 even a legal address on the GBA? I thought that part of RAM only went up to x0203FFFF.

It's legal on an emulator, but not on the real hardware. Good catch, as I missed this.

Also this:
Hex (inflict double damage to a status-ed foe)
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @hex
jumpifstatus 0x0 0x10 @doubledamage 
jumpifstatus 0x0 0x8 @doubledamage
jumpifstatus 0x0 0x80 @doubledamage
jumpifstatus 0x0 0x40 @doubledamage
jumpifstatus 0x0 0x7 @doubledamage
goto 0x81D6900

#org @doubledamage
setbyte damagemultiplier 0x2
goto 0x81D6900

Can be combined into a single check:

Code:
#org @hex
jumpifstatus 0x0 0xFF @doubledamage
goto 0x81D6900

#org @doubledamage
setbyte damagemultiplier 0x2
goto 0x81D6900
 
Last edited:

Trainer 781

Guest
0
Posts
@Jambo51 - Aah, thank you. I'm inexperienced, so I don't know about the GBA system properly. I will keep this in mind for the next time. I'll update this code so it will use only 2 RAM bytes and try to put it somewhere in the 0x02000000-x0203FFFF region if there is free space (I don't know the offsets, can anyone tell?. It would be a great help). And also thanks for the correction of the hex check, I really forgot about this.

@DoesntKnowHowToPlay - You are right about the AI. I am aware of this (I read one of your posts in this thread mentioning about this). I don't have the ASM skills to modify the command (hopefully,
someday I or someone else can). These types of scripts can serve as decent placeholders for the time being. Also, thanks for telling about the RAM region limit.

I tested this move. It was working properly in an emulator (in double battles too), but because i used an outside RAM region so it will not work on GBA.

EDIT: I have now updated the code in the OP (it is not complete because of not knowing the free RAM offsets). If further improvement need to be done, then advice is welcome.
 
Last edited:

Shadowraze

ur mum
794
Posts
10
Years
Well after 10,001 years I finally updated the OP! :)

Thanks for all your contributions everyone especially to MrDollSteak, KDS, Bugmania, Spherical Ice now lets get some animating and coding going on. :D

I would probably add in 6th gen moves and other versions some time later since they are not my top priority now.
 
180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
Well after 10,001 years I finally updated the OP! :)

Thanks for all your contributions everyone especially to MrDollSteak, KDS, Bugmania, Spherical Ice now lets get some animating and coding going on. :D

I would probably add in 6th gen moves and other versions some time later since they are not my top priority now.

On the first page, 11bayerf1 made an animation for Payback that doesn't work. The only thing that needs to be done to fix it is to add 08 after every pointer which 11bayerf1 seems to have forgotten when adding it.

This animation looks really nice so you should definitely add it with the added 08's after every instance of ZZ YY XX(2,3,4)
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
On the first page, 11bayerf1 made an animation for Payback that doesn't work. The only thing that needs to be done to fix it is to add 08 after every pointer which 11bayerf1 seems to have forgotten when adding it.

This animation looks really nice so you should definitely add it with the added 08's after every instance of ZZ YY XX(2,3,4)

also I tested the quiver dance one and it freezes after it says I used it
I added it 3 different times in different roms, so it's not my sanity :P
(not necessary for me but it's just to help)
 
180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
3. Charge (set charge and raise user's sp. def by one stafe)
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @charge
attackcanceler
attackstring
ppreduce
setcharge
attackanimation
waitanimation
printstring 0xA5
waitmessage 0x40
setbyte 0x2023FDE 0x15
statbuffchange 0x1 true 0x81D694E
jumpifbyte 0x0 0x2023E87 0x2 0x81D694E
playstatchangeanimation 0x1 0x30 0x0
printfromtable 0x83FE57C
waitmessage 0x40
goto 0x81D694E

Your Charge will freeze if you max out the Sp. Def and try to raise another level. You'll need to add "Jumpifstat 0x1 0x0 0x5 0xC 0x81D694E" after waitmessage 0x40 to fix it.
 
180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
Sorry for the double post, but I actually have a contribution as well as a question

These are my Close Combat Effect scripts:

Method 1:

Emerald:
Spoiler:

Fire Red:
Spoiler:

Method 2:
I'll just post one version of this:

Fire Red:
Spoiler:

While both of these can be used fine, they have their problems.

Method 1 has an animation which is consistent with the rest of the game: 1 grey downwards anmation for both stats. However, if, say, the user Has -4 in Defense and -6 (maximum, - 3 and - 5 works fine) in Sp. Def at one point, neither will be lowered. It only works if the stats are lowered at the same phase.

Method 2 has good functionality as it treats both stats seperately. However, it has 1 animation for each stat so you have to go through two "lower stats animation" every time you use the move (which is inconsistent with the rest of the game).

So yeah, feel free to use whichever you want. I would love if someone else could help me see what I miss in the first animation to make it have 1 animation for lowering the stats but treat Sp. Def and Def separately.
 
Last edited:

Trainer 781

Guest
0
Posts
^ i tested it on my system, it worked fine even in the case of max sp. def but if you are saying i'll take a look again
 
1,323
Posts
16
Years
  • Seen Dec 9, 2023
Here's my Roost animation for Emerald:
00 1E 28 0A 03 29 19 CA 00 3F 04 00 02 88 63 59 08 80 08 00 00 F0 FF 40 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 88 63 59 08 80 08 00 00 F0 FF 20 00 02 00 68 00 28 2C 20 00 01 00 02 88 63 59 08 80 08 00 00 F0 FF 00 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 88 63 59 08 80 08 00 00 F0 FF E0 00 02 00 68 00 28 2C 20 00 01 00 02 88 63 59 08 80 08 00 00 F0 FF 80 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 88 63 59 08 80 08 00 00 F0 FF C0 00 02 00 68 00 28 2C 20 00 01 00 02 88 63 59 08 80 08 00 00 F0 FF A0 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 88 63 59 08 80 08 00 00 F0 FF 60 00 02 00 68 00 28 2C 20 00 01 00 05 0B 03 00 2F 27 05 0B 02 0D 04 01 0E DF 79 2D 08 05 08
It's basically Feather Dance + healing animation.
 

Trainer 781

Guest
0
Posts
Your Charge will freeze if you max out the Sp. Def and try to raise another level. You'll need to add "Jumpifstat 0x1 0x0 0x5 0xC 0x81D694E" after waitmessage 0x40 to fix it.

Hmm. This is a good idea for safety I'll update it.
Edited the OP for charge.
 

BugMania

The Bug Master
32
Posts
10
Years
  • Seen Nov 4, 2016
Here is the "Flame Burst":
Spoiler:

this will make possible the "FlameBurstCalculationDemageCommand"!!
I apologize if anyone has been trying to use this code and could not until today ^_^:
Spoiler:

I noticed that there was a mistake in the table counter ...
here is the fixed routine:
Spoiler:

Now we can use this to create assembly routines for use in the BSP!
 

Trainer 781

Guest
0
Posts
Wake-up Slap (Improved):
I figured out the way to cure sleep :D, so my psyco shift's 2nd problem is also fixed.
Spoiler:


Updated the psyco shift too.
Changed the condition byte for blizzard.
 
Last edited:

Trainer 781

Guest
0
Posts
Found Jambo's callasm method (link here) in battle scripts by seeing Chaos Rush's roost effect post.

So made two effects using the callasm method and Tlachti's decimal damage manipulation ASM code, which is found here.

1. Knock Off (Better Alternative)
Code:
#dynamic 0x(YourOffset)
#freespacebyte 0xFF

#org @start
jumpifbyte 0x0 0x02023D6C 0x0 @slot1
jumpifbyte 0x0 0x02023D6C 0x1 @slot2
jumpifbyte 0x0 0x02023D6C 0x2 @slot3
jumpifbyte 0x0 0x02023D6C 0x3 @slot4

#org @slot1
jumpifhalfword 0x1 0x02023C12 0x0 @knock
goto 0x081D6926

#org @slot2
jumpifhalfword 0x1 0x02023C6A 0x0 @knock
goto 0x081D6926

#org @slot3
jumpifhalfword 0x1 0x02023CC2 0x0 @knock
goto 0x081D6926

#org @slot4
jumpifhalfword 0x1 0x02023D1A 0x0 @knock
goto 0x081D6926

#org @knock
setbyte 0x2023E85 0x36
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
callculatedamage
cmdF8  0x([Offset to 1.5x damage asm]+1)
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

This knock off script is much better it as does not required base power change (set to 65), and better AI understanding (not perfect though) and also does not give techician mons a undesirable boost as mine first script does, but requires the ability to insert ASM and repointing tables.
--
2. Metal Burst
Code:
#dynamic 0x720000
#freespacebyte 0xFF

#org @start
jumpifhalfword B_== 0x2023D4A 0x44 0x81D7433
attackcanceler
counterdamagecalculator @specialpass
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
damagecalc2
cmd69
cmdF8 0x([Offset to 0.75x damage asm]+1)
goto 0x81D6934

#org @specialpass
mirrorcoatdamagecalculator 0x81D7DF0
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
damagecalc2
cmd69
cmdF8 0x([Offset to 0.75x damage asm]+1)
goto 0x81D6934

Understanding Doesnt's point on mapping new effects to similar old effects so that AI can use them in a better way, this script is meant to replace the original counter script (so change the counter's original pointer in the effect table to the inserted scripts's location). It branches to counter's effect if the move ID is of counter, otherwise it executes metal burst's effect. This also requires Jambo's callasm method.
--
The way of inserting these two codes is:
i.) First use Jambo's callasm method, if already done then skip this step.
ii.) Insert this in command.bsh by opening in notepad, if already done then skip this step also
Code:
#command cmdF8 0xF8 0x1 "Offset of routine" 0x4
#command cmd69 0x69 0x0
#command cmd98 0x98 0x1 "Byte" 0x1
iii). View Tlachtli's ASM routines and change 0x020241F0 to 0x02023d50 in the last line before compiling to make them working for FR.
iv) Then insert the compiled decimal multiplier ASM routines using an Hex Editor.
v) Then insert the battle scripts using BSP.
--
3. Soak (no callasm required):
Code:
#dynamic 0x720000
#freespacebyte 0xFF

#org @start
attackcanceler
accuracycheck 0x1D695E 0x0
attackstring
ppreduce
jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
attackanimation
waitanimation
jumpifbyte 0x0 0x02023D6C 0x0 @slot1
jumpifbyte 0x0 0x02023D6C 0x1 @slot2
jumpifbyte 0x0 0x02023D6C 0x2 @slot3
jumpifbyte 0x0 0x02023D6C 0x3 @slot4

#org @slot1
setbyte 0x2023C05 0xB
setbyte 0x2023C06 0xB
goto 0x81D694E

#org @slot2
setbyte 0x2023C5D 0xB
setbyte 0x2023C5E 0xB
goto 0x81D694E

#org @slot3
setbyte 0x2023CB5 0xB
setbyte 0x2023CB6 0xB
goto 0x81D694E

#org @slot4
setbyte 0x2023D0D 0xB
setbyte 0x2023C06 0xB
goto 0x81D694E
 
5,256
Posts
16
Years
I've managed to port Chaos Rush's Roost over to FireRed. I'm just going to copy his explanation, and edit parts where applicable.

-------------------

Here's how to implement it:
1. First, you need Jambo51's callasm routine for Battle Script Pro. It is found right here. Your new command will be 0xF8.

2. Now to get BSP to recognize our new command, open up the folder where BSP is located, and then there should be another folder called "Data". Then you should see a file called, "commands.bsh". Open it up with Notepad, and put this in:

#command callasm 0xF8 0x1 "Offset of routine" 0x4

DO NOT change anything in the quotation marks!

3. Now, put in this routine somewhere:
Code:
.text
.align 2
.thumb
.thumb_func

/*What this routine does is check if the attacking PKMN
is Flying-type. It then changes its Flying-type to
the ???-type.*/

GetPkmnType1:
push {r0-r5}
ldr r1, .BattleData
ldr r0, .CurPokeIndex
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x21
add r1, r2
ldrb r0, [r1]
ldrb r2, [r1, #0x1]
mov r3, #0x2
cmp r0, r3
beq ChangeType1
cmp r2, r3
beq ChangeType2
b End

ChangeType1:
mov r4, #0x9
strb r4, [r1]
cmp r2, r3
beq ChangeType2
b End

ChangeType2:
mov r4, #0x9
strb r4, [r1, #0x1]
b End

End:
pop {r0-r5}
bx lr

.align 2
.BattleData:        .word 0x02023BE4
.CurPokeIndex:        .word 0x02023D6B

4. Now open up BSP, and open up Recover's battle script. Replace it with this:

Code:
#dynamic 0x800000
#freespacebyte 0xFF

#org @start
jumpifhalfword 0x0 0x2023D4A 0x163 @roost
attackcanceler
attackstring
ppreduce
setdamageasrestorehalfmaxhp @max 0x1
attackanimation
waitanimation
orword 0x2023DD0 0x100
graphicalhpupdate 0x1
datahpupdate 0x1
printstring 0x4B
waitmessage 0x40
goto @end

#org @roost
attackcanceler
attackstring
ppreduce
setdamageasrestorehalfmaxhp @max 0x1
attackanimation
waitanimation
orword 0x2023DD0 0x100
graphicalhpupdate 0x1
datahpupdate 0x1
printstring 0x4B
waitmessage 0x40
jumpiftype2 0x1 0x2 @changetype
goto @end

#org @max
pause 0x20
printstring 0x4C
waitmessage 0x40
goto @end

#org @changetype
callasm 0x(offset of your routine +1)
goto @end

#org @end
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end

A couple things to note: At the top, we have "jumpifhalfword 0x0 0x2023D4A 0x163 @roost".
Replace 0x163 with your move ID for Roost.

Towards the bottom, at "#org @changetype", you see "callasm 0x(offset of your routine +1)". Obviously, put in the offset of the routine we added earlier, but add 0x1 to the offset.

So far, we have made it so that every time a Flying-type Pokémon uses Roost, it will turn into a ???-type. (If it was part-Flying, it would become part-???, and if it was pure-Flying, it would become pure-???).

5. Now we're going to insert another routine. This second routine will be called at the end of every turn and simply checks to see if there are any ???-type Pokémon, and then changes them back to Flying types.
Code:
[FONT="Courier New"].text
.align 2
.thumb
.thumb_func

HandlePoke1:
push {r0-r5}
mov r3, #0x9
ldr r1, .Poke1Type
ldrb r0, [r1]
ldrb r2, [r1, #0x1]
cmp r0, r3
beq Poke1ChangeType1
cmp r2, r3
beq Poke1ChangeType2
b HandlePoke2

Poke1ChangeType1:
mov r4, #0x2
strb r4, [r1]
cmp r2, r3
beq Poke1ChangeType2
b HandlePoke2

Poke1ChangeType2:
mov r4, #0x2
strb r4, [r1, #0x1]
b HandlePoke2

HandlePoke2:
ldr r1, .Poke2Type
ldrb r0, [r1]
ldrb r2, [r1, #0x1]
cmp r0, r3
beq Poke2ChangeType1
cmp r2, r3
beq Poke2ChangeType2
b HandlePoke3

Poke2ChangeType1:
mov r4, #0x2
strb r4, [r1]
cmp r2, r3
beq Poke2ChangeType2
b HandlePoke3

Poke2ChangeType2:
mov r4, #0x2
strb r4, [r1, #0x1]
b HandlePoke3

HandlePoke3:
ldr r1, .Poke3Type
ldrb r0, [r1]
ldrb r2, [r1, #0x1]
cmp r0, r3
beq Poke3ChangeType1
cmp r2, r3
beq Poke3ChangeType2
b HandlePoke4

Poke3ChangeType1:
mov r4, #0x2
strb r4, [r1]
cmp r2, r3
beq Poke3ChangeType2
b HandlePoke4

Poke3ChangeType2:
mov r4, #0x2
strb r4, [r1, #0x1]
b HandlePoke4

HandlePoke4:
ldr r1, .Poke4Type
ldrb r0, [r1]
ldrb r2, [r1, #0x1]
cmp r0, r3
beq Poke4ChangeType1
cmp r2, r3
beq Poke4ChangeType2
b End

Poke4ChangeType1:
mov r4, #0x2
strb r4, [r1]
cmp r2, r3
beq Poke4ChangeType2
b End

Poke4ChangeType2:
mov r4, #0x2
strb r4, [r1, #0x1]
b End

End:
pop {r0-r5}
ldr r0, .ReturnAddress
bx r0


.align 2
.Poke1Type: .word 0x02023C05
.Poke2Type: .word 0x02023C5D
.Poke3Type: .word 0x02023CB5
.Poke4Type: .word 0x02023D0D
.ReturnAddress:	.word 0x08013BD5[/FONT]

6. At the following offsets, replace the pointers to instead point to the second routine +1:

0x13BBC
0x18254

Remember to add +1 to the routine's offset; this is NOT the case in the Emerald version.

And now we have a fully working Roost with Generation IV's effect, and the AI can use it properly too, since we're using Recover's battle script slot, but the battle script is designed so that Recover will still function separately from Roost.

A couple things to note, this routine replicates the Generation IV effect of Roost where if the user was pure-Flying, it would become ??? type upon using Roost. In Generation V+, a pure-Flying type using Roost would become Normal-type.. If anyone wants to mod my routine to have the Generation V effect, feel free to do so.

Credits:
Chaos Rush - creating the original
DoesntKnowHowToPlay - for the idea of the method to achieve this
Tchlatli - Chaos Rush looked at his custom Protean code to figure out how to correctly calculate the type offset of the attacking Pokémon
JPAN - documentation on FireRed battle-related RAM offsets

To verify that it's working properly, here are some useful RAM offsets:
02023BE4 - Battle Data (check out this post to see how its structured.)

02023C05 - Your(1) Type 1
02023C06 - Your(1) Type 2

02023C5D - Opponent(1) Type 1
02023C5E - Opponent(1) Type 2

02023CB5 - Your(2) Type 1
02023CB6 - Your(2) Type 2

02023D0D - Opponent(2) Type 1
02023D0E - Opponent(2) Type 2

-------------------

This probably has some mistakes, so feel free to correct me. It appears to work in-game properly without any bugs or side-effects, but who knows? If you find something out, please do tell me! This was my first real excursion into disassembly, etc. so it likely won't be perfect.

Edit:

Here's the animation, it's just a hybrid of Featherdance and the healing animation:

Code:
00 A3 27 00 2F 27 00 1E 28 0A 03 29 19 C3 00 3F 04 00 02 00 6C 3E 08 80 08 00 00 F0 FF 40 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 00 6C 3E 08 80 08 00 00 F0 FF 20 00 02 00 68 00 28 2C 20 00 01 00 02 00 6C 3E 08 80 08 00 00 F0 FF 00 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 00 6C 3E 08 80 08 00 00 F0 FF E0 00 02 00 68 00 28 2C 20 00 01 00 02 00 6C 3E 08 80 08 00 00 F0 FF 80 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 00 6C 3E 08 80 08 00 00 F0 FF C0 00 02 00 68 00 28 2C 20 00 01 00 02 00 6C 3E 08 80 08 00 00 F0 FF A0 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 00 6C 3E 08 80 08 00 00 F0 FF A0 00 02 00 68 00 28 2C 20 00 01 00 04 06 02 00 6C 3E 08 80 08 00 00 F0 FF 60 00 02 00 68 00 28 2C 20 00 01 00 05 0B 02 0D 04 01 0E C9 56 1D 08 05 08 02 80 76 3E 08

And here's a video demonstrating the full package in action:
 
Last edited:
Back
Top