YesNoOk
avatar

How to Stop Ending Flight With a Single Attack?  (Read 580 times)

Started by Ki$@1st456v, February 07, 2021, 04:23:17 PM
Share this topic:
How to Stop Ending Flight With a Single Attack?
#1  February 07, 2021, 04:23:17 PM
  • avatar
  • *
    • USA
Hi again everyone! I have added another form of flight to my custom Storm and it works well. I like that I am able to fly higher without a height limit on it like in the MVC2 style flight. I wanted to improve it though, and I wanted to make sure that the flight does not stop when I perform a single attack during flight so that the flight continues its entire duration before I land or I stop it manually by using the same command to activate it. I have the code for it below:

;Sky Flight
[Statedef 5400]
type    = A
movetype= I
physics = N
juggle  = 3
poweradd= 20
ctrl = 0
velset = 0,-4
anim = 5400
sprpriority = 2

[State 1330]
type = null; PlaySnd
trigger1 = Time = 1
value = 192,1

[State 1330]
type = VarSet
trigger1 = Time = 0
var(54) = 1

[State 1330]
type = ChangeState
trigger1 = AnimTime = 0 && var(54) >= 1
value = 5405
ctrl = 0
;---------------------------------------------------------------------------
;Flight Cancel
[Statedef 5401]
type    = A
movetype= I
physics = N
juggle  = 3
poweradd= 20
ctrl = 0
velset = 0,0
;anim = 44
sprpriority = 2


[State 1331]
type = ChangeAnim
trigger1 = Time = 0
value = 44
elem = 2


[State 1331]
type = VarSet
trigger1 = Time = 0
var(54) = 0


[State 1331]
type = VelAdd
trigger1 = Pos Y < 0
y = 0.35



[State 1331]
type = CtrlSet
trigger1 = Time = 1
value = 1


[State 1331]
type = ChangeState
trigger1 = Pos Y >= 0
trigger1 = Vel Y > 0
value = 52
ctrl = 0


;---------------------------------------------------------------------------
;Flight End
[Statedef 5402]
type    = A
movetype= I
physics = A
juggle  = 3
;poweradd= 40
ctrl = 1
velset = 0,0
;anim = 5402
sprpriority = 2

[State 1332]
type = ChangeAnim
trigger1 = Time = 0
value = 44
elem = 2

[State 1332]
type = ChangeState
trigger1 = Pos Y >= 0
trigger1 = Vel Y > 0
value = 52
ctrl = 0


;---------------------------------------------------------------------------
;Flight after S Jump
[Statedef 5403]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 1333]
type = PlaySnd
trigger1 = Time = 1
value = 710,0
channel = 1

[State 1333]
type = Explod
trigger1 = Time = 1
anim = 7055

[State 1333]
type = Explod
trigger1 = Time = 1
anim = 7055
facing = -1


[State 1333]
type = Explod
trigger1 = Time = 1
anim = 8010
sprpriority = 4


[State 1333, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 1333, 2]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 1333, 3]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 1333, 4]
type = null;VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y) - 3

[State 1333, 4]
type = null;VelSet
trigger1 = AnimTime = 0
x = (P2Dist X)*0.07
y = (P2Dist Y)*0.07

[State 1333, 5]
type = null;VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 1333, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 5404
ctrl = 0


;---------------------------------------------------------------------------
; Super Jump Up
[Statedef 5404]
type    = A
physics = N


[State 1334, 4]
type = null;VelSet
trigger1 = 1;Time = 0
y = -11


[State 1334, 4]
type = VelSet
trigger1 = Time = 0
y = -17;-13

[State 1334, 4]
type = VelAdd
trigger1 = 1
y = 0.35;0.4



[State 1334]
type = veladd
triggerall = vel x <= 4
trigger1 = var(59)
trigger1 = p2bodydist x >= 0
persistent = 4
x = .9


[State 1334]
type = veladd
triggerall = vel x >= -4
trigger1 = var(59)
trigger1 = p2bodydist x <= 0
persistent = 4
x = -.9


[State 1334,4]
type = null;VelAdd
triggerall = command = "holdfwd"
trigger1 = sysvar(1) = 1
trigger1 = vel X <=4
trigger2 = sysvar(1) = -1
trigger2 = Vel X <= -.4
x = .2

