Punkline
Dr. Frankenstack
- Joined
- May 15, 2015
- Messages
- 423
This is a very small module that can be used to scale the knockback force that characters receive while they are in a specific action state.
Included in the code is a blank list of knockback modifiers. Each modifier can be used to describe a scale value to be multiplied to the final knockback value when hit during a specified character:action.
You may install this code by using the latest version of Melee Code Manager.
Get the Code Here:
---
How to Use:
To create new knockback modifiers, open up the <Defensive_Knockback_Modifiers> function in MCM by using the Edit button, like so:
Once you have this open, place your cursor at the line above the comment that says:
# <- place new modifiers here
---
Entry Syntax:
You may use the following syntax to describe a modifier:
FF------ = Internal Character ID
--FFF--- = Action State ID
-----FFF = Modifier Coefficient
Together, these fields create a parsable 32-bit element that will be checked by the code on hitbox collisions.
You may add as many modifier entries as the DOL will allow for -- just make sure to include them before the null 00000000 terminator.
---
FF------
The character ID may be specified as “FF” to have a modifier apply to all characters.
Otherwise an internal character ID may be used to choose a specific character.
Internal Character IDs:
00 = Mario
01 = Fox
02 = Captain Falcon
03 = Donkey Kong
04 = Kirby
05 = Bowser
06 = Link
07 = Sheik
08 = Ness
09 = Peach
0A = Popo
0B = Nana
0C = Pikachu
0D = Samus
0E = Yoshi
0F = Jigglypuff
10 = Mewtwo
11 = Luigi
12 = Marth
13 = Zelda
14 = Young Link
15 = Dr. Mario
16 = Falco
17 = Pichu
18 = Mr. Game and Watch
19 = Ganondorf
1A = Roy
1B = Master Hand
1C = Crazy Hand
1D = Wireframe Male
1E = Wireframe Female
1F = Giga Bowser
20 = Sandbag
---
--FFF---
Action state IDs include both common actions and character-specific actions:
The following tables describe action states that are unique to a character motif:
---
-----FFF
The coefficient is a 12-bit fixed point, which includes an 8-bit mantissa.
0xF.FF = range between 0.0...16.0
The 4-bit F. portion is read as a whole number between 0 and 16
The 8-bit .FF portion is added to the whole number as a decimal point in units of 1/256
Here are some example inputs:
080 = 50% force
0C0 = 75% force
100 = 100% force (no effect)
140 = 125% force
180 = 150% force
1C0 = 175% force
200 = 200% force
---
Example Usage:
0215B140
02------ = Captain Falcon
--15B--- = Grounded Falcon Punch
-----140 = 125%
This modifier targets Captain Falcon, making it riskier to use his Falcon Punch. With 125% knockback force, he will be hit much harder by a counter attack than he normally would be.
When creating new modifiers, my advice is to not stray too far from 100%. Very large or very small coefficients may have a more dramatic effect than you anticipate. To help illustrate this, here’s a composite image of Captain Falcon being struck by an imperfect Marth fsmash at 0% dmg. The illustration marks the distance traveled using various coefficients in the above knockback modifier entry:
This next image illustrates Captain Falcon being struck by a fully charged tipper fsmash at 300% dmg:
As you can see from these images, approaching anything too far above 100%, or too close to 0% will have ridiculous effects.
When using a literal 0%, it’s possible to replicate the effect caused by Fox’s blaster:
This is effectively a “super-shield” like in Yoshi’s double jump.
Included in the code is a blank list of knockback modifiers. Each modifier can be used to describe a scale value to be multiplied to the final knockback value when hit during a specified character:action.
You may install this code by using the latest version of Melee Code Manager.
Get the Code Here:
Code:
-==-
Defensive Knockback Modifiers
Modify <Defensive_Knockback_Modifiers> to assign defensive coefficients to character:action_state IDs.
Follow the instructions in the comments, or visit here for more info about usage:
https://smashboards.com/threads/defensive-knockback-modifiers-1-0.456230/
[Punkline]
<Defensive_Knockback_Modifiers>
4E800021
# place an arbitrary number of character:action state IDs below these comments:
# FF------ = Internal Character ID
# --FFF--- = Action State ID
# -----FFF = fixed point: 0xF.FF
# <- place new modifiers here
# terminator:
00000000
1.02 --- 8008d940 ----- 7c7f1b78 -> branch
7C7F1B78 C03F1850 7D57E2A6 3C800805 7C97E3A6
bl <Defensive_Knockback_Modifiers>
7CA802A6 80C50000 38A50004 2C060000 41820044 54C7463E 813F0004 2C8700FF 7C093800 4C422342 4082FFDC 54C7A53E 813F0010 7C093800 4082FFCC 54C7053E B0E1FFF0 E0017FF0 EC010032 D01F1850 7D57E3A6 00000000
Code:
-==-
!
ASM - Defensive Knockback Modifiers
Modify <Defensive_Knockback_Modifiers> to assign defensive coefficients to character:action_state IDs.
Follow the instructions in the comments, or visit here for more info about usage:
https://smashboards.com/threads/defensive-knockback-modifiers-1-0.456230/
[Punkline]
<Defensive_Knockback_Modifiers>
4E800021
# place an arbitrary number of character:action state IDs below these comments:
# FF------ = Internal Character ID
# --FFF--- = Action State ID
# -----FFF = fixed point: 0xF.FF
# <- place new modifiers here
# terminator:
00000000
1.02 --- 8008d940 ----- 7c7f1b78 -> branch
# INJ: on knockback adjustment check, before any math
mr r31, r3 # original instruction backs up player GObj_data argument
# r31 = player data base
lfs f1, 0x1850(r31)
# f1 = current knockback; stored value is about to be used as a variable in host function
mfspr r10, 919
lis r4, 0x0805
# 0b0011111100000000 = signed 6-bit int : L_scale
# 0b0000000000000111 = unsigned 3-bit : L_type
mtspr 919, r4
# GQR7 is backed up in r10, and now L_ = 8 scale, type 5
# this causes dequantization to scale by 2^8,
# and the input to be interpreted as a type 5: U16 - 16-bit unsigned integer.
# the casted result is a 16-bit fixed point loaded as a 32-bit floating point
# -- this makes it so that an integer may be used to represent a packed floating point
# --- but the value has constant fidelity that's based on the L_scale value
# in this case, L_scale = 8 (bits)
# so:
# 8-bit int: FF.-- 255/1
# 8-bit mantissa: --.FF 255/256
bl <Defensive_Knockback_Modifiers>
mflr r5
# r5 = start of index for parser
_for_each_knockback_modifier:
lwz r6, 0(r5)
addi r5, r5, 4
cmpwi r6, 0
beq- _return
# parse uses a 0 terminator
rlwinm r7, r6, 8, 0xFF
lwz r9, 0x4(r31)
cmpwi cr1, r7, 0xFF
cmpw cr0, r9, r7
crorc eq, eq, lt+4
# if IDs match and ID spec or ID is >= 0xFF, then this is the correct character
bne+ _for_each_knockback_modifier
# if this is not the right chracter ID, then look for next entry
# else, check the action state
# (the ID "FF" will be recognized as a wildcard value; applying to all characters)
rlwinm r7, r6, 20, 0xFFF
lwz r9, 0x10(r31)
cmpw r9, r7
bne+ _for_each_knockback_modifier
# if this is not the right action state, then look for next entry
# else, read in knockback modifier, apply it, and exit parse
rlwinm r7, r6, 0, 0xFFF
sth r7, -0x10(sp)
.long 0xE0017FF0
# psq_l f0, -0x10(sp), 0, GQR7
# f0 = dequantized integer
fmuls f0, f1, f0
stfs f0, 0x1850(r31)
mtspr 919, r10
# multiply dequantized integer by current knockback value
# store calculated result, and restore GQR7 back to the way it was before dequantization
_return:
.long 0
---
How to Use:
To create new knockback modifiers, open up the <Defensive_Knockback_Modifiers> function in MCM by using the Edit button, like so:
# <- place new modifiers here
---
Entry Syntax:
You may use the following syntax to describe a modifier:
FF------ = Internal Character ID
--FFF--- = Action State ID
-----FFF = Modifier Coefficient
Together, these fields create a parsable 32-bit element that will be checked by the code on hitbox collisions.
You may add as many modifier entries as the DOL will allow for -- just make sure to include them before the null 00000000 terminator.
---
FF------
The character ID may be specified as “FF” to have a modifier apply to all characters.
Otherwise an internal character ID may be used to choose a specific character.
Internal Character IDs:
00 = Mario
01 = Fox
02 = Captain Falcon
03 = Donkey Kong
04 = Kirby
05 = Bowser
06 = Link
07 = Sheik
08 = Ness
09 = Peach
0A = Popo
0B = Nana
0C = Pikachu
0D = Samus
0E = Yoshi
0F = Jigglypuff
10 = Mewtwo
11 = Luigi
12 = Marth
13 = Zelda
14 = Young Link
15 = Dr. Mario
16 = Falco
17 = Pichu
18 = Mr. Game and Watch
19 = Ganondorf
1A = Roy
1B = Master Hand
1C = Crazy Hand
1D = Wireframe Male
1E = Wireframe Female
1F = Giga Bowser
20 = Sandbag
---
--FFF---
Action state IDs include both common actions and character-specific actions:
Taken from a section of the SSBM Data Sheet:
Code:
ID Action State
0000 DeadDown
0001 DeadLeft
0002 DeadRight
0003 DeadUp
0004 DeadUpStar
0005 DeadUpStarIce
0006 DeadUpFall
0007 DeadUpFallHitCamera
0008 DeadUpFallHitCameraFlat
0009 DeadUpFallIce
000A DeadUpFallHitCameraIce
000B Sleep
000C Rebirth
000D RebirthWait
000E Wait
000F WalkSlow
0010 WalkMiddle
0011 WalkFast
0012 Turn
0013 TurnRun
0014 Dash
0015 Run
0016 RunDirect
0017 RunBrake
0018 KneeBend
0019 JumpF
001A JumpB
001B JumpAerialF
001C JumpAerialB
001D Fall
001E FallF
001F FallB
0020 FallAerial
0021 FallAerialF
0022 FallAerialB
0023 FallSpecial
0024 FallSpecialF
0025 FallSpecialB
0026 DamageFall
0027 Squat
0028 SquatWait
0029 SquatRv
002A Landing
002B LandingFallSpecial
002C Attack11
002D Attack12
002E Attack13
002F Attack100Start
0030 Attack100Loop
0031 Attack100End
0032 AttackDash
0033 AttackS3Hi
0034 AttackS3HiS
0035 AttackS3S
0036 AttackS3LwS
0037 AttackS3Lw
0038 AttackHi3
0039 AttackLw3
003A AttackS4Hi
003B AttackS4HiS
003C AttackS4S
003D AttackS4LwS
003E AttackS4Lw
003F AttackHi4
0040 AttackLw4
0041 AttackAirN
0042 AttackAirF
0043 AttackAirB
0044 AttackAirHi
0045 AttackAirLw
0046 LandingAirN
0047 LandingAirF
0048 LandingAirB
0049 LandingAirHi
004A LandingAirLw
004B DamageHi1
004C DamageHi2
004D DamageHi3
004E DamageN1
004F DamageN2
0050 DamageN3
0051 DamageLw1
0052 DamageLw2
0053 DamageLw3
0054 DamageAir1
0055 DamageAir2
0056 DamageAir3
0057 DamageFlyHi
0058 DamageFlyN
0059 DamageFlyLw
005A DamageFlyTop
005B DamageFlyRoll
005C LightGet
005D HeavyGet
005E LightThrowF
005F LightThrowB
0060 LightThrowHi
0061 LightThrowLw
0062 LightThrowDash
0063 LightThrowDrop
0064 LightThrowAirF
0065 LightThrowAirB
0066 LightThrowAirHi
0067 LightThrowAirLw
0068 HeavyThrowF
0069 HeavyThrowB
006A HeavyThrowHi
006B HeavyThrowLw
006C LightThrowF4
006D LightThrowB4
006E LightThrowHi4
006F LightThrowLw4
0070 LightThrowAirF4
0071 LightThrowAirB4
0072 LightThrowAirHi4
0073 LightThrowAirLw4
0074 HeavyThrowF4
0075 HeavyThrowB4
0076 HeavyThrowHi4
0077 HeavyThrowLw4
0078 SwordSwing1
0079 SwordSwing3
007A SwordSwing4
007B SwordSwingDash
007C BatSwing1
007D BatSwing3
007E BatSwing4
007F BatSwingDash
0080 ParasolSwing1
0081 ParasolSwing3
0082 ParasolSwing4
0083 ParasolSwingDash
0084 HarisenSwing1
0085 HarisenSwing3
0086 HarisenSwing4
0087 HarisenSwingDash
0088 StarRodSwing1
0089 StarRodSwing3
008A StarRodSwing4
008B StarRodSwingDash
008C LipStickSwing1
008D LipStickSwing3
008E LipStickSwing4
008F LipStickSwingDash
0090 ItemParasolOpen
0091 ItemParasolFall
0092 ItemParasolFallSpecial
0093 ItemParasolDamageFall
0094 LGunShoot
0095 LGunShootAir
0096 LGunShootEmpty
0097 LGunShootAirEmpty
0098 FireFlowerShoot
0099 FireFlowerShootAir
009A ItemScrew
009B ItemScrewAir
009C DamageScrew
009D DamageScrewAir
009E ItemScopeStart
009F ItemScopeRapid
00A0 ItemScopeFire
00A1 ItemScopeEnd
00A2 ItemScopeAirStart
00A3 ItemScopeAirRapid
00A4 ItemScopeAirFire
00A5 ItemScopeAirEnd
00A6 ItemScopeStartEmpty
00A7 ItemScopeRapidEmpty
00A8 ItemScopeFireEmpty
00A9 ItemScopeEndEmpty
00AA ItemScopeAirStartEmpty
00AB ItemScopeAirRapidEmpty
00AC ItemScopeAirFireEmpty
00AD ItemScopeAirEndEmpty
00AE LiftWait
00AF LiftWalk1
00B0 LiftWalk2
00B1 LiftTurn
00B2 GuardOn
00B3 Guard
00B4 GuardOff
00B5 GuardSetOff
00B6 GuardReflect
00B7 DownBoundU
00B8 DownWaitU
00B9 DownDamageU
00BA DownStandU
00BB DownAttackU
00BC DownFowardU
00BD DownBackU
00BE DownSpotU
00BF DownBoundD
00C0 DownWaitD
00C1 DownDamageD
00C2 DownStandD
00C3 DownAttackD
00C4 DownFowardD
00C5 DownBackD
00C6 DownSpotD
00C7 Passive
00C8 PassiveStandF
00C9 PassiveStandB
00CA PassiveWall
00CB PassiveWallJump
00CC PassiveCeil
00CD ShieldBreakFly
00CE ShieldBreakFall
00CF ShieldBreakDownU
00D0 ShieldBreakDownD
00D1 ShieldBreakStandU
00D2 ShieldBreakStandD
00D3 FuraFura
00D4 Catch
00D5 CatchPull
00D6 CatchDash
00D7 CatchDashPull
00D8 CatchWait
00D9 CatchAttack
00DA CatchCut
00DB ThrowF
00DC ThrowB
00DD ThrowHi
00DE ThrowLw
00DF CapturePulledHi
00E0 CaptureWaitHi
00E1 CaptureDamageHi
00E2 CapturePulledLw
00E3 CaptureWaitLw
00E4 CaptureDamageLw
00E5 CaptureCut
00E6 CaptureJump
00E7 CaptureNeck
00E8 CaptureFoot
00E9 EscapeF
00EA EscapeB
00EB Escape
00EC EscapeAir
00ED ReboundStop
00EE Rebound
00EF ThrownF
00F0 ThrownB
00F1 ThrownHi
00F2 ThrownLw
00F3 ThrownLwWomen
00F4 Pass
00F5 Ottotto
00F6 OttottoWait
00F7 FlyReflectWall
00F8 FlyReflectCeil
00F9 StopWall
00FA StopCeil
00FB MissFoot
00FC CliffCatch
00FD CliffWait
00FE CliffClimbSlow
00FF CliffClimbQuick
0100 CliffAttackSlow
0101 CliffAttackQuick
0102 CliffEscapeSlow
0103 CliffEscapeQuick
0104 CliffJumpSlow1
0105 CliffJumpSlow2
0106 CliffJumpQuick1
0107 CliffJumpQuick2
0108 AppealR
0109 AppealL
010A ShoulderedWait
010B ShoulderedWalkSlow
010C ShoulderedWalkMiddle
010D ShoulderedWalkFast
010E ShoulderedTurn
010F ThrownFF
0110 ThrownFB
0111 ThrownFHi
0112 ThrownFLw
0113 CaptureCaptain
0114 CaptureYoshi
0115 YoshiEgg
0116 CaptureKoopa
0117 CaptureDamageKoopa
0118 CaptureWaitKoopa
0119 ThrownKoopaF
011A ThrownKoopaB
011B CaptureKoopaAir
011C CaptureDamageKoopaAir
011D CaptureWaitKoopaAir
011E ThrownKoopaAirF
011F ThrownKoopaAirB
0120 CaptureKirby
0121 CaptureWaitKirby
0122 ThrownKirbyStar
0123 ThrownCopyStar
0124 ThrownKirby
0125 BarrelWait
0126 Bury
0127 BuryWait
0128 BuryJump
0129 DamageSong
012A DamageSongWait
012B DamageSongRv
012C DamageBind
012D CaptureMewtwo
012E CaptureMewtwoAir
012F ThrownMewtwo
0130 ThrownMewtwoAir
0131 WarpStarJump
0132 WarpStarFall
0133 HammerWait
0134 HammerWalk
0135 HammerTurn
0136 HammerKneeBend
0137 HammerFall
0138 HammerJump
0139 HammerLanding
013A KinokoGiantStart
013B KinokoGiantStartAir
013C KinokoGiantEnd
013D KinokoGiantEndAir
013E KinokoSmallStart
013F KinokoSmallStartAir
0140 KinokoSmallEnd
0141 KinokoSmallEndAir
0142 Entry
0143 EntryStart
0144 EntryEnd
0145 DamageIce
0146 DamageIceJump
0147 CaptureMasterhand
0148 CapturedamageMasterhand
0149 CapturewaitMasterhand
014A ThrownMasterhand
014B CaptureKirbyYoshi
014C KirbyYoshiEgg
014D CaptureLeadead
014E CaptureLikelike
014F DownReflect
0150 CaptureCrazyhand
0151 CapturedamageCrazyhand
0152 CapturewaitCrazyhand
0153 ThrownCrazyhand
0154 BarrelCannonWait
The following tables describe action states that are unique to a character motif:
---
-----FFF
The coefficient is a 12-bit fixed point, which includes an 8-bit mantissa.
0xF.FF = range between 0.0...16.0
The 4-bit F. portion is read as a whole number between 0 and 16
The 8-bit .FF portion is added to the whole number as a decimal point in units of 1/256
Here are some example inputs:
080 = 50% force
0C0 = 75% force
100 = 100% force (no effect)
140 = 125% force
180 = 150% force
1C0 = 175% force
200 = 200% force
---
Example Usage:
0215B140
02------ = Captain Falcon
--15B--- = Grounded Falcon Punch
-----140 = 125%
This modifier targets Captain Falcon, making it riskier to use his Falcon Punch. With 125% knockback force, he will be hit much harder by a counter attack than he normally would be.
When creating new modifiers, my advice is to not stray too far from 100%. Very large or very small coefficients may have a more dramatic effect than you anticipate. To help illustrate this, here’s a composite image of Captain Falcon being struck by an imperfect Marth fsmash at 0% dmg. The illustration marks the distance traveled using various coefficients in the above knockback modifier entry:
This next image illustrates Captain Falcon being struck by a fully charged tipper fsmash at 300% dmg:
As you can see from these images, approaching anything too far above 100%, or too close to 0% will have ridiculous effects.
When using a literal 0%, it’s possible to replicate the effect caused by Fox’s blaster:
This is effectively a “super-shield” like in Yoshi’s double jump.
Last edited: