Jump to content
  • 0

How do I end a state on button release?


wazzledog
 Share

Question

I'm working on a non-traditional fighting game prototype using the mugen engine. I'm very comfortable with my design work and my ability to rewrite kung fu man's code to create new fighters, but I have no idea how to approach something I'm struggling with.

That thing being, how do I return to idle state when I release the button? I have a normal attack that persists after you press the button, but it still persists until you cancel into a different state after you release the button. I want it to return to idle when I let go of the normal attack's move. I am very comfortable with the animations file, comfortable with the states file, but don't know all the commands, and am completely confused by the commands file.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

In the cns file as Whiplash is saying.  To add to Whiplash's post...

type = Changestate

trigger1 = Command != "hold x"

value = y

 

Would be something like...

 

[State 2220, xyzpdq]

type = Changestate

trigger1 = Command != "hold x"

value = 0

ctrl = 1

 

The last ctrl = 1 is important as it returns control to the player and allows you to do commands again from the cmd file. Note, state 0 is the default 'standing' state.

Forgot, at the top of the cmd file is the keypresses.  Look up the move in that part like so...

[Command]
name = "JLK"
command = ~B, DB, D, b

So for the B,DB,D,b move look for a changestate in the cmd like this later...

;Jumping Lower Kick
[State -1]
type = ChangeState
value = 2220
triggerall = command = "JLK"
triggerall = statetype != A
triggerall = ctrl
trigger1 = power >= 1000 && AILevel > 0
trigger2 = AILevel = 0

Which then leads you to state 2220 in the cns file which would start out with [Statedef 2220] Note again, if it is an 'air' attack or such you would want to return to state 52 or else your character will be froze in the air. If Statetype is A then use value = 52. If statetype is S or C then use value = 0.

 

Link to comment
Share on other sites

  • 0

You would need to use -2 states for something like that. -2 states are at the bottom of the cns and are always active.  But a 'changestate' in the -2 states is probably what you'll need to do with the triggers for command and all that stuff. The cmd file is only accessed when ctrl = 1 which most moves to execute need ctrl = 0.  You may be able to get away a little with using ctrl = 1 for the move though. Experiment a bit.

Link to comment
Share on other sites

  • 0

easy.

In the attack's state:

[State 1600,3]

type = Changestate

trigger1 = Command != "hold x"

value = y

 

WHere x is whatever button you want. and y is the state you want to go into

 

Basically the attack stops when mugen does not detect the command.

 

hold x BTW is:

[command]

name = "hold x"

command = /x

time = 1

 

Good luck.

 

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
 Share

×
×
  • Create New...