[State 1334,5]
type = null;VelAdd
triggerall = command = "holdback"
trigger1 = sysvar(1) = -1
trigger1 = Vel X >= -4
trigger2 = sysvar(1) = 1
trigger2 = Vel X >= .4
x = -.2

[State 1334, 1]
type = null;ScreenBound
trigger1 = 1
value = 0
movecamera = 0,1


[State 1334]
type = Explod
trigger1 = Time%4 = 0
trigger1 = Time >= 4
trigger1 = Vel Y < 0
anim = 7056
pos = 0,0
random = 50,0
ontop = 1

[State 1334]
type = Explod
trigger1 = Time%2 = 0
trigger1 = Time >= 12
trigger1 = Vel Y < 0
anim = 7057+random%3
pos = 0,0
random = 60,0
ontop = 1


[State 1334, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 1334, 3]
type = ChangeAnim
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

[State 1334]
type = turn
trigger1 = p2dist x < -5


[State 1334]
type = ChangeState
trigger1 = Vel Y > -1
value = 5400

;---------------------------------------------------------------------------
;Sky Flight
[Statedef 5405]
type    = A
physics = N
anim = 5400
velset = 0,0
movetype= I
sprpriority = 2
ctrl = 1




[State 1335]
type = Turn
trigger1 = FrontEdgeDist < 15
trigger2 = enemy(0),facing = facing
trigger2 = Time%4 = 0


[State 1335]
type = PosAdd
trigger1 = Pos Y > -10
y = -4

[State 1335]
type = VarSet
trigger1 = 1
sysvar(1) = 0


[State 1335]
type = VarSet
trigger1 = Time = 0
var(1) = 0

[State 1335]
type = ChangeAnim
trigger1 = Anim = [41,43]
persistent = 0
value = Anim + 3

[State 1335]
type = VarSet
trigger1 = p2bodydist x != 0
var(1) = ifelse((p2bodydist y/p2bodydist x = [0.4,0.8]),1,0)


[State 1335]
type = ChangeState
trigger1 = var(59)
trigger1 = !var(1)
trigger1 = p2bodydist x > 200
value = 113


[State 1335]
type = ChangeState
trigger1 = var(59)
trigger1 = !var(1)
trigger1 = p2bodydist x < 70
value = ifelse(BackEdgeDist > 70,113,114)

[State 1335]
type = ChangeState
trigger1 = var(59)
trigger1 = !var(1)
trigger1 = p2bodydist y < 170;240
value = 5402


[State 1335]
type = ChangeState
trigger1 = var(59)
trigger1 = !var(1)
trigger1 = p2bodydist y > 340;480
value = 5404

[State 1335]
type = VarSet
trigger1 = command = "holdfwd"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = !var(1)
trigger2 = p2bodydist x > 200
sysvar(1) = 1


[State 1335]
type = VarSet
trigger1 = command = "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = !var(1)
trigger2 = p2bodydist x < 70
sysvar(1) = -1


[State 1335, 3]
type = VarSet
trigger1 = command = "holdfwd"
trigger1 = command = "holdup"
sysvar(1) = 2


[State 1335, 3]
type = VarSet
trigger1 = command = "holdback"
trigger1 = command = "holdup"
sysvar(1) = -2



[State 1335, 3]
type = VarSet
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command = "holdup"
trigger2 = var(59)
trigger2 = !var(1)
trigger2 = p2bodydist y < 170
sysvar(1) = 3

[State 1335, 3]
type = VarSet
trigger1 = command = "holddown"
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger2 = var(59)
trigger2 = !var(1)
trigger2 = p2bodydist y > 340
sysvar(1) = -3



[State 1335, 3]
type = VarSet
trigger1 = command = "holdfwd"
trigger1 = command = "holddown"
sysvar(1) = 4

[State 1335, 3]
type = VarSet
trigger1 = command = "holddown"
trigger1 = command = "holdback"
sysvar(1) = -4

[State 1335, 3]
type = null;ChangeAnim
trigger1 = anim != 103
value = 103
persistent = 0

[State 1335, 3]
type = null;ChangeAnim
triggerall = anim != 102
trigger1 = sysvar(1) = 0
value = 102
persistent = 0

