The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking > Binary Hack Research & Development
Reload this Page Code ASM Resource Thread

Notices
For all updates, view the main page.

Binary Hack Research & Development Got a well-founded knack with your binary Pokémon hacks? Love reverse-engineering them? For the traditional Pokémon ROM hacker, this is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!

Ad Content
Reply
 
Thread Tools
  #601   Link to this post, but load the entire thread.  
Old June 7th, 2015 (4:19 AM).
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Quote:
Originally Posted by KDS View Post
EV-enhancing items (Power Items)


Spoiler:

The routines assume that the Held Item Effect Bytes of the Power Items are in a particular order (same as that of Stat EVs in Pokemon Party Data Structure) and are consecutive.
For example, if Power Weight has Held Item Effect Byte 68, then Power Bracer will have 69, Power Belt 6A, Power Anklet 6B, Power Lens 6C and Power Band 6D.

So in the routines, you only need to specify the Held Item Effect Byte for Power Weight by replacing KK. The routine will automatically recognize other Power items.
Also I have not coded the Speed Drop, I might do it later and update the OP.
If you want to code the Speed Drop yourself, you can make a hook around the Macho Brace check for Speed Drop.

Fire Red:-
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func


    add r4, r0, #0x0 /*EV of a particular stat before checking pokerus and applying EV enhancers*/ 
    push {r2}  /*Store pokerus factor*/
    mov r0, r8  /*Load pokemon slot no*/
    mov r1, #0xC
    mov r2, #0x0
    bl Decrypter /* Load pokemon's item */
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    bl GetItemEffect /* Get Held Item's Effect Byte*/
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r3, #0xKK
    add r1, r6, r3 /* Load Power Item's Effect Byte*/
    pop {r2}
    cmp r1, r0 /*Match items*/ 
    bne NoPowerItem /*No Power Item or No Match for that particular stat*/
    add r4, r4, #0x4 /* Add Bonus 4+ EV */
    mul r4, r2 /*Use pokerus multiplier*/
    ldr r3, =0x080439D9
    bx r3

NoPowerItem:
    mul r4, r2
    mov r0, r8
    mov r1, #0xC
    ldr r3, =0x08043981
    bx r3

Decrypter:
    ldr r3, =0x0803FBE9
    bx r3

GetItemEffect:
    ldr r1, =0x0809A925
    bx r1

/*At 43978:00 49 08 47 XX+1 XX XX 08*/


Emerald:-
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func


    add r4, r0, #0x0 /*EV of a particular stat before checking pokerus and applying EV enhancers*/ 
    push {r2}  /*Store pokerus factor*/
    mov r0, r8  /*Load pokemon slot no*/
    mov r1, #0xC
    mov r2, #0x0
    bl Decrypter /* Load pokemon's item */
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    bl GetItemEffect /* Get Held Item's Effect Byte*/
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r3, #0xKK
    add r1, r6, r3 /* Load Power Item's Effect Byte*/
    pop {r2} /*Restore Pokerus Muliplier*/
    cmp r1, r0 /*Match items*/ 
    bne NoPowerItem /*No Power Item or No Match for that particular stat*/
    add r4, r4, #0x4 /* Add B Bonus 4+ EV */
    mul r4, r2 /*Use pokerus multiplier*/
    ldr r3, =0x0806DC25
    bx r3

NoPowerItem:
    mul r4, r2
    mov r0, r8
    mov r1, #0xC
    ldr r3, =0x0806DBCD
    bx r3

Decrypter:
    ldr r3, =0x0806A519
    bx r3

GetItemEffect:
    ldr r1, =0x080D74DD
    bx r1

/*At 6DBC4:00 49 08 47 XX+1 XX XX 08*/


KDS to make it easier, what you should do is have the same effect as the Macho Brace, and make the individual EV enhancing items use the secondary byte as 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 etc.

That way you don't need to code the extra speed drop for each individual effect.
__________________
Reply With Quote
  #602   Link to this post, but load the entire thread.  
Old June 7th, 2015 (4:36 AM). Edited June 8th, 2015 by Trainer 781.
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by MrDollSteak View Post
KDS to make it easier, what you should do is have the same effect as the Macho Brace, and make the individual EV enhancing items use the secondary byte as 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 etc.

That way you don't need to code the extra speed drop for each individual effect.
Hmm, this looks a great idea. Might need to add some bit of extra code for this.

EDIT: Now updated. :D
Reply With Quote
  #603   Link to this post, but load the entire thread.  
Old June 8th, 2015 (9:46 PM).
Xencleamas's Avatar
Xencleamas Xencleamas is offline
Suddenly lurking in the shadows...
 
Join Date: Feb 2014
Gender: Male
Nature: Adamant
Posts: 456
Quote:
Originally Posted by KDS View Post
EV-enhancing items (Power Items)
Nice work there KDS! Your are truly an ASM Lord! Haha! Anyway, can you also implement this idea as well:

Quote:
Originally Posted by leyn09 View Post
Is there a possibility to make sitrus berry work like on the later generations (increases 25% hp). If there is anyone knows how, please help me. Thanks!:D
__________________
Reply With Quote
  #604   Link to this post, but load the entire thread.  
Old June 8th, 2015 (10:35 PM).
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by Sky High View Post
Nice work there KDS! Your are truly an ASM Lord! Haha! Anyway, can you also implement this idea as well:
Thanks! My domain on ASM is only limited to Battle Mechanics though and I'm still learning new things.

