My method uses a helper, in state -2 have a helper spawn. This is just an example, change numbers and triggers to your needs etc
;This is the actual helper armor
[State -2]
type = Helper
trigger1 = NumHelper(10000) = 0 ;<---this is the id of my helper, use whatever number youd like
trigger1 = !lose
ID = 10000
name = "Armor"
pos = 0,0
postype = p1
stateno = 10000
helpertype = normal
keyctrl = 0
ownpal = 1
Then I put this statedef it refers to under it in the -2 section
[Statedef 10000]
type = U
movetype= I
physics = N
poweradd= 0
ctrl = 0
anim = 0
sprpriority = 0
;they shouldnt see the helper
[State Armor]
type = AssertSpecial
trigger1 = 1
flag = invisible
;when hit go to state10001 below
[State Damage]
type = HitOverride
trigger1 = ishelper
attr = SCA,AA,AT,AP
time = -1
stateno = 10001
bind to player
[State Armor]
type = BindToRoot
trigger1 = 1
time = -1
facing = 1
pos = 0, 0
[State Armor]
type = NotHitBy
trigger1 = roundstate != 2
trigger2 = root,alive = 0
value = SCA,AA,AT,AP
;even if invisible, it has to change animation to your root (your character) so the hit boxes line up
[State Armor]
type = changeanim
trigger1 = 1
value = root,anim
elem = root,animelemno(0)
;this is so your helper doesn't "die"
[State Armor]
type = LifeAdd
trigger1 = 1
value = 10000
absolute = 1
[State Armor]
type = Turn
trigger1 = root,facing != facing
[State -2]
type = playerpush
trigger1 = 1
value = 1
[state -2]
type = DestroySelf
trigger1 = root,!alive
Then this is when they (the helper) gets hit state10001 right below it:
[Statedef 10001]
type = U
movetype= H
physics = N
poweradd= 0
ctrl = 0
anim = 0
sprpriority = 0
[State Armor]
type = AssertSpecial
trigger1 = 1
flag = invisible
[State Damage]
type = HitOverride
trigger1 = ishelper
attr = SCA,AA,AT,AP
time = -1
stateno = 10001
[State Armor]
type = BindToRoot
trigger1 = 1
time = -1
facing = 1
pos = 0, 0
[State Armor]
type = NotHitBy
trigger1 = roundstate != 2
trigger2 = root,alive = 0
trigger3 = 1
value = SCA,AA,AT,AP
[State Armor]
type = changeanim
trigger1 = 1
value = root,anim
elem = root,animelemno(0)
[State Armor]
type = LifeAdd
trigger1 = 1
value = 10000
absolute = 1
[State Armor]
type = Turn
trigger1 = root,facing != facing
;this is to calculate damage!!!
[State Damage]
type = parentvarset
trigger1 = 1
var(2) = gethitvar(damage) ;<--------Change variable number to whatever you want that is free, this var saves the damage being done
[State to10000]
type = changestate
trigger1 = time >= 1
value = 10000
[State -2]
type = playerpush
trigger1 = 1
value = 1
[state -2]
type = DestroySelf
trigger1 = root,!alive
Then we actually have to redirect that damage value to the root, we do that with a var and put these two in -2 state
[state -2]
type = lifeadd
trigger1 = 1
value = ceil(var(2) * -1) <---gets the damage value from helper to apply to character, var(2) saves the damage amount
ignorehitpause = 1
;you WANT the var that saves damage to always reset to 0 so damage is only applied to 1 frame
[state -2]
type = varset
trigger1 = 1
var(2) = 0
ignorehitpause = 1