The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Topic started by: Zukuwo on September 29, 2016, 09:11:04 am

Title: Run back
Post by: Zukuwo on September 29, 2016, 09:11:04 am
So hi everyone, i'm working on my first "test" progject before i start working on an actual one and i wanted to give my character a run backwards instead of the hop backwards. the thing is i don't know how to do that. How can i change the Hop into a Run? Thanks beforehead :3
Title: Re: Run back
Post by: jaede_ on September 29, 2016, 09:34:57 am
For that you'll need to override the character's Hop Back state, which is 105, to do that you simply need to create a state in your character's state files that has the same number, now since you want to change the hop into a run you can pretty much do the following:

1) Take an already existing run state, like the one in common1.cns (which you can find in your /data folder from MUGEN), for sake of convenience and help I'm going to leave it here:

Code:
;---------------------------------------------------------------------------
; Run forward
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

2) Now copy this state into your character's files and change the stateno to the state you want to override, which in this case is State 105, the hop back state, you can also change the numbers on the controllers so it looks more organized, but it's not really required:


Code:
;---------------------------------------------------------------------------
; Run Backwards
[Statedef 105] ;<--- You HAVE to change this one
type    = S
physics = S
anim = 105 ;<-- same with this to match with your running back anim
sprpriority = 1

[State 105, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 105, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 105, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 105, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

3) Now it's time to alter the behavior of the state, since we want the character to run backwards, we need to read the value defined from the constants for running back, so to do that we write: const(velocity.run.back.x) instead of const(velocity.run.fwd.x), then just make sure the way to end running is by not holding back (instead of not holding forward) you change the final changestate's trigger:

Code:
;---------------------------------------------------------------------------
; Run Backwards
[Statedef 105]
type    = S
physics = S
anim = 105
sprpriority = 1

[State 105, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.back.x)
y = 0 ;<- the default values of the run velocities from are set at time = 0 no matter what, so we need to make sure it doesn't get taken

[State 105, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 105, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 105, 4]
type = ChangeState
trigger1 = command != "holdback"
value = 0

And that's pretty much the basics of it, after that you can alter the run states to be more to your liking.
Title: Re: Run back
Post by: Zukuwo on September 29, 2016, 09:52:11 am
thanks a lot!! i'm gonna try this right away


     Posted: September 29, 2016, 10:02:41 am
it worked just fin, thanks a lot for the detailed explanation