Oran Berry would require some effort and some knowledge of regular scripting (which I haven't touched yet). I suppose it would require three routines:
1. One for pinch berry activation.
2. Second, when you use an Oran Berry on your Pokemon while battling.
3. Third, when you use an Oran Berry on your Pokemon in the Overworld.
Reply With Quote
  #605   Link to this post, but load the entire thread.  
Old June 9th, 2015 (3:20 PM). Edited June 11th, 2015 by BluRose.
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
I'd like to say that this thread has been really helpful for me as my ASM skills are far worse than sub-par and, also, the Chain-Fishing one in particular is really cool to me. (◕‿◕✿)

I'd also like to request something for Fire Red BPRE v1.0 (adding to the infinite list of requests...):
Stance Change.
Basically, where a Pokémon uses an offensive move and changes its form to a more offensive Pokémon (or, rather, just a different index-number Pokémon entirely). However, when it uses a certain move (or just a status move would be fine, too), it reverts back to the old form.
EDIT: Oh, and it would also have to revert to the other form outside of battle.
What I was thinking was two separate abilities in order to accomplish this, but if one is possible, then that's great too!
Thanks in advance!

God I sound so rude I am so sorry

EDIT: Also, should I go to DaniilS with this? I noticed that he had his own thread for form(e)s...

EDIT EDIT: Okay, I just noticed something while I was trying to get the Male-only and Female-only evolution methods working on Burmy.
But ALL of the Pokémon generated by your routine are Male unless if they have more of an 82 percent chance of being female, in which case they are, and the Pokémon already caught turn into females. This is also shown in you post showcasing it, as the Tyranitar are also all Male.
Just wanted to say this, haha...
Reply With Quote
  #606   Link to this post, but load the entire thread.  
Old June 13th, 2015 (4:18 PM).
Exodrake's Avatar
Exodrake Exodrake is offline
The Manliest Chick that Ever Manlied
 
Join Date: May 2013
Age: 29
Gender: Female
Nature: Quirky
Posts: 163
Quote:
Originally Posted by FBI agent View Post
You need the random number routine and the shiny generator routine I made. The three of them work in conjunction to make this effect happen. I know it works, because my test ROM is only shinies :x
Can someone post links to those required routines? I've been driving myself up a wall searching for them to no avail.
Reply With Quote
  #607   Link to this post, but load the entire thread.  
Old June 13th, 2015 (8:37 PM). Edited June 13th, 2015 by Kenny1.
Kenny1's Avatar
Kenny1 Kenny1 is offline
On a break from Rom hacking, to improve other skills.
 
Join Date: Nov 2013
Gender: Male
Posts: 86
Quote:
Originally Posted by Exodrake View Post
Can someone post links to those required routines? I've been driving myself up a wall searching for them to no avail.
FBI kinda did in the post about the routine: http://www.pokecommunity.com/showpost.php?p=8547374&postcount=400
Anyways, just in case: Shiny and Random
__________________
I'm no longer active here, I check back every now and then to see what happens, but that's it. I no longer hack either.
Reply With Quote
  #608   Link to this post, but load the entire thread.  
Old June 13th, 2015 (10:19 PM).
Exodrake's Avatar
Exodrake Exodrake is offline
The Manliest Chick that Ever Manlied
 
Join Date: May 2013
Age: 29
Gender: Female
Nature: Quirky
Posts: 163
Quote:
Originally Posted by Kenny1 View Post
FBI kinda did in the post about the routine: http://www.pokecommunity.com/showpost.php?p=8547374&postcount=400
Anyways, just in case: Shiny and Random
Gah I did not see those, were they not in the quoted version that I saved? I didn't see the original post, sorry about that! But thank you.
Reply With Quote
  #609   Link to this post, but load the entire thread.  
Old June 16th, 2015 (8:13 PM).
FamiliaWerneck's Avatar
FamiliaWerneck FamiliaWerneck is offline
 
Join Date: May 2015
Location: São Paulo, Brasil
Gender: Male
Posts: 275
Quote:
Originally Posted by FBI agent View Post
Controling what breeds with what and what hatches from the result can be done with a Pokemon editor iirc.
Few simple questions on breeding, egg groups and all that. You said it's all doable via a Pokémon Editor. What I want, actually is that Charizard evolutionary line breeds only with its line and/or Ditto. No Dragon/Monster egg groups. Will I have to make an egg group for each evolutionary family?
Also, how can I make Ditto breeds with himself too, not only all other Pokémon? And genderless Pokémon, like Magnemite? How can I make them breed?
Finally, for Nidorans and Volbeat/Illumise, I wanna make the male breed with the female, but not breedable with Ditto. How can I do it?

Quote:
Originally Posted by FBI agent View Post
Status update:
Today I've been working on breeding stat passing, particularly nature. I found that a Pokemon's nature in the gen iii games are determined rather randomly. It's done by PID % 25, = nature. In later games, you'll notice that nature is determined in otherways than PID. It's quite bad that FR uses this system because that means that the Pokemon's nature is going to be randomized quite well. I can't really modify the PID to match a certain nature because the PID is used to determine Pokemon IVs and all that good stuff, not to mention the checksum which turns a Pokemon into a badegg. What this means is that I would have to keep generating a new Pokemon UNTIL the PID generated from the game matches qualities of the PID I want. The process is rather complicated and I'm frankly debating whether or not it's worth the work. Honestly, does anyone actually breed farm in ROM hacks?
Here, I just want to know if I can make all Pokémon to be Docile as default or if I can change all natures' data, so all natures behave like Docile. Is either of these possible?
Thanks in advance!
Reply With Quote
  #610   Link to this post, but load the entire thread.  
Old June 16th, 2015 (11:21 PM).
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 792
Disabling "Gain money
" after defeating a trainer", it's useful for those who want to have a battle frontier
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #611   Link to this post, but load the entire thread.  
Old June 17th, 2015 (2:57 AM). Edited June 19th, 2015 by Trainer 781.
Trainer 781
Guest
 
Posts: n/a
Life Orb Recoil

Spoiler:

This only includes the Life Orb Recoil not the Life Orb Boost.
Credits to MrDollsteak for the Sheer Force Routine which I ripped from his Rombase.
Life Orb recoil is disabled for Volt Switch and U-turn in order to prevent damage to switched ally. (Special callasm in Battle Scripts of these Moves should be made in order to process Life Orb Recoil for them. Preferably before switching happens).
If you don't have Sheer Force, Magic Guard, U-turn or Volt Switch remove the bolded lines.
Replace KK with Held Effect Item Byte of Life Orb.

Bug/Oddity: It can trigger multiple times for multi-hit moves like Life Orb and multiple target moves like Earthquake in doubles. Fixed

Fire Red:-

Spoiler:


Routine at XXXXXX:
Code:
.text
.align 2
.thumb
.thumb_func
.global lifeorbrecoil

SheerForceCheck:
      ldr r1, .UserBank
      ldr r2, .BattleStruct
      ldrb r1, [r1, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x7E /*Sheer Force*/
      bne EffectCheck 
      ldr r0, .CurrMove
      ldrh r3, [r0, #0x0]
      mov r0, #0x0
      ldr r1, .FEHalfWord
      ldr r2, .SheerForceTable

Loop:
      lsl r4, r0, #0x01
      add r4, r4, r2
      ldrh r4, [r4, #0x0]
      cmp r3, r4
      beq Exit
      cmp r4, r1
      beq EffectCheck
      add r0, #0x1
      b Loop

EffectCheck:
      mov r1, r8
      cmp r1, #0x3E
      beq ShellBell
      cmp r1, #0xKK
      bne Exit
    
CheckOutcome:
      ldr r0, .Outcome
      ldrb r0, [r0, #0x0]
      mov r5, #0x29
      and r5, r0
      cmp r5, #0x0
      bne Exit

CheckUturnVoltSwitch:
      ldr r0, .CurrMove
      ldrh r0, [r0]
      ldrh r1, .VoltSwitchID
      cmp r0, r1
      beq Exit
      ldrh r1, .UTurnID
      cmp r0, r1
      beq Exit 

CheckIfMoveDamagedSomeTarget:
      ldr r1, .DamageStruct
      ldr r4, .TargetBank
      ldrb r2, [r4, #0x0]
      lsl r0, r2, #0x02
      add r0, r0, r2
      lsl r0, r0, #0x02
      add r6, r1, #0x4
      add r0, r0, r6
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit
      ldr r0, .FFHalfWord
      cmp r1, r0
      beq Exit
      
CheckIfUserIsNotTheTarget:
      ldr r0, .UserBank
      ldrb r3, [r0, #0x0]
      cmp r3, r2
      beq Exit

CheckMagicGuard:
      ldr r2, .BattleStruct
      ldrb r1, [r0, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x63 /*Magic Guard*/
      beq Exit

HPCheck:
      ldrh r1, [r0, #0x28]
      cmp r1, #0x0
      beq Exit

SetLifeOrbRecoilBit:
      ldr r1, .LORBit
      mov r0, #0x1
      strb r0, [r1]

Exit:
      ldr r1, .Return2
      bx r1

ShellBell:
      ldr r1, .Return1
      bx r1

.align 2
.UserBank: .word 0x02023D6B
.TargetBank: .word 0x02023D6C
.BattleStruct: .word 0x02023BE4
.DamageStruct: .word 0x02023ECC
.CurrMove: .word 0x02023D4A
.SheerForceTable: .word 0x08XXXXXX
.Outcome: .word 0x02023DCC
.FEHalfWord: .word 0x0000FEFE
.FFHalfWord: .word 0x0000FFFF
.Return1: .word 0x0801CF11
.Return2: .word 0x0801CFA7
.LORBit: .word 0x0203C038
.UTurnID: .word 0x000001YY
.VoltSwitchID: .word 0x000001ZZ

/*At 1CE58: 00 48 00 47 XX+1 XX XX 08*/
Routine at YYYYYY:
Code:
.text
.align 2
.thumb
.thumb_func
.global endcommandwithlifeorbsupport

Main:   
      ldr r1, .LORBit
      ldrb r0, [r1]
      cmp r0, #0x1
      bne EndCommand

LifeOrb:
      push {lr}
      push {r2-r7}
      mov r0, #0x0
      strb r0, [r1]
      ldr r0, .UserBank
      ldrb r3, [r0]      
      mov r0, #0x58
      mul r0, r3
      ldr r2, .BattleStruct
      add r2, r2, r0
      ldrh r0, [r2, #0x28]
      cmp r0, #0x0
      beq Exit
      ldr r0, =0x02023D6F
      strb r3, [r0, #0x0]
      ldr r0, =0x02023DC4
      strb r3, [r0, #0x17]
      ldr r4, =0x02023D50
      ldrh r0, [r2, #0x2C]
      mov r1, #0xA
      bl Divider
      strh r0, [r4, #0x0]
      cmp r0, #0x0
      bne NotZero
      mov r0, #0x1

NotZero:
      strh r0, [r4, #0x0]
      bl ScriptPusher
      ldr r1, .ScriptPointer
      ldr r0, .LifeOrbDamageScript
      str r0, [r1, #0x0]
      pop {r2-r7}
      pop {r0}
      bx r0

Exit:
       pop {r2-r7}
       pop {r0}

EndCommand:
      ldr r0, =0x08022CCD @Replace this with the offset of the 4th Mold Breaker Routine if you are using Mold Breaker
      bx r0

Divider:
      ldr r2, =0x081E4019
      bx r2

ScriptPusher:
      ldr r0, =0x08017545
      bx r0

.align 2
.LifeOrbDamageScript: .word 0x08BBBBBB
.ScriptPointer: .word 0x02023D74
.UserBank: .word 0x02023D6B
.BattleStruct: .word 0x02023BE4
.LORBit: .word 0x0203C038

@Set YY+1 YY YY 08 as the 'End' Battle Script Command.
Battle Script at BBBBBB:
Code:
39 20 00 FA 20 C0 03 02 SS SS SS 08 10 84 01 12 40 00 35 D0 3D 02 02 00 01 00 00 0B 01 0C 01 19 01 00 00 00 00 00 3C
String at SSSSSS:
Code:
FD 0F 00 E0 E3 E7 E8 00 E7 E3 E1 D9 00 E3 DA 00 DD E8 E7 00 C2 CA AB FF


Reply With Quote
  #612   Link to this post, but load the entire thread.  
Old June 17th, 2015 (4:36 AM). Edited June 17th, 2015 by Squeetz.
Squeetz's Avatar
Squeetz Squeetz is offline
ROM Hacker
 
Join Date: Jun 2013
Location: Norway
Age: 25
Gender: Male
Nature: Quiet
Posts: 236
I have a request.

A routine that copies the player's current pokemon in party (EVs IVs, moves, Abilities, held items, etc.) and pastes it on a trainerbattle (user gets to choose which trainer).
So, like a Battle With yourself. Would be cool as a final Battle or something.
Is this possible? Would be awesome if anyone made this.
__________________
Reply With Quote
  #613   Link to this post, but load the entire thread.  
Old June 18th, 2015 (4:43 PM).
Criminon's Avatar
Criminon Criminon is offline
Forever Spriting
 
Join Date: Aug 2012
Location: California
Gender: Male
Nature: Timid
Posts: 264
Anyone want to try to make it so you can only use 4 items per battle so you're on equal footing with the trainers you're fighting?
__________________
Unbound Team / Crown Team
Reply With Quote
  #614   Link to this post, but load the entire thread.  
Old June 19th, 2015 (4:28 PM).
Exodrake's Avatar
Exodrake Exodrake is offline
The Manliest Chick that Ever Manlied
 
Join Date: May 2013
Age: 29
Gender: Female
Nature: Quirky
Posts: 163
Can somebody post the code for the updated lightning rod/storm drain and sap sipper? I want to try modifying them to make my own abilities based on the same idea.
__________________

I'M A WITCH THAT'S HOW
Reply With Quote
  #615   Link to this post, but load the entire thread.  
Old June 19th, 2015 (4:55 PM). Edited June 20th, 2015 by MrDollSteak.
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Quote:
Originally Posted by KDS View Post
Life Orb Recoil

Spoiler:

This only includes the Life Orb Recoil not the Life Orb Boost.
Credits to MrDollsteak for the Sheer Force Routine which I ripped from his Rombase.
Life Orb recoil is disabled for Volt Switch and U-turn in order to prevent damage to switched ally. (Special callasm in Battle Scripts of these Moves should be made in order to process Life Orb Recoil for them).
If you don't have Sheer Force, Magic Guard, U-turn or Volt Switch remove the bolded lines.
Replace KK with Held Effect Item Byte of Life Orb.

Bug/Oddity: It can trigger multiple times for multi-hit moves like Life Orb and multiple target moves like Earthquake in doubles. Fixed

Fire Red:-

Spoiler:


Routine at XXXXXX:
Code:
.text
.align 2
.thumb
.thumb_func
.global lifeorbrecoil

SheerForceCheck:
      ldr r1, .UserBank
      ldr r2, .BattleStruct
      ldrb r1, [r1, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x7E /*Sheer Force*/
      bne EffectCheck 
      ldr r0, .CurrMove
      ldrh r3, [r0, #0x0]
      mov r0, #0x0
      ldr r1, .FEHalfWord
      ldr r2, .SheerForceTable

Loop:
      lsl r4, r0, #0x01
      add r4, r4, r2
      ldrh r4, [r4, #0x0]
      cmp r3, r4
      beq Exit
      cmp r4, r1
      beq EffectCheck
      add r0, #0x1
      b Loop

EffectCheck:
      mov r1, r8
      cmp r1, #0x3E
      beq ShellBell
      cmp r1, #0xKK
      bne Exit
    
CheckOutcome:
      ldr r0, .Outcome
      ldrb r0, [r0, #0x0]
      mov r5, #0x29
      and r5, r0
      cmp r5, #0x0
      bne Exit

CheckUturnVoltSwitch:
      ldr r0, .CurrMove
      ldrh r0, [r0]
      ldrh r1, .VoltSwitchID
      cmp r0, r1
      beq Exit
      ldrh r1, .UTurnID
      cmp r0, r1
      bew Exit 

CheckIfMoveDamagedSomeTarget:
      ldr r1, .DamageStruct
      ldr r4, .TargetBank
      ldrb r2, [r4, #0x0]
      lsl r0, r2, #0x02
      add r0, r0, r2
      lsl r0, r0, #0x02
      add r6, r1, #0x4
      add r0, r0, r6
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit
      ldr r0, .FFHalfWord
      cmp r1, r0
      beq Exit
      
CheckIfUserIsNotTheTarget:
      ldr r0, .UserBank
      ldrb r3, [r0, #0x0]
      cmp r3, r2
      beq Exit

CheckMagicGuard:
      ldr r2, .BattleStruct
      ldrb r1, [r0, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x63 /*Magic Guard*/
      beq Exit

HPCheck:
      ldrh r1, [r0, #0x28]
      cmp r1, #0x0
      beq Exit

SetLifeOrbRecoilBit:
      ldr r1, .LORBit
      mov r0, #0x1
      strb r0, [r1]

Exit:
      ldr r1, .Return2
      bx r1

ShellBell:
      ldr r1, .Return1
      bx r1

Divider:
      ldr r2, =0x081E4019
      bx r2

ScriptPusher:
      ldr r0, =0x08017545
      bx r0

.align 2
.UserBank: .word 0x02023D6B
.TargetBank: .word 0x02023D6C
.BattleStruct: .word 0x02023BE4
.DamageStruct: .word 0x02023ECC
.CurrMove: .word 0x02023D4A
.SheerForceTable: .word 0x08XXXXXX
.Outcome: .word 0x02023DCC
.FEHalfWord: .word 0x0000FEFE
.FFHalfWord: .word 0x0000FFFF
.Return1: .word 0x0801CF11
.Return2: .word 0x0801CFA7
.LORBit: .word 0x0203C038
.UTurnID: .word 0x000001YY
.VoltSwitchID: .word 0x000001ZZ

/*At 1CE58: 00 48 00 47 XX+1 XX XX 08*/
Routine at YYYYYY:
Code:
.text
.align 2
.thumb
.thumb_func
.global endcommandwithlifeorbsupport

Main:   
      ldr r1, .LORBit
      ldrb r0, [r1]
      cmp r0, #0x1
      bne EndCommand

LifeOrb:
      push {lr}
      push {r2-r7}
      mov r0, #0x0
      strb r0, [r1]
      ldr r0, .UserBank
      ldrb r3, [r0]      
      mov r0, #0x58
      mul r0, r3
      ldr r2, .BattleStruct
      add r2, r2, r0
      ldrh r0, [r2, #0x28]
      cmp r0, #0x0
      beq Exit
      ldr r0, =0x02023D6F
      strb r3, [r0, #0x0]
      ldr r0, =0x02023DC4
      strb r3, [r0, #0x17]
      ldr r4, =0x02023D50
      ldrh r0, [r2, #0x2C]
      mov r1, #0xA
      bl Divider
      strh r0, [r4, #0x0]
      cmp r0, #0x0
      bne NotZero
      mov r0, #0x1

NotZero:
      strh r0, [r4, #0x0]
      bl ScriptPusher
      ldr r1, .ScriptPointer
      ldr r0, .LifeOrbDamageScript
      str r0, [r1, #0x0]
      pop {r2-r7}
      pop {r0}
      bx r0

Exit:
       pop {r2-r7}
       pop {r0}

EndCommand:
      ldr r0, =0x08022CCD @Replace this with the offset of the 4th Mold Breaker Routine if you are using Mold Breaker
      bx r0

Divider:
      ldr r2, =0x081E4019
      bx r2

ScriptPusher:
      ldr r0, =0x08017545
      bx r0

.align 2
.LifeOrbDamageScript: .word 0x08BBBBBB
.ScriptPointer: .word 0x02023D74
.UserBank: .word 0x02023D6B
.BattleStruct: .word 0x02023BE4
.LORBit: .word 0x0203C038

@Set YY+1 YY YY 08 as the 'End' Battle Script Command.
Battle Script at BBBBBB:
Code:
39 20 FA 20 C0 03 02 SS SS SS 08 10 84 01 12 40 00 35 D0 3D 02 02 00 01 00 00 0B 01 0C 01 19 01 00 00 00 00 00 3C
String at SSSSSS:
Code:
FD 0F 00 E0 E3 E7 E8 00 E7 E3 E1 D9 00 E3 DA 00 DD E8 E7 00 C2 CA AB FF


I've noticed that this also prevents Sheer Force Pokemon getting any healing from the Shell Bell. This doesn't happen in the games I don't think. I'd probably do the Sheer Force Check after determining whether it has Shell Bell.

Great work! I'll have to link this post when I write up the rest of my Sheer Force routines on the Ability Resource Thread.

Quote:
Can somebody post the code for the updated lightning rod/storm drain and sap sipper? I want to try modifying them to make my own abilities based on the same idea.
These will be posted on the Ability Resource Thread eventually.
__________________
Reply With Quote
  #616   Link to this post, but load the entire thread.  
Old June 19th, 2015 (7:33 PM). Edited September 1st, 2015 by kleenexfeu.
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by KDS View Post
Life Orb Recoil

Spoiler:

This only includes the Life Orb Recoil not the Life Orb Boost.
Credits to MrDollsteak for the Sheer Force Routine which I ripped from his Rombase.
Life Orb recoil is disabled for Volt Switch and U-turn in order to prevent damage to switched ally. (Special callasm in Battle Scripts of these Moves should be made in order to process Life Orb Recoil for them).
If you don't have Sheer Force, Magic Guard, U-turn or Volt Switch remove the bolded lines.
Replace KK with Held Effect Item Byte of Life Orb.

Bug/Oddity: It can trigger multiple times for multi-hit moves like Life Orb and multiple target moves like Earthquake in doubles. Fixed

Fire Red:-

Spoiler:


Routine at XXXXXX:
Code:
.text
.align 2
.thumb
.thumb_func
.global lifeorbrecoil

SheerForceCheck:
      ldr r1, .UserBank
      ldr r2, .BattleStruct
      ldrb r1, [r1, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x7E /*Sheer Force*/
      bne EffectCheck 
      ldr r0, .CurrMove
      ldrh r3, [r0, #0x0]
      mov r0, #0x0
      ldr r1, .FEHalfWord
      ldr r2, .SheerForceTable

Loop:
      lsl r4, r0, #0x01
      add r4, r4, r2
      ldrh r4, [r4, #0x0]
      cmp r3, r4
      beq Exit
      cmp r4, r1
      beq EffectCheck
      add r0, #0x1
      b Loop

EffectCheck:
      mov r1, r8
      cmp r1, #0x3E
      beq ShellBell
      cmp r1, #0xKK
      bne Exit
    
CheckOutcome:
      ldr r0, .Outcome
      ldrb r0, [r0, #0x0]
      mov r5, #0x29
      and r5, r0
      cmp r5, #0x0
      bne Exit

CheckUturnVoltSwitch:
      ldr r0, .CurrMove
      ldrh r0, [r0]
      ldrh r1, .VoltSwitchID
      cmp r0, r1
      beq Exit
      ldrh r1, .UTurnID
      cmp r0, r1
      beq Exit 

CheckIfMoveDamagedSomeTarget:
      ldr r1, .DamageStruct
      ldr r4, .TargetBank
      ldrb r2, [r4, #0x0]
      lsl r0, r2, #0x02
      add r0, r0, r2
      lsl r0, r0, #0x02
      add r6, r1, #0x4
      add r0, r0, r6
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit
      ldr r0, .FFHalfWord
      cmp r1, r0
      beq Exit
      
CheckIfUserIsNotTheTarget:
      ldr r0, .UserBank
      ldrb r3, [r0, #0x0]
      cmp r3, r2
      beq Exit

CheckMagicGuard:
      ldr r2, .BattleStruct
      ldrb r1, [r0, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x63 /*Magic Guard*/
      beq Exit

HPCheck:
      ldrh r1, [r0, #0x28]
      cmp r1, #0x0
      beq Exit

SetLifeOrbRecoilBit:
      ldr r1, .LORBit
      mov r0, #0x1
      strb r0, [r1]

Exit:
      ldr r1, .Return2
      bx r1

ShellBell:
      ldr r1, .Return1
      bx r1

Divider:
      ldr r2, =0x081E4019
      bx r2

ScriptPusher:
      ldr r0, =0x08017545
      bx r0

.align 2
.UserBank: .word 0x02023D6B
.TargetBank: .word 0x02023D6C
.BattleStruct: .word 0x02023BE4
.DamageStruct: .word 0x02023ECC
.CurrMove: .word 0x02023D4A
.SheerForceTable: .word 0x08XXXXXX
.Outcome: .word 0x02023DCC
.FEHalfWord: .word 0x0000FEFE
.FFHalfWord: .word 0x0000FFFF
.Return1: .word 0x0801CF11
.Return2: .word 0x0801CFA7
.LORBit: .word 0x0203C038
.UTurnID: .word 0x000001YY
.VoltSwitchID: .word 0x000001ZZ

/*At 1CE58: 00 48 00 47 XX+1 XX XX 08*/
Routine at YYYYYY:
Code:
.text
.align 2
.thumb
.thumb_func
.global endcommandwithlifeorbsupport

Main:   
      ldr r1, .LORBit
      ldrb r0, [r1]
      cmp r0, #0x1
      bne EndCommand

LifeOrb:
      push {lr}
      push {r2-r7}
      mov r0, #0x0
      strb r0, [r1]
      ldr r0, .UserBank
      ldrb r3, [r0]      
      mov r0, #0x58
      mul r0, r3
      ldr r2, .BattleStruct
      add r2, r2, r0
      ldrh r0, [r2, #0x28]
      cmp r0, #0x0
      beq Exit
      ldr r0, =0x02023D6F
      strb r3, [r0, #0x0]
      ldr r0, =0x02023DC4
      strb r3, [r0, #0x17]
      ldr r4, =0x02023D50
      ldrh r0, [r2, #0x2C]
      mov r1, #0xA
      bl Divider
      strh r0, [r4, #0x0]
      cmp r0, #0x0
      bne NotZero
      mov r0, #0x1

NotZero:
      strh r0, [r4, #0x0]
      bl ScriptPusher
      ldr r1, .ScriptPointer
      ldr r0, .LifeOrbDamageScript
      str r0, [r1, #0x0]
      pop {r2-r7}
      pop {r0}
      bx r0

Exit:
       pop {r2-r7}
       pop {r0}

EndCommand:
      ldr r0, =0x08022CCD @Replace this with the offset of the 4th Mold Breaker Routine if you are using Mold Breaker
      bx r0

Divider:
      ldr r2, =0x081E4019
      bx r2

ScriptPusher:
      ldr r0, =0x08017545
      bx r0

.align 2
.LifeOrbDamageScript: .word 0x08BBBBBB
.ScriptPointer: .word 0x02023D74
.UserBank: .word 0x02023D6B
.BattleStruct: .word 0x02023BE4
.LORBit: .word 0x0203C038

@Set YY+1 YY YY 08 as the 'End' Battle Script Command.
Battle Script at BBBBBB:
Code:
39 20 FA 20 C0 03 02 SS SS SS 08 10 84 01 12 40 00 35 D0 3D 02 02 00 01 00 00 0B 01 0C 01 19 01 00 00 00 00 00 3C
String at SSSSSS:
Code:
FD 0F 00 E0 E3 E7 E8 00 E7 E3 E1 D9 00 E3 DA 00 DD E8 E7 00 C2 CA AB FF


Well done on that KDS !

Same routine with Emerald offset !

Here :
Spoiler:

Spoiler:

Routine at XXXXXX:
Code:
.text
.align 2
.thumb
.thumb_func
.global lifeorbrecoil

SheerForceCheck:
      ldr r1, .UserBank
      ldr r2, .BattleStruct
      ldrb r1, [r1, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x7E /*Sheer Force*/
      bne EffectCheck 
      ldr r0, .CurrMove
      ldrh r3, [r0, #0x0]
      mov r0, #0x0
      ldr r1, .FEHalfWord
      ldr r2, .SheerForceTable

Loop:
      lsl r4, r0, #0x01
      add r4, r4, r2
      ldrh r4, [r4, #0x0]
      cmp r3, r4
      beq Exit
      cmp r4, r1
      beq EffectCheck
      add r0, #0x1
      b Loop

EffectCheck:
      mov r1, r8
      cmp r1, #0x1E
      beq KingsRock
      cmp r1, #0x3E
      beq ShellBell
      cmp r1, #0xKK    /*Life orb held item effect*/
      bne Exit
    
CheckOutcome:
      ldr r0, .Outcome
      ldrb r0, [r0, #0x0]
      mov r5, #0x29
      and r5, r0
      cmp r5, #0x0
      bne Exit

CheckUturnVoltSwitch:
      ldr r0, .CurrMove
      ldrh r0, [r0]
      ldrh r1, .VoltSwitchID
      cmp r0, r1
      beq Exit
      ldrh r1, .UTurnID
      cmp r0, r1
      beq Exit 

CheckIfMoveDamagedSomeTarget:
      ldr r1, .DamageStruct
      ldr r4, .TargetBank
      ldrb r2, [r4, #0x0]
      lsl r0, r2, #0x02
      add r0, r0, r2
      lsl r0, r0, #0x02
      add r6, r1, #0x4
      add r0, r0, r6
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit
      ldr r0, .FFHalfWord
      cmp r1, r0
      beq Exit
      
CheckIfUserIsNotTheTarget:
      ldr r0, .UserBank
      ldrb r3, [r0, #0x0]
      cmp r3, r2
      beq Exit

CheckMagicGuard:
      ldr r2, .BattleStruct
      ldrb r1, [r0, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x63 /*Magic Guard*/
      beq Exit

HPCheck:
      ldrh r1, [r0, #0x28]
      cmp r1, #0x0
      beq Exit

SetLifeOrbRecoilBit:
      ldr r1, .LORBit
      mov r0, #0x1
      strb r0, [r1]

Exit:
      ldr r1, .Return2
      bx r1

KingsRock:
      ldr r0, .Return3
      bx r0

ShellBell:
      ldr r1, .Return1
      bx r1

Divider:
      ldr r2, =0x082E7540+1
      bx r2

ScriptPusher:
      ldr r0, =0x0803FAFC+1
      bx r0

.align 2
.UserBank: .word 0x0202420B
.TargetBank: .word 0x0202420C
.BattleStruct: .word 0x02024084
.DamageStruct: .word 0x0202437C
.CurrMove: .word 0x020241EA
.SheerForceTable: .word 0x08XXXXXX
.Outcome: .word 0x0202427C
.FEHalfWord: .word 0x0000FEFE
.FFHalfWord: .word 0x0000FFFF
.Return1: .word 0x08045794+1
.Return2: .word 0x0804582A+1
.Return3: .word 0x080456EC+1
.LORBit: .word 0x0203E338	/*It's actually a FreeRam loc*/
.UTurnID: .word 0x00000YYY	/*ID number of U-Turn*/
.VoltSwitchID: .word 0x00000ZZZ	/*ID number of Volt Switch*/

/*At 080456DC: 00 48 00 47 XX+1 XX XX 08*/

Spoiler:

Routine at YYYYYY:
Code:
.text
.align 2
.thumb
.thumb_func
.global endcommandwithlifeorbsupport

Main:   
      ldr r1, .LORBit
      ldrb r0, [r1]
      cmp r0, #0x1
      bne EndCommand

LifeOrb:
      push {lr}
      push {r2-r7}
      mov r0, #0x0
      strb r0, [r1]
      ldr r0, .UserBank
      ldrb r3, [r0]      
      mov r0, #0x58
      mul r0, r3
      ldr r2, .BattleStruct
      add r2, r2, r0
      ldrh r0, [r2, #0x28]
      cmp r0, #0x0
      beq Exit
      ldr r0, =0x0202420F
      strb r3, [r0, #0x0]
      ldr r0, =0x02024274
      strb r3, [r0, #0x17]
      ldr r4, =0x020241F0
      ldrh r0, [r2, #0x2C]
      mov r1, #0xA
      bl Divider
      strh r0, [r4, #0x0]
      cmp r0, #0x0
      bne NotZero
      mov r0, #0x1

NotZero:
      strh r0, [r4, #0x0]
      bl ScriptPusher
      ldr r1, .ScriptPointer
      ldr r0, .LifeOrbDamageScript
      str r0, [r1, #0x0]
      pop {r2-r7}
      pop {r0}
      bx r0

Exit:
       pop {r2-r7}
       pop {r0}

EndCommand:
      ldr r0, =0x0804B664+1
      bx r0

Divider:
      ldr r2, =0x082E7540+1
      bx r2

ScriptPusher:
      ldr r0, =0x0803FAFC+1
      bx r0

.align 2
.LifeOrbDamageScript: .word 0x08BBBBBB
.ScriptPointer: .word 0x02024214
.UserBank: .word 0x0202420B
.BattleStruct: .word 0x02024084
.LORBit: .word 0x0203E338	/*Same as in previous routine*/

/*YY+1 YY YY 08 must replaces the "end" command pointer */

Spoiler:

Battle Script at BBBBBB:
Code:
39 20 00 FA 20 E3 03 02 SS SS SS 08 10 84 01 12 40 00 35 80 42 02 02 00 01 00 

00 0B 01 0C 01 19 01 00 00 00 00 00 3C
String at SSSSSS:
Code:
FD 0F 00 E0 E3 E7 E8 00 E7 E3 E1 D9 00 E3 DA 00 DD E8 E7 00 C2 CA AB FF



Bonus:
-Life Orb boost
-Light ball updated
-Item that boost a certain type of attack for Emerald
-Timespace Orbs for Emerald

Note that for timespace orbs and new boost-type item, you can adjust the power added the same way than miracle seed and the like.

Spoiler:

Emerald:
Code:
CheckLifeOrb:
cmp r2, #0x43	/*Held item effect of life orb, I chose 0x43 (= 67 in decimal) because it's unused*/
beq Lifeorb

CheckNewItem:
cmp r2, #0x44	/*Held item effect of the boost item, I chose 0x44 (= 68 in decimal) because it's unused*/
beq NewItem

CheckAdamantOrb:
cmp r2, #0x45	/*Unused held item effect*/
bne CheckLustreous
ldrh r0, [r6]
mov r3, #0xFF	/*0xFF + 0xE4 = 0x1E3 = 483 = index number of Dialga*/
add r3, #0xE4
cmp r0, r3
beq AdamantOrb

CheckLustreous:
cmp r2, #0x46	/*Unused held item effect*/
bne CheckGriseous
ldrh r0, [r6]
mov r3, #0xFF	/*0xFF + 0xE5 = 0x1E4 = 484 = index number of Palkia*/
add r3, #0xE5
cmp r0, r3
beq LustreousOrb

CheckGriseous:
cmp r2, #0x47	/*Unused held item effect*/
bne CheckLightBall
ldrh r0, [r6]
mov r3, #0xFF	/*0xFF + 0xE8 = 0x1E7 = 487 = index number of Giratina*/
add r3, #0xE8
cmp r0, r3
beq GriseousOrb
b Back

AdamantOrb:
push {r0-r5}
mov r1, #8	/*Steel type*/
mov r2, #0x10	/*Dragon type*/
b CheckExceptionTypeAttack

LustreousOrb:
push {r0-r5}
mov r1, #0xB	/*Water type*/
mov r2, #0x10	/*Dragon type*/
b CheckExceptionTypeAttack

GriseousOrb:
push {r0-r5}
mov r1, #7	/*Ghost type*/
mov r2, #0x10	/*Dragon type*/
b CheckExceptionTypeAttack

NewItem:
push {r0-r5}
mov r1, #9	/*New type you want to boost*/
mov r2, #9	/*New type you want to boost, here I choose the same because I want it boost only one type*/

CheckExceptionTypeAttack:
ldr r4, CheckTypeLoc
ldr r4, [r4]
ldrb r4, [r4, #0x13]
cmp r4, #0
beq GetMoveType
mov r5, #0x3F
and r4, r5
cmp r4, r1
beq Boost
cmp r4, r2
beq Boost
b PopAndBack

Back:
ldr r0, Return
bx r0

PopAndBack:
pop {r0-r5}
b Back

CheckLightBall:
cmp r2, #0x2D
bne Back
ldrh r0, [r6]
cmp r0, #0x19
beq Lightball
b Back

GetMoveType:
ldr r3, CurMoveIndex
ldrh r3, [r3]
ldr r4, MoveData
mov r5, #0xC
mul r5, r3
add r4, r5
ldrb r4, [r4, #2]
cmp r4, r1
beq Boost
cmp r4, r2
bne PopAndBack

Boost:
pop {r0-r5}
ldrh r3, [r6, #0x2E]
lsl r0, r3, #4
push {r1}
mov r1, #6
mul r3, r1
pop {r1}
add r3, r0
lsl r3, #1
ldr r0, LocItems
add r3, r0
add r3, #0x13
ldrb r0, [r3]
mov r3, #0x52
mul r0, r3
lsr r0, #6
add r0, #0x7B
mul r7, r0
lsr r7, #7
mov r3, r8
mul r3, r0
lsr r3, #7
mov r8, r3
b Back

Lifeorb:
mov r0, r8
mov r3, #0xA7
mul r0, r3
lsr r0, #7
mov r8, r0
mul r7, r3
lsr r7, #7
b Back

Lightball:
mov r0, r8
lsl r0, r0, #0x1
mov r8, r0
lsl r7, r7, #0x1
b Back

.align 2
Return: .word 0x0806983E+1
LocItems: .word 0x085839A0           /*Location of your items Data*/
CurMoveIndex: .word 0x020241EA
MoveData: .word 0x0831C898           /*Location of your move data*/
CheckTypeLoc: .word 0x0202449C

/*00 48 00 47 XX XX XX 08 00 00 00 at 0x6982C*/
Fire Red:
Code:
cmp r2, #0x43   /*Held item effect, I chose 0x43 (=67 in dec) because it is unused in the game*/
beq Lifeorb
cmp r2, #0x2D
bne Back
ldrh r0, [r6]
cmp r0, #0x19
beq Lightball
b Back

Lifeorb:
mov r0, r8
mov r3, #0xA7
mul r0, r3
lsr r0, #7
mov r8, r0
mul r7, r3
lsr r7, #7
b Back

Lightball:
mov r0, r8
lsl r0, r0, #0x1
mov r8, r0
lsl r7, r7, #0x1

Back:
ldr r0, Return
bx r0

.align 2
Return: .word 0x0803F00A+1

/*00 48 00 47 XX XX XX 08 00 00 00 at 0803EFF8*/


Quote:
Originally Posted by leyn09 View Post
Thanks! Oh, will the FR ver. be available soon? :D
Yep, it is now updated
Reply With Quote
  #617   Link to this post, but load the entire thread.  
Old June 19th, 2015 (9:20 PM). Edited June 19th, 2015 by Trainer 781.
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by MrDollSteak View Post
I've noticed that this also prevents Sheer Force Pokemon getting any healing from the Shell Bell. This doesn't happen in the games I don't think. I'd probably do the Sheer Force Check after determining whether it has Sheer Force. Otherwise great work! I'll have to link this post when I write up the rest of my Sheer Force routines on the Ability Resource Thread.
Thanks.
Well it does prevent according to Bulbapedia.
Also, I have already done the Sheer Force Check after checking the ability (literally copy pasted line-to-line your Sheer Force implementation xD).

Quote:
Originally Posted by kleenexfeu View Post
Spoiler:

Well done on that KDS !
Thanks

Typo in the check Volt Switch/U-turn : bew exit instead of beq
I'll fix it, aha

Something else troubles me though. In that part :
EffectCheck:
mov r1, r8
cmp r1, #0x3E
beq ShellBell
cmp r1, #0xKK
bne Exit
Shouldn't you check King's Rock effect too ? There's cmp r1, #0x1E in the original routine.
You can. But there is no need, since the Battle Script for King Rock utilizes 'setbyte 0x2023E85' along with 'seteffecttargetwithchance' command which MrDS's Sheer Force implementation already handles. Choose whatever that looks more efficient to you.

Something else, I tried to port it to Emerald and failed. I think this is the part of the "end" command battle that causes problem.
I saw there's a difference beetwin Emerald and Fire Red Mold breaker routines regarding the part of the end command, so I tried to change a little bit that part of your routine but didn't managed to make it work.
Is there something obviously wrong ?
You have to insert the Routine at YYYYYY the same way as done in Fire Red. This involves, replacing the pointer to the 'end command' in the command table with the offset of this routine.
The 'EndCommand' label of Routine at YYYYYY should be this

Code:
EndCommand:
      ldr r1, =0x0804B666+1 @The pointer to the old 'end' command
      bx r1
Also in Emerald, you don't have to worry about whether Mold Breaker is there or not. The Pointer in the EndCommand label won't change unlike Fire Red.
Your routine was creating stack imbalance because it was not pushing and popping equal no of registers.



Responses in Bold.


Also, I might post a mini-documentation about the Battle Script Command 'cmd49' in the Quick R&D thread to provide insight of things that are happening at the End of a Move Execution.

And it will also help to create things like Weakness Policy, Rocky Helmet, Absorb Bulb etc.

Since I will be very busy doing College and Intern Projects, I don't have time to work on these for now. It would be better if some-one with free time will be able to work on these items.
Reply With Quote
  #618   Link to this post, but load the entire thread.  
Old June 21st, 2015 (4:11 AM).
leyn09's Avatar
leyn09 leyn09 is offline
Truant Trainer
 
Join Date: May 2011
Location: Philippines
Gender: Male
Nature: Careful
Posts: 84
Quote:
Originally Posted by kleenexfeu View Post
Well done on that KDS !

Bonus, Life Orb boost (lightball updated included) :

Spoiler:

Code:
cmp r2, #0x43
beq Lifeorb
cmp r2, #0x2D
bne Back
ldrh r0, [r6]
cmp r0, #19
beq Lightball
ldr r0, =(0x0806983F)
bx r0

Lifeorb:
mov r0, r8
mov r3, #0xA7
mul r0, r3
lsr r0, #7
mov r8, r0
mul r7, r3
lsr r7, #7
ldr r0, =(0x0806983F)
bx r0

Lightball:
mov r0, r8
lsl r0, r0, #0x1
mov r8, r0
lsl r7, r7, #0x1
ldr r0, =(0x0806983F)
bx r0

Back:
ldr r0, =0x0806983E+1
bx r0

/*00 48 00 47 XX XX XX 08 00 00 00 at 0x6982C*/
May I ask on how to incorporate the life orb recoil and boost?
Reply With Quote
  #619   Link to this post, but load the entire thread.  
Old June 21st, 2015 (1:02 PM).
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by leyn09 View Post
May I ask on how to incorporate the life orb recoil and boost?
The bunch of code you see here is ASM routine. If you don't know what is ASM, type on google or in this forum "ASM" and you'll see a lot of good tutorials.

If you know more or less what it is but don't know how to insert it, refer to that post because I can't explain it in a better way : http://www.pokecommunity.com/showpost.php?p=8526603&postcount=199

Btw you can simply read the tutorials on that thread, they're very good : http://www.pokecommunity.com/showthread.php?t=343871

For the rest, read the instruction put together with the routine.

If you still have problem (and you actually tried to make it work), you can PM me

Hope it'll help
Reply With Quote
  #620   Link to this post, but load the entire thread.  
Old June 21st, 2015 (3:48 PM).
leyn09's Avatar
leyn09 leyn09 is offline
Truant Trainer
 
Join Date: May 2011
Location: Philippines
Gender: Male
Nature: Careful
Posts: 84
Quote:
Originally Posted by kleenexfeu View Post
The bunch of code you see here is ASM routine. If you don't know what is ASM, type on google or in this forum "ASM" and you'll see a lot of good tutorials.

If you know more or less what it is but don't know how to insert it, refer to that post because I can't explain it in a better way : http://www.pokecommunity.com/showpost.php?p=8526603&postcount=199

Btw you can simply read the tutorials on that thread, they're very good : http://www.pokecommunity.com/showthread.php?t=343871

For the rest, read the instruction put together with the routine.

If you still have problem (and you actually tried to make it work), you can PM me

Hope it'll help
Oh sorry, my question was quite misleading. I know how to insert ASM. hehe. I was asking if the life orb will work if I just separately insert your LO boost and KDS' LO recoil? Or I should change a byte (the held item effect,maybe?) in your asm routine. Thanks!
Reply With Quote
  #621   Link to this post, but load the entire thread.  
Old June 22nd, 2015 (6:23 AM).
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by leyn09 View Post
Oh sorry, my question was quite misleading. I know how to insert ASM. hehe. I was asking if the life orb will work if I just separately insert your LO boost and KDS' LO recoil? Or I should change a byte (the held item effect,maybe?) in your asm routine. Thanks!
Oh ok. So yeah, they work seperatly, I edited my routine, the first "cmp 0x43" actually compare to held item effect of your life orb. I advice using an unused item effect.

Note that the boost power I post is only for Emerald though
Reply With Quote
  #622   Link to this post, but load the entire thread.  
Old June 24th, 2015 (3:30 AM).
leyn09's Avatar
leyn09 leyn09 is offline
Truant Trainer
 
Join Date: May 2011
Location: Philippines
Gender: Male
Nature: Careful
Posts: 84
Quote:
Originally Posted by kleenexfeu View Post
Oh ok. So yeah, they work seperatly, I edited my routine, the first "cmp 0x43" actually compare to held item effect of your life orb. I advice using an unused item effect.

Note that the boost power I post is only for Emerald though
Thanks! Oh, will the FR ver. be available soon? :D
Reply With Quote
  #623   Link to this post, but load the entire thread.  
Old June 29th, 2015 (10:19 AM).
Mr.Pkmn's Avatar
Mr.Pkmn Mr.Pkmn is offline
Ordinary ASM Magician
 
Join Date: May 2008
Posts: 54
Can we have run-like speed for surf and mach bike speed in FR? Even better would be an arbitrary speed value!
__________________
Someone making a pokemon hack

Reply With Quote
  #624   Link to this post, but load the entire thread.  
Old July 4th, 2015 (2:06 AM). Edited July 4th, 2015 by Telemetius.
Telemetius's Avatar
Telemetius Telemetius is offline
Tele*
 
Join Date: Nov 2014
Location: Italy
Gender: Male
Nature: Relaxed
Posts: 267
Hi FBI, first of all thanks for your work! You've been really helpful.
My question regards your battle routine http://www.pokecommunity.com/showthread.php?p=8527650#8527650 .
I've been trying it without success in my Ruby rom hack hoping it would work just like in Fire Red.
Is there any way to remove the whiteout after losing a battle in a Ruby hack rom?
Reply With Quote
  #625   Link to this post, but load the entire thread.  
Old July 6th, 2015 (7:57 PM).
leyn09's Avatar
leyn09 leyn09 is offline
Truant Trainer
 
Join Date: May 2011
Location: Philippines
Gender: Male
Nature: Careful
Posts: 84
Quote:
Originally Posted by daniilS View Post

Delete save and reset game after whiteout




I tried getting it to delete the save file and to return to the titlescreen afterwards, but I couldn't get a brief flash of the pokécenter to disappear. I might fix it later, but as for now, here's a much more simple version using SoftReset:
Code:
Type 5F F1 53 FC 00 DF at 0807F5B6 and F1 E7 at 0807F5D0.
Can its effectivity be toggled using flags?

Also, Is there any way how to disable the usage of bag during battle? Thanks!
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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