YesNoOk
avatar

grab problem (Read 1247 times)

Started by Marc123456789, September 17, 2018, 05:57:27 pm
Share this topic:
grab problem
#1  September 17, 2018, 05:57:27 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
Hello everyone!
I decided to share a problem im having with a character im developing. The problem in question is the lone grab attack my first character is going to have, which consists in the character lifting the opponent over his head then slamming it to the ground right in front of him. After trying to code the throw without the throw creator and not making it work I decided to give up and use said tool but when it generated the coding all the character does is flicker and nothing else. Since im a novice at this im not sure what I did wrong.
Code:
[Statedef 800]
type = S
movetype= A
physics = S
juggle = 0
velset = 0
anim = 800

[State 800, 1]
type = HitDef
trigger1 = Time = 0
attr = S, NT
hitflag = M
priority = 1, Miss
sparkno = -1
p1sprpriority = 1
p1facing = 1
p2facing = 1
p1stateno = 810
p2stateno = 820
fall = 1

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

[Statedef 810]
type = S
movetype= A
physics = N
anim = 810
poweradd = 60

[State 810, Bind 1]
type = TargetBind
trigger1 = AnimElem = 1
pos = -19.666666666667, -102

[State 810, Bind 2]
type = TargetBind
trigger1 = AnimElem = 2
pos = 34.333333333333, -74

[State 810, Bind 3]
type = TargetBind
trigger1 = AnimElem = 3
pos = 27, -40

[State 810, Bind 4]
type = TargetBind
trigger1 = AnimElem = 4
pos = 34.333333333333, -1.3333333333333

[State 810, Bind 5]
type = TargetBind
trigger1 = AnimElem = 5
pos = 33, -0.66666666666667

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

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

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

[Statedef 820]
type = A
movetype = H
physics = N
velset = 0,0

[State 820, 1]
type = ChangeAnim2
trigger1 = Time = 0
value = 820

[Statedef 821]
type = A
movetype = H
physics = N
velset = 0,0
poweradd = 40

[State 821, 1] ;Gravity
type = VelAdd
trigger1 = 1
y = .4

[State 821, 2] ; Recover near ground (use ChangeState)
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 821, 3] ; Recover in mid air (use SelfState)
type = SelfState
triggerall = Vel Y > 0
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

[State 821, 4] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground
Re: grab problem
#2  September 17, 2018, 11:07:00 pm
  • *****
  • Shame on you!
    • USA
Two quick things. One, you should have a selfstate backup plan in State 820. Two, you have a changestate in 821 instead of SelfState.

The selfstate in 820 is in case things go bad in 2v2. Just put a time >= about 2 seconds longer than your animation. So say your animation is 40 tics, I'd do time >= 180. If some how P1 messes up, you wont have to reset the round because P2 cant be hit and is locked up. Trust me, it happens.

For your flickering, You may want to try,
trigger1 = animelemtime(1) >= 0 && animelemtime(2) < 0
instead of 
trigger1 = AnimElem = 1
In your target bind.

trigger1 = animelemtime(5) >= 0
only for the last frame


The throw tool is good. I use onion skin to set up my throws. Put P1 in the bg, then make the animation and move the sprite(s) where you need. It lists the values for your targetbinds. Then reset all of the sprites to their 0,0 positions and it should work perfect.
vVv Wheat Stage Released vVv
Re: grab problem
#3  September 17, 2018, 11:44:44 pm
  • ***
  • 風よ伝えて
    • Brazil
    • deathscythe.co.vu
Also, I recommend replacing p2stateno for targetstate.
Re: grab problem
#4  September 18, 2018, 05:01:10 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
I tried all of that and the issue persists. The flickering only happens for like an split second when I do the command for the throw
Code:
[code[State 810, Throw]
type = targetstate
trigger1 = AnimElem = 5
value = 821]
It's not valid to replace the targetstate with p2stateno
Re: grab problem
#5  September 18, 2018, 10:34:51 pm
  • ***
  • 風よ伝えて
    • Brazil
    • deathscythe.co.vu
What I meant is:

[State 800, 1]
type = HitDef
trigger1 = Time = 0
attr = S, NT
hitflag = M
priority = 1, Miss
sparkno = -1
p1sprpriority = 1
p1facing = 1
p2facing = 1
p1stateno = 810
p2stateno = 820 <-- delete this line
fall = 1

And since your character is going to state 810 when the throw connect, go to state 810 and add this:

[State 810, Throw]
type = TargetState
trigger1 = !Time && NumTarget
value = 820

The flickering may be because of wrong binding values, like odb said, it can be either the triggers or the XY values.
Re: grab problem
#6  September 21, 2018, 07:14:13 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
Okay, the grab itself works a bit hapzardly (the grabber turns, something it shouldn't do) and at random (if you press the command when you walk into the opponent, it just disappears and never comes back) but the animation works and the enemy takes damage. but the enemy's throwed animation doesn't show up.
Code:
[Statedef 820]
type = A
movetype = H
physics = N
velset = 0,0

[State 820, 1]
type = ChangeAnim2
trigger1 = Time = 0
value = 820

[State 820, 2]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 35

[Statedef 821]
type = A
movetype = H
physics = N
velset = 5,5
poweradd = 40

[State 821, 1] ;Gravity
type = VelAdd
trigger1 = 1
y = .4

[State 821, 2] ; Recover near ground (use ChangeState)
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 821, 3] ; Recover in mid air (use SelfState)
type = SelfState
triggerall = Vel Y > 0
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

[State 821, 4] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground
Re: grab problem
#7  September 24, 2018, 12:13:16 pm
  • *****
  • Shame on you!
    • USA
Your anim 820 really shouldn't have hitboxes so
[State 820, 2]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 35
wouldn't be needed. Having boxes and the nothitby can lead to issues.

Are you using Debug to make sure P1 and P2 are going into their states properly? Ctrl+D will bring up the debug. I always recommend setting debug to active if you test/dev a lot. When you play Mugen, you only have to turn it off once, versus having to turn it on multiple times a day when you develop.

You probably want to get rid of the fractions on your target placement. They're really not going to make that much of a difference.
pos = 34, -74
should look just as good as
pos = 34.333333333333, -74
and it may make it more compatible.
vVv Wheat Stage Released vVv
Re: grab problem
#8  September 24, 2018, 04:58:22 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
http://www.angelfire.com/ego/heavens/mugen_throws.htm this tutorial told me to add the nothitby to the thrown opponent's animation but I removed it anyway.
I have already trimmed up the XY values but the problem's still here. Also, the debug says something about missing sprites but not ones related to the grab.
Re: grab problem
#9  September 25, 2018, 02:16:23 pm
  • *****
  • Shame on you!
    • USA
Not sure how I missed this.
[State 800, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

You dont want control during a throw. Set it to 0. Make sure your other states related to the throw dont have control. P1 and P2 should regain control at the change/selfstates that end the throw.
vVv Wheat Stage Released vVv
Re: grab problem
#10  September 25, 2018, 03:00:22 pm
  • ***
  • 風よ伝えて
    • Brazil
    • deathscythe.co.vu
Isn't it the end of the throw attempt animation? I think it's not wrong at all, it just says that if the throw fail it will go back to the idle state.
Re: grab problem
#11  September 25, 2018, 04:47:41 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
I decided to scrap the code that the throw creator generated and slap in KFM's throw code (albeit with  modifications) and while the throw itself now works and deals damage, the thrown opponent is still missing it's thrown sprites and said thrown opponent in question is KFM so there's no way this is happening, right?
Re: grab problem
#12  September 25, 2018, 06:21:32 pm
  • ***
  • 風よ伝えて
    • Brazil
    • deathscythe.co.vu
This is a problem in animation 820 of your character. You must use the default hurt animations for Kung Fu Man (and other characters) to use.
Re: grab problem
#13  September 25, 2018, 07:16:28 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
but KFM already has his hurt animations. And Jack already has said animations (albeit placeholder ones)
Re: grab problem
#14  September 25, 2018, 07:49:02 pm
  • ***
  • 風よ伝えて
    • Brazil
    • deathscythe.co.vu
I'll try to explain a little more.

First, I'll explain how throws/grabs work, you probably already know, but I'll explain anyway.
You'll create a state for the "attempt". In this case, state 800. If you succeed grabbing the opponent, your character will go to state 810, and the opponent grabbed will be sent to a custom state (custom state means you have to create a state for the opponent to use, instead of having the opponent use his own hurt states), in your case, opponent will be sent to state 820.

The same way you have to create a custom state, now you need to create a custom animation that the opponent will use. That's why the hurt sprites have universal group numbers, they are always group 5000, 5001, 5002, 5010, 5011, 5012, etc., and that's why they are required. Keep in mind that you will use your own hurt sprites to make the anim 820, but the opponent will use their own sprites. What you're doing is telling them what sprites they should use in the animation. Take KFM's anim 820 as an example, it's all KFM's own hurt sprites, but when he uses the throw/grab in a different opponent,  they will use their own sprites while being thrown/grabbed.

If you use a number that is not present in the opponent sprites, say number 7032, for example, they will "vanish" because there are no sprites with this number.
Re: grab problem
#15  September 25, 2018, 07:56:07 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
I already know the basics of the grab but the problem is that despite that I copy-pasted the coding from KFM then that means that the opponent's animation when being thrown is properly assigned but for whatever reason it doesn't show up.
Re: grab problem
#16  September 26, 2018, 07:55:38 pm
  • *****
  • Shame on you!
    • USA
copy and pasting is the problem. You character isn't KFM. The code may work, but the animation is different. The timing is different. Did you copy both animations of the throw? Your sprite of your character will probably disappear. P2 should work though.
Copying KFM's code and using your animations is probably the worst way to do this.

Sprite 820,0 is completely wrong. It NEEDS to be something like 5012,0. It has to be a hit reaction.
These are the images you should be using. Not 820,0.



vVv Wheat Stage Released vVv
Re: grab problem
#17  September 28, 2018, 04:39:04 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
That's kind of strange since animation no.820 is supposed to be the standard for any kind of throw but since I have no other option I guess I'll have to do that
Re: grab problem
#18  September 28, 2018, 06:33:41 pm
  • avatar
  • *
    • USA
Animation for being thrown needs to be defined and animated by your character in it's AIR file.  There is no standard, automatic, or generic being thrown animation.  An animation for being thrown is just sprites floating around in a position that looks good for the throw.  There's no way to standardize it.
Re: grab problem
#19  September 29, 2018, 05:37:34 pm
  • *****
  • Shame on you!
    • USA
The 800s are usually set aside for throws. But the animation number and the sprites it uses aren't related like that. The sprites have to be the universal images so the throw works with all the characters set up properly.
Anim 820 is fine.
Sprite 820,0 isn't.
vVv Wheat Stage Released vVv
Re: grab problem
#20  September 29, 2018, 07:19:39 pm
  • avatar
  • *
    • Spain
    • Marcus-22@hotmail.es
oh okay thanks everyone, all I have to do now is set up the XY values. I'll make sure to credit.  ;D