YesNoOk
avatar

How To Code Characters To Attack While Flying? (Read 4548 times)

Started by Ki$@1st456v, September 26, 2021, 01:44:37 pm
Share this topic:
How To Code Characters To Attack While Flying?
#1  September 26, 2021, 01:44:37 pm
  • avatar
  • **
    • USA
I was trying to code aerial attacks into my character Lilith while flying, but I am not sure how or what to add. I have asked this question before and got an answer but I could not get it to work and the answer was not informative. I have looked at some characters such as MVC2 Storm in order to get somewhat of an understanding on coding attacks into flight and I see that they put a changestate into the coding of the aerial attacks of these characters like this:

;Air Dash Up
[Statedef 112]
type    = A
physics = N
movetype = I
anim = 1100
ctrl = 0 + (0*(var(55):=1))
velset = 0,0
sprpriority = 3

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

[State 855, VarSet]
type = PosAdd
triggerall = var(15)
trigger1 = pos y < -170
y = 10

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

[State 112, 3]
type = CtrlSet
trigger1 = time = 5
value = 1

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

[State 112, 4]
type = ChangeState
triggerall = !var(15)
trigger1 = time = 21
value = 1211
ctrl = 1

[State 112, 4]
type = ChangeState
triggerall = var(15)
trigger1 = time = 21
value = 1505
ctrl = 1

;-------------------------

; Star Flight
[StateDef 1505]
type = A
movetype = I
physics = N
ctrl = 0
anim = 0
velset = 0,0
sprpriority = 2

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

[State 855, VarSet]
type = VarSet
trigger1 = 1
var(8) = (command="holdfwd")|(command="holdback")*2|(command="holdup")*4|(command="holddown")*8

; ”͈͐§ŒÀ
[State 855, VarSet]
type = VarSet
trigger1 = pos y > -15
var(8) = var(8)&7

[State 855, VarSet]
type = VarSet
trigger1 = pos y < -160
var(8) = var(8)&11

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

; ‘¬“x
[State 855, VelSet]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 855, VelSet]
type = VelSet
trigger1 = var(8)&1
x = ifelse(var(8)&4||var(8)&4,4,6)

[State 855, VelSet]
type = VelSet
trigger1 = var(8)&2
x = ifelse(var(8)&4||var(8)&4,-4,-6)

[State 855, VelSet]
type = VelSet
trigger1 = var(8)&4
y = ifelse(var(8)&1||var(8)&5,-5,-5)

[State 855, VelSet]
type = VelSet
trigger1 = var(8)&8
y = ifelse(var(8)&1||var(8)&5,5,5)

[State 0, 2]
type = Helper
triggerall = anim = 0
trigger1 = NumHelper(7041) = 0
stateno = 7041
id = 7041

[State 0, 2]
type = Helper
triggerall = anim = 0
trigger1 = NumHelper(7042) = 0
stateno = 7042
id = 7042

[State 20]
type = Helper
triggerall = Anim = 20
trigger1 = NumHelper(7000) = 0
stateno = 7000
id = 7000


[State 20]
type = Helper
triggerall = Anim = 20
trigger1 = NumHelper(7001) = 0
stateno = 7001
id = 7001


[State 20]
type = Helper
triggerall = Anim = 21
trigger1 = NumHelper(7002) = 0
stateno = 7002
id = 7002


[State 20]
type = Helper
triggerall = Anim = 21
trigger1 = NumHelper(7003) = 0
stateno = 7003
id = 7003

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

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

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

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

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

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

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

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

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

[State 855, ChangeState]
type = ChangeState
trigger1 = var(15) = 0
value = 1510

;-------------------------------------------------------------------

; Flight End
[StateDef 1510]
type = A
movetype = I
physics = A
ctrl = 0
anim = 48
velset = 0,0
sprpriority = 2

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

;------------------------------------------------------------------------
With Magneto there is a section where there is a ChangeAnim that corresponds to a value with a command for Magneto to perform attacks in the air:

[Statedef 6000]     ;Flight
type = S
movetype = I
anim = 341
ctrl = 0
physics = A
sprpriority = 5

