A place to have fun with Mugen
 
PortalHomeFAQMemberlistSearchRegisterComic WIP TrackerDownloadsLog inChat
Website Navigation Help
Translate the Website
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Latest topics
» chuchoryu & Friends vs all Realms!!!
by chuchoryu Today at 12:39 am

» SNK chuchoryu!! the King of Mugen...XD not true
by chuchoryu Today at 12:30 am

» Release Elektra 2.4 by Fede de 10
by pockydeluxe1 Today at 12:24 am

» Post cool art you find
by ColdDarkness Today at 12:19 am

» Sprite comic book covers
by NightDevil123 Yesterday at 11:01 pm

» CvS Ultron! soon CvS Gamora
by chuchoryu Yesterday at 9:56 pm

Special Features at MMV






Chat on MMV w/ Discord


Share | 
 

 Need help with flying code

View previous topic View next topic Go down 
AuthorMessage
RyoHazaki

avatar

Posts : 84
Join date : 2016-02-21

PostSubject: Need help with flying code   November 20th 2016, 10:46 am

Greetings all,

I'm assisting a creator in making a character. The character is supposed to fly. He's been able to figure out some of the code to get the character to fly and attack in the air; however, he wants to add to the code to make the character come down after re-entering the flying command? What does he need to add?

Here's the code:

From CMD

;-------------------------------------------------------------------------
;Fly

[Command]
name = "Fly"
command = ~D,DB,B, a

[Command]
name = "Fly"
command = ~D,DB,B, a

[Command]
name = "Fly"
command = ~D,DB,B, a

;---------------------------------------------------------------------------
;Commands
;---------------------------------------------------------------------------
[Statedef -1]
;---------------------------------------------------------------------------
;Fly

[State -1]
type = Changestate
trigger1 = command = "Fly"
trigger1 = statetype = S
trigger1 = ctrl = 1
value = 4999

[State -1]
type = Changestate
trigger1 = command = "Fly"
trigger1 = statetype = A
trigger1 = ctrl = 1
value = 4999
------------------------------------------------------------------
From the CNS:

[Statedef 4999]
type    = S
movetype= I
physics = S
anim =41
ctrl = 0

[State 4999, 1]
type = Explod
trigger1 = Time = 1
trigger1 = statetype != A
anim = F62
pos= 0,0
postype= p1
sprpriority = 3

[State 4999, 2]
type = PlaySnd
trigger1 = Time = 0
value = 6, 3

[State 5000, stand in the air]
type = Velset
trigger1= time = 0
y=-9

[State 5000, define var]
type = Varset
trigger1= time = 0
v = 4
value = 0

[State 5000, stand in the air]
type = Changestate
trigger1= time = 10
value = 4998

;===============================================================================
;Flying
;===============================================================================

[Statedef 4998]
type    = A
movetype= I
physics = A
ctrl = 0

[State 5000, 0]
type = Varset
trigger1 = time = 0
v=5
value = 5000

[State 5000, stand in the air]
type = Changeanim
trigger1= vel x =0
trigger1= vel y >= 0
trigger1= anim != 6000
value = 6000

[State 5000, stop in the air]
type = Velset
trigger1= command != "holdfwd"
trigger1= command != "holdback"
trigger1= command != "holdup"
trigger1= command != "holddown"
x=0
y=0

[State 5000, stand in the air]
type = Velset
trigger1= command = "holdfwd"
trigger2= command = "holdback"
y=0

[State 5000, stand in the air]
type = Velset
trigger1= command = "holdup"
trigger2= command = "holddown"
x=0

[State 5000, to turn aroud]
type = Turn
trigger1 = p2dist X < -5

[State 5000, fly forward]
type = Velset
trigger1= command = "holdfwd"
x = 4.3

[State 5000, fly back]
type = Velset
trigger1= command = "holdback"
x = -4.3

[State 5000, fly up]
type = Velset
trigger1= command = "holdup"
trigger1= command != "holdback"
trigger1= command != "holdfwd"
trigger1= pos y > -220
y = -3.5

[State 5000, fly diagonally forward and upward]
type = Velset
trigger1 = command = "holdfwd"
trigger1 = command = "holdup"
x = 4.3
y = -3.5

[State 5000, fly diagonally up and back]
type = Velset
trigger1 = command = "holdback"
trigger1 = command = "holdup"
x = -4.3
y = -3.5

[State 5000, stop flying up]
type = Velset
trigger1= command = "holdup" || command != "holdback" || command != "holdfwd"
trigger1= pos y < -220
y=0

[State 5000, stop flying up]
type = Velset
trigger1= command = "holdup" || command = "holdfwd" || command != "holdback"
trigger1= pos y < -220
y=0

