YesNoOk
avatar

KOF Guard Anims (weak/strong variations) (Read 3586 times)

Started by PotS, March 05, 2008, 02:29:18 am
Share this topic:
KOF Guard Anims (weak/strong variations)
#1  March 05, 2008, 02:29:18 am
  • ******
    • network.mugenguild.com/pots/
So if you've ever played KOF you've probably noticed that characters use different animations when blocking weak or strong attacks.
This is something you rarely ever see brought to Mugen, but that can actually be done with relative ease, so here's one way to do it.




Animations

The anims for guarding against strong attacks will be your default ones, i.e. the ones filling the animation numbers required by Mugen (120, 121, etc), so just put them together like you normally would.
The reason for this is that these anims are used more often in KOF, so as such the ones for weak attacks will be those with the special coding.

Now, for every standing/crouching guard anim make its equivalent for weak attacks, adding 5 to the anim number. For example, Kasumi in guarding pose:

   

On the left there's animation 130, which is required by Mugen for standing guard, and on the right is animation 135, the same but to be used against weak attacks. Note that animation 135 isn't required by Mugen, we're only using it for this code.

That covers the anims.




States

First things first, you'll need to override Mugen's default guard states for this. To do it just copy states 120 to 155 from common1.cns (from the data folder) into your character's state files.

Now you'll need something that checks when the weak guard anim should be used, a variable will be used to store when the conditions for it are met:

[State 120, Weak]
type= VarSet
trigger1= !time
Var(1)= 0

[State 120, Weak]
type=VarSet
triggerall= !time &&StateType!=A && NumEnemy
trigger1= (EnemyNear(0),StateNo=[200,201]) || (EnemyNear(0),StateNo=[230,231])
trigger2= (EnemyNear(0),StateNo=400) || (EnemyNear(0),StateNo=430)
trigger3= (EnemyNear(0),StateNo=[600,601]) || (EnemyNear(0),StateNo=[630,631])
Var(1)=1

(Alternatively you can use P2StateNo instead of EnemyNear, I just like to use the latter.)

The first Sctrl is just so it always starts from the "off" position.
The second sets the variable to 1 if the nearest opponent is using a weak normal attack.
Of course since all we have to detect when's that is the standard state numbers used by most people for such attacks (200 = weak punch, and so on), StateNo is the only trigger we can use. More importantly, since this is just a visual change with no impact on gameplay, you don't need it to absolutely work against every attack of every char, so in this case the engine's limitations aren't so bad.

You'll need to include those two Sctrl at the top of states 120, 150 and 152.


Finally, now that the char can detect when to use the anims for weak attacks, you need to make it actually use them. To do this just edit all the anim changing in these states to be "+5 if weak attack", e.g.:

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 140 + (statetype = C) + (statetype = A)*2
Becomes
[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 140 + (statetype = C) + (statetype = A)*2 + (Var(1)!=0)*5

And


[State 130, 1]
type = ChangeAnim
trigger1 = Anim != 130
value = 130

Becomes

[State 130, 1]
type = ChangeAnim
trigger1 = Anim != 130 && Var(1)=0
trigger2 = Anim != 135 && Var(1)!=0
value = 130 + (Var(1)!=0)*5





Extra

In the KOF games the char only checks for the type of anim at the beginning of the guarding state and when getting hit, if you want it to switch anim while guarding if the opponent switches attack type, just add these Sctrl to states 130 and 131:


[State 130, Weak]
type=VarSet
trigger1= 1
Var(1)=0

[State 130, Weak]
type=VarSet
triggerall= StateType!=A && NumEnemy
trigger1= (EnemyNear(0),StateNo=[200,201]) || (EnemyNear(0),StateNo=[230,231])
trigger2= (EnemyNear(0),StateNo=400) || (EnemyNear(0),StateNo=430)
trigger3= (EnemyNear(0),StateNo=[600,601]) || (EnemyNear(0),StateNo=[630,631])
Var(1)=1



And that covers everything, I think.
Use anything you want from my works.  If you need to contact me use email, not private messages.
Re: KOF Guard Anims (weak/strong variations)
#2  March 05, 2008, 02:44:25 am
  • ****
    • Japan
The reason this is not converted to MUGEN is because it can't be done accurately outside a full game.

Your method assigns incorrect animations if the opponent uses a heavy basic in some characters (Iron's, OrochiKOF97's, mine)  because there is no standard numbers for that.

I recommend sticking to a single animation as this is pretty pointless.
Re: KOF Guard Anims (weak/strong variations)
#3  March 05, 2008, 03:40:27 am
  • ******
    • network.mugenguild.com/pots/
More importantly, since this is just a visual change with no impact on gameplay, you don't need it to absolutely work against every attack of every char, so in this case the engine's limitations aren't so bad.


Anyway, what are those anims you use for knockdowns? Note that it defaults to the "strong guard pose", so anything that's not a typical weak attack number triggers the normal guard.
Use anything you want from my works.  If you need to contact me use email, not private messages.
Re: KOF Guard Anims (weak/strong variations)
#4  March 06, 2008, 12:24:52 am
  • avatar
  • ******
  • Complicated.cns
    • Argentina
I tried this kind of things with my K' 3 days ago and came out very buggy :P (and the coding was similar to this) so after a lot of testing I just decided to not to use it and stick with 1 anim for the block >_> (and use the other one for the parrying anim)
Re: KOF Guard Anims (weak/strong variations)
#5  March 07, 2008, 10:05:16 am
  • ****
  • "Moyashi tsuku shite yaru..."
I had this feature implemented in my character and it works accurately most of the time. Well done, PotS.