[State 1335]
type = null;ChangeAnim
triggerall = anim != 101
trigger1 = sysvar(1) = 1
trigger2 = sysvar(1) = 2
value = 101
persistent = 0


[State 1335]
type = VarSet
trigger1 = command = "x" && command = "y"
var(1) = 4

[State 1335]
type = ChangeAnim
triggerall = anim != 100
trigger1 = sysvar(1) = 1
value = 100

[State 1335]
type = ChangeAnim
triggerall = anim != 105
trigger1 = sysvar(1) = -1
value = 105


[State 1335]
type = ChangeAnim
triggerall = anim != 20
trigger1 = sysvar(1) = 2
value = 20

[State 1335]
type = ChangeAnim
triggerall = anim != 21
trigger1 = sysvar(1) = -2
value = 21


[State 1335]
type = ChangeAnim
triggerall = anim != 41
trigger1 = sysvar(1) = 3
value = 41


[State 1335]
type = ChangeAnim
triggerall = anim != 5400
trigger1 = sysvar(1) = -3
value = 5400


[State 1335]
type = ChangeAnim
triggerall = anim != 20
trigger1 = sysvar(1) = 4
value = 20

[State 1335]
type = ChangeAnim
triggerall = anim != 21
trigger1 = sysvar(1) = -4
value = 21


[State 1335]
type = VelSet
trigger1 = sysvar(1) = 0
y = 0
x = 0

[State 1335]
type = VelSet
trigger1 = sysvar(1) = 1
x = 7
y = 0

[State 1335]
type = VelSet
trigger1 = sysvar(1) = -1
x = -7
y = 0

[State 1335]
type = VelSet
trigger1 = sysvar(1) = 2
x = 7
y = -7+7*(ScreenPos Y < 120)



[State 1335]
type = VelSet
trigger1 = sysvar(1) = -2
x = -7
y = -7+7*(ScreenPos Y < 120)




[State 1335]
type = VelSet
trigger1 = sysvar(1) = 3
y = -7+7*(ScreenPos Y < 120)
x = 0


[State 1335]
type = VelSet
trigger1 = sysvar(1) = -3
y = 7-7*(Pos Y > -20)
x = 0


[State 1335]
type = VelSet
trigger1 = sysvar(1) = 4
y = 7-7*(Pos Y > -20)
x = 7


[State 1335]
type = VelSet
trigger1 = sysvar(1) = -4
y = 7-7*(Pos Y > -20)
x = -7


[State 1335]
type = VarSet
trigger1 = Time = 0
var(6) = 0


[State 1335]
type = null;PlaySnd
trigger1 = sysvar(1) != 0
trigger1 = var(6) != sysvar(1)
value = 100,5


[State 1335]
type = null;VarSet
trigger1 = sysvar(1) != 0
trigger1 = var(6) != sysvar(1)
var(6) = sysvar(1)


[State 1335]
type = ChangeAnim
triggerall = anim != 5400
trigger1 = sysvar(1) = 0
value = 5400

[State 1335]
type = ChangeState
trigger1 = var(54) = 0
value = 5401
ctrl = 0

Thank you all for your help so far and I appreciate any help you have. Please let me know what and where in the code I should add to get the flight to not stop with one attack.
Re: How to Stop Ending Flight With a Single Attack?
#2  February 08, 2021, 09:24:09 AM
  • avatar
  • **
    • USA
Ok, so it's gonna work like this.

You're flying.
You do an attack.
The attack does its thing.
Now the attack is going to end.  The attack needs to know whether or not you were flying.

If you were flying, then changestate back to flying. (var(54) = 1, then changestate to 5405)
If you were not flying, then do whatever is normal.


Also, you probably need to disable gravity when flying, but whatever.

In short, this needs to be handled in the attack states.  It has nothing to do with the flying part.
Re: How to Stop Ending Flight With a Single Attack?
#3  February 08, 2021, 04:56:42 PM
  • avatar
  • *
    • USA
Okay. So do I have to add

[State 1335]
type = ChangeState
trigger1 = var(54) = 1
value = 5405
ctrl = 0

To the end of all of the coding for everyone of my attacks, or do I have to just change the value at the end of the code for the flight to the value right here to change the flight?