Jump to content

How to code fly?


llyyr

Recommended Posts

This is an tutorial maybe?

Okay here is the code i use.

I will explain codes line by line.

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

; go to fly mode

[statedef 999] ;< Statedef, this is the process to go in fly from standing.

type = A ;< Make sure you use A = Air as type

movetype = I

physics = N

juggle = 0

velset = 0,0

ctrl = 0

anim = 999 ;< Enter the anim you want

;go up (whether you are in ground or air before you went to this state, you go up)

[state 0, VelSet] ;< This is for make the character go up till the Anim ends

type = VelSet

trigger1 = 1

x = 0

y = -3

[state 0, ChangeState] ;< This Change state is to go to Fly Stand state after you are flying

type = ChangeState

trigger1 = animtime = 0

value = 1000

ctrl = 1

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

;fly stance

[statedef 1000] ;< This is fly stance

type = A ;< Make sure you use A = Air as type

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

anim = 1000 ;< here enter the number of anim which you want as Fly idle

velset = 0,0

;limit for flying up

[state 0, PosSet] ;< This is to limit the character not to go too high, if you remove it then it won't be fair gameplay.

type = PosSet

trigger1 = pos y <= -180 ;< Limit -180 is ideal for it

y = -180

;fly stance float up

[state 0, VelSet]

type = VelSet

trigger1 = gametime%30 = [0,14] ;< This is to make the character float in AIR to make it look more real

x = 0

y = -1

;fly stance float down

[state 0, VelSet]

type = VelSet

trigger1 = gametime%30 = [15,29] ;< This is to make the character float in AIR to make it look more real

x = 0

y = 1

;turn

[state 0, Turn] ;< Simple Turn, When P2's distance is X <-10

type = Turn

trigger1 = P2dist X < -10

; fly dash forward

[state 0, ChangeState] ;< This is the command for fly dash forward.

type = ChangeState

trigger1 = command = "FF"

value = 1100

ctrl = 1

; fly dash backward

[state 0, ChangeState] ;< This is the command for fly dash backward.

type = ChangeState

trigger1 = command = "BB"

value = 1105

ctrl = 1

;fly forward ;< This is the command for fly forward.

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holdfwd"

value = 1020

ctrl = 1

;fly backward ;< This is the command for fly backward.

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holdback"

value = 1021

ctrl = 1

;fly up ;< This is the command for fly up

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holdup"

value = 1040

ctrl = 1

;fly down ;< This is the command for fly down

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holddown"

value = 1041

ctrl = 1

;go back to jump/fall state ;< This is the command for jump to ground if you Won in air, you know no one will like to have the win pose in AIR

[state 0, ChangeState]

type = ChangeState

trigger1 = Win = 1

value = 50

ctrl = 1

;go back to damage fall state ;< If you get hit then this will happen.

[state 0, ChangeState]

type = ChangeState

trigger1 = Life = 0

trigger2 = roundstate = 3

value = 5050

ctrl = 1

;go back to fly land state

[state 0, ChangeState] ;< This is to come down from Fly mode

type = ChangeState

trigger1 = pos y >= 0

value = 1047

ctrl = 1

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

;fly fwd

[statedef 1020] ;< Fly walk fwd

type = A

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

;anim = 1020 ;< I have commented out the anim because i didn't had an Fly walk fwd so i use the Fly idle Anim for it

velset = 0,0

[state 0, Turn]; < Turn

type = Turn

trigger1 = P2dist X < -10

[state 0, VelSet] ;< VelSet or The speed to fly walk fwd

type = VelSet

trigger1 = 1

x = 4

y = 0

[state 0, ChangeState] ;< This change state is to go back to the fly idle state if you are not holding fwd

type = ChangeState

trigger1 = command != "holdfwd"

value = 1000

ctrl = 1

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

;fly bkd

[statedef 1021] ;< fly Walk Back

type = A

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

;anim = 1021 ;< I have commented out the anim because i didn't had an Fly walk back so i use the Fly idle Anim for it

velset = 0,0

[state 0, Turn] ;< Turn

type = Turn

trigger1 = P2dist X < -10

[state 0, VelSet] ;< VelSet or The speed to fly walk back

type = VelSet

trigger1 = 1

x = -4

y = 0

[state 0, ChangeState] ;< This change state is to go back to the fly idle state if you are not holding back

type = ChangeState

trigger1 = command != "holdback"

value = 1000

ctrl = 1

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

;fly up

[statedef 1040] ;< Fly Up

type = A

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

;anim = 1040

velset = 0,0

[state 0, Turn] ;< Turn

type = Turn

trigger1 = P2dist X < -10

[state 0, VelSet] ;< VelSet for the speed of Fly Up.

type = VelSet

trigger1 = pos y > -180 ;< I am using the pos trigger to stop to play the fly up anim when reaching the Limit. (Change the 180 if you have changed the limit.

x = 0

y = -4

;limit for flying up

[state 0, PosSet]

type = PosSet

trigger1 = pos y <= -180

y = -180

[state 0, ChangeState]

type = ChangeState

trigger1 = command != "holdup"

value = 1000

ctrl = 1

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

;fly down

[statedef 1041] ; Fly down

type = A

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

;anim = 1041

velset = 0,0

[state 0, Turn]

type = Turn

trigger1 = P2dist X < -10

[state 0, VelSet] ; The speed of fly down

type = VelSet

trigger1 = pos y < 0

x = 0

y = 4

;go back to jump/fall state

[state 0, ChangeState] ; If you are landing with by pressing "down" then this will take it to the landing state

type = ChangeState

trigger1 = pos y >= 0

value = 1047

ctrl = 1

[state 0, ChangeState]

type = ChangeState

trigger1 = command != "holddown"

value = 1000

ctrl = 1

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

;fly landing

[statedef 1047] ;< Airplane is landing

type = S

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

;anim = 1047 ;< I have commented this out because i didn't had an fly land

velset = 0,0

[state 0, PosSet] ;< You know PosSet

type = PosSet

trigger1 = pos y >= 0

y = 0

[state 0, ChangeState] ;< This is to take the character to the Jump Land state.

type = ChangeState

trigger1 = Animtime = 0

value = 52

ctrl = 1

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

;fly dash forward

[statedef 1100] ; Fly Dash Fwd

type = A

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

anim = 1100 ;< Anim to the Fly dash Fwd

velset = 0,0

[state 0, VelSet] ;< Speed of Fly Dash Fwd

type = VelSet

trigger1 = time = 0

x = 5

[state 0, VelAdd]

type = VelAdd

trigger1 = 1

x = 0.1

[state 0, ChangeState] ;< To stop him

type = ChangeState

trigger1 = frontedgebodydist < 2

trigger2 = command != "holdfwd"

trigger3 = command = "BB"

value = 1000

ctrl = 1

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

;fly dash backward

[statedef 1105] ; The fly dash back is same as the fly dash forward

type = A

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

anim = 1105

velset = 0,0

[state 0, VelSet]

type = VelSet

trigger1 = time = 0

x = -5 ;-0.2

[state 0, VelAdd]

type = VelAdd

trigger1 = 1

x = -0.1 ;-2

[state 0, ChangeState]

type = ChangeState

trigger1 = backedgebodydist < 2

trigger2 = command != "holdback"

trigger3 = command = "FF"

value = 1000

ctrl = 1

________________________________________________________________________________________________

;If you want to make the character fly even after getting hurt then make the 5000s state's type "A"

----------------------------------------------------------------------------------------------------------------------------------------------------------

EVERYTHING WHICH IS COMMENTED OUT IS IN RED COLOR.

I hope this helps, credit to sgn15 because he told me how to code fly.

TO make Fly Attacks copy the codes and make the type = A.

And do something like this in you CMD

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

;Fly

[state -1, Fly] ;< This is the Fly code command

type = ChangeState

value = 999

trigger1 = command = "c"

trigger1 = statetype != C

trigger1 = ctrl

;flying Light Punch

[state 0, ChangeState] ;< There are fly attacks

type = ChangeState

trigger1 = command = "x"

value = 2000

ctrl = 1

;flying Strong Punch

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "y"

value = 2100

ctrl = 1

;flying Light Kick

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "a"

value = 2300

ctrl = 1

;flying Strong Punch

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "b"

value = 2400

ctrl = 1

;Now an example of the CNS code of the fly attacks:

; Fly Light Punch ;< This is an example

[statedef 2000]

type = A

movetype= A

physics = S

juggle = 1

velset = 0,0

ctrl = 0

anim = 200

[state 2000, 1]

type = HitDef

trigger1 = AnimElem = 2

attr = A, NA

damage = 23, 0

animtype = Light

guardflag = MA

hitflag = MAF

priority = 3, Hit

pausetime = 8, 8

sparkno = 0

sparkxy = -10, -56

hitsound = 5, 0

guardsound = 6, 0

ground.type = High

ground.slidetime = 5

ground.hittime = 11

ground.velocity = -4

airguard.velocity = -1.9,-.8

air.type = High

air.velocity = -1.4,-3

air.hittime = 15

[state 2000, 2] ;< Now this is very important if you don't do this then you will be standing in air

type = ChangeState

trigger1 = AnimTime = 0

value = 1000 ;< In the value add the statedef number of the fly idle to make him fly after the attack finishes

ctrl = 1

Link to comment
Share on other sites

Just so you know. ALOT of the DBZ chars from back in the day. (2007 - 2009) had flying in their code. Not only was it a stupid feature for the AI to be able to use, but became a nuisance to the player as well when fighting a DBZ character that can fly. Usually what happens is the AI takes controll.... Flies in the air.... And flies as high above the stage so normal characters cannot hit him, Its just annoying and mainly the reason why DBZ characters were frowned appon by the average Mugen players. Not that this tutorial isnt helpful.....

Link to comment
Share on other sites

Just so you know. ALOT of the DBZ chars from back in the day. (2007 - 2009) had flying in their code. Not only was it a stupid feature for the AI to be able to use, but became a nuisance to the player as well when fighting a DBZ character that can fly.

Usually what happens is the AI takes controll.... Flies in the air.... And flies as high above the stage so normal characters cannot hit him,

Its just annoying and mainly the reason why DBZ characters were frowned appon by the average Mugen players.

Not that this tutorial isnt helpful.....

well yeah true but there are also char that drain their power when flying and also i saw some that had a limit on how high they can fly

i think with these 2 you could make flying not so cheap

Link to comment
Share on other sites

Usually what happens is the AI takes controll.... Flies in the air.... And flies as high above the stage so normal characters cannot hit him,

He has a line that stops that

;limit for flying up

[state 0, PosSet] ;< This is to limit the character not to go too high, if you remove it then it won't be fair gameplay.

type = PosSet

trigger1 = pos y <= -180 ;< Limit -180 is ideal for it

y = -180

Yes what you said is true about DBZ chars being frowned upon for this reason but flying at any time isnt the only way this code can be used(granted it's used most in those cases)

The creator can set a limit on flight if they chose or set it up that it only works at certain times or even is only allowed for a short duration(in ex mode for examples or timed transformations)

And as ace-sama said,the powerbar can be drained while the move is used and (what i personally think would work even better) is after the powerbar is drained,the lifebar starts draining as well

All Gopal did was share with us something that wasnt here.

Link to comment
Share on other sites

his fly code is not the same thing as what your thinking drunk ryu. this is a super butoden flying code. which means when you enter flying mode, the player will move up into the sky and stay there, they can not move higher or lower. so in a sense it acts as a second layer of floor. there limited to foward, backward, and jump. or at least i believe i'm right.

Link to comment
Share on other sites

no if you copy and paste it, its not gonna work. he basically give you an example of the code, you have to add the same codes to your character, except change them to make your character work with it.

Link to comment
Share on other sites

yes, but for the commands i will suggest to keep them in CNS, because in CMD i don't like junk.

can you tell me what the value stands for becuase it seems like it stands for more than one thing,i dont understand if thats based off the anim or same statedef?is it safe for me to use the same value= number for fly up,fly fwd , fly dwn and so on.plz explain a little more
Link to comment
Share on other sites

  • 5 years later...

but im saying he doesnt stay still when running, when flying its a still image in various angles so of course he doesnt move when shooting.

but he still runs when shooting.

 

are you trying to bring  space harrier into mugen!?

Link to comment
Share on other sites

  • 3 years later...

Hello, I would like to know how I could add a time limit for when the character is in the air, and that when performing attacks the time does not restart, I already tried a lot of variants and state changes but either the time is restarted or it flies a few seconds and falls.

An example could be like Iron Man from Marvel vs. Capcom, who have a limited time to fly and then fall to the ground.

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

; go to fly mode

[statedef 1800] ;< Statedef, this is the process to go in fly from standing.

type = A ;< Make sure you use A = Air as type

movetype = A

physics = N

juggle = 0

velset = 0,0

ctrl = 0

anim = 1800 ;< Enter the anim you want

;go up (whether you are in ground or air before you went to this state, you go up)

 

[state 0, VelSet] ;< This is for make the character go up till the Anim ends

type = VelSet

trigger1 = 1

x = 0

y = -10

 

[State 100, Spark Stars]

type = Explod

trigger1 = -1

anim = 14901

postype = p1

pos = 0,-15

scale = 0.4,0.4

accel = 0, -0.3

facing = -1

vfacing = -1

sprpriority = -1

ontop = 1

ownpal = 1

bindtime = 1

pausemovetime = 20

supermovetime = 99999

persistent = 5

removetime = 13

ignorehitpause = 1

 

[State 1300, Super D]

type = AfterImage

trigger1 = Time = 0

trans = add

TimeGap = 1

FrameGap = 1

time = 15

length = 10

palbright = 161, 0, 252

palcontrast = 161, 0, 252

palpostbright = 140,45,140

PalAdd = 1,1,1

PalMul = .65,.65,.75

 

[State 410, 2]

type = PlaySnd

trigger1 = AnimElem = 1

value = 100,2

 

[state 0, ChangeState] ;< This Change state is to go to Fly Stand state after you are flying

type = ChangeState

trigger1 = animtime = 0

value = 1806

ctrl = 1

 

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

;fly stance

[statedef 1806] ;< This is fly stance

type = A ;< Make sure you use A = Air as type

movetype= I

physics = N

juggle = 0

poweradd= 0

ctrl = 0

anim = 1900 ;< here enter the number of anim which you want as Fly idle

velset = 0,0

 

[State -3, sense bar]

type = Explod

triggerall = animtime = 0

trigger1 = numexplod(3309)=0

anim = 3309

id = 3309

pos = 6,ifelse(var(14) = 0,214,202)+var(16)

postype = left

facing = 1;ifelse(TeamSide = 1, 1, -1)

bindtime = -1

removetime = -2

sprpriority = 92

ignorehitpause = 1

ownpal = 1

scale = 0.5,0.5

 

[State 1500,fuwavar(1)]

type = VarSet

trigger1 = (command != "holdfwd" && command != "holdback" && command != "holdup" && command != "holddown") && var(2) != 2

trigger2 = (var(2) = 2) && Vel Y >= 1

v = 2

value = 1

 

[State 1500,fuwavar(2)]

type = VarSet

triggerall = var(2) = 1

trigger1 = Vel Y <= -1

trigger2 = (P2BodyDist Y > 200)&&(Vel Y < 0)

v = 2

value = 2

 

[State 1500,fuwaUp]

type = VelAdd

trigger1 = var(2) = 1

y = -0.05

 

[State 1500,fuwaDown]

type = VelAdd

trigger1 = var(2) = 2

y = 0.05

 

;turn

[state 0, Turn] ;< Simple Turn, When P2's distance is X <-10

type = Turn

trigger1 = P2dist X < -10

 

; fly dash forward

[state 0, ChangeState] ;< This is the command for fly dash forward.

type = ChangeState

trigger1 = command = "FF"

value = 104

ctrl = 1

 

;fly forward ;< This is the command for fly forward.

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holdfwd"

value = 1807

ctrl = 1

 

;fly backward ;< This is the command for fly backward.

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holdback"

value = 1808

ctrl = 1

 

;fly up ;< This is the command for fly up

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holdup"

value = 1809

ctrl = 1

 

;fly down ;< This is the command for fly down

[state 0, ChangeState]

type = ChangeState

trigger1 = command = "holddown"

value = 1810

ctrl = 1

 

[State 5000, Smart Bombs]

type = Changestate

trigger1 = command = "RaiolaserF"

value = 1015

ctrl = 1

 

[State 5000, Caida Libre]

type = Changestate

trigger1 = (command = "y+z" && command != "holddown")

value = 650

ctrl = 1

 

[State 5000, Smart Bombs]

type = Changestate

trigger1 = command = "Lightning"

value = 730

ctrl = 1

 

[State 5000, Smart Bombs]

type = Changestate

trigger1 = command = "lightningball"

value = 3250

ctrl = 1

 

[State 5000, Air Uni Beam]

type = Changestate

trigger1 = command = "megaice"

value = 3950

ctrl = 1

 

[State 5000, Air Uni Beam]

type = Changestate

trigger1 = command = "qcf_z"

value = 717

ctrl = 1

 

[State 5000, weak kick]

type = Changestate

trigger1= command = "a"

value = 111903

ctrl = 1

 

[State 5000, medium kick]

type = ChangeState

value = 111904

trigger1= command = "b"

 

[State 5000, strong kick]

type = ChangeState

value = 111906

trigger1= command = "c"

 

[State 5000, weak punch]

type = ChangeState

value = 111901

trigger1= command = "x"

 

[State 5000, weak punch]

type = ChangeState

value = 219

trigger1= command = "x"

 

[State 5000, medium punch]

type = ChangeState

value = 111902

trigger1 = command = "y"

 

[State 5000, medium punch]

type = ChangeState

value = 214

trigger1 = command = "y"

 

[State 5000, strong punch]

type = ChangeState

value = 111905

trigger1 = command = "z"

 

;go back to jump/fall state ;< This is the command for jump to ground if you Won in air, you know no one will like to have the win pose in AIR

[state 0, ChangeState]

type = ChangeState

trigger1 = Win = 1

value = 50

ctrl = 1

 

;go back to damage fall state ;< If you get hit then this will happen.

[state 0, ChangeState]

type = ChangeState

trigger1 = Life = 0

trigger2 = roundstate = 3

value = 1040

ctrl = 1

 

;go back to fly land state

[state 0, ChangeState] ;< This is to come down from Fly mode

type = ChangeState

trigger1 = pos y >= 0

value = 1047

ctrl = 1

 

[State 0, RemoveExplod]

type = RemoveExplod

triggerall = stateno = 1806

trigger1 = numexplod(133333) > 0

id = 133333

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...