Throw Issue

Started by Darkspines22, April 16, 2013, 05:22:34 AM

Previous topic - Next topic

Darkspines22

I'm currently trying to code a throw in Mugen, but I encounter a weird bug. When I press forward + y when up close to do the throw animation, the animation plays, the opponent gets grabbed and then... they disappear for a slight second before falling straight to the ground. However, my character does his animation for when the throw connects. Can someone tell me what's going on?
Nothing To see here.

Cobra Caddie

In your custom state, try using changeanim2 instead of changeanim. If that doesn't work lemme know and we can fix it from there.

Darkspines22

#2
Quote from: Caddie on April 16, 2013, 11:36:12 AM
In your custom state, try using changeanim2 instead of changeanim. If that doesn't work lemme know and we can fix it from there.

The value was Changeanim2 :(
I also just want this throw to launch the opponent in the air (I'm trying to make a command grab that is similar to Q's command grab from SFIII: 3rd Strike). Will I need a custom get hit state for that? (Sorry for the very noob-ish questions)
Nothing To see here.

Cobra Caddie

You don't have to. You can use a custom state for the beginning of the grab and then just hit the opponent into the air. Or you could use a custom state for the throw too. Could you post what you have for all the throw states you have so far? Both your players and the "being thrown" attacks.

Darkspines22

Quote from: Caddie on April 16, 2013, 09:31:12 PM
You don't have to. You can use a custom state for the beginning of the grab and then just hit the opponent into the air. Or you could use a custom state for the throw too. Could you post what you have for all the throw states you have so far? Both your players and the "being thrown" attacks.

In all honesty, I just copied Kung Fu Man's throw code (I"m lazy at times).  However, with the throw code, I don't it to trigger a custom state from my file, just a knockdown, and I'm curious as to how I would go about triggering the hit def. Do you still want me to post my code?
Nothing To see here.

Cobra Caddie

Sure, would make it easy to figure out what's wrong. You can have you hit knock the opponent in the air by giving it a negative y-velocity for the hit velocity. Put this in your hitdef, making sure to adjust the values for the effect you want:

ground.velocity = -3, -7

And make sure it has one of these:

fall = 1

Keep in mind that you're gonna need a hitdef that has params that are closer to a normal hit for this to look good. If you're using KFM's throw hitdef for your knock up attack, it won't look right.

Darkspines22

#6
So would I change in State 820 (custom state/action for when the opponent is thrown) to a hitdef with a posadd?
(Aka should I change this code:
[Statedef 820]
type    = A
movetype= H
physics = N
velset = 0,0

[State 820, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 820

;In case attacker loses binding on player for any reason, this controller
;guarantees that the player will never get stuck in this thrown state.
[State 820, 2]
type = SelfState
trigger1 = !gethitvar(isbound)
value = 5050)

Here's the full code just so you can see it:
Spoiler (click to show)
[Statedef 800]
type    = S
movetype= A
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 800
sprpriority = 2

; Notes: The '-' symbol in the hitflag field means that it only affects
;   players who are not in a hit state. This prevents KFM from combo-ing
;   into the throw. The priority should be set to a low number, such as
;   1 or 2, so that the throw does not take precedence over normal attacks.
;   The type of priority must always be set to "Miss" or "Dodge" for throws,
;   otherwise strange behavior can result.
[State 800, 1]
type = HitDef
Trigger1 = Time = 0
attr = S, NT          ;Attributes: Standing, Normal Throw
hitflag = M-          ;Affect only ground people who are not being hit
priority = 1, Miss    ;Throw has low priority, must be miss or dodge type.
sparkno = -1          ;No spark
p1sprpriority = 1     ;Draw p1's sprite in front of p2
                      ;p2's sprite priority is set to 0 by default
p1facing = 1
p2facing = 1          ;Force p2 to face KFM
p1stateno = 810       ;On success, KFM changes to state 810
p2stateno = 820       ;If hit, p2 changes to state 820 in KFM's cns
guard.dist = 0        ;This prevents p2 from going into a guard state if close
fall = 1              ;Force p2 into falling down

[State 800, 2]
type = ChangeState
Trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Kung Fu Throw - Throwing the opponent
; Description: In this state, KFM throws the opponent by binding him to
;     various offsets based on his current frame of animation. For
;     example, [State 810, Bind 1] binds the opponent to an offset of
;     28 pixels in front of KFM. That puts him around where KFM's hand
;     is at. Is is important to keep the opponent bound using a
;     TargetBind controller at all times, until you let him go. This
;     is especially important if your player has a Clsn2 box that
;     allows him to get hit while throwing someone. Each time a player
;     gets hit, all his bound targets will be set to a fall state. If
;     the opponent is not bound, then he may get stuck in his thrown
;     state when his attacker is knocked out of the throw halfway.
; Notes: There is a TargetLifeAdd controller to decrease the opponent's
;     life, and a TargetState controller to change his state to a
;     falling state when KFM lets go of him.
[Statedef 810]
type    = S
movetype= A
physics = N
anim = 810
poweradd = 0

; Here a variable, var(2), is used to remember whether or not the
; player was holding forward at the start of the state. This variable
; is checked later on to turn KFM around if necessary.
[State 810, Holding fwd?]
type = VarSet
trigger1 = Time = 0
var(2) = command = "holdfwd"

[State 810, Grab Sound]
type = PlaySnd
trigger1 = AnimElem = 2
value = 1, 1

[State 810, Throw Sound]
type = PlaySnd
trigger1 = AnimElem = 7
value = 800, 0

[State 810, Bind 1]
type = TargetBind
trigger1 = AnimElemTime(2) < 0
pos = 112, 0

[State 810, Width 2-11]
type = Width
trigger1 = AnimElemTime(2) >= 0 && AnimElemTime(12) < 0
edge = 240,0

[State 810, Bind 2-4]
type = TargetBind
trigger1 = AnimElemTime(2) >= 0 && AnimElemTime(5) < 0
pos = 232, 0

[State 810, Bind 5]
type = TargetBind
trigger1 = AnimElemTime(5) >= 0 && AnimElemTime(6) < 0
pos = 188, 0

[State 810, holdfwd - Turn 6] ;If was holding fwd before, turn now
type = Turn
trigger1 = var(2)
trigger1 = AnimElem = 6

[State 810, holdfwd - Pos 6] ;If was holding fwd before, move a little
type = PosAdd
trigger1 = var(2)
trigger1 = AnimElem = 6
x = -148

[State 810, holdfwd - Turn Target 6] ;If was holding fwd before, turn target too
type = TargetFacing
trigger1 = var(2)
trigger1 = AnimElem = 6
value = -1

[State 810, Bind 6]
type = TargetBind
trigger1 = AnimElemTime(6) >= 0 && AnimElemTime(7) < 0
pos = 164, -240

[State 810, Bind 7]
type = TargetBind
trigger1 = AnimElemTime(7) >= 0 && AnimElemTime(8) < 0
pos = 100, -300

[State 810, Bind 8]
type = TargetBind
trigger1 = AnimElemTime(8) >= 0 && AnimElemTime(9) < 0
pos = 60, -360

[State 810, Bind 9]
type = TargetBind
trigger1 = AnimElemTime(9) >= 0 && AnimElemTime(10) < 0
pos = -20, -384

[State 810, Bind 10]
type = TargetBind
trigger1 = AnimElemTime(10) >= 0 && AnimElemTime(11) < 0
pos = -56, -360

[State 810, Bind 11]
type = TargetBind
trigger1 = AnimElem = 11
pos = -200, -200

[State 810, Hurt 11]
type = TargetLifeAdd
trigger1 = AnimElem = 11
value = -78

[State 810, Throw 11]
type = TargetState
trigger1 = AnimElem = 11
value = 821

[State 810, Turn 12]
type = Turn
trigger1 = AnimElem = 12

[State 810, Pos 15]
type = PosAdd
trigger1 = AnimElem = 15
x = -40

[State 810, State End]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Thrown by Kung Fu Throw
; (a custom gethit state)
; Description: This is the state that the opponent changes to after being
;     hit by KFM's throw HitDef. The important thing here is to use a
;     ChangeAnim2 controller. The difference between ChangeAnim2 and
;     ChangeAnim is that ChangeAnim2 changes the player's animation to
;     an action in the AIR file of the attacker (in this case, kfm.air),
;     whereas ChangeAnim always changes the player to an action in his
;     own AIR file. Look at Action 820 in kfm.air for some extra
;     comments.
[Statedef 820]
type    = A
movetype= H
physics = N
velset = 0,0

[State 820, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 820

;In case attacker loses binding on player for any reason, this controller
;guarantees that the player will never get stuck in this thrown state.
[State 820, 2]
type = SelfState
trigger1 = !gethitvar(isbound)
value = 5050

;---------------------------------------------------------------------------
;Thrown by Kung Fu Throw - thrown into the air
; (a custom gethit state)
; Description: This state has the opponent flying through the air and
;     falling down onto the ground. The SelfState controller sets the
;     opponent back using to his own state file when he his the ground.
;     Controllers 821,2 and 821,3 allow the opponent to recover by
;     hitting his recovery command when he is falling.
[Statedef 821]
type    = A
movetype= H
physics = N
velset = 11.2,-28
poweradd = 40

[State 821, 1] ;Gravity
type = VelAdd
Trigger1 = 1
y = 1.6



[State 821, 4] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground
What section of it would I need to change? And should I remove the custom get hit state all together?

Update: I didn't notice the hitdef in the beginning of code, being the idiot that I am. However, I gave it a ground.velocity and the opponent didn't go upward at all, but the opponent went straight down even though I added ground.velocity = -3, -7
Nothing To see here.

Cobra Caddie

First things first:

[State 820, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 820

This needed to be changeanim2 for the opponent to take on your character's animation info. Secondly, no. It'd go in the attacker's state(810, this is assuming you want it to be just like Q's throw. Q's throw has a bit where he grabs the opponent and they're frozen".

Darkspines22

Quote from: Caddie on April 16, 2013, 09:53:22 PM
First things first:

[State 820, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 820

This needed to be changeanim2 for the opponent to take on your character's animation info. Secondly, no. It'd go in the attacker's state(810, this is assuming you want it to be just like Q's throw. Q's throw has a bit where he grabs the opponent and they're frozen".

It was already like that in the code, and now they disappear again and then fall down. I just want it to hit the opponent straight up because I don't want to create the custom state. :P
Should I remove creating state 820 and add a hitdef somewhere? (Sorry, I'm a little confused.) I've also tried looking at Q mugen character's throw coding, but that didn't help.
Nothing To see here.

Cobra Caddie

Ok, I'll try to explain everything.

You're never going to want to put your character into a custom state and then give them a changeanim instead of a changeanim2, for the most part. If you want the move to be like Q's command throw, keep it like it is but add a hitdef to 810 and remove all the targetbind, targetstate, and posadd stuff(you only need one targetbind to keep the enemy in place). Make sure you actually do have an animation 820 in the air file.

Darkspines22

Okay, so, which bind should I keep? And also, with the hitdef, what should I make as the trigger for the hitdef?

Thanks for all of your help so far, by the way. ^_^
Nothing To see here.

Cobra Caddie

The first one, and adjust it until the opponent looks good. This is done to keep the opponent in place until they are hit by the move that is going to knock them up.

Odb718

Remember you can use the debug to find out what animation it's trying to use when they turn invisible. You can use the Pause key or print screen on your keyboard if the move is happening too fast to see. KFM probably has a couple animations your character doesnt. It's trying to use those.
vVv Gouken718 vVv SabreTooth718 vVv