• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Completed Add Frames of Armor/Knockback Resistance to Action States

rmn

Smash Rookie
Joined
Feb 15, 2016
Messages
15
Location
Alabama
This replicates the knockback resistance functionality present in the later Smash installations, allowing the knockback from hits weaker than a specified threshold to be ignored (while damage is still dealt normally). Note that this effect is distinct from Yoshi's double jump armor, which is subtractive.

Knockback resistance can be added to any frame window of any action state for any character. Additionally, a color overlay may be specified to visually indicate when knockback resistance is active.

$Knockback Resistance [rmn]
C208DA40 0000000C
4800006D 7C8802A6
88DE0007 C03E1850
881E000C 1C000004
7C840214 2C06000B
40A20008 38840002
A0040000 B001FFFC
C001FFFC FC010040
40A00018 C022A1C4
D03E1850 3C008006
6000D6A0 48000008
8001001C 38210018
60000000 00000000
C206CB80 NNNNNNNN
4800001C 4E800021
00000000 00000000
00000000 00000000
00000000 4BFFFFE9
7C8802A6 480000CD
7D2802A6 38A90004
88DF0007 80FF0010
C03F0894 FC20081E
D821FFF8 8101FFFC
881F000C 1C000004
7C840214 2C06000B
40A20008 38840002
88050000 2C0000FF
41820068 7C003000
40A20058 A0050002
7C003800 40A2004C
88050005 2C000000
41820018 7C080000
41810038 88050004
7C080000 4180002C
80C90000 54C0063F
41820018 3C008000
80FF0504 7C003B78
901F0504 90DF04B4
A0050006 48000010
38A50008 4BFFFF94
38000000 B0040000
8001001C 83E10014
3CA08006 60A5CB84
7CA803A6 4E800020
4E800021 UUUUUUUU
VV00WWWW XXYYZZZZ
FFFFFFFF 00000000


NNNNNNNN: Number of lines of code below this line. Will depend on the number of VV00WWWWXXYYZZZZ entries.

UUUUUUUU: Overlay color for frames of armor. RRGGBBAA. AA=00 to not use any overlay.

VV00WWWWXXYYZZZZ: Set armor for some frame window of an action state.
VV: Character ID
00: Unused space, may be used in a later version
WWWW: Action state ID
XX: Frame window start
YY: Frame window end. 00 for no frame window (in which case all frames of the AS will be armored)
ZZZZ: Knockback threshold--knockback below this value will be resisted. Value is specified as the upper 2 bytes of a 32-bit float.

Any number of VV00WWWWXXYYZZZZ entries may be inserted.
This example code uses a magenta color overlay for armor frames and adds armor to two action states:
  • Bowser will have functionally infinite knockback resistance during grounded fire breath.
  • Nana will resist knockback of less than 50 during frames 13-14 of fsmash (same window as when the hitboxes are active).
C208DA40 0000000C
4800006D 7C8802A6
88DE0007 C03E1850
881E000C 1C000004
7C840214 2C06000B
40A20008 38840002
A0040000 B001FFFC
C001FFFC FC010040
40A00018 C022A1C4
D03E1850 3C008006
6000D6A0 48000008
8001001C 38210018
60000000 00000000
C206CB80 00000022
4800001C 4E800021
00000000 00000000
00000000 00000000
00000000 4BFFFFE9
7C8802A6 480000CD
7D2802A6 38A90004
88DF0007 80FF0010
C03F0894 FC20081E
D821FFF8 8101FFFC
881F000C 1C000004
7C840214 2C06000B
40A20008 38840002
88050000 2C0000FF
41820068 7C003000
40A20058 A0050002
7C003800 40A2004C
88050005 2C000000
41820018 7C080000
41810038 88050004
7C080000 4180002C
80C90000 54C0063F
41820018 3C008000
80FF0504 7C003B78
901F0504 90DF04B4
A0050006 48000010
38A50008 4BFFFF94
38000000 B0040000
8001001C 83E10014
3CA08006 60A5CB84
7CA803A6 4E800020
4E800021 FF00FF50
05000156 00006FFF
0B00003C 0D0E4248
FFFFFFFF 00000000

# Armor V2

# Armor V2 (bugfixed)

#############################################################
# Part 1:
# Inject at 8008da40
# End of @8008d930, Damage_KnockbackAdjust_CC...
# Original instruction: addi r1, r1, 24
.set player_data, 30

bl 0x6c # Update to always point to data_storage of Part 2 injection
mflr r4
lbz r6, 0x7(player_data) # character ID
lfs f1, 0x1850(player_data) # KB amount
lbz r0, 0xC(player_data) # player slot
mulli r0, r0, 0x4
add r4, r4, r0 # armor amount save location
cmpwi r6, 0xB
bne+ check_kb
addi r4, r4, 0x2 # adjust for Nana

check_kb:
lhz r0, 0(r4) # KB threshold
sth r0, -4(sp)
lfs f0, -4(sp)
fcmpo cr0, f1, f0
bge+ do_nothing
lfs f1, -0x5e3c(rtoc) # Set KB = 0
stfs f1, 0x1850(player_data)
lis r0, 0x8006
ori r0, r0, 0xd6a0 # Branch past flinching
b done

