• 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
    • Seen Jan 10, 2017
    Toxic that has perfect accuracy for poison-types.

    Works for Emerald

    Spoiler:
     
    Last edited:

    GOLDstandard

    Eclectic
    51
    Posts
    10
    Years
  • This is a particle I made for the move water shuriken
    View attachment 72755
    00 10 27 00 97 27 0A 03 28 01 0C 0C 08 19 B4 00 C0 02 28 7A 3E 08 02 00 04 14 19 9F 00 3F 02 08 7C 3E 08 02 04 00 00 00 00 01 00 01 00 03 F9 89 09 08 05 05 01 00 05 00 00 00 05 00 01 00 04 11 19 73 00 C0 02 54 4E 3D 08 02 02 06 00 FC FF 05 0B 03 0D 08

    i recommend using bonemerang's anim (above) as a base.

    View attachment 72756

    Edit:
    added v-create particle

    View attachment 72768
     
    Last edited:

    Tlachtli

    Crit happens.
    267
    Posts
    12
    Years
  • Here's an effect I wrote for Flower Shield, usable in Emerald. It individually raises the defense of all Grass Pokemon present in battle (works for 1v1 and 2v2), and if there are no Grass-types out (or their defenses are all maxed) it gives the "But it failed!" message instead of animating.
    Spoiler:
    I tacked it on as a special condition of Effect 11 (Withdraw, Harden, etc.) that branches for Flower Shield's move id; mixing it with an existing effect helps the AI understand how to use it better. All you need to do is make Flower Shield target everyone on the field (a la Earthquake) and give it the new Effect 11.
     
    180
    Posts
    10
    Years
    • Seen Jan 10, 2017
    Here's an effect I wrote for Flower Shield, usable in Emerald. It individually raises the defense of all Grass Pokemon present in battle (works for 1v1 and 2v2), and if there are no Grass-types out (or their defenses are all maxed) it gives the "But it failed!" message instead of animating.

    Whenever you give an attacking move the "Hit all other on the field" which Earthquake has, it ends up only hitting the opponent to the right. Have you tested so this doesn't happen with Flower Shield?

    Could be different since it is a status move...

    Anyway, nice work. I'll make sure to try it later.

    EDIT: I believe you made a little typo. Shouldn't "goto 0x82D8CA1" be "goto 0x82D8C85" (pointer to beginning of withdraw effect). Otherwise you miss out on the setbyte 0x202448E 0x12 when making a normal defense-raising moves such as Harden or Withdraw.
     
    Last edited:

    Tlachtli

    Crit happens.
    267
    Posts
    12
    Years
  • Whenever you give an attacking move the "Hit all other on the field" which Earthquake has, it ends up only hitting the opponent to the right. Have you tested so this doesn't happen with Flower Shield?

    Could be different since it is a status move...

    Anyway, nice work. I'll make sure to try it later.

    EDIT: I believe you made a little typo. Shouldn't "goto 0x82D8CA1" be "goto 0x82D8C85" (pointer to beginning of withdraw effect). Otherwise you miss out on the setbyte 0x202448E 0x12 when making a normal defense-raising moves such as Harden or Withdraw.

    The Withdraw effect is only one line (setbyte 0x202448E 0x12), then it branches off to a generic self-stat raiser shared by most self-targeting status moves. Flower Shield needs that setbyte the same as the other Defense raising moves do, so by putting it at the beginning of my effect it saves a jump, and means one less line in the Flower Shield-specific part.

    Most moves don't work with the "hit all on field" targeting because of the way the attacks are structured. Most attacks will write the index of the target into the target byte, execute the script, then end. Earthquake is specifically written to iterate the target byte instead of ending the script, so it re-reads the script for each valid target rather than only hitting one. I started my script as a combination of Earthquake's iteration with Withdraw's defense raising then did some extra fine-tuning, the basic idea being that it first raises the user's defense (if it's Grass type), then follows Earthquake's iteration to target each of the other Pokes and check for Grass type (and raise Defense accordingly).

    If you're interested, cmd25 is the command Earthquake uses to iterate the target byte. If you combine that with jumpwhiletargetvalid (which jumps to an address if the target is valid, ie not fainted or out-of-bounds) you can make the script repeat through all targets.
     
    5,256
    Posts
    16
    Years
  • I've made a fully functional Close Combat effect for FireRed, with the animation varying when one stat is already at its minimum (i.e. only lowering one), when both aren't at their minimum (i.e. lowering both) and when both are at their minimum (i.e. skipping the drops altogether). This does use ASM but I've since been told that it could be done with the jumpifstat command. I'm going to post this anyway. You'll need to have the battle script callasm command, too.

    Battle Script (use this for the effect ID):
    Code:
    [FONT="Courier New"]#dynamic 0x800000
    #freespacebyte 0xFF
    
    #org @start
    attackcanceler
    accuracycheck 0x8[B]1D695E[/B] 0x0
    attackstring
    ppreduce
    calculatedamage
    attackanimation
    waitanimation
    missmessage
    cmd5c 0x0
    waitstate
    graphicalhpupdate 0x0
    datahpupdate 0x0
    critmessage
    waitmessage 0x40
    resultmessage
    waitmessage 0x40
    faintpokemon 0x0 0x0 0x8000000
    callasm 0x8AABBCC + 1[/FONT]

    ASM at AABBCC:
    Code:
    [FONT="Courier New"].text
    .align 2
    .thumb
    .thumb_func
    
    Main:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, #0x1a
    add r1, r2
    ldrb r0, [r1]
    ldrb r2, [r1, #0x3]
    mov r3, #0x0
    cmp r0, r3
    beq DefIsZero
    cmp r2, r3
    beq SpDefIsZero
    ldr r4, .LowerBothBS
    b End
    
    DefIsZero:
    cmp r2, r3
    beq BothBS
    ldr r4, .LowerSpDefBS
    b End
    
    SpDefIsZero:
    ldr r4, .LowerDefBS
    b End
    
    BothBS:
    ldr r4, .EndBS
    
    End:
    ldr r5, .ActiveBSPointer
    str r4, [r5, #0x0]
    bx lr
    
    .align 2
    .BattleData:		.word 0x02023BE4
    .UserBank:		.word 0x02023D6B
    .ActiveBSPointer:	.word 0x02023D74
    .LowerSpDefBS:		.word 0x08SSSSSS
    .LowerDefBS:		.word 0x08DDDDDD
    .LowerBothBS:		.word 0x08BBBBBB
    .EndBS:			.word 0x08[B]1D694E[/B][/FONT]

    Battle script at SSSSSS (lowers SDef only):
    Code:
    [FONT="Courier New"]#dynamic 0x800000
    #freespacebyte 0xFF
    
    #org @start
    setbyte 0x2023FDF 0x0
    playstatchangeanimation 0x1 0x4 0x1
    setbyte 0x2023FDE 0x92
    statbuffchange 0x80 true @end
    jumpifbyte 0x0 statchange 0x2 @end
    printfromtable 0x83FE588
    waitmessage 0x40
    
    #org @end
    goto 0x8[B]1D694E[/B][/FONT]

    Battle script at DDDDDD (lowers Def only):
    Code:
    [FONT="Courier New"]#dynamic 0x800000
    #freespacebyte 0xFF
    
    #org @start
    setbyte 0x2023FDF 0x0
    playstatchangeanimation 0x1 0x20 0x1
    setbyte 0x2023FDE 0x95
    statbuffchange 0x80 true @end
    jumpifbyte 0x0 statchange 0x2 @end
    printfromtable 0x83FE588
    waitmessage 0x40
    
    #org @end
    goto 0x8[B]1D694E[/B][/FONT]

    Battle script at BBBBBB (lowers both):
    Code:
    [FONT="Courier New"]#dynamic 0x800000
    #freespacebyte 0xFF
    
    #org @start
    setbyte 0x2023FDF 0x0
    playstatchangeanimation 0x1 0x24 0x1
    setbyte 0x2023FDE 0x92
    statbuffchange 0x80 true @end
    jumpifbyte 0x0 statchange 0x2 @end
    printfromtable 0x83FE588
    waitmessage 0x40
    setbyte 0x2023FDE 0x95
    statbuffchange 0x80 true @end
    jumpifbyte 0x0 statchange 0x2 @end
    printfromtable 0x83FE588
    waitmessage 0x40
    
    #org @end
    goto 0x8[B]1D694E[/B][/FONT]

    The bolded offsets points to these battle scripts from vanilla FireRed:
    Code:
    [FONT="Courier New"]#org 0x1D695E
    attackstring
    ppreduce
    pause 0x20
    missmessage
    resultmessage
    waitmessage 0x40
    goto 0x81D694E[/FONT]

    Code:
    [FONT="Courier New"]#org 0x1D694E
    setbyte 0x2023FD8 0x0
    cmd49 0x0 0x0
    end[/FONT]

    Thanks to DoesntKnowHowToPlay for troubleshooting with me.
     
    Last edited:
    5,256
    Posts
    16
    Years
  • Here's an effect for Assurance, again for FireRed:

    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 assurance
    
    main:
    push {lr}
    ldr r0, targetBank
    ldrb r0, [r0]
    mov r1, #0x10
    mul r0, r1
    ldr r1, damage
    add r1, r0
    ldrb r0, [r1]
    ldrb r2, [r1, #0x2]
    cmp r0, #0x0
    bne double
    cmp r2, #0x0
    beq endasm
    
    double:
    mov r2, #0x2
    ldr r3, damageMultiplier
    strb r2, [r3, #0x0]
    
    endasm:
    pop {r0}
    bx r0
    
    .align 2
    targetBank: .word 0x02023D6C
    damage: .word 0x02023E90
    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]

    As usual, you'll need Jambo51's callasm command for this to work.
     
    Last edited:
    5,256
    Posts
    16
    Years
  • This lists moves from the first three generations whose effects have been changed or updated in Generations 4, 5 and 6.

    Code:
    Whirlwind		no longer works on same/higher levelled wild PKMN
    			ignores accuracy and evasion
    			bypasses protect and detect
    Bind			inflicts 1/8 of max. HP*
    Stomp		x2 base power & ignores accuracy and evasion if target has used Minimize**
    Jump Kick		Crash damage = 1/2 of user's max. HP, rounded down***
    Thrash		disrupted by:	missing
    						sleeping
    						paralysis
    						freeze
    						flinching
    						protecting target
    						immune target
    			if disrupted on final turn of Thrash, confusion still occurs****
    Roar			ignores accuracy and evasion
    			bypasses protect and detect
    Supersonic		bypasses sub
    Disable		always lasts 4 turns
    			reflected by Magic Coat++
    Acid			10% chance to drop Sp.D by 1 stage
    Growth		raises Atk and Sp.A stats by 1 stage
    			raises Atk and Sp.A stats by 2 stages in Sun
    Surf			hits all Pokémon on the field except the user
    Blizzard		ignores accuracy and evasion in Hail
    String Shot	drops Speed by 2 stages
    Thunder		ignores accuracy and evasion in Rain
    			lowered accuracy in Sun
    Dig			underground wild PKMN canot be captured
    Toxic			ignores accuracy and evasion if used by a Poison-type
    Rage			raging users get Attack stat boosts every time they get hit
    Mimic		mimicked moves have max PP, not 5 PP
    Focus Energy	increases crit ratio by 2 stages, not 1
    Bide			only endures 2 turns
    			hits Ghost-types, as well semi-invulnerable PKMN in Dive, Bounce or Shadow Force
    			broken by sleep
    Selfdestruct	user faints before dealing damage +
    			no longer halves target's Def +
    Waterfall		20% flinch chance
    Sky Attack		displays "<user> became cloaked in a harsh light!" instead of "<user> is glowing!" on turn 1
    Transform		copies shininess
    			fails on subs
    Conversion		can be stolen by Snatch
    			can be used on Curse (because Curse is Ghost-type)
    			changes the user's current type to match the type of the first of the user's moves
    Substitute		multi-strike moves continue after breaking sub
    			blocks intimidate
    			blocks transform
    			doesn't block sound-based moves
    Struggle		ignores accuracy & evasion
    			user takes 1/4 max. HP as recoil
    Sketch		can copy Metronome and Transform
    Spider Web	no longer traps Ghost-types+++
    Thief			doesn't permanently steal a Trainer's Pokémon's item
    			items can be stolen back
    Flail			base damage = (48 * CurrentHP) / MaxHP
    Conversion2	changes user's type to resist target's last move, including non-damaging moves
    Spite			reflected by Magic Coat
    			always deducts 4 PP
    Destiny Bond	target faints after the user
    Sandstorm		boosts Rock-type Pokémon's Sp.D by 50%
    Sleep Talk		can use PP-less moves
    Heal Bell		bypasses sub
    			bypasses Soundproof
    Encore		lasts 3 turns
    			reflected by Magic Coat, but then fails
    Sweet Scent	lowers evasion by 2 stages
    Hidden Power	base power of 60
    Crunch		20% chance to lower Def by 1 stage, not Sp.D
    Future Sight	now does Psychic-type damage
    			uses Sp.D stat of receiving Pokémon, not original target
    Beat Up		base power = (party member's base Attack) / 10 + 5
    			receives STAB from Dark-type users
    Uproar		lasts exactly 3 turns
    Stockpile		raises user's Def and Sp.D stat by 1 stage
    Spit Up		removes Stockpile boosts
    Swallow		removes Stockpile boosts
    Torment		activates the turn it is used
    			reflected by Magic Coat
    Facade		ignores Burn Attack cut
    Focus Punch	charging turn has +6 priority
    Nature Power	calls different moves: http://bulbapedia.bulbagarden.net/wiki/Nature_Power_(move)#Generation_VI
    Charge		boosts Sp.D by one stat
    Taunt		lasts exactly 3 turns
    			reflected by Magic Coat
    Trick			no longer permanently switches a Trainer's Pokémon's items
    Wish			heals for half of the user's max. HP, not the recipient's
    			affected by Snatch
    Ingrain		Ghost-types who have ingrained can switch
    Recycle		affected by Snatch
    Magic Coat		reflects Teeter Dance, Taunt, Torment
    Brick Break		no longer removes screens if target is Ghost-type
    Knock Off		deals 50% more damage if target has item
    Skill Swap		switch-in abilities like intimidate activate after being swapped
    Secret Power	different effects: http://bulbapedia.bulbagarden.net/wiki/Secret_Power_(move)#Generation_VI
    Dive			underwater wild PKMN canot be captured
    Camouflage	more types for different terrain: http://bulbapedia.bulbagarden.net/wiki/Camouflage_(move)#Generation_VI
    Tail Glow		raises Sp.A by 3 stages
    Mud Sport		active for exactly 5 turns++++
    Poison Fang	50% chance to badly poison target
    Aromatherapy	lists PKMN that are healed
    Covet		no longer permanently steals a Trainer's Pokémon's items
    Doom Desire	now does Steel-type damage
    			uses Sp.D stat of receiving Pokémon, not original target
    
    *applies to Bind, Wrap, Fire Spin, Clamp, Whirlpool, Sand Tomb
    **applies to Stomp, Body Slam
    ***applies to Hi Jump Kick
    ****applies to Thrash, Outrage, Petal Dance
    +applies to Selfdestruct, Explosion
    ++applies to Disable, Spite, Spkies, Foresight, Torment, Taunt, Odor Sleuth
    +++applies to Spider Web, Block, Mean Look
    ++++applies to Mud Sport, Water Sport

    This link may also be useful, as it lists all of the other changes that have been done to moves, such as base power and accuracy:
    http://bulbapedia.bulbagarden.net/wiki/List_of_modified_moves
     
    Last edited:

    DoesntKnowHowToPlay

    Tiny Umbrella with Lots and Lots of Good
    265
    Posts
    12
    Years
    • Seen Feb 24, 2024
    Oh right this thread exists.

    Sucker Pun (assumes status moves are flagged 0x2 in dpss byte):
    Spoiler:


    Stored Power:
    Spoiler:


    Punishment:
    Spoiler:



    Scripts are straightforward, just callasm the appropriate function at the start of a regular attack after reducing pp and announcing the attack. I don't use BSP so IDK what they decompile to, but it'll be similar to Flail with the command xAC replaced by callasm.
     
    Last edited:

    Trainer 781

    Guest
    0
    Posts
    Updated Hi Jump Kick [FR]:
    The script to insert
    Code:
    #dynamic 0x[YourOffset]
    #freespacebyte 0xFF
    
    #org @jumpkick
    attackcanceler
    accuracycheck @crash 0x0
    goto 0x81D692E
    
    #org @crash
    attackstring
    ppreduce
    pause 0x40
    resultmessage
    waitmessage 0x40
    jumpifbyte 0x4 0x2023DCC 0x8 0x81D694E
    printstring 0x60
    waitmessage 0x40
    bicbyte 0x2023DCC 0x1
    orword 0x2023DD0 0x100
    callasam 0x(offset to asm+1)
    graphicalhpupdate 0x1
    datahpupdate 0x1
    faintpokemon 0x1 0x0 0x0
    orbyte 0x2023DCC 0x1
    goto 0x81D694E

    The ASM for crash damage calculation:
    Code:
    .align 2
    .thumb
    .thumb_func
    
    main:
    push {r0-r4}
    ldr r0, .userBank
    ldrb r0, [r0, #0x0]
    ldr r1, .battleStruct
    mov r2, #0x58
    mul r0, r2
    add r4, r0, r1
    ldrh r3, [r4, #0x2c]
    lsr r3, #0x1
    ldr r0, .damageValue
    stm r0!, {r3}
    pop {r0-r4}
    bx lr
    
    .align
    .damageValue:  .word 0x02023D50
    .battleStruct:  .word 0x02023be4
    .userBank: .word 0x02023D6B

    The vanilla scripts:
    Code:
    #org 0x1D694E
    setbyte 0x2023FD8 0x0
    cmd49 0x0 0x0
    end

    Code:
    #org 0x1D692E
    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

    Also, to modernize to Gen 6, the scripts for powder and paralysis inducing moves need to be altered too, since now Grass pokemon are immune to powder moves and Electric pokemon cannot be paralysed.
     
    5,256
    Posts
    16
    Years
  • I've made an effect for both Power Swap and Guard Swap, using only one effect ID for both. This requires Jambo51's callasm command, as well as his battle string hack, which can both be found here. This is, as usual, for FireRed, though porting it should be easy:

    Battle Script:
    Code:
    [FONT="Courier New"]#dynamic 0x800000
    #freespacebyte 0xFF
    
    #org @start
    jumpifhalfword 0x0 0x2023D4A 0xCCCC @guardswap
    attackcanceler
    attackstring
    ppreduce
    accuracycheck 0x8[B]1D7DF2[/B] 0xFFFF
    callasm 0x8AAAAAA +1
    attackanimation
    waitanimation
    setword 0x203C020 0x8DDDDDD
    printstring 0x184
    waitmessage 0x40
    goto 0x8[B]1D694E[/B]
    
    #org @guardswap
    attackcanceler
    attackstring
    ppreduce
    accuracycheck 0x8[B]1D7DF2[/B] 0xFFFF
    callasm 0x8BBBBBB +1
    attackanimation
    waitanimation
    setword 0x203C020 0x8EEEEEE
    printstring 0x184
    waitmessage 0x40
    goto 0x8[B]1D694E[/B]
    [/FONT]

    CCCC = hex ID of Guard Swap

    Message at DDDDDD:
    Code:
    [FONT="Courier New"]FD 0F 00 E7 EB DD E8 D7 DC D9 D8 00 D5 E0 E0 00 D7 DC D5 E2 DB D9 E7 00 E8 E3 00 DD E8 E7 FE BB E8 E8 D5 D7 DF 00 D5 E2 D8 00 CD E4 AD 00 BB E8 DF 00 EB DD E8 DC 00 DD E8 E7 00 E8 D5 E6 DB D9 E8 AB FF 00[/FONT]

    This translates to:
    "<user> switched all changes to its Attack and Sp. Atk with its target!"

    Message at EEEEEE:
    Code:
    [FONT="Courier New"]FD 0F 00 E7 EB DD E8 D7 DC D9 D8 00 D5 E0 E0 00 D7 DC D5 E2 DB D9 E7 00 E8 E3 00 DD E8 E7 FE BE D9 DA D9 E2 E7 D9 00 D5 E2 D8 00 CD E4 AD 00 BE D9 DA 00 EB DD E8 DC 00 DD E8 E7 00 E8 D5 E6 DB D9 E8 AB FF 00[/FONT]

    This translates to:
    "<user> switched all changes to its Defense and Sp. Def with its target!"

    ASM at AAAAAA (Power Swap):
    Code:
    [FONT="Courier New"].text
    .align 2
    .thumb
    .thumb_func
    
    Start:
    push {lr}
    
    GetUserStats:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x19
    ldrb r3, [r1]
    ldrb r4, [r1, #0x3]
    
    GetFoeStats:
    ldr r1, .BattleData
    ldr r0, .TargetBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x19
    ldrb r5, [r1]
    ldrb r6, [r1, #0x3]
    
    SetUserAtkToFoeAtk:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x19
    strb r5, [r1]
    
    SetUserSpAtkToFoeSpAtk:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1c
    strb r6, [r1]
    
    SetFoeAtkToUserAtk:
    ldr r1, .BattleData
    ldr r0, .TargetBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x19
    strb r3, [r1]
    
    SetFoeSpAtkToUserSpAtk:
    ldr r1, .BattleData
    ldr r0, .TargetBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1c
    strb r4, [r1]
    
    End:
    pop {r0}
    bx lr
    
    .align 2
    .BattleData:		.word 0x02023BE4
    .UserBank:		.word 0x02023D6B
    .TargetBank:		.word 0x02023D6C[/FONT]

    ASM at BBBBBB (Guard Swap):
    Code:
    [FONT="Courier New"].text
    .align 2
    .thumb
    .thumb_func
    
    Start:
    push {lr}
    
    GetUserStats:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1A
    ldrb r3, [r1]
    ldrb r4, [r1, #0x3]
    
    GetFoeStats:
    ldr r1, .BattleData
    ldr r0, .TargetBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1A
    ldrb r5, [r1]
    ldrb r6, [r1, #0x3]
    
    SetUserDefToFoeDef:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1A
    strb r5, [r1]
    
    SetUserSpDefToFoeSpDef:
    ldr r1, .BattleData
    ldr r0, .UserBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1D
    strb r6, [r1]
    
    SetFoeDefToUserDef:
    ldr r1, .BattleData
    ldr r0, .TargetBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1A
    strb r3, [r1]
    
    SetFoeSpDefToUserSpDef:
    ldr r1, .BattleData
    ldr r0, .TargetBank
    ldrb r0, [r0]
    mov r2, #0x58
    mul r2, r0
    add r1, r2
    add r1, #0x1D
    strb r4, [r1]
    
    End:
    pop {r0}
    bx lr
    
    .align 2
    .BattleData:		.word 0x02023BE4
    .UserBank:		.word 0x02023D6B
    .TargetBank:		.word 0x02023D6C
    [/FONT]

    There's probably a more efficient way to combine those two routines together and include the check in the assembly, but this works fine even if it is a little bulky.
     
    Last edited:
    180
    Posts
    10
    Years
    • Seen Jan 10, 2017
    I've made a fully functional Close Combat effect for FireRed, with the animation varying when one stat is already at its minimum (i.e. only lowering one), when both aren't at their minimum (i.e. lowering both) and when both are at their minimum (i.e. skipping the drops altogether). This does use ASM but I've since been told that it could be done with the jumpifstat command. I'm going to post this anyway. You'll need to have the battle script callasm command, too.

    Could you please double-check your Close Combat asm. It does not work with Thumb.

    I'm not good at asm but a quick look at the stuff down at the bottom (Align 2) has pointers defined which are not in the code (.UserBank) and (.LowerBothBS) and in the main itself there is .CurrentMonIndex which is not down in the Align 2. list.

    Would you mind re-checking it with your notes and confirming with Thumb that it works for you?


    Oh right this thread exists.

    I've also ported Sucker Punch to Emerald:
    Spoiler:

    However, I can't manage to get "The Moved Failed" in my script. It just shows "XX Used Sucker Punch" and then nothing (everything works fine, just that this textstring doesn't come up). I've tried to add Resultmessage and missmessage after the callasm, but neither of that worked.

    This is my script (Uses Quick Attack effect spot):

    Spoiler:

    Do I need to add a printstring somewhere? Sorry if noobish question.
     
    Last edited:

    MrDollSteak

    Formerly known as 11bayerf1
    858
    Posts
    15
    Years
  • Here's an effect I wrote for Flower Shield, usable in Emerald. It individually raises the defense of all Grass Pokemon present in battle (works for 1v1 and 2v2), and if there are no Grass-types out (or their defenses are all maxed) it gives the "But it failed!" message instead of animating.

    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?

    I've made an effect for both Power Swap and Guard Swap, using only one effect ID for both.

    There's probably a more efficient way to combine those two routines together and include the check in the assembly, but this works fine even if it is a little bulky.

    I'd probably hook this into Psych Up! Might be a good way to save another move effect slot.
    As Psych Up copies the opponents stat changes, I figure it'd have similar usage.

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

    Anyway, I've been working on redoing stat changing moves in the OP for Fire Red, these are all based on the existing scripts and are hooked into existing battle scripts. The only thing you'll need to change is the move IDs. They should all have the correct animations etc.

    The benefit of this as Doesn't mentioned is that the AI will be more intelligent in selecting moves.

    Hone Claws

    Spoiler:

    Flame Charge


    Spoiler:

    Charge Beam, Acid Spray and Fiery Dance

    Spoiler:

    Coil

    Spoiler:

    Quiver Dance and Geomancy

    Spoiler:


    Shift Gear and Shell Smash

    Spoiler:

    I'm currently working on porting Tlachtli's Flower Shield to Fire Red,
    as well as completing Work Up, Growth, and Rototiller.
    I just need to find the best move effect this to. I'm currently thinking
    of hooking into effect 12 (sp. atk) as most Pokemon that use Growth
    in particular, would be doing so for the Special Attack boost.
    Physical Pokemon would likely use the move anyway.

    Haven't tested these particularly, so if anyone spots any bugs let me know.
     
    Last edited:
    180
    Posts
    10
    Years
    • Seen Jan 10, 2017
    Oh, right, that was my mistake, sorry.

    Thanks!

    It compiles into Thumb now. However, it doesn't lower any stats. I've noticed that the .LowerBothBS is not in the script (but it is in the .Align 2) while the .LowerSpDefBS and .LowerDefBS are (Under BothBS, there is only ldr r4, .EndBS while the other two look differently. Perhaps that's the issue?

    I'm currently working on porting Tlachtli's Flower Shield to Fire Red,
    as well as completing Work Up, Growth, Shell Smash and Rototiller.
    I just need to find the best move effect this to. I'm currently thinking
    of hooking into effect 12 (sp. atk) as most Pokemon that use Growth and
    Shell Smash in particular, would be doing so for the Special Attack boost.
    Physical Pokemon would likely use the move anyway.

    Why not use Dragon Dance for Shell Smash? Although it raises attack, doesnt the game calculate that the Pokemon has raised Sp. Attack + Speed aswell after one Shell Smash and then proceed to attack if opponent is in OHKO range?
     
    Last edited:
    5,256
    Posts
    16
    Years
  • Thanks!

    It compiles into Thumb now. However, it doesn't lower any stats. I've noticed that the .LowerBothBS is not in the script (but it is in the .Align 2) while the .LowerSpDefBS and .LowerDefBS are (Under BothBS, there is only ldr r4, .EndBS while the other two look differently. Perhaps that's the issue?

    Oh, right, my mistake again, I'm just really dumb. Fixed in the original post. Turns out the stat animations were wrong too as they displayed stats being raised, and that's also been fixed. I've also added correct strings to the Power Swap / Guard Swap effects.
     
    Last edited:
    180
    Posts
    10
    Years
    • Seen Jan 10, 2017
    Oh, right, my mistake again, I'm just really dumb. Fixed in the original post. Turns out the stat animations were wrong too as they displayed stats being raised, and that's also been fixed. I've also added correct strings to the Power Swap / Guard Swap effects.

    Hmm.. Still Doesn't lower any stats :/
     

    MrDollSteak

    Formerly known as 11bayerf1
    858
    Posts
    15
    Years
  • Thanks!

    It compiles into Thumb now. However, it doesn't lower any stats. I've noticed that the .LowerBothBS is not in the script (but it is in the .Align 2) while the .LowerSpDefBS and .LowerDefBS are (Under BothBS, there is only ldr r4, .EndBS while the other two look differently. Perhaps that's the issue?



    Why not use Dragon Dance for Shell Smash? Although it raises attack, doesnt the game calculate that the Pokemon has raised Sp. Attack + Speed aswell after one Shell Smash and then proceed to attack if opponent is in OHKO range?

    The worry for this is having a Gorebyss with only special moves, ultimately It'd probably use the move in the first place for the Speed Boost, but theres always the chance. I'll give it a mull over.

    Oh, right, my mistake again, I'm just really dumb. Fixed in the original post. Turns out the stat animations were wrong too as they displayed stats being raised

    Spherical, I'd probably just handle the stat lowering through the battle script itself, easier to bug check.
     
    5,256
    Posts
    16
    Years
  • Hmm.. Still Doesn't lower any stats :/

    It does, but I edited it again since my post.

    Spherical, I'd probably just handle the stat lowering through the battle script itself, easier to bug check.

    This is true, though the original did work fine and I just messed it up when trying to make it readable. It should work now (in that, I completely redid it in my ROM using the scripts in the original post and it works fine). I might rewrite it in the future so that it's better though, that was one of my first ASM routines and one of my first battle scripts so it probably does need revision.
     
    Last edited:
    Back
    Top