[State 5000, fly down]
type = Velset
trigger1= command = "holddown"
trigger1= command != "holdback"
trigger1= command != "holdfwd"
trigger1= pos y <= -40
y = 2.9

[State 5000, fly back down diagonal]
type = Velset
trigger1= command = "holddown"
trigger1= command = "holdback"
trigger1= pos y <= -40
x = -4.3
y = 2.9

[State 5000, fly diagonal front low]
type = Velset
trigger1= command = "holddown"
trigger1= command = "holdfwd"
trigger1= pos y <= -40
x = 4.3
y = 2.9

[State 5000, stop flying down]
type = Velset
trigger1= command = "holddown"
trigger1= pos y >= -40
y=0

[State 5000, fly up]
type = Changeanim
trigger1= vel y < 0
trigger1= pos y >= -220
trigger1= command != "holdfwd"
trigger1= command != "holddown"
trigger1= command != "holdback"
trigger1= command = "holdup"
trigger1= anim != 6003
value = 6003

[State 5000, fly forward]
type = Changeanim
trigger1 = command = "holdfwd"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1= anim != 6001
value = 6001

[State 5000, fly diagonally up front]
type = ChangeAnim
trigger1 = command = "holdfwd" && command = "holdup"
trigger1 = command != "holddown"
trigger1 = anim != 6004
value = 6004

[State 5000, fly back]
type = Changeanim
trigger1 = command = "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = anim != 6002
value = 6002

[State 5000, fly diagonally backwards up]
type = Changeanim
trigger1 = command = "holdup"
trigger1 = command = "holdback"
trigger1 = command != "holddown"
trigger1 = anim != 6002
value = 6002

[State 5000, fly down]
type = Changeanim
trigger1= vel y > 0
trigger1= anim != 6000
trigger1 = command != "holddown"
value = 6000

[State 5000, fly back down diagonal]
type = Changeanim
trigger1= command = "holddown"
trigger1= command = "holdback"
trigger1 = anim != 6002
value = 6002

[State 5000, fly diagonal front low]
type = Changeanim
trigger1= command = "holddown"
trigger1= command = "holdfwd"
trigger1 = anim != 6001
value = 6001

[State 5000, Manual order]
type = VarSet
trigger1 = command = "Fly"
trigger2 = command = "Fly"
trigger3 = command = "Fly"
v = 4
value = 458

[State 5000, Land if fight ends]
type = Changestate
trigger1 = Win = 1
trigger2 = lose = 1
value = 50

[State 5000, weak punch]
type = ChangeState
value = 6010
trigger1= command = "x"

[State 5000, medium punch]
type = ChangeState
value = 6011
trigger1 = command = "y"

[State 5000, strong punch]
type = ChangeState
value = 6012
trigger1 = command = "z"

[State 5000, weak kick]
type = Changestate
trigger1= command = "a"
value = 6013

[State 5000, medium kick]
type = ChangeState
value = 6014
trigger1= command = "b"

[State 5000, strong kick]
type = ChangeState
value = 6015
trigger1= command = "c"

[State 5000, land]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = Var(5) != 5000
value = 50

;-------------------------------------------------------------------------------
;Flying light punch

[Statedef 6010]
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 6010
poweradd = 15
sprpriority = 2
velset = vel x, 0

[State 6010, PlaySnd]
type = PlaySnd
trigger1 =  AnimElem = 1
value = 8400,0

