Posted by Drewism19
in Starting a main menu (Started by Drewism19 April 29, 2021, 06:57:12 am
Board: M.U.G.E.N Development Help
Board: M.U.G.E.N Development Help
[Statedef 50000, hit by slam]
type = A
movetype= H
physics = N
[State 50000, 4] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground
You're not going to use SelfState right away. You can use whatever you want, maybe some VelSet, maybe some EnvShake, and only at the end you'll use SelfState.
The SelfState will send P2 back to his own GetHit states instead of yours. It's like a ChangeState when you end a move (where you go back to state 0 for example), but used in custom states.
I had to read your post like 10 times to finally understand what you mean lol
But yeah, basically that.
In your attack state (it says jumping strong punch, so let's use this), you will add a targetstate, right after the hitdef. The value is the custom state, in my post I used 611. Then, you will create statedef 611, which will be used by P2. As soon as the hit connects, P2 will be sent to YOUR state 611 instead of a normal hit state.
You can take a look at one of KFM's custom state:Spoiler, click to toggle visibilty
Notice how it useses movetype = H, indicating the player is being hit, and type = A and not L. In the very end, it uses selfstate to send P2 to it's own gethit states.
Hope it gets a bit easier to understand.
TargetState.
[State 610, TargetState]
type = TargetState
triggerall = NumTarget
trigger1 = !Time
value = 611
Something like that. What it does is you can control how P2 reacts uppon being hit. But you have to create the whole state for it. Look for grabs/throws, they are good examples of custom states.
I've actually struggled with this while working on my very first character. I ultimately learned that down.bounce is the target are still in their liedown statedef (i.e.: their statetype is L). This means you can't hit them even while they down.bounce unless your hitflag has D in it. Meaning that at least the strong punch you posted above will connect, but anything else with no D in their hitflag will not. If you want to actually create a true groundbounce state, it has to put P2 in a custom state so that they'll be in statetype A instead of L.
;Jump Strong Punch
; CNS difficulty: easy
[Statedef 610]
type = A
movetype= A
physics = A
juggle = 0
poweradd= 30
ctrl = 0
anim = 610
sprpriority = 2
[State 610, 2]
type = PlaySnd
trigger1 = Time = 2
value = 0, 1
[State 610, 3]
type = HitDef
trigger1 = Time = 0
attr = A, NA
getpower = 15
damage = 23
animtype = light
guardflag = HA
hitflag = MAFD
priority = 3
pausetime = 8,8
guard.pausetime = 17,20
hitsound = S8,2
guardsound = S9,1
ground.type = high
ground.slidetime = 0
guard.slidetime = 9
ground.hittime = 15
ground.velocity = -2,22
airguard.velocity = -1,-.8
air.type = high
air.velocity = -2, 22
air.hittime = 2
fall = 1
fall.yvelocity = -9
down.bounce = 9
p2facing =1
Here, this is on a character I'm working on:Code:[State -1]
type = ChangeState
value = 1000
triggerall = roundstate = 2 && !AILevel
triggerall = command = "qcf_x"
trigger1 = statetype != A && ctrl
trigger2 = stateno = [200,450]
trigger2 = movecontact
Statedef 1000 is the special move. The trigger2 lines are the important part. It makes it so you can input the command if you're in the middle of using the normals AND if they make contact. This is essentially how it works in Marvel vs. Capcom.
I hope this helps!
When you're working with the basic states like standing, walking, running, jumping, you're either using the core common1.cns found in the data folder of your mugen, or you're overriding it in your character's cns (what you've done by adding in your own state 20).
here's what's in the common for state 20Code:; Walk
[Statedef 20]
type = S
physics = S
sprpriority = 0
[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)
[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)
[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20
[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21
The common will generally use those constants that you've defined in the character's main cns, so in this case, "walk.fwd" and "walk.back".
When you have some time, open up the common and check out what they do for all the states, it's helpful to see how they code everything so you know how to interact with it, or see if you need to override it for something specific. At some point what some creators end up doing is copying that common and placing it into the character folder so they can edit it to have a common that's custom for that character.