[State 6000, VarSet]
type = VarSet
trigger1 = Time = 9
v = 12    ;fv = 10
value = 12

[State 6000, VelAdd]
type = VelAdd
triggerall = command = "Flight"
triggerall = var(12) != 12
trigger1 = time = 0
;x = 0
y = -7.75

[State 6000, SelfState]
type = SelfState
trigger1 = AnimTime = 0
value = 6001
;anim =
;ctrl =
;ignorehitpause = 0
;persistent = 1

;-------------------------------------------------
[Statedef 6001]
Type = A
movetype = I
anim = 0
ctrl = 0
velset = 0,0

[State 6001, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 6001, Turn]
type = Turn
trigger1 = p2dist x < -3

[State 6001, VarSet]
type = VarSet
triggerall = command = "Flight"
trigger1 = Time = 0
v = 12    ;fv = 10
value = 0

[State 6001, ChangeState]
type = ChangeState
trigger1 = command = "Flight"
value = 50
ctrl = 0

[State 6001, Helper]  ;-----Cape
type = Helper
triggerall = Anim = 0
trigger1 = NumHelper(6000) = 0
helpertype = normal ;player
ID = 6000
stateno = 1
pos = -14,-9
postype = left    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
ignorehitpause = 1

[State 6001, VelSet]
type = VelSet
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger2 = time = 0
x = 0

[State 6001, VelSet]
type = VelSet
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger2 = time = 0
y = 0

[State 6001, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)*2

[State 6001, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)*1.8

[State 6001, 1]
type = VelSet
trigger1 = command = "holdup"
y = -3.5*1.5

[State 6001, 1]
type = VelSet
trigger1 = command = "holddown"
y = 3.5*1.5

[State 6001, PosSet]
type = PosSet
trigger1 = pos y >= -25
y = -25

[State 6001, PosSet]
type = PosSet
trigger1 = pos y <= -250
y = -250

;---- BASICS -------

[State 6001, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 6001, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 6001, 4]
type = ChangeAnim
triggerall = vel y < 0
trigger1 = command = "holdup"
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holddown"
trigger1 = anim != 341
value = 341

[State 6001, 4]
type = null;ChangeAnim
trigger1 = anim != 343
trigger1 = command = "holdup"
trigger1 = command = "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holddown"
value = 343

[State 6001, 4]
type = ChangeAnim
triggerall = vel y > 0
trigger1 = command = "holddown"
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = anim != 342
value = 342

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

[State 6000, ChangeState]
type = ChangeState
trigger1 = Win
trigger2 = Lose
value = 50
ctrl = 0

;----- ATTACKS -----

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "x"
value = 6005

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "y"
value = 6006

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "z"
value = 6007

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "a"
value = 6008

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "b"
value = 600

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "c"
value = 6010

[State 6001, ChangeAnim]
type = ChangeState
trigger1 = command = "Metal Shard"
value = 6500

;----------------------------------------
[Statedef 6005]
type    = A
movetype= A
;physics = A
juggle  = 2
poweradd= 20
ctrl = 0
anim = 600

[State 6005, HitDef]
type = HitDef
trigger1 = Time = 0
attr = A,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = 20,10
pausetime = 9,10
ground.hittime = 10
;pausetime = 0,0
sparkno = 0
guard.sparkno = 40
sparkxy = -15,-30
hitsound = 5,0
guardsound = 0,0
ground.type = High      ;Low,Trip,None
air.hittime = 20
ground.velocity = -2,0
;guard.velocity = 0
air.velocity = -2,-5
;airguard.velocity = 0,0
sprpriority = 1

[State 1010, VelSet]
type = VelSet
trigger1 =  Time = 0
x = 0
y = 0

[State 6005, SelfState]
type = SelfState
trigger1 = Animtime = 0
value = 6001

;--------------------------
[Statedef 6006]
type    = A
movetype= A
;physics = A
juggle  = 2
poweradd= 28
ctrl = 0
anim = 610

[State 1010, VelSet]
type = VelSet
trigger1 =  Time = 0
x = 0
y = 0