[State 6010, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,NA
damage = 15,1
givepower = 15
getpower = 20
animtype = Light
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 11,11
sparkno = s7710
sparkxy = -10, -63
guard.sparkno = s6767
hitsound = s8000,0
guardsound = 6,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 25
ground.velocity = -6
air.fall = 0
air.velocity = -3.2, -10.5

[State 6010, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = prevstateno

;-------------------------------------------------------------------------------
;Flying medium punch

[Statedef 6011]
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 6011
poweradd = 35
sprpriority = 2

[State 6011, PlaySnd]
type = PlaySnd
trigger1 =  AnimElem = 1
value = 8400,1

[State 6011, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,NA
damage = 35,1
givepower = 30
getpower = 40
animtype = medium
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 11,11
sparkno = s7711
sparkxy = -10,-68
guard.sparkno = s6767
hitsound = s8000,1
guardsound = 6,0
ground.type = High
ground.slidetime = 25
ground.hittime  = 20
ground.velocity = -8
air.fall = 0
air.velocity = -3.2, -7.5

[State 6011, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = prevstateno

;-------------------------------------------------------------------------------
;Flying strong punch

[Statedef 6012]
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 6012
poweradd = 55
sprpriority = 2

[State 6012, PlaySnd]
type = PlaySnd
trigger1 =  AnimElem = 1
value = 8400,2

[State 6012, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,NA
damage = 45,1
givepower = 50
getpower = 70
animtype = High
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 11,11
sparkno = s7712
sparkxy = -10, -53
guard.sparkno = s6767
hitsound = s8000,2
guardsound = 6,0
ground.type = High
ground.slidetime = 18
ground.hittime  = 25
ground.velocity = -10
air.velocity = -12,10
air.hittime = 25
air.fall = 1

[State 6012, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = prevstateno

;-------------------------------------------------------------------------------
;Flying light kick

[Statedef 6013]
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 6013
poweradd = 15
sprpriority = 2

[State 6013, PlaySnd]
type = PlaySnd
trigger1 =  AnimElem = 1
value = 8400,0

[State 6013, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,NA
damage = 15,1
givepower = 15
getpower = 20
animtype = Light
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 11,11
sparkno = s7710
sparkxy = -10, -63
guard.sparkno = s6767
hitsound = s8000,3
guardsound = 6,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -6
air.fall = 0
air.velocity = -3.2, -10.5
air.hittime = 25

[State 6013, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = prevstateno

;-------------------------------------------------------------------------------
;Flying medium kick
[Statedef 6014]
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 6014
poweradd = 35
sprpriority = 2

[State 6014, PlaySnd]
type = PlaySnd
trigger1 =  AnimElem = 1
value = 8400,1

[State 6014, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,NA
damage = 35,1
givepower = 30
getpower = 40
animtype = Medium
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 11,11
sparkno = s7711
sparkxy = -10,-68
guard.sparkno = s6767
hitsound = s8000,4
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -8
air.fall = 0
air.velocity = -3.2, -7.5
air.hittime = 25

[State 6014, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = prevstateno

;-------------------------------------------------------------------------------
;Flying strong kick

[Statedef 6015]
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 6015
poweradd = 55
sprpriority = 2

[State 6015, PlaySnd]
type = PlaySnd
trigger1 =  AnimElem = 1
value = 8400,2

[State 6015, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,NA
damage = 45,1
givepower = 50
getpower = 70
animtype = High
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 11,11
sparkno = s7712
sparkxy = -10, -53
guard.sparkno = s6767
hitsound = s8000,5
guardsound = 6,0
ground.type = High
ground.slidetime = 18
ground.hittime  = 25
ground.velocity = -10
air.velocity = -12,10
air.fall = 1
air.hittime = 25

[State 6015, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = prevstateno
Back to top Go down
View user profile
borewood2013

avatar

Posts : 5004
Join date : 2014-08-11

PostSubject: Re: Need help with flying code   November 24th 2016, 5:42 am

I don't know but....there seems to be some MUGEN logic problem here Arrow :

First, the Var(5) looks like a timer MUGEN variable to me, but it is not doing the timer job because it gets reset every time it comes back to Statedef 4998 from those punches and kicks:
[State 5000, 0]
type = Varset
triggerall = Var(5) = 0 ;===>>>>> add this one for safety
trigger1 = time = 0
v=5
value = 5000

===>>>> you can put the above Varset v=5 in Statedef 4999 rather than Statedef 4998, because Statedef 4999 can be entered only once

Second, you still need a VarAdd in Statedef -3 to make the Var(5) timer being able to count down from value = 5000:
[State -3, VarAdd]
type = VarAdd
triggerall = StateNo != 4999
trigger1 = Var(5) > 0
v = 5
value = -1

Then in Statedef 4998, only after Var(5) is decreased to 0 it can enter the default jump Statedef 50:
[State 5000, land]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = Var(5) != 5000  ;===>>>>> this one shall be changed to Var(5) <= 0
value = 50

Now, for the "the code to make the character come down after re-entering the flying command" part........
I think you don't really need the VarSet v = 4 in both Statedef 4999 & 4998.  And you can put the  "Land if fight ends" MUGEN Triggers to one (1) single ChangeState value = 50 too.
You can just add more MUGEN Trigger to the ChangeState value = 50 to make it happen:

[State 5000, land]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = Var(5) <= 0
;;;;;; add more MUGEN Trigger below:
trigger2 = AnimTime = 0
|| Time > ## ;;; ## depends on those flying Animations
trigger2 = Command = "Fly"
;;;;; put the "Land if fight ends" MUGEN Triggers here too:

trigger3 = Win = 1
trigger4 = lose = 1

value = 50
Back to top Go down
View user profile https://onedrive.live.com/?cid=7DB65F02B0BBD12E
 
Need help with flying code
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
The Mugen Multiverse :: Mugen :: Mugen Help-
Jump to: