YesNoOk
avatar

help me undersstand this code.... MVC 8 way air-dashing  (Read 871 times)

Started by kiLabee, December 29, 2019, 08:51:09 pm
Share this topic:
help me undersstand this code.... MVC 8 way air-dashing
New #1  December 29, 2019, 08:51:09 pm
  • avatar
  • **
help mugen guild! you're my only hope....

so im trying to understand how to implement the 8 way airdash code used by author="Kong & DarkWolf13-MvC2"
Editor = "REDHOT" version of magneto.



code is here below.

Code:
;Air Dash Fwd
[Statedef 110]
type    = A
physics = A
sprpriority = 1
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 730

[State 117, 1]
type = VelSet
trigger1 = time >= 1
x = 11
y = 0

[State 111, 1]
type = VelSet
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Backward
[Statedef 111]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 731

[State 117, 1]
type = VelSet
trigger1 = time >= 1
x = -11
y = 0

[State 111, 1]
type = VelSet
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Up
[Statedef 112]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 732

[State 117, 1]
type = VelSet
trigger1 = time >= 1
x = -0
y = -9

[State 111, 1]
type = VelSet
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Down
[Statedef 113]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 733

[State 115, 1.1]
type = VelSet
trigger1 = Pos Y < -5
x = 0
y = 9

[State 115, 1.2]
type = VelSet
trigger1 = Pos Y >= -8
x = 0
y = 0

[State 111, 1]
type = VelSet
triggerall = Pos Y >= -255
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Fwd Up
[Statedef 114]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 734

[State 117, 1]
type = VelSet
trigger1 = time >= 1
x = 11
y = -6.5

[State 111, 1]
type = VelSet
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Fwd Down
[Statedef 115]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 735

[State 114, 1.1]
type = VelSet
trigger1 = Pos Y < -5
x = 11
y = 6.5

[State 114, 1.2]
type = VelSet
trigger1 = Pos Y >= -9
x = 9
y = 0

[State 111, 1]
type = VelSet
triggerall = Pos Y >= -255
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Back Up
[Statedef 116]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 736

[State 117, 1]
type = VelSet
trigger1 = time >= 1
x = -11
y = -6.5

[State 111, 1]
type = VelSet
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

;Air Dash Back Down
[Statedef 117]
type    = A
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0 + (0*((var(37):=2) + (var(38):=20)))
anim = 737

[State 114, 1.1]
type = VelSet
trigger1 = Pos Y < -5
x = -11
y = 6.5

[State 114, 1.2]
type = VelSet
trigger1 = Pos Y >= -9
x = -9
y = 0

[State 111, 1]
type = VelSet
triggerall = Pos Y >= -255
trigger1 = time >= 20
x = 0
y = 0

[State 117, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 110, 2]
type = CtrlSet
trigger1 = Time = 0
value = Cond((!var(1) && (PrevStateNo = [600,799])), 0, 1)

