YesNoOk
avatar

Walk cycle issue (Read 275 times)

Started by Plum, September 13, 2019, 08:14:18 pm
Share this topic:
Walk cycle issue
#1  September 13, 2019, 08:14:18 pm
  • **
  • Variables > Boyfriends
I have a transformation cycle that's working fine, but now I'm trying to add a third and final walk cycle using var(13) and it's not working even though it's identical to the others and var(10) and !var(10) works just fine. The animation is getting stuck on the first walk tick and it's weird since the others work are working. Is something wrong with variable(13) somehow?

Any help would be great, the code is pasted below.


; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
triggerall = var(10) = 0
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
triggerall = var(10) = 0
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[State 20, 1]
type = VelSet
triggerall = var(10) = 1
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)+.2

[State 20, 2]
type = VelSet
triggerall = var(10) = 1
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)+.2

[State 20, 1]
type = VelSet
triggerall = var(13) = 1
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
triggerall = var(13) = 1
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[state 0, 0]
type = changeanim
trigger1 = anim = 5
trigger1 = var(10) = 1
value = 7

[state 20, 1]
type = changeanim
triggerall = !var(10)
triggerall = Vel X > 0
trigger1 = anim != 5 && anim != 20 ;not turning or walking
trigger2 = anim = 5 && animtime = 0 ;turning, turn anim over
value = 20

[state 20, 1]
type = changeanim
triggerall = var(10)
triggerall = Vel X > 0
trigger1 = anim != 7 && anim != 30 ;not turning or walking
trigger2 = anim = 7 && animtime = 0 ;turning, turn anim over
value = 30


[state 20, 1]
type = changeanim
triggerall = !var(10)
triggerall = Vel X < 0
trigger1 = anim != 5 && anim != 21 ;not turning or walking
trigger2 = anim = 5 && animtime = 0 ;turning, turn anim over
value = 21

[state 20, 1]
type = changeanim
triggerall = var(10)
triggerall = Vel X < 0
trigger1 = anim != 7 && anim != 31 ;not turning or walking
trigger2 = anim = 7 && animtime = 0 ;turning, turn anim over
value = 31

[state 20, 1]
type = changeanim
triggerall = var(13)
triggerall = Vel X > 0
trigger1 = anim != 32 && anim != 32 ;not turning or walking
trigger2 = anim = 32 && animtime = 0 ;turning, turn anim over
value = 32



[state 20, 1]
type = changeanim
triggerall = var(13)
triggerall = Vel X < 0
trigger1 = anim != 33 && anim != 33 ;not turning or walking
trigger2 = anim = 33 && animtime = 0 ;turning, turn anim over
value = 33
Re: Walk cycle issue
#2  September 13, 2019, 09:28:49 pm
  • ***
    • deathscythemugen.neocities.org
I think using two variables like this is making them conflict. For example, you can have var(10) set to either 0 or 1, but not 0 and 1 at the same time, but you can also have var(13) and var(10) set to 0 or 1 at the same time. Not sure if you understand.

what exactly are variables 10 and 13?

Re: Walk cycle issue
#3  September 14, 2019, 12:29:20 am
  • **
  • Variables > Boyfriends
var 10 is a transformation, like a power downed state, var 13 is the powered up state. And honestly no... I don't really understand other than the part about me using two variables conflicting in such a way. But... you're saying I can have 13 and 10 set at the same time?
Re: Walk cycle issue
#4  September 14, 2019, 02:12:45 am
  • ***
    • deathscythemugen.neocities.org
Ok I'll try to explain a little more.

Let's say my character has 3 forms, he has the normal form, the evil form and the master form. Let's suppose I want a different stance for each form, and I use var(10) = 1 for evil form and var(13) = 1 for master form, so in the code if I do something like this:

[State 0, ChangeAnim]; Normal
Type = ChangeAnim
Trigger1 = !var(10)
Value = 0

[State 0, ChangeAnim]; Evil
Type = ChangeAnim
Trigger1 = var(10) = 1
Value = 1

[State 0, ChangeAnim]; Master
Type = ChangeAnim
Trigger1 = var(13) = 1
Value = 2

It may happen that both vars (10 and 13) set to 1 at the same time and this will give a conflict.
Instead you can only use one var for all forms:

[State 0, ChangeAnim]; Normal
Type = ChangeAnim
Trigger1 = !var(10)
Value = 0

[State 0, ChangeAnim]; Evil
Type = ChangeAnim
Trigger1 = var(10) = 1
Value = 1

[State 0, ChangeAnim]; Master
Type = ChangeAnim
Trigger1 = var(10) = 2
Value = 2

Or even a simple code could do everything:

[State 0, ChangeAnim]
Type = ChangeAnim
Trigger1 = !Time
Value = ifelse(var(10) = 2, 2, ifelse(var(10) = 1, 1, 0))

Understand now? But this is just a guess because of what I saw in your code.
Re: Walk cycle issue
#5  September 14, 2019, 02:21:49 am
  • **
  • Variables > Boyfriends
Hmm, soooo... I take it the varset would look something like this?

[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 10    ;fv = 10
value = 1


If so then your code: [State 0, ChangeAnim]; Evil
Type = ChangeAnim
Trigger1 = var(10) = 1
Value = 1

would apply?


This code has be a bit confused honestly:

[State 0, ChangeAnim]
Type = ChangeAnim
Trigger1 = !Time
Value = ifelse(var(10) = 2, 2, ifelse(var(10) = 1, 1, 0))

so var(10) =2 become anim 2? And if that's true then how does mugen read  the "1, 0))" part?
Re: Walk cycle issue
#6  September 14, 2019, 02:48:48 am
  • ***
    • deathscythemugen.neocities.org
the ifelse code reads like this:
ifelse(var(10) = 2, 2, ifelse(var(10) = 1, 1, 0))

if var(10)=2, it will return 2, otherwise... (then I start another ifelse before the first one ends) if var(10)=1, it will return 1, otherwise it will return 0

An even simpler code could be used:
value = var(10)
this would return the exact number you set for var(10).

BUT... I don't want to confuse you more, sorry about that.

The problem is with the anim for the walk, right? Try replacing the triggers in the ChangeAnim sctrl, doing the following:
Cycle 1 = !var(10)
Cycle 2 = var(10) = 1
Cycle 3 = var(10) = 2

You will also need to rework your varset. Let me know if you have a problem with that too.
Re: Walk cycle issue
#7  September 14, 2019, 03:56:51 am
  • **
  • Variables > Boyfriends
I /think/ I finally get it. I change my varset and used this code:

Cycle 1 = !var(10)
Cycle 2 = var(10) = 1
Cycle 3 = var(10) = 2

and now everything seems to be working fine for the walk cycle. X3

Either way I have an /actual/ understanding after reading your comments a few times over and testing. I'm really grateful, this is for a full game I plan to have done in a year or two that I've been working on, so I really appreciate it.~

My last question is: Does Var 13 overshadow var 10, seeing as I'm not able to go backwards it seems? For example: if I wanted the transform to revert back to var(10) = 1 instead of var(10) =2? the walk cycles revert back to var(10) =1 but the idle animation remains in var(10) = 2 and I can't seem to figure out way, I also tried your earlier code and it still wouldn't let me revert back to any of the previous transformations. If you don't have answer that's fine since you've helped me so much already! I just wanted to ask before I mark the topic as solved. ^^"
Re: Walk cycle issue
#8  September 14, 2019, 04:42:57 am
  • ***
    • deathscythemugen.neocities.org
I'd have to take a look at your idle animation codes.
The way MUGEN reads the codes is from top to bottom, so if you have for example 2 ChangeAnim with similar triggers, if the first one triggers, the second one [PROBABLY] won't trigger. A good example would be special intros against specific characters. Usually we code the specific intro first, then, if the character we are fighting against is NOT the one specified, then our character will do a random intro. This is also important when doing commands, harder commands should go first in the CMD, and easier commands should go after.

And no problem, we are here to help! ;)
Re: Walk cycle issue
#9  September 14, 2019, 04:58:32 am
  • **
  • Variables > Boyfriends
This is how it looks currently, I tried using your code from earlier and while it did work; I did had an ssue of all the idle animation where stuck on tick 1 and idle 2 still couldn't revert back to idle 1 despite me taunting. My taunt equals var(10) = 1 while Max Mode(KOF) is var(10) = 2. So it sounds as though there isn't a way to revert back unless I use a change state of some kind? To be clear I'm just trying to find a way to go from Max Mode, back to weakened state, which all seems to work fine--expect for the idle animation.^^"


;Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[state 0, 0]
type = changeanim
trigger1 = anim = 5
trigger1 = var(10) = 1
value = 7



[State 0,1]
type = ChangeAnim
triggerall = time = 0
trigger1 = Anim !=0 && Anim !=6
trigger2 = Anim !=6 && Animtime = 0 ; Turn Anim Over
value = ifelse(var(10)=0,0,1)

[State 0,1]
type = changeanim
triggerall = time = 0
triggerall = var(13)
trigger1 = anim != 7 && anim != 13 ;not turning or walking
trigger2 = anim = 7 && animtime = 0 ;turning, turn anim over
value = ifelse(var(13)=0,0,2)


[State 0, 4]
type = ChangeState
trigger1 = Anim = 5
value = 0
ctrl = 1
Re: Walk cycle issue
#10  September 14, 2019, 05:35:21 am
  • ***
    • deathscythemugen.neocities.org
Ok, I think I know what is causing the anim to be stuck. But is hard to tell how to fix it without knowing how you're using var(10) and var(13). I'd need both VarSet codes. Also why are you still using var(13) here? lol
And I need to know what is the right animation for each state, normal, tant and max mode.

I still see some conflicts here and there, I could fix it for you. Mind uploading your char and send it via PM?
Re: Walk cycle issue
#11  September 14, 2019, 05:53:20 am
  • **
  • Variables > Boyfriends
 I tried that before, sharing the character so someone could help me with something, and surprise-surprise the character was uploaded a week later--incomplete and uploaded with someone else's name on it. So I'm weary of doing that sort of thing anymore, sorry.

Heh, I only went back to using it for the idle animation only since that was the only way to get it to display since it's coming from a statedef in -3.^^"



Max Mode: Animation 2
Weakened State: Animation 1
Normal: Animation 0

All of them are read from state 0... so it's kind of messy at the moment.
Is it better to have them all in separate states?

[State 0, VarSet]
type = VarSet
trigger1 = stateno = 750
v = (13)
value =ifelse(var(13)=0,1,(ifelse(var(13)=1,2,0)))
ignorehitpause = 1

Currently the code above is activating the idle stance 2, I'm not using var(13) for anything but idle now.

Trigger for idle stance animation 1: AKA taunting
[State 0, VarSet]
type = VarSet
trigger1 = !time = 0
v = 10    ;fv = 10
value = 1


This is the varset for the Max Mode activation:
[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 10   ;fv = 10
value = 2

And this final code that makes idle animation 2 display properly. As I mentioned above it's in the -3 state I'd say this is probably the main issue.

[State 0, VarSet]
type = VarSet
trigger1 = stateno = 750
v = (13)
value =ifelse(var(13)=0,1,(ifelse(var(13)=1,2,0)))
ignorehitpause = 1

Re: Walk cycle issue
#12  September 14, 2019, 06:18:52 am
  • ***
    • deathscythemugen.neocities.org
I understand, it's fine.
Ok, so, no, better doing everything in one state as you're doing, I'll help you.

So the first thing I notice is, your varset for var(13) will ALWAYS be 2, here is why:
Spoiler, click to toggle visibilty

Now try using this in your State 0:

Code:
;Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, Anim]
type = changeanim
trigger1 = anim != var(10)
trigger1 = anim != 5
trigger2 = anim = 5 && !animtime
value = var(10)

You can delete everything else from state 0.

Although I think it will still have some issues but at least this will clean your code. Try it and tell me what happened.
Re: Walk cycle issue
#13  September 14, 2019, 06:35:47 am
  • **
  • Variables > Boyfriends
That did the trick. X3 And I already saved the text so I'll be sure to read it again. I just wanted to let you know it was successful and I can go to sleep without this being on my mind for the rest of the night.

Thanks, DS~
Re: Walk cycle issue
#14  September 14, 2019, 06:40:19 am
  • ***
    • deathscythemugen.neocities.org
Oh, ok then. And no problem, if you ever need more help we'll be here. Good luck!