Lance32497
LanceKoijer of Pokemon_Addicts
- 792
- Posts
- 10
- Years
- Criscanto town-Ginoa Region xD
- Seen Aug 14, 2017
I can finally say it is completely done ! This is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea
Spoiler:
Read Me :
Spoiler:
In all of those routines and battlescripts I used 0x0203E331 as a free ram location to check whether a perma weather is set or not. You can use whatever you want while this is not used in-game.
Checking switch-in Abilities :
Spoiler:
The routine :
Spoiler:
Code:.text .align 2 .thumb .thumb_func .global checkswitchin Start: ldrb r3, [r5] cmp r1, r3 blo CheckIfSwitchInAbility mov r0, r10 strb r0, [r2] CheckIfSwitchInAbility: CheckDrizzle: ldrb r0, [r7] cmp r0, #0x2 bne CheckCloudNine Drizzle: ldr r2, FreeRam ldrb r1, [r2] cmp r1, #0x00 bne NoSwitchInAbility ldr r1, =(0x08042B78+1) bx r1 CheckCloudNine: cmp r0, #0x0D bne CheckIntimidate b AirLockCloudNine CheckIntimidate: cmp r0, #0x16 bne CheckTrace Intimidate: ldr r1, =(0x08042C08+1) bx r1 CheckTrace: cmp r0, #0x24 bne CheckSandStream Trace: ldr r1, =(0x08042C68+1) bx r1 CheckSandStream: cmp r0, #0x2D bne CheckForeCast SandStream: ldr r2, FreeRam ldrb r1, [r2] cmp r1, #0x00 bne NoSwitchInAbility ldr r1, =(0x08042BA8+1) bx r1 CheckForeCast: cmp r0, #0x3B bne CheckDrought ForeCast: ldr r1, =(0x08042C3C+1) bx r1 CheckDrought: cmp r0, #0x46 bne CheckAirLock Drought: ldr r2, FreeRam ldrb r1, [r2] cmp r1, #0x00 bne NoSwitchInAbility ldr r1, =(0x08042BD8+1) bx r1 CheckAirLock: cmp r0, #0x4D bne CheckDelta AirLockCloudNine: ldr r2, FreeRam ldrb r1, [r2] cmp r1, #0x00 bne NoSwitchInAbility ldr r1, =(0x08042CA4+1) bx r1 CheckDelta: cmp r0, #[b]0xC0[/b] /*Number of your ability Delta Stream*/ bne CheckDeso UpdateStrongWind: ldr r0, CurrentWeather mov r1, #0 strb r1, [r0] ldr r0, FreeRam ldrb r1, [r0] cmp r1, #[b]0xC0[/b] /*Number of your ability Delta Stream*/ beq NoSwitchInAbility mov r1, #[b]0xC0[/b] /*Number of your ability Delta Stream*/ strb r1, [r0] ldr r0, BattleScript bl ExecuteScript ldr r1, =(0x08042A72+1) bx r1 CheckDeso: cmp r0, #[b]0xBF[/b] /*Number of your ability Desolate Land*/ bne CheckPrimo UpdateDesolate: ldr r2, FreeRam mov r0, #[b]0xBF[/b] /*Number of your ability Desolate Land*/ strb r0, [r2] ldr r2, =(0x08042BD8+1) bx r2 CheckPrimo: cmp r0, #[b]0xBE[/b] /*Number of your ability Primordial Sea*/ bne NoSwitchInAbility UpdatePrimordial: ldr r2, FreeRam mov r0, #[b]0xBE[/b] /*Number of your ability Primordial Sea*/ strb r0, [r2] ldr r2, =(0x08042B78+1) bx r2 NoSwitchInAbility: ldr r1, =(0x08042A7E+1) bx r1 ExecuteScript: ldr r1, =(0x08042BEE+1) bx r1 .align 2 BattleScript: .word 0x08A21E80 CurrentWeather: .word 0x020243CC FreeRam: .word 0x0203E331 ActiveBSPointer: .word 0x02024214 /*00 4B 18 47 xx+1 xx xx 08 at 08042A20*/
BattleScript :
Spoiler:Spoiler:
Code:#org 0xA21E80 pause 0x20 setword 0x0203E320 0x08XXXXXX // Assuming 0x0203E320 is the pointer of your setword and XX XX XX the address of the message you want to display printstring 0x184 waitmessage DELAY_1SECOND playanimation 0x0 0x1E 0x0 //The table below ends with the 0x0 0x1D 0x0 animation, replace it accordingly (0x1E in my case, I just added this one) waitanimation call 0x82DB48D end3
At TT TT TT :
This is the string that says "A mysterious air..." You can change it in whatever you want.Code:BB 00 E1 ED E7 E8 D9 E6 DD E3 E9 E7 00 D5 DD E6 00 D7 E9 E6 E6 D9 E2 E8 00 DD E7 FE E4 E6 E3 E8 D9 D7 E8 DD E2 DB 00 C0 E0 ED DD E2 DB AE E8 ED E4 D9 00 CA E3 DF D9 E1 E3 E2 AB
Also, you'll have to repoint a little table to play a new custom animation. At 0x5DA3C there's a pointer. Change this pointer to your new table which will be :
Spoiler:
Whith LL LL LL being the pointer to your new animation (you can use an existing one but you'll still have to repoint as I said).Code:9E 7E 2D 08 D4 7E 2D 08 DD 7E 2D 08 1A 7F 2D 08 22 7F 2D 08 6A 7F 2D 08 75 7F 2D 08 08 81 2D 08 7C 81 2D 08 58 82 2D 08 A5 82 2D 08 EE 82 2D 08 F3 82 2D 08 F8 82 2D 08 FD 82 2D 08 0B 83 2D 08 3C 83 2D 08 61 83 2D 08 BF 83 2D 08 1E 84 2D 08 E3 84 2D 08 23 85 2D 08 66 85 2D 08 E3 85 2D 08 04 86 2D 08 15 86 2D 08 26 86 2D 08 7A 86 2D 08 93 86 2D 08 9D 86 2D 08 LL LL LL 08
I assumed here that FA is your setword command and 0x0203E320 your freelocation that point to your battlestring.
Weather attacks ineffective under Primal/Mega weathers :
Spoiler:
The battlescript :
Spoiler:
Code:#org @YourOffset jumpifhalfword 0x0 0x203E331 [I][U]0xBE[/U][/I] 0x82D9F1A ##Here I check if the FreeRam loc that as used is different from 0, to see whether the mega/prima weather are activated or not jumpifhalfword 0x0 0x203E331 [I][U]0xBF[/U][/I] 0x82D9F1A ##Same thing jumpifhalfword 0x0 0x203E331 [I][U]0xC0[/U][/I] 0x82D9F1A ##Same jumpifhalfword 0x0 0x20241EA 0xC9 0x82D99B7 ##Check if the move index correspond to sandstorm jumpifhalfword 0x0 0x20241EA 0xF0 0x82D9B3D ##or rain dance jumpifhalfword 0x0 0x20241EA 0xF1 0x82D9B55 ##or sunny day jumpifhalfword 0x0 0x20241EA 0x102 0x82D9FD2 ##or finally hail
Finally make hail/raindance/sandstorm having the same effect which point on @YourOffset.
Modulation damages :
Spoiler:
The routines :
Spoiler:
Code:.text .align 2 .thumb .thumb_func .global damagemodulationmegaprima CheckPermaWeather: ldr r5, FreeRam ldrb r5, [r5] cmp r5, #0x0 bne PrimoWeather ClassicRoutine: ldr r5, TypeChart add r0, r3, r5 ldrb r0, [r0] ClassicReturn: cmp r0, r8 ldr r2, Return bx r2 PrimoWeather: FireUseless: cmp r5, #[B][I][U]0xBE[/U][/I][/B] /*Index number of your ability Primordial Sea*/ bne WaterUseless ldr r5, TypeChart add r0, r3, r5 ldrb r0, [r0] push {r1} mov r1, #0xA cmp r1, r8 beq Damped pop {r1} b ClassicReturn WaterUseless: cmp r5, #[B][I][U]0xBF[/U][/I][/B] /*Index number of your ability Desolate Land*/ bne ClassicRoutine ldr r5, TypeChart add r0, r3, r5 ldrb r0, [r0] push {r1} mov r1, #0xB cmp r1, r8 beq Evaporated pop {r1} b ClassicReturn Evaporated: ldr r0, BattleScript1 b EndFail Damped: ldr r0, BattleScript2 EndFail: pop {r1} ldr r1, ActiveBSPointer str r0, [r1] ldr r1, ReturnFail bx r1 .align 2 Return: .word 0x08047144+1 ReturnFail: .word 0x08047266+1 FreeRam: .word 0x0203E331 TypeChart: .word [B][I][U]0x08E3D114[/U][/I][/B] /*Take care to change this address accordingly to your type chart*/ BattleScript1: .word [U][I][B]0x08YourOffset[/B][/I][/U] /*Change accordingly to the location your battle script1*/ BattleScript2: .word [B][I][U]0x08YourOffset[/U][/I][/B] /*Change accordingly to the location your battle script2*/ ActiveBSPointer: .word 0x02024214 /*00 48 00 47 XX+1 XX XX 08 at 0x4713C*/
Spoiler:
Code:.thumb push {r4, r5, lr} cmp r4, #2 bne Back ldr r4, FreeRam ldrb r4, [r4] cmp r4, #[B]0xC0[/B] /*Index number Delta Stream*/ bne Back lsl r0, r0, #0x18 lsr r4, r0, #0x18 cmp r4, #0xA ble Nope ldr r5, Damage ldr r0, [r5] ldr r1, Return2 mov pc, r1 Back: lsl r0, r0, #0x18 lsr r4, r0, #0x18 Nope: ldr r5, Damage ldr r0, [r5] mul r0, r4 ldr r1, Return mov pc, r1 .align 2 FreeRam: .word 0x203E331 /*Free Ram for weathers*/ Damage: .word 0x020241F0 Return: .word 0x8046F6C+1 Return2: .word 0x8046F72+1 /*00 49 08 47 xx+1 xx xx 08 at 46F60*/
Battlescripts :
Spoiler:
At BattleScript1:
Spoiler:
at PPPPPP :Code:#org 0xYourOffset pause 0x20 setword 0x203E320 0x8PPPPPP printstring 0x184 end2
Spoiler:
the "move evaporated.." thingCode:CE DC D9 00 D1 D5 E8 D9 E6 AE E8 ED E4 D9 00 D5 E8 E8 D5 D7 DF FE D9 EA D5 E4 E3 E6 D5 E8 D9 D8 00 DD E2 00 E8 DC D9 00 DC D5 E6 E7 DC 00 E7 E9 E2 E0 DD DB DC E8 AB
[/code]
At BattleScript2:
Spoiler:
At KKKKKK :Code:#org 0xYourOffset pause 0x20 setword 0x203E320 0x8KKKKKK printstring 0x184 end2
Spoiler:
"Move damped..."Code:CE DC D9 00 C0 DD E6 D9 AE E8 ED E4 D9 00 D5 E8 E8 D5 D7 DF FE DA DD EE EE E0 D9 D8 00 E3 E9 E8 00 DD E2 00 E8 DC D9 00 DC D9 D5 EA ED 00 E6 D5 DD E2 AB
Checking switch-out :
Spoiler:
The routine :
Spoiler:
This is the MrDollSteak's regenerator routine wich I've modifed a bit to remove the permaweather if the mega/prima is switched out.Code:.text .align 2 .thumb .thumb_func .global regenerator AbilityBuffer: add r0, r1, r3 add r0, #0x20 ldrb r0, [r0] RegeneratorCheck: cmp r0, #[I][U]0x91[/U][/I] /*Index number of your ability Regenerator*/ beq Regenerator NaturalCureCheck: cmp r0, #0x1E bne CheckDelta NaturalCure: ldr r0, .Return bx r0 NoAbility: ldr r0, .Return2 bx r0 Regenerator: GetHP: add r3, #0x28 add r3, r1, r3 mov r1, #0x20 mul r0, r1 mov r1, #0x60 push {r3} bl Divide pop {r3} ldrh r1, [r3] add r0, r0, r1 b CheckHP CheckDelta: cmp r0, #[I][U]0xC0[/U][/I] /*Index number of your ability Delta Stream*/ beq Delta b CheckDesolate CheckHP: ldrh r2, [r3, #0x4] cmp r0, r2 ble StoreHP MaxHP: mov r0, r2 StoreHP: strh r0, [r3] BufferHealthChange: ldr r2, .CommandTable ldrb r1, [r4] ldr r0, .RamLoc ldr r0, [r0] add r0, r1, r0 add r0, #0x58 ldrb r0, [r0] lsl r0, r0, #0x2 add r0, r0, r2 ldrb r2, [r0] mov r0, r1 mul r0, r6 add r0, r0, r3 str r0, [sp] mov r0, #0x0 HealthChangeIndex: mov r1, #0x2A Success: ldr r3, .Return3 bx r3 Divide: ldr r3, .DivideLoc bx r3 CheckDesolate: cmp r0, #[I][U]0xBF[/U][/I] /*Index number of yout ability Desolate Land*/ beq Desolate CheckPrimordial: cmp r0, #[I][U]0xBE[/U][/I] /*Index number of yout ability Primordial Sea*/ beq Primordial b NoAbility NormalWeather: push {lr} bl ScriptPusher ldr r1, ActiveBS ldr r2, ScriptNormalWeather str r2, [r1] pop {pc} bl ScriptPoper b NoAbility Delta: ldr r2, .FreeRam ldrb r0, [r2] cmp r0, #[I][U]0xC0[/U][/I] /*Index number of your ability Delta Stream*/ bne NoAbility b ClearWeather Desolate: ldr r2, .FreeRam ldrb r0, [r2] cmp r0, #[I][U]0xBF[/U][/I] /*Index number of your ability Desolate Land*/ bne NoAbility b ClearWeather Primordial: ldr r2, .FreeRam ldrb r0, [r2] cmp r0, #[I][U]0xBE[/U][/I] /*Index number of your ability Primordial Sea*/ bne NoAbility ClearWeather: mov r0, #0x00 strb r0, [r2] ldr r2, .CurrentWeather mov r0, #0x00 strb r0, [r2] b NormalWeather ScriptPusher: ldr r0, ScriptPush bx r0 ScriptPoper: ldr r0, ScriptPop bx r0 .align 2 .CurrentWeather: .word 0x020243CC .FreeRam: .word 0x0203E331 .Return: .word 0x08055A9F .Return2: .word 0x08055AD3 .CommandTable: .word 0x08A20000 .RamLoc: .word 0x0202449C .Return3: .word 0x08055AC7 .DivideLoc: .word 0x082E7541 ActiveBS: .word 0x02024214 ScriptNormalWeather: .word 0x08UUUUUU ScriptPush: .word 0x0803FAFC+1 ScriptPop: .word 0x0803FB24+1 /*Insert 00 48 00 47 XX+1 XX XX 08 00 00 at 0x55A94*/
BattleScript at 0x08UUUUUU :
Spoiler:
Code:#org 0xA1FCF0 pause 0x40 setword 0x203E320 0x8GGGGGG printstring 0x184 return
At GGGGGG :
"The weather has returned to normal!"Code:CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
Second routine :
Spoiler:
This one clear the FreeRam in the end of every battle.Code:.thumb ldr r0, =0x803DE41 str r0, [r1] ldr r0, FreeRam mov r1, #0 strb r1, [r0] ldr r1, =0x30061E8 ldr r0, =0x8038421 str r0, [r1] ldr r0, =0x803DE2A mov pc, r0 .align 2 FreeRam: .word 0x0203E331 /*00 48 00 47 xx+1 xx xx 08 at 0803DDE4*/
Modification of FaintPokemon command :
Spoiler:
The Routines :
Spoiler:
Target Routine :
User Routine :Code:.text .align 2 .thumb .thumb_func .global clearweather Start: ldr r1, =0x02024064 ldr r0, BankTarget ldrb r0, [r0] strb r0, [r1] ldr r4, FreeRam ldrb r4, [r4] cmp r4, #0 beq Return push {r0-r3} ldr r1, BattleData mov r2, #0x58 mul r0, r2 add r0, r1 add r0, #0x20 ldrb r3, [r0] ldrb r2, [r0, #8] cmp r2, #0 bne PopAndReturn cmp r3, r4 beq Clear pop {r0-r3} b Return Clear: pop {r0-r3} ldr r4, FreeRam mov r3, #0 strb r3, [r4] ldr r4, CurrentWeather strb r3, [r4] ldr r0, BankUser ldrb r0, [r0] mov r9, r0 ldr r4, MoxieandClear ldr r0, =0x08049C18+1 bx r0 PopAndReturn: pop {r0-r3} Return: ldr r0, BankUser ldrb r0, [r0] mov r9, r0 ldr r0, Back bx r0 .align 2 CurrentWeather: .word 0x020243CC FreeRam: .word 0x0203E331 BankTarget: .word 0x0202420C BankUser: .word 0x0202420B BattleData: .word 0x02024084 MoxieandClear: .word 0x08PPPPPP Back: .word 0x08049C16+1 /*00 49 08 47 XX+1 XX XX 08 at 08049C08*/
Associated BattleScripts :Code:.text .align 2 .thumb .thumb_func .global clearweather Start: ldr r0, BankUser ldrb r0, [r0] strb r0, [r1] ldr r4, FreeRam ldrb r4, [r4] cmp r4, #0 beq Return push {r0-r3} ldr r1, BattleData mov r2, #0x58 mul r0, r2 add r0, r1 add r0, #0x20 ldrb r3, [r0] ldrb r2, [r0, #8] cmp r2, #0 bne PopAndReturn cmp r3, r4 beq Clear pop {r0-r3} b Return Clear: pop {r0-r3} ldr r4, FreeRam mov r3, #0 strb r3, [r4] ldr r4, CurrentWeather strb r3, [r4] ldr r0, BankTarget ldrb r0, [r0] mov r9, r0 ldr r4, NormalWeatherScript ldr r0, =0x08049C18+1 bx r0 PopAndReturn: pop {r0-r3} Return: ldr r0, BankTarget ldrb r0, [r0] mov r9, r0 ldr r0, Back bx r0 .align 2 CurrentWeather: .word 0x020243CC FreeRam: .word 0x0203E331 BankTarget: .word 0x0202420C BankUser: .word 0x0202420B BattleData: .word 0x02024084 NormalWeatherScript: .word 0x08HHHHHH Back: .word 0x08049BF4+1 /*00 48 00 47 XX+1 XX XX 08 at 08049BE8*/
Note : I assumed you implemented Moxie in your rom (see page 1 of this thread). So if you don't want that ability you can remove the underlined part in the first battlescript.
Spoiler:
Target BattleScript (at PPPPPP:
[/code]Code:For target : 56 00 39 40 00 1A 00 1B before the battlescript below. So you have to make it point on the "56". #dynamic 0xSomeOffset #freespace 0xFF #org @start attackcanceler printstring 0x1D printstring 0x130 pause 0x40 setword 0x203E320 0x8QQQQQQ printstring 0x184 waitmessage 0x40 [U]jumpifability 0x1 [B][I][U]0x9A[/U][/I][/B] @Moxie[/U] return [U]#org @Moxie jumpiffainted 0x1 @Ornot jumpifstat 0x1 0x0 0x1 0xC @Ornot pause 0x20 setbyte 0x202448F 0x0 playstatchangeanimation 0x1 0x2 0x0 setbyte 0x202448E 0x11 statbuffchange 0x1 TRUE @Ornot setword 0x203E320 0x8MoxieString printstring 0x184 waitmessage 0x40 return[/U] #org @Ornot return At QQQQQQ : [code]CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
User BattleScript :
[/code]Code:Assuming FA is your Setword command and 0203E320 your location of battle string: [B][I]FA[/I][/B] [I][U]F0 E3 03 02[/U][/I] QQ QQ QQ 08 10 84 01 12 40 00 56 01 39 40 00 1A 01 1B 01 10 1C 00 3C At QQQQQQ : [code]CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
Altering check for Air Lock/Cloud Nine :
Spoiler:
Code:.thumb Start: ldr r4, [sp, #0x48] lsl r0, r0, #0x18 lsr r0, r0, #0x18 str r0, [sp, #4] ldr r6, FreeRam ldrb r6, [r6] cmp r6, #0 bne NegCheck Return: ldr r6, =0x0804283C+1 mov pc, r6 NegCheck: cmp r2, #0xD beq Neg cmp r2, #0x4D bne Return Neg: mov r2, #0xFF b Return .align 2 FreeRam: .word 0x0203E331
Thank a lot to MrDollSteak to pointing me how to handle a good part of this, thanks to daniilS for help me to fix some bugs, and thanks to Touched for being really patient with me.
Hope this could be useful to someone, if there's any problem or bugs PM me
Can someone port it in FireRed?
Last edited: