YesNoOk
avatar

Super Armor (Guarding disabled) (Read 26062 times)

Started by Noctis, September 16, 2012, 12:43:22 am
Share this topic:
Super Armor (Guarding disabled)
New #1  September 16, 2012, 12:43:22 am
  • ****
  • Hey, I'm Grump!
    • USA
    • soldier.ucoz.net/
*Some of the coding has been edited to work better thanks to Seravy's feedback. Some issues might still exist.

This first batch of coding is the helper which is the super armor.
Mostly everything is explained in the coding.
I'll be using my personal stateno which is 800. You can change it to whatever you want, but the most commonly used stateno for super armor is 9000.

Code:
;==============================================================================
;--| Super Armor |-------------------------------------------------------------
;==============================================================================
[Statedef 800]
type    = S
movetype= I
physics = S
velset = 0,0

[State 0, AssertSpecial]
type = AssertSpecial ;This is so the animation that this helper is using isn't visible. Without this, you'll basically be seeing a fully colored afterimage of your character.
trigger1 = 1
flag = invisible
flag2 = noshadow

[State 0, Turn]
type = Turn ;This is to turn the helper when your character turns.
trigger1 = facing != root,facing

[State 0, ChangeAnim]
type = ChangeAnim ;This is so the helpers animation is the exact same as your characters animation.
trigger1 = anim != Root,anim
value = Root,animelemno(0)
ignorehitpause = 1

[State 0, StateTypeSet]
type = StateTypeSet ;This is so your helper is read as S statetype when your character's statetype is S.
trigger1 = root,statetype = S
statetype = S
ignorehitpause = 1

[State 0, StateTypeSet]
type = StateTypeSet  ;This is so your helper is read as C statetype when your character's statetype is C.
trigger1 = root,statetype = C
statetype = C
ignorehitpause = 1

[State 0, StateTypeSet]
type = StateTypeSet;This is so your helper is read as A statetype when your character's statetype is A.
trigger1 = root,statetype = A
statetype = A
ignorehitpause = 1

[State 0, StateTypeSet]
type = StateTypeSet ;This is so your helper is read as L statetype when your character's statetype is L.
trigger1 = root,statetype = L
statetype = L
ignorehitpause = 1

;[State 800, 1]
;type = NotHitBy
;trigger1 = root,stateno = [120,159] ;This is so your character can block, but this super armor is not kind to blocking. It's better to disable guarding.
;value = SCA
;time = 1

[State 800, 2]
type = BindToParent ;This is so the helper stays on you at all times
trigger1 = 1
pos = 0,0

[State 800, 3]
type = ParentVarSet ;This sets the var that will control your health when the helper gets hit later on.
trigger1 = time = 0
v = 8
value = 0

[State 800, 4]
type = HitOverride ;This is so when the helper gets hit, it changes to stateno 801.
trigger1 = 1
attr = SCA, NA, SA, HA, NP, SP, HP, NT, ST, HT
stateno = 801
time = -1

[State 800, 5]
type = ChangeState ;This is so when you die or when more than one of these helpers exists, it'll destroy itself. You can add more triggers if you want. For example, a burst mode with super armor that is activated when var(50)=1. The burst mode and super armor deactivate when var(50)=0. You would want to put a "trigger3 = var(50)=0".
trigger1 = parent,life = 0
trigger2 = parent,numhelper(800) > 1
value = 802
;------------------------------------------------------------------------------
[Statedef 801]
type    = S
movetype= H
physics = S
ctrl = 0
velset = 0,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = invisible
flag2 = noshadow

[State 0, Turn]
type = Turn
trigger1 = facing != root,facing

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = anim != Root,anim
value = Root,animelemno(0)
ignorehitpause = 1

[State 801, 0]
type = ParentVarSet ;This var will read how much damage you've just taken and how many times you were hit.
trigger1 = time = 0
v = 8
value = floor(GetHitVar(damage) / GetHitVar(HitCount))

[State 801, 1]
type = ChangeState ;This will destroy the helper when you die.
trigger1 = parent,life = 0
value = 802

[State 801, 2]
type = ChangeState ;This changes the state back to helper 800.
trigger1 = Time = 1
value = 800
;------------------------------------------------------------------------------
[Statedef 802] ;This is the state that destroys the helper.
type    = S
movetype= I
physics = N
poweradd = 0
ctrl = 0
velset = 0, 0
anim = 9999 ;This is my blank animation used for destroying helpers. It's got a time of -1 and no image playing. Completely blank.

[state 802, 0]
type = destroyself
trigger1 = Time = 1

That's it for the helper. The next part is creating the helper.

Code:
[State -2, Helper] ;This does NOT have to be in your [Statedef -2]. It can be wherever. It's just most effective in your [Statedef -2] when spawning it through vars.
type = Helper
;Feel free to add as many triggers as you want. The triggers below are just required to prevent errors.
trigger1 = NumHelper(800) = 0 ;This is so it will only spawn if the helper doesn't already exist.
trigger1 = alive ;This is so it will only spawn if you're not dead.
stateno = 800
id = 800
name = "Super Armor"
keyctrl = 0
ownpal = 1

[State -2, VarSet] ;This var is necessary to make the next part of the coding work better and this belongs in your [Statedef -2].
type = VarSet
trigger1 = NumHelper(800) = 1
var(9) = 1
ignorehitpause = 1

[State -2, AssertSpecial]
type = AssertSpecial ;This is to disable blocking when the super armor is active because blocking messes up this super armor.
trigger1 = NumHelper(800) = 1
trigger1 = var(9)
flag = nostandguard
flag2 = nocrouchguard
flag3 = noairguard

The next part is a necessity and belongs in your [Statedef -3].

Code:
[State -3, NotHitBy] ;This is so your character does not get hit when the super armor is activated.
type = NotHitBy
trigger1 = var(9)
trigger1 = stateno != [120,159]
value = SCA
time = 1

[State -3, LifeAdd] ;This is the first part of the LifeAdd's that makes you take damage when the super armor is active.
type = LifeAdd
trigger1 = alive = 1
trigger1 = var(9)
trigger1 = Var(8)
time = 1
value = -Var(8)

[State -3, LifeAdd] ;This is the second part of the LifeAdd's that makes you take damage when the super armor is active.
type = LifeAdd
trigger1 = alive = 1
trigger1 = movetype = H
trigger1 = stateno != [120,159]
trigger1 = var(9) && !Var(8)
value = -floor(GetHitVar(damage) / GetHitVar(HitCount))

[State -3, SelfState] ;This was for when Guarding was not disabled. It's purpose was to send you straight to Stateno 0 should you get hit while stand/crouch guarding, but it doesn't work. You can disable this and the one below if you want. Or you can enable guarding and try to make it work.
type = SelfState
trigger1 = alive = 1
trigger1 = movetype = H
trigger1 = stateno != [120,159]
trigger1 = statetype != A
trigger1 = var(9)
value = 0
ctrl = 1

[State -3, SelfState] ;This was for when Guarding was not disabled. It's purpose was to send you straight to Stateno 50 should you get hit while air guarding, but it doesn't work.
type = SelfState
trigger1 = alive = 1
trigger1 = movetype = H
trigger1 = stateno != [120,159]
trigger1 = statetype = A
trigger1 = var(9)
value = 50
ctrl = 1

[State -3, VarSet] ;This removes var(9) when the super armor helper no longer exists.
type = VarSet
trigger1 = NumHelper(800) = 0
var(9) = 0
ignorehitpause = 1

I've never had problems with this piece of coding. I always use it. If someone comes across a problem or if I'm missing something please comment.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."
Last Edit: March 17, 2013, 10:58:51 pm by Noctis
Re: Super Armor
#2  September 17, 2012, 06:02:58 am
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Thats using the helper method, which I used to use. One issue though is if you want to make them affected by hitstun as a pause. While it's possible with the helper method using a workaround, I find it easier to do that through the hitoverride method. The tradeoff is that you'll need to use a changeanim controller at the beginning of each state instead of declaring the anim in the statedef, which can be equally as time consuming.

Either way, it might be beneficial to provide both methods. I might do it myself later when I have the time.
Re: Super Armor
New #3  September 17, 2012, 01:08:26 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
A few suggestions for that code
1.Use anim=root,anim in your changeanim to copy the exact clsn of the root. You don't want the helper to have clsn2 when the player doesn't, and you do want to copy the exact clsn location for every state, including attacks. Use the invisible flag to make the helper invisible.
2.Use statetypeset to copy the state type of the root. You don't want your helper to get hit when the player is crouching and the incoming attack can't hit crouching players.
3.Hitoverride prevents custom states from activating so the Nothitby for NT/ST/HT is not only unnecessary, but it will block non-custom stated attacks that have a T type hitdef for whatever reason (which often happens when for whatever reason you can't use A or P on an attack, you are only left with T...).
4.While you can guard with this code, the superarmor is inactive while guarding, so an unguardable (even if it's only unguarable in a specific situation, like against crouching opponents) will ignore the superarmor completely, even if it is a throw when you try to guard against it , but will be blocked if you don't. In short, with this code, guarding makes you vulnerable to attacks you are otherwise immune to.

This is my superarmor code (and it does include both methods) : http://elecbyte.com/wiki/index.php/Superarmor

One thing that worthy of mention is that damage dampeners will fail on helper type superarmors, so you might take significantly more damage than normal (or less if you apply your own dampener in the code like you did and it's different from the attacker's), while hitoverride superarmors doesn't always have this problem (they do if the state is not movetype=H only, but if it is H, then the attacker's dampeners will work as intended)
Last Edit: September 17, 2012, 01:13:18 pm by Seravy