News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Problem with Grab\throw

Started by DrStrange, January 25, 2010, 05:21:24 PM

Previous topic - Next topic

DrStrange

So I have created a grab\throw basic move. The move basically is wolverine climbs on the opponents back, does a couple of claw swipes and then jumps off leaving the opponent dizzy. The same move is done on the full size wolverine and I am trying to implement it for the pocket size version.

I currently have Wolverine climbing on P2's performing the swiping then jumping off behind the p2. But as soon as he lands he moves back to the original side of p2 where he started the move from. I want him to stay where he lands and just turn around. Not sure what I did wrong.

Here is the code:

; Throw/Grab
[Statedef 12000]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 12000
ctrl = 0
sprpriority = 2

[state 12000, Throw Attempt HitDef]
type = HitDef
Trigger1 = Time = 0
attr = S, NT
hitflag = M-
priority = 1, Miss
sparkno = -1
p1sprpriority = -1
p1facing = 1
p2facing = 1
p1stateno = 12001
p2stateno = 15000
guard.dist = 0
fall = 0

[State 12000, ChangeState)
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

[statedef 12001]
type = S
movetype = A
physics = N
velset = 0,0
anim = 12001
ctrl = 0
sprpriority = -1


;[state 0, Pause]
;type = Pause
;trigger1 = (gametime%2)
;time = 20


[state 12001 TargetBind]
type = TargetBind
trigger1 = animelem = 1
time  = 0
pos = 25,2

[State 12001, 1]
type = HitDef
trigger1 = AnimElem = 1
trigger2 = AnimElem = 2
trigger3 = AnimElem = 3
trigger4 = AnimElem = 4
trigger5 = AnimElem = 5
trigger6 = AnimElem = 6
trigger7 = AnimElem = 7
trigger8 = AnimElem = 8
trigger9 = AnimElem = 9
trigger10 = AnimElem = 10
attr = A, NT
damage = 25, 0
animtype = Light
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 0, 8
sparkno = -1
guard.sparkno = -1
sparkxy = -10, -55
hitsound = S2,0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = 0
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
fall = 0
kill = 0

[State 12001, MoveHitReset]
type = MoveHitReset
trigger1 = MoveHit = 1
persistent = 1
ignorehitpause = 1


[state 12001 ChangeState]
type = ChangeState
trigger1 = time >= 72
value = 12002
ctrl = 0

[statedef 12002]
type = A
movetype = A
physics = N
velset = 0,0
anim = 12002
ctrl = 0
sprpriority = -1

;[State 12002, Gravity]
;type = Gravity
;trigger1 = 1

;[State 0, Turn]
;type = Turn
;trigger1 = animelem = 5


[State 12002, TargetState]
type = TargetState
trigger1 = animelem = 5
value = 15001