[State 610, HitDef]
type = HitDef
trigger1 = Time = 0
attr = A,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = medium          ;light,medium,hard,back,up,diagup
air.animtype = medium
priority = 4,Hit   ;Hit,Miss,Dodge
damage = 30,0
pausetime = 10,8
ground.hittime = 10
sparkno = 1
guard.sparkno = 41
sparkxy = -10,-38
hitsound = 5,0
guardsound = 0,0
ground.type = High      ;Low,Trip,None
air.hittime = 20
ground.velocity = -5,0
;guard.velocity = 0
air.velocity = -.5,-3
;airguard.velocity = 0,0
sprpriority = 1

[State 610, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = 1,1

[State 6005, SelfState]
type = SelfState
trigger1 = Animtime = 0
value = 6001

;-----------------------
[Statedef 6007]
type    = A
movetype= A
;physics = A
juggle  = 2
poweradd= 20
ctrl = 0
anim = 620

[State 1010, VelSet]
type = VelSet
trigger1 =  Time = 0
x = 0
y = 0

[State 620, HitDef]
type = HitDef
trigger1 = Time = 0
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = 30,0
ground.hittime = 10
pausetime = 10,7
sparkno = 2
guard.sparkno = 42
sparkxy = -14,-270
hitsound =5,0
guardsound = 0,0
ground.type = High      ;Low,Trip,None
air.hittime = 10
ground.velocity = 0,0
;guard.velocity = 0
air.velocity = 0,-1
;airguard.velocity = 0,0
sprpriority = 1

[State 6005, SelfState]
type = SelfState
trigger1 = Animtime = 0
value = 6001

;--------------------------
[Statedef 6008]
type    = A
movetype= A
;physics = A
juggle  = 2
poweradd= 20
ctrl = 0
anim = 630

[State 1010, VelSet]
type = VelSet
trigger1 =  Time = 0
x = 0
y = 0

[State 630, HitDef]
type = HitDef
trigger1 = Time = 0
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = 20,10
;hittime = 0,0
pausetime = 10,7
ground.hittime = 10
sparkno = 0
guard.sparkno = 40
sparkxy = 0,-60
hitsound =5,0
guardsound = 0,0
ground.type = High      ;Low,Trip,None
air.hittime = 20
ground.velocity = 0,0
;guard.velocity = 0
air.velocity = 0,-1
;airguard.velocity = 0,0
sprpriority = 1

[State 630, PosFreeze]
type = PosFreeze
triggerall = movehit
trigger1 = time = 0
value = 1

[State 630, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = 1,1

[State 6005, SelfState]
type = SelfState
trigger1 = Animtime = 0
value = 6001

;----------------------------
[Statedef 6009]
type    = A
movetype= A
;physics = A
juggle  = 2
poweradd= 20
ctrl = 0
anim = 640

[State 1010, VelSet]
type = VelSet
trigger1 =  Time = 0
x = 0
y = 0

[State 640, HitDef]
type = HitDef
trigger1 = Time = 0
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = 30,0
ground.hittime = 10
pausetime = 10,7
sparkno = 1
guard.sparkno = 41
sparkxy = 0,-60
hitsound = 5,0
guardsound = 0,0
ground.type = High      ;Low,Trip,None
air.hittime = 20
ground.velocity = 0,0
;guard.velocity = 0
air.velocity = 0,-1
;airguard.velocity = 0,0
sprpriority = 1

[State 640, PosFreeze]
type = PosFreeze
triggerall = movehit
trigger1 = time = 0
value = 1

[State 640, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = 1,2

[State 6005, SelfState]
type = SelfState
trigger1 = Animtime = 0
value = 6001

;----------------------------
[Statedef 6010]
type    = A
movetype= A
;physics = A
juggle  = 2
poweradd= 20
ctrl = 0
anim = 650

[State 1010, VelSet]
type = VelSet
trigger1 =  Time = 0
x = 0
y = 0

[State 650, HitDef]
type = HitDef
trigger1 = Time = 0
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = hard          ;light,medium,hard,back,up,diagup
air.animtype = hard
priority = 4,Hit   ;Hit,Miss,Dodge
damage = 40,19
ground.hittime = 10
pausetime = 3,5
air.pausetime = 0,0
sparkno = 2
guard.sparkno = 41
sparkxy = 0,0
hitsound = 5,0
guardsound = 0,0
ground.type = High      ;Low,Trip,None
air.hittime = 20
ground.velocity = -3,0
ground.dist = -5
;guard.velocity = 0
air.velocity = -8.2,6
air.dist = -10
;airguard.velocity = 0,0
sprpriority = 1

[State 650, ScreenBound]
type = null;ScreenBound
triggerall = movehit
trigger1 = 1
value = 1
movecamera = 1,1

[State 650, PosFreeze]
type = PosFreeze
triggerall = movehit
trigger1 = time = 0
value = 1

[State 650, PlaySnd]
type = PlaySnd
trigger1 = Time = 3
value = 1,3

[State 6005, SelfState]
type = SelfState
trigger1 = Animtime = 0
value = 6001
;----------------------------------------
;-----------------------------------------------------
[Statedef 6500] ;Metal Shard Super
type = A
Movetype = A
Anim = 3100
poweradd = -1000
ctrl = 0
velset = 0,0

[State 6500, Explod]
type = Explod
trigger1 = Time = 0
anim = 6010
pos = -190,0
postype = back  ;p2,front,back,left,right
;bindtime =
vel = 5,0
accel = -.1,0
removetime = 52
supermove = 1
supermovetime = 500
scale = 1,1.1
sprpriority = -3
ontop = 1
ownpal = 1

[State 6500, Explod]
type = Explod
trigger1 = Time = 0
anim = 6005
pos = -28,0
postype = back  ;p2,front,back,left,right
removetime = 52
supermove = 1
scale = 1,1.1
sprpriority = 0

[State 6500, Explod]
type = Explod
trigger1 = Time = 1
anim = 6006
pos = -0,0
postype = back  ;p2,front,back,left,right
removetime = 40
;supermove = 1
scale = 1,1.1
sprpriority = 0

[State 6500, SuperPause]
type = SuperPause
trigger1 = Time = 0
time = 30
anim = 4000
sound = S500, 0
pos = 7, -110
;move =
darken = 1
unhittable = 1

[State 6500, Helper]
type = Helper
trigger1 = GameTime%3 = 0
helpertype = normal ;player
name = "Shard"
ID = 2550
stateno = 2550
pos = 0,0
postype = back    ;p2,front,back,left,right
facing = 1

[State 6500]
type = ChangeState
trigger1 = AnimTime = 0
value = 6001
ctrl = 1
;---------------------------------------

I am not sure however what to add for my Lilith with the flight coding I have here. I have tried doing a ChangeAnim like in Magneto's code but that only made her do the beginning frame of her aerial attacks with no attack coming out. Here is her code here:

;---------------------------------------

[Statedef 40000]
type = A
movetype = I
physics = N
ctrl = 0
anim = 40000
velset = 0,-4
sprpriority = 2

[State 850, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 100,4
volume = 255
volumescale = 255

[State 850, VarSet]
type = VarSet
trigger1 = time = 0
var(21) = 460

[State 850, VelMul]
type = VelMul
trigger1 = 1
y = .92

[State 850, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 40005
 
[Statedef 40001]
type = A
movetype = I
physics = N
ctrl = 0
anim = 40000
velset = 0,-4
sprpriority = 2

[State 200, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 100,4
volume = 255
volumescale = 255

[State 851, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = 0

[State 851, VarSet]
type = VarSet
trigger1 = time = 0
var(21) = 460

[State 851, VelMul]
type = VelMul
trigger1 = 1
y = .92

[State 851, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 40005

[Statedef 40005]
type = A
movetype = I
physics = N
ctrl = 0
anim = 0
velset = 0,0
sprpriority = 2

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

[State 855, VarSet]
type = VarSet
trigger1 = 1
var(11) = (command="holdfwd")|(command="holdback")*2|(command="holdup")*4|(command="holddown")*8

; ”͈͐§ŒÀ
[State 855, VarSet]
type = VarSet
trigger1 = pos y > -15
var(11) = var(11)&7

[State 855, VarSet]
type = VarSet
trigger1 = pos y = -270
var(11) = var(11)&11

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

[State 855, PosSet]
type= PosSet
trigger1 = pos y =-270
y=-270
; ‘¬“x
[State 855, VelSet]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 855, VelSet]
type = VelSet
trigger1 = var(11)&1
x = ifelse(var(11)&4||var(11)&4,4,7)

[State 855, VelSet]
type = VelSet
trigger1 = var(11)&2
x = ifelse(var(11)&4||var(11)&4,-4,-7)

[State 855, VelSet]
type = VelSet
trigger1 = var(11)&4
y = ifelse(var(11)&1||var(11)&6,-6,-6)

[State 855, VelSet]
type = VelSet
trigger1 = var(11)&8
y = ifelse(var(11)&1||var(11)&6,6,6)

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1347
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1343
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1345
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1344
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1346
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1341
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1340
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = anim = 1342
value = 100,4
volume = 255
volumescale = 255
channel = 7
loop = 0
pan = 0
persistent = 0

[State 200, PlaySnd]
type = PlaySnd
trigger1 = (enemy,pos x-pos x)*facing < -5
value = 100,4
volume = 255
volumescale = 255
channel = 1
loop = 0
pan = 0
persistent = 0

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

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

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

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

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

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

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

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

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

[State 855, ChangeState]
type = ChangeState
trigger1 = var(21) = 0
value = 40006

[Statedef 40005]
type = A
movetype = I
physics = N
ctrl = 0
anim = 0
velset = 0,0
sprpriority = 2

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

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

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

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

[State 20, PosSet]
type = PosSet
trigger1= pos y =-270
y =-270

[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 != 40006
trigger1 = command = "holdup"
value = 40006

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

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

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

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

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

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

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

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

[State 856, VarSet]
type = VarSet
trigger1 = time = 0
var(21) = 0
;------------------------------------------------------------------------------------------------------------

What must I add to make Lilith able to attack during flight? I appreciate any help anyone can give on this subject.
Re: How To Code Characters To Attack While Flying?
#2  September 26, 2021, 02:24:12 pm
  • avatar
  • **
    • USA
So I'm not going to go through all that and get into details because I'm lazy and I don't have to, but it's like this.

Step 1) Your entire CMD file needs to be set up so that all of your attacks for not flying have triggers specifically to prevent being used while flying.  Even if you have a move that is technically the same, it needs to be separated using completely separate code because...

Step 2) All of your flying attack states need to changestate back to flying, and not to idle.  Don't do some crazy ass variable checking to see if you are flying.  Just do the attack and go back to flying.  Every flying attack should have its own statedef.  Don't bother trying to make them share.

Step 3) Now you can add flying attack CMDs in your CMD file.  All of them need to have triggers that ensure they only activate when flying.

Don't do this ghetto thing of adding the commands to the actual statedefs.  It just makes it harder to troubleshoot any issues you have.
Re: How To Code Characters To Attack While Flying?
#3  September 27, 2021, 07:46:45 am
  • avatar
  • **
    • USA
I have tried to set a separate statedef for the flying attacks. I did this below:

;---------------------------------------------------------------------------
;Jump Light Punch
[Statedef 600]
type    = A
movetype= A
physics = A
juggle  = 2
poweradd= 11
ctrl = 0
anim = 600
sprpriority = 2
hitcountpersist = 1

[State 600, 1] ;Swing Sound
type = PlaySnd
trigger1 = Time = 1
value = 3, 0

[State 600, 2]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage = 15
guardflag = HA
priority = 3
pausetime = 7,8
sparkno = S9103
sparkxy = -10,-58
hitsound = S5544,0                 ;Sound to play on hit
guardsound = S6,0
guard.sparkno = s9101
ground.type = High
ground.slidetime = 5
ground.hittime  = 5
ground.velocity = -4
air.velocity = 0,-8
yaccel = .6

[state 451,3]
type = veladd
trigger1 = var(3) = 1
y = -0.1

[State 600, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 460

;---------------------------------------------------------------------------

;Flying Light Punch
[Statedef 40007]
type    = A
movetype= A
physics = A
juggle  = 2
poweradd= 11
ctrl = 0
anim = 600
sprpriority = 2
hitcountpersist = 1

[State 600, 1] ;Swing Sound
type = PlaySnd
trigger1 = Time = 1
value = 3, 0

[State 600, 2]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage = 15
guardflag = HA
priority = 3
pausetime = 7,8
sparkno = S9103
sparkxy = -10,-58
hitsound = S5544,0                 ;Sound to play on hit
guardsound = S6,0
guard.sparkno = s9101
ground.type = High
ground.slidetime = 5
ground.hittime  = 5
ground.velocity = -4
air.velocity = 0,-8
yaccel = .6

[state 451,3]
type = veladd
trigger1 = var(3) = 1
y = -0.1

[State 0, ChangeState]
type = ChangeState
trigger1 = animelem = 5 && var(21)
value = 40006
ctrl = 1
;---------------------------------------------------------------------------

This is for the CMND list

;---------------------------------------------------------------------------
[State -1, Jump Light Punch]
type = ChangeState
value = 40007
triggerall = !var(59) <= 0
triggerall = command = "x"
trigger1 = statetype = A && (ctrl || stateno = 40006)
;---------------------------------------------------------------------------

Yet it still is not working. Am I still missing something?
Re: How To Code Characters To Attack While Flying?
#4  September 27, 2021, 11:17:51 am
  • avatar
  • **
    • USA
Code:
[State -1, Jump Light Punch]
type = ChangeState
value = 40007
triggerall = !var(59) <= 0
triggerall = command = "x"
trigger1 = statetype = A && (ctrl || stateno = 40006) ;; nope

I'm assuming 40006 is your flying state, but this trigger is incorrect.  If statetype is A and you have ctrl, then you're jumping.  Wrong.  Don't allow flying attacks to function when jumping.  Don't allow jumping attacks to work when flying.

Have a triggerall that checks for the flying variable.  Pretty sure I saw one in there somewhere.  Every single attack in your CMD file should be checking for flight and only working one way or the other.

Trigger1 should just be something like "trigger1 = stateno = 40006".  If you want this attack to work in combos or be spammable, make more triggers to add that function.  If you have different states for moving around when flying, add those to your trigger as well.

Re: How To Code Characters To Attack While Flying?
#5  September 27, 2021, 05:25:49 pm
  • avatar
  • **
    • USA
I rewrote the trigger in the command to be this:

[State -1, Jump Light Punch]
type = ChangeState
value = 40007
triggerall = !var(59) <= 0
triggerall = command = "x"
trigger1 = stateno = 40006

However, that did not work, then I did this command below and it still did not solve the problem

[State -1, Jump Light Punch]
type = ChangeState
value = 40007
triggerall = !var(59) <= 0
triggerall = command = "x"
trigger1 = stateno = 40006
trigger1 = ctrl
 
Should I try a different trigger?
Re: How To Code Characters To Attack While Flying?
#6  September 28, 2021, 02:42:14 am
  • avatar
  • **
    • USA
I don't know what you're using var(59) for, but that whole trigger looks really weird to me.  Try it without that line.

Also, I'm not sure if you actually have ctrl when in the flying state, so try without the ctrl trigger.  What I see above shows that statedef 40006 has ctrl = 0...

Straight up just try this and add triggers that you might need later.  If it stops working, then you'll know what the problem is.
Code:
[State -1, Jump Light Punch]
type = ChangeState
value = 40007
triggerall = command = "x"
trigger1 = stateno = 40006
Re: How To Code Characters To Attack While Flying?
#7  September 28, 2021, 05:45:45 am
  • avatar
  • **
    • USA
I have changed it to that without adding anything to it, but for some reason it is not working and no aerial light punch is coming out. I do not know why.