do_nothing:
lwz r0, 0x1c(sp)

done:
addi sp, sp, 0x18

#############################################################
# PART 2:
# Inject at 8006cb80, in PlayerThink
# Original instruction: lwz r31, 0x0014 (sp)
.set player_data, 31
b code_start

data_storage:
blrl
.long 0 # Storage for "armor active" data
.long 0
.long 0
.long 0
.long 0

code_start:
bl data_storage
mflr r4
bl get_data
mflr r9
addi r5, r9, 0x4
lbz r6, 0x7(player_data) # character ID
lwz r7, 0x10(player_data) # Action state
lfs f1, 0x894(player_data) # AS frame
fctiwz f1, f1
stfd f1, -8(r1)
lwz r8, -4(r1) # frame (int)
lbz r0, 0xC(player_data) # player slot
mulli r0, r0, 0x4
add r4, r4, r0 # armor amount save location
cmpwi r6, 0xB
bne+ loop_start
addi r4, r4, 0x2 # adjust for Nana

loop_start:
lbz r0, 0(r5)
cmpwi r0, 0xFF # Check if end of data
beq- do_nothing
cmpw r0, r6 # Check character
bne+ continue
lhz r0, 2(r5)
cmpw r0, r7 # Check action state
bne+ continue
lbz r0, 5(r5)
cmpwi r0, 0 # Check if there is a frame window
beq armor_on
cmpw r8, r0 # Check frame window
bgt continue
lbz r0, 4(r5)
cmpw r8, r0
blt continue

armor_on:
lwz r6, 0x0(r9) # overlay color
rlwinm. r0, r6, 0, 24, 31
beq set_armor
lis r0, 0x8000
lwz r7, 0x504(player_data)
or r0, r0, r7
stw r0, 0x504(player_data) # color overlay on
stw r6, 0x4b4(player_data)
set_armor:
lhz r0, 6(r5) # KB threshold
b done

continue:
addi r5, r5, 0x8
b loop_start

do_nothing:
li r0, 0

done:
sth r0, 0(r4)
lwz r0, 0x1c(sp)
lwz r31, 0x0014 (sp)
lis r5, 0x8006
ori r5, r5, 0xcb84
mtlr r5
blr

get_data:
blrl
# Overlay:
.long 0xff00ff50 # Overlay color, RGBA. Use AA=00 for no overlay.

# Action State Armor Settings:
# VV00WWWW
# XXYYZZZZ
# UU: Character ID
# WWWW: Action State
# XX: Frame Window Start
# YY: Frame Window End (00 for no frame limitation)
# ZZZZ: Knockback threshold (upper half of 32-bit float)
.long 0x05000156 #Bowser massive armor during fire
.long 0x00006fff

.long 0x0b00003c # Nana 50-KB armor during fsmash hitboxes
.long 0x0d0e4248

# terminate data section
.long 0xFFFFFFFF

This code was inspired by a request from The Cape The Cape for light armor at all times on Bowser (I think related to something from Smash 4?). That original code is here:
$Universal Bowser Armor
C208DA48 00000008
881E0007 C03E1850
2C000005 40A2002C
3C00XXXX 9001FFFC
C001FFFC FC010040
40A00018 C022A1C4
D03E1850 3C808007
3884D6A0 7C8803A6
4E800020 00000000

XXXX: Knockback threshold (upper half of a 32-bit float). Any knockback less than this value will be ignored.
 
Last edited:

The Cape

Smash Master
Joined
May 16, 2004
Messages
4,478
Location
Carlisle, PA
Love your codes dude. Going to likely add this to Bowser and Yoshi down B

With those, I would want to start it as they travel down and continue until it ends. Would I put 00 on the YY, or would that simply give the entire animation heavy armor?
 
Last edited:

rmn

Smash Rookie
Joined
Feb 15, 2016
Messages
15
Location
Alabama
Fixed the bug I mentioned, and everything should work fine now.

For Bowser and Yoshi's down B, they actually freeze on a single animation frame for their entire descent (and they use the same AS for the descent portion of down B regardless of if the move was initiated on the ground or in the air). For Bowser, he stays on frame 32 of AS 362 (0x16A). For Yoshi, it's frame 20 of AS 368 (0x170). You could give them armor during descent by having it active on only that frame, letting XX and YY be the same number.
 

The Cape

Smash Master
Joined
May 16, 2004
Messages
4,478
Location
Carlisle, PA
Mer,

Do you think you could do a code similar to this but allowing subtractive armor on specific moves?
 

Stormghetti

Smash Journeyman
Joined
Aug 23, 2015
Messages
400
Location
Europe
Slippi.gg
STRM#798
NNID
Stormghetti
Petition to add a feature to flash an overlay color when you're hit during armor frames? Maybe even add the Smash charge shake effect when you're hit as well? Unless that's something to do with animations. I feel like this would also be a good indicator for armor frames because without the current overlay color activated, it kind of looks like you got a phantom hit. You don't get a fire aura when burnt and you don't get a darkness aura when hit by something with that element, which looks off. I don't want to make the armor frames look super obvious by making the character have an overlay color throughout the entirety of the move so I thought this would be a better alternative.
 
Last edited:
Top Bottom