[state 12002 ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
velset = ,0
value = 11
ctrl = 1



[statedef 15000]
type = S
movetype = H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 2


[state 15000, changeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5016

[statedef 15001]
type = S
movetype = H
physics = N
velset = 0,0
sprpriority = 2

[state 15001, changeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5300

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


Byakko

Hit ctrl+C to display the collision boes and the axis, and see how the axis of your Wolverine doesn't move ; of course when the animation is over, it restarts where the axis still is.
Use a posadd or a velset when you jump away.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

DrStrange

Ok, well I have him landing on the proper side now, but he still moves back closer to p2.

updated code:

; Throw/Grab
[Statedef 12000]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 12000
ctrl = 0
sprpriority = -1

[state 12000, Throw Attempt HitDef]
type = HitDef
Trigger1 = Time = 0
attr = S, NT
hitflag = M-
priority = 1, Miss
sparkno = -1
p1sprpriority = -1
p1facing = 1
p2facing = 1
p1stateno = 12001
p2stateno = 15000
guard.dist = 0
fall = 0

[State 12000, ChangeState)
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

[statedef 12001]
type = S
movetype = A
physics = N
velset = 0,0
anim = 12001
ctrl = 0
sprpriority = -1


;[state 0, Pause]
;type = Pause
;trigger1 = (gametime%2)
;time = 20


[state 12001 TargetBind]
type = TargetBind
trigger1 = animelem = 1
time  = 0
pos = 25,2

[State 12001, 1]
type = HitDef
trigger1 = AnimElem = 1
trigger2 = AnimElem = 2
trigger3 = AnimElem = 3
trigger4 = AnimElem = 4
trigger5 = AnimElem = 5
trigger6 = AnimElem = 6
trigger7 = AnimElem = 7
trigger8 = AnimElem = 8
trigger9 = AnimElem = 9
trigger10 = AnimElem = 10
attr = A, NT
damage = 25, 0
animtype = Light
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 0, 8
sparkno = -1
guard.sparkno = -1
sparkxy = -10, -55
hitsound = S2,0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = 0
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
fall = 0
kill = 0

[State 12001, MoveHitReset]
type = MoveHitReset
trigger1 = MoveHit = 1
persistent = 1
ignorehitpause = 1


[state 12001 ChangeState]
type = ChangeState     
trigger1 = AnimTime = 0
value = 12002     
ctrl = 0

[statedef 12002]
type=A
movetype=A
physics=N
velset=1,-1
ctrl=0
juggle=15
anim = 12002

[state 12002, 1]
type = PosAdd ;Adds to P1s position
trigger1 = AnimElem = 7 ;Trigger on 2nd element.
x = -300


;[State 12002, TargetState]
;type = TargetState
;trigger1 = animelem = 5
;value = 15001

[State 1100]
type=ChangeState
trigger1=Time=20
value=660

[statedef 15000]
type = S
movetype = H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 2


[state 15000, changeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5016

[statedef 15001]
type = S
movetype = H
physics = N
velset = 0,0
sprpriority = 3

[state 15001, changeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5300



;[State 15001, 1]
;type = ChangeState
;trigger1 = AnimTime = 0
;value = 0
;ctrl = 1


Byakko

Quote from: Byakko on January 25, 2010, 05:42:42 PM
Hit ctrl+C to display the collision boes and the axis, and see how the axis of your Wolverine doesn't move ; of course when the animation is over, it restarts where the axis still is.
Use a posadd or a velset when you jump away.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

DrStrange

I had tried the posadd and that did not work. But velset did the trick. So now I have one problem left. The last state that I change to, back to idle, is starting facing the wrong way. Where can I use "facing = -1" do I need a new state for this? What is the code to do that part.

Updated code:

; Throw/Grab
;Calls my run animation but this never happens
[StateDef 12000]       ; now should work fine
type = S
movetype= A
physics = N
juggle  = 15
ctrl = 0
anim = 12000

; you need this to  know when wolverine hits the P2 while running
[State 12000, 2]
type = HitDef
trigger1 = !movehit
attr = S, SA
damage = 0, 0
guardflag = HA
pausetime = 0, 0
sparkno = -1
sparkxy = 0, 0
guard.sparkno = -1
hitsound = -1
guardsound = 6, 0
ground.type = High
ground.slidetime = 9
ground.hittime = 9
ground.velocity = 0, 0
air.velocity = 0, 0
p1stateno = 12001
fall = 0

;Not sure what this is for
[State 12000, 4]
Type = VelSet
trigger1 = MoveHit  ; the velset is activated if while running wolverine hits the P2 if success, the velocity  X and Y will be back to 0
y = 0               ; in other words it will stop  the velocity
x = 0

;This is how you make Batman fly towards opponent right?  I am setting Wolverines Run velocity here
[State 12000, 4]   ; yes, you just need this one, set the X velocity,  you did right on coment the others
Type = VelSet
trigger1 = Time = 0
y = 0
x = 9

;Not sure what this is for. I think it calls a new state at the end. Not sure what th rest means though.

[State 12000, 9]     ; This change state is our safe, in case the hitdef of above doesnt make contact or if it as guarded
Type = ChangeState
triggerall = Time > 5     ; minimum time required to activated the next 2 triggers
trigger1 = Time= 5   ; time that wolverine will be running before it stops and change states
trigger2 = MoveGuarded    ; in case of is guarded
value = 3102        ; as I said if is guarded or the hit fails the player will change to state 3102

;------------------------------------------------ End code that moves player 1 towards player 2 in order to get in position to start move

;-----------------------------------------
;Not sure what this is for
[StateDef 3102]    ; is the state and anim that will be used if the move was guarded or avoided
type = A
physics = A
anim = 3012

[State 3102, 2]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

;---------------------;------------------
[Statedef 12001] ; Ok remember that you asked what it was on the last hitdef p1stateno = 3103   here it is
type    = S     ; if that hitdef succeded on hit the P2 this state starts it is when the rage flury activates
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 12001
sprpriority = 2

;---------------------------------------
[State 3200, blind] ;this it is for make the P2 close and locked on the position, now the P2 is easy target for the hits
type = targetbind
trigger1 = time = 0
pos = 20, 0

; the next parts are all the hits I guess they dont need major explanation
; still you will need to adjust the sparks when they hit, sound effects and damage
; for now I just adjusted the correct animelem of the anim 3013

[State 200, 1]
type = HitDef
trigger1 = AnimElem = 1
trigger2 = AnimElem = 2
trigger3 = AnimElem = 3
trigger4 = AnimElem = 4
trigger5 = AnimElem = 5
trigger6 = AnimElem = 6
trigger7 = AnimElem = 7
trigger8 = AnimElem = 8
trigger9 = AnimElem = 9
trigger10 = AnimElem = 10
attr = A, NT
damage = 25, 0
animtype = Light
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 0, 8
sparkno = -1
guard.sparkno = -1
sparkxy = -10, -55
hitsound = S2,0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = 0
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
fall = 0
kill = 0

[State 200, MoveHitReset]
type = MoveHitReset
trigger1 = MoveHit = 1
persistent = 1
ignorehitpause = 1

[State 1010, 5]    ; In batman the finish state redirects to the uppercut special, wolverine will do a diferent thing
type = ChangeState     ; it will change to the X cut finisher
trigger1 = AnimTime = 0
value = 12002     ; new state
ctrl = 0


;-------------------------------------------------------------------------------
; finisher
[Statedef 12002]
type=A
movetype=A
physics=N
velset=2,-2
ctrl=0
juggle=15
anim = 12002

;[state 0, Pause]
;type = Pause
;trigger1 = (gametime%2)
;time = 10

[State 3104,hit]
type=HitDef
trigger1=AnimElem=3
attr=S, SA
damage=90,30
animtype=Heavy
guardflag=M
hitflag=MAF
hitsound = S2,2
guardsound = S3,0
pausetime=5,21
sparkno=3
sparkxy=-10,-20
ground.type=Low
ground.slidetime=18
ground.hittime=21
ground.velocity=1,-2
air.velocity=1,-2
yaccel=0.25
fall=1
air.fall=1
air.hittime=36



[State 1100]
type=ChangeState
trigger1=Time=23
facing = 1
value=660

[State 1100, 1]   
Type = VelSet
trigger1 = Time = 0
y = -2
x = 3



Cyanide

There is no reason for the posadd not to work

Look at how many pixels forward of the axis your sprites are when the attack finishes. x = that number. May need tweaking. Velset seems to me to be an awful solution.

As for facing. You would use turn rather than facing as it's a more controllable method

type= turn
trigger1 = time = 0 && p2dist X< -10

Also, please try posadd again, i don't know what you did but that is the correct solution to this issue short of realigning your whole animation.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

DrStrange

Thanks for the info. I am going to start this move over from the beginning starting with the animation. I think I may have several problems. I will update this thread tomorrow. Thanks for the help everyone.

Byakko

QuoteVelset seems to me to be an awful solution.
It should make more sense if Wolverine is jumping away from his opponent. But that would require changing the axis on a big part of the anim.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

DrStrange

Guys thanks for all the help. This is all cleared up. I will post the code tomorrow and close the topic as solved.

DrStrange

There were several things wrong with the original move. Here is the final code that works if anyone ever needs it.

; Throw/Grab
;Calls my run animation but this never happens
[StateDef 12000]       ; now should work fine
type = S
movetype= A
physics = N
juggle  = 15
ctrl = 0
anim = 12000
sprpriority = -1

;[state 0, Pause]
;type = Pause
;trigger1 = (gametime%2)
;time = 10

; you need this to  know when wolverine hits the P2 while running
[State 12000, 2]
type = HitDef
trigger1 = !movehit
attr = S, SA
damage = 0, 0
guardflag = HA
pausetime = 0, 0
sparkno = -1
sparkxy = 0, 0
guard.sparkno = -1
hitsound = -1
guardsound = 6, 0
ground.type = High
ground.slidetime = 9
ground.hittime = 9
ground.velocity = 0, 0
air.velocity = 0, 0
p1stateno = 12001
fall = 0

;Not sure what this is for
[State 12000, 4]
Type = VelSet
trigger1 = MoveHit  ; the velset is activated if while running wolverine hits the P2 if success, the velocity  X and Y will be back to 0
y = 0               ; in other words it will stop  the velocity
x = 0

;This is how you make Batman fly towards opponent right?  I am setting Wolverines Run velocity here
[State 12000, 4]   ; yes, you just need this one, set the X velocity,  you did right on coment the others
Type = VelSet
trigger1 = Time = 0
y = 0
x = 1

;Not sure what this is for. I think it calls a new state at the end. Not sure what th rest means though.

[State 12000, 9]     ; This change state is our safe, in case the hitdef of above doesnt make contact or if it as guarded
Type = ChangeState
triggerall = Time > 5     ; minimum time required to activated the next 2 triggers
trigger1 = Time= 5   ; time that wolverine will be running before it stops and change states
trigger2 = MoveGuarded    ; in case of is guarded
value = 3102        ; as I said if is guarded or the hit fails the player will change to state 3102

;------------------------------------------------ End code that moves player 1 towards player 2 in order to get in position to start move

;-----------------------------------------
;Not sure what this is for
[StateDef 3102]    ; is the state and anim that will be used if the move was guarded or avoided
type = A
physics = A
anim = 3012

[State 3102, 2]
type = VarSet
trigger1 = Time = 16
sysvar(1) = 0

;---------------------;------------------
[Statedef 12001] ; Ok remember that you asked what it was on the last hitdef p1stateno = 3103   here it is
type    = S     ; if that hitdef succeded on hit the P2 this state starts it is when the rage flury activates
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 12001
sprpriority = 0


;---------------------------------------
[State 3200, blind] ;this it is for make the P2 close and locked on the position, now the P2 is easy target for the hits
type = targetbind
trigger1 = time = 0
pos = 20, 0

; the next parts are all the hits I guess they dont need major explanation
; still you will need to adjust the sparks when they hit, sound effects and damage
; for now I just adjusted the correct animelem of the anim 3013

;[State 200, 1]
;type = HitDef
;trigger1 = AnimElem = 1
;trigger2 = AnimElem = 2
;trigger3 = AnimElem = 3
;trigger4 = AnimElem = 4
;attr = S, HA
;damage = 25, 0
;animtype = Light
;sprpriority = -1
;guardflag = MA
;hitflag = MAF
;priority = 3, Hit
;pausetime = 0, 8
;sparkno = -1
;guard.sparkno = -1
;sparkxy = -10, -55
;hitsound = S2,0
;guardsound = 6, 0
;ground.type = High
;ground.slidetime = 5
;ground.hittime  = 12
;ground.velocity = 0
;airguard.velocity = -1.9,-.8
;air.type = High
;air.velocity = -1.4,-3
;air.hittime = 12
;fall = 0
;kill = 0

[State 200, 1]
type = HitDef
trigger1 = AnimElem = 4
trigger2 = AnimElem = 6
trigger3 = AnimElem = 8
trigger4 = AnimElem = 10
attr = S, HA
damage = 25, 0
animtype = Light
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 0, 8
sparkno = -1
guard.sparkno = -1
sparkxy = -10, -55
hitsound = S2,0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = 0
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
fall = 0
kill = 0


[State 200, MoveHitReset]
type = MoveHitReset
trigger1 = MoveHit = 1
persistent = 1
ignorehitpause = 1

[State 1010, 5]    ; In batman the finish state redirects to the uppercut special, wolverine will do a diferent thing
type = ChangeState     ; it will change to the X cut finisher
trigger1 = AnimTime = 0
value = 12002     ; new state
ctrl = 0


;-------------------------------------------------------------------------------
; finisher
[Statedef 12002]
type=A
movetype=A
physics=N
velset=1,-1
ctrl=0
juggle=15
anim = 12002
sprpriority = -1

[State 3104,hit]
type=HitDef
trigger1=AnimElem=3
attr=S, SA
damage=90,30
animtype=Heavy
guardflag=M
hitflag=MAF
hitsound = S2,2
guardsound = S3,0
pausetime=5,21
sparkno=3
sparkxy=-10,-20
ground.type=Low
ground.slidetime=18
ground.hittime=21
ground.velocity=1,-2
air.velocity=1,-2
yaccel=0.25
fall=1
air.fall=1
air.hittime=36



[State 1100]
type=ChangeState
trigger1=Time=23
value=660

;[state 0, Pause]
;type = Pause
;trigger1 = (gametime%2)
;time = 10

[State 1100, 1]   
Type = VelSet
trigger1 = Time = 0
y = -2
x = 3

[state 660,1]
Type = turn
trigger1 = animelem = 1