Okay, so I fixed the problem. I forgot that sometimes people change var values by using "v = " instead of "var() = " because of that, I thought var(21) wasn't being used, when, it infact was. So I used var(43) instead and then found a new issue.
[State -2, ResistState]
type = SelfState
trigger1 = var(43) = 2
value = ifelse(random < 333, 6500, ifelse(random < 500, 12012, 5210))
ignorehitpause = 1
This selfstate was being triggered when the var changed to 2, but it was in State -2 so it spam triggered when the var finally changed.
When I realized this I fixed it, and so this is what I ended up with, just so that anyone in future who may need this can copy:
In State -2:
[State -2, VarSet]
type = VarSet
trigger1 = life = 0 && var(43) = 0
var(43) = 1
ignorehitpause = 1
[State -2, Resist]
type = AssertSpecial
trigger1 = stateno = 14000 && var(43) < 2
flag = noko
flag2 = nobardisplay
ignorehitpause = 1
[State -2, SecondChance]
type = SelfState
trigger1 = life = 0 && var(43) < 2
value = 14000
ignorehitpause = 1
In State of your choice (I chose 14000):
[Statedef 14000]
sprpriority = -1
[State 14000, ResistBy]
type = NotHitBy
trigger1 = life = 0 && var(43) = 1
value = SCA,AA,NA,SA,HA,AP,NP,SP,HP,AT,NT,ST,HT
ignorehitpause = 1
[State 14000, ResistPause]
type = SuperPause
trigger1 = life = 0 && var(43) = 1
time = 5
movetime = 5
supermovetime = 5
darken = 0
unhittable = 1
ignorehitpause = 1
[State 14000, ResistSet]
type = LifeSet
trigger1 = life = 0 && var(43) = 1
value = lifemax / 4.66
ignorehitpause = 1
[State 14000, VarSet]
type = VarSet
trigger1 = var(43) = 1
var(43) = 2
ignorehitpause = 1
[State 14000, ResistState]
type = SelfState
trigger1 = var(43) = 2
value = ifelse(random < 333, 6500, ifelse(random < 500, 12012, 5210))
ignorehitpause = 1
And there you have it. This code should partially restore your chars HP when it reaches 0, giving it a second chance for battle. You can use it for resurrection like effects.
EDIT: Since I don't have any vfx in mind for the char, I decided to make it look like a counter attack by putting "ResistState" at the end. You don't have to do this, you could have it simply changestate to 0 or add some vfx or whatever you want!