[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51 + (0 * ((var(37) := -1) + (var(38) := 0)))
ctrl = ctrl
 
[State 102, ChangeState]
type = ChangeState
trigger1 = var(17) && animtime = 0
value = 1335

; HIT_FALLRECOVER (on the ground)
[Statedef 5201]
type    = C
movetype= H
physics = N
anim = ifelse(prevstateno=5200,5200,5201)
facep2 = 1
sprpriority = -1

[State 5201, PosSet]
type = PosSet
trigger1 = time = 0
y = 0

[State 5201, VelSet]
type = VelSet
trigger1 = time = 0
x = ifelse(anim=5200,8,-4)
y = 0

[State 5201, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 5201, PlayerPush]
type = PlayerPush
trigger1 = anim = 5200
value = 0

[State 5201, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

so i am trying to understand what the code is doing and i have a few questions obviously,

1. how does one read/ interpret what this is?
there are a bunch of variables included in the code.
help me identify and understand what each variable does if someone here is more experienced in variable usage.

2. in this code the final changestate for the dash is "changestate =1335"

i look it up and here is 1335
Code:
[Statedef 1335] 
type = A
movetype = I
physics = N
ctrl = 0
anim = 0
velset = 0,0
sprpriority = 2

[State 0, 2]
type = Helper
trigger1 = NumHelper(6000) = 0
stateno = 6000
id = 6000


[State 855, PosAdd]
type = PosAdd
trigger1 = pos y < -170
y = 10

[State 855, PosAdd]
type = PosAdd
trigger1 = pos y > -30
y = -10

[State 20, Turn]
type = Turn
trigger1 = (enemy,pos x-pos x)*facing < -5

[State 20, VelSet]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 20, VelSet]
type = VelSet
trigger1 = command = "holdfwd"
x = ifelse(command!="holdup"&&command!="holddown",1,1)

[State 20, VelSet]
type = VelSet
trigger1 = command = "holdback"
x = ifelse(command!="holdup"&&command!="holddown",-1,-1)

[State 20, VelSet]
type = VelSet
trigger1 = command = "holdup"
y = ifelse(command!="holdfwd"&&command!="holdback",-1,-1)

[State 20, VelSet]
type = VelSet
trigger1 = command = "holddown"
y = ifelse(command!="holdfwd"&&command!="holdback",1,1)

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 0
trigger1 = command != "holdfwd" &&command != "holdback" && command != "holdup"
value = 0

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1336
trigger1 = command = "holdup"
value = 1336

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1335
trigger1 = command = "holddown"
value = 1335

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1331
trigger1 = command = "holdfwd" && command!="holdup" && command!="holddown"
value = 1331

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1337
trigger1 = command = "holdfwd" && command="holdup" && !command="holddown"
value = 1337

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1334
trigger1 = command = "holdfwd" && !command="holdup" && command="holddown"
value = 1334

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1332
trigger1 = command = "holdback" && command!="holdup" && command!="holddown"
value = 1332

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1338
trigger1 = command = "holdback" && command="holdup" && command!="holddown"
value = 1338

[State 855, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1339
trigger1 = command = "holdback" && command!="holdup" && command="holddown"
value = 1339

[State 855, ChangeState]
type = ChangeState
trigger1 = var(17) = 0
value = 1336
 
[Statedef 1336]
type = A
movetype = I
physics = A
ctrl = 0
anim = 57
velset = 0,0
sprpriority = 2

[State 856, VarSet]
type = VarSet
trigger1 = time = 0
var(17) = 0

what is going on in here and how does this pertain to making the 8 way dash work?
Last Edit: December 31, 2019, 07:40:24 am by kiLabee
Re: help me undersstand this code.... MVC 8 way air-dashing
#2  December 29, 2019, 10:33:32 pm
  • *****
  • Shame on you!
    • USA
So you've left out the main thing that makes the 8-way dash work. The CMD commands. That's going to put you into each of the states.
The most obvious thing that will be different in 8 way dash moves is the Velocities. Down goes down, up forward goes up forward, on and on.
Once the end of the move is reached, because it's in the air, all of the states can just end as being in the air. One "move" is all that's needed.

Var(17) seems to be the biggest question. But I don't really see enough info here to tell you exactly what/why. I _think_ it just means P1's still airborn.


Each of the dash moves are pretty straight forward in what they're doing.
Spoiler, click to toggle visibilty
Those are pretty standard. If you're having trouble figuring out what AssertSpecial does, you can use Mugen Class to read up on any thing. The Master Thread is easy to look stuff up in.

The only reason why I think Var(17) checks if you're still in the air is because
[State 102, ChangeState]
type = ChangeState
trigger1 = !var(17) && animtime = 0
anim = 57
value = 51
the States "50s" are usually on the ground. And it doesn't want 17 to be active when it switches to the ground moves.

The common end state just has a collection of velsets and animation changes so it can switch to the correct ones.
[Statedef 1335]
type = A
movetype = I
physics = N
If you have questions about what these do, I'd honestly suggest looking it up in Mugen Class. Reading about it there would kill a lot of questions you'll have in the future.

Was there 1 or 2 specific problems or questions?
vVv Ryuko718 Updated 10/31/22 vVv
Re: help me undersstand this code.... MVC 8 way air-dashing
#3  December 30, 2019, 08:50:30 pm
  • avatar
  • **
so basically i got the move to somewhat work.
but it only works once and i have to reset the round in order to make the move work again.
i think its the variables that making it not work like its checking it off at first but the variables ardent in the character so it works once then done.

i read what variables do and still fucking confused a.f as to how it works.
http://mugenguild.com/forum/topics/all-things-variables-a-variable-tutorial-129930.0.html

i read that whole thing and BOY am I  stupid.

i think its just something im missing??

basically i want to give superman from hannnibal an 8 way dash
im kinda reworking the character into a true MVC style character.
8 way airdash, wavedash, etc etc

basically magneto.

where could the variable be in?

Re: help me undersstand this code.... MVC 8 way air-dashing
#4  December 31, 2019, 04:46:48 am
  • *****
  • Shame on you!
    • USA
Could be in? Everywhere/Anywhere.
Probably be in? Statedef -2.
Statedef -1 is the CMD, Statedef -2 and -3 are in the CNS file(s). -2 is usually where everyone codes their "resets". Which is why your move isn't working properly. You have it blank, you set it to a new value, and never reset it. So the check to allow it can't work because it says it's already going/bad.

Just think of a variable as a post-it note you get to decide what it says.
But instead of saying
P1 Gets to 8 way dash when he's in the air,
You have to write it as Var(17) = 1. In this instance, Var(17) equals P1 gets to 8 way dash, and = 1 equals in the air.
You'll notice a lot of characters will have a list of variables at the top of the CNS greyed out with what they do. It's like a cheat key. It's handy because Var(17) is used for 8 way dash in the air, but no way you'll remember that in a couple years. So you just look at the top of the CNS and remember.
Var(17) = 0 would be on the ground so 8 way dash wouldn't work.

One thing you'll want/need to do is use CTRL+F in Fighter Factory 3 and search for Var(17). Keep pressing Enter to see where it's used at. Keep searching until you see the first spot you saw it. Then switch to the CMD and search there. Once you understand the Var(X) is a phrase and the = Y is the end of the sentence your imagination will be able to put that phrase together after reading where it's used at.

Var(17) Can also be written like
[state 2902, detract]
type = varadd
trigger1 = time%3 = 0
trigger1 = var(17) > 0
v = 17
value = -1

So you'll also want to try and search for
v = 17
v= 17
v =17
&
v=17
FF3 wont show you all 4 results for just trying V = 17, and the person coding the character may have written it differently.
vVv Ryuko718 Updated 10/31/22 vVv
Re: help me undersstand this code.... MVC 8 way air-dashing
#5  December 31, 2019, 07:22:04 am
  • avatar
  • **


i found the problem

Code:
; Air Dash Controls
; --------------------------------
[State -2, A-Dash-CLR]
type = VarSet
triggerall = var(37)
trigger1 = stateno = 52
trigger2 = stateno = 0
trigger3 = StateNo = 50 && var(6) > 0
var(37) = 0

[State -2, A-Dash-IN-Timer.R]
type = VarSet
triggerall = var(38)
trigger1 = StateType != A
trigger1 = StateNo != [600,655]
trigger1 = StateNo != 50
var(38) = 0

[State -2, A-Dash-IN-Timer.A]
type = VarAdd
triggerall = var(38) > 0
trigger1 = StateNo = [600,655]
trigger2 = StateNo = 50
var(38) = -1

[State -2, A-Dash-Mul.PFX]
type = VelMul
triggerall = MoveType != H && StateType = A && var(38) > 12
triggerall = StateNo != [110,117]
trigger1 = StateNo < 900
x = 0.927

[State -2, A-Dash-ST.VSZ]
type = VelSet
triggerall = MoveType != H && StateType = A && var(38) > 12
triggerall = StateNo != [110,117]
trigger1 = StateNo < 900
y = 0

[State -2, A-Dash-Mul.PFY]
type = VelAdd
triggerall = (StateNo = [600,655])
triggerall = StateType = A
trigger1 = var(37) = 1
y = Cond(Vel Y < 0, -0.22, 0.20) * const(size.yscale)

[State 0]
type = VarAdd
trigger1 = var(33) >= 1
persistent = 1
var(33) = -2

[State 0]
type = Varset
trigger1 = var(33) >= 1
trigger1 = Movetype = H
var(33) = -2

[State 0]
type = VelSet
trigger1 = var(33) > 0
trigger1 = Movetype = A
trigger1 = Pos Y <= -1
trigger1 = prevstateno != [111,119]
x = 0
y = 0

;•‚—V
[State 0]
type = statetypeset
trigger1 = var(33) > 0
trigger1 = pos y < -1
trigger1 = Movetype != H
physics = N

[State 0]
type = posset
trigger1 = var(33) > 0
trigger1 = pos y >= -20
trigger1 = movetype != H
y = -20

[State 0]
type = posset
triggerall = prevstateno = 0
triggerall = pos y != 0
trigger1 = stateno != 0
trigger1 = statetype != A
trigger1 = movetype != H
trigger2 = anim = [120,121]
trigger3 = statetype != A
trigger3 = movetype = H
persistent = 0
y = 0


[State -2, VarSet]
type = VarSet
trigger1 = movetype = H
trigger2 = roundstate != 2
trigger3 = statetype != A
var(17) = 0

[State -2, VarAdd]
type = VarAdd
trigger1 = var(17)
var(17) = -1

[State -2, PosFreeze]
type = PosFreeze
trigger1 = var(17)
trigger1 = stateno = [600,800)
 
[State 23080, StopSnd]
type = StopSnd
trigger1 = StateNo != 9000
trigger1 = StateNo != 600
trigger1 = StateNo != 610
trigger1 = StateNo != 620
channel = 3

[State -2, Dizzy Stars]
type = RemoveExplod
trigger1 = anim != 5300
ID = 5301

[State 0, VarSet]
type = VarSet
trigger1 = var(43) = 0 && Stateno = 150000
var(43) = 1

[State 0, VarSet]
type = VarSet
trigger1 = partner,var(4) = 0 && var(43)
var(43) = 0

[State -2, Pre-walking state]
type = ChangeState
;triggerall = !var(59)
trigger1 = prevstateno = 191 ;Enable after Intro
trigger2 = RoundNo != 1              ;Enable If Round Number is > 1
trigger2 = RoundState = 1           ;RoundState < 2 and
trigger2 = stateno = 0              ;Current state is 0
value = 21
ctrl = 0

thanks to you i found this peice of code and it worked.

now all i have to do is fix the CMD to clean it up and the animations