YesNoOk
avatar

Char goes through another char when he attacks (Read 2062 times)

Started by mugenfan89, February 14, 2021, 06:05:58 am
Share this topic:
Char goes through another char when he attacks
New #1  February 14, 2021, 06:05:58 am
  • avatar
  • *
    • USA
I am coding a special for one of my characters, it is sort of a slide punch which I can successfully perform when I am in a larger distance to my opponent, however when I come very close to him I usually go through my opponent, kind of as if I missed him and he dodged the attack even though he didn't dodged but I simply went through without even touching him. How can solve this ?

Here is the code I appreciate every help.


;---------------------------------------
; Baton hit

[StateDef 1900]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1900
ctrl = 0

[State ]
type = PlaySnd
trigger1 = !time
value = 4,19
volumescale = 100
persistent = 0

[State ]
type = Helper
triggerall = enemy,stateno != [1810,1811]
trigger1 = movehit
stateno = 7420
pos = 0,-15
postype = p2
persistent = 0

[State ]
type = HitDef
trigger1 = !movecontact && enemy,stateno != [1810,1811]
damage = 140,20
pausetime = 0,2
attr = S,NA
hitflag = MAD
guardflag = L
animtype = light
air.animtype = back
priority = 4,hit
sparkno = -1
guard.sparkno = -1
sparkxy = 0,0
hitsound = s20,2
guardsound = 5,14
ground.type = High
guard.ctrltime = 8
guard.slidetime = 8
ground.slidetime = 8
ground.hittime  = 8
ground.velocity = -4,-8
air.velocity = -4,-8
yaccel = .5
ground.cornerpush.veloff = -20
guard.cornerpush.veloff = -20
guard.dist = 90
air.fall = 1
fall.recover = 0
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
p2stateno = 21238
forcestand = 1
p2facing = 1
hitonce = 1

[State ]
type = HitDef
trigger1 = !movecontact && enemy,stateno = [1810,1811]
damage = 140,20
pausetime = 0,2
attr = S,NA
hitflag = MAD
guardflag = HL
animtype = light
air.animtype = back
priority = 4,hit
sparkno = -1
guard.sparkno = -1
sparkxy = 0,0
hitsound = s20,2
guardsound = 5,14
ground.type = High
guard.ctrltime = 8
guard.slidetime = 8
ground.slidetime = 8
ground.hittime  = 8
ground.velocity = -4,-8
air.velocity = -4,-8
yaccel = .5
ground.cornerpush.veloff = -20
guard.cornerpush.veloff = -20
guard.dist = 90
air.fall = 1
fall.recover = 0
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
;p2stateno = 21238
forcestand = 1
p2facing = 1
hitonce = 1

[State ]
type = StateTypeSet
trigger1 = Movecontact
movetype = I

[State ]
type = targetvelset
trigger1 = moveguarded && target,hitover = 0
x = -1.5
ignorehitpause = 1

[State var]
type = playsnd
trigger1 = moveguarded
value = 20,3
volumescale = 60
ignorehitpause = 1
persistent = 0

[State ]
type = EnvShake
trigger1 = Movecontact
time = 24
freq = 60
ampl = 1
persistent = 0

[State ]
type = ChangeState
trigger1 = !animtime && movecontact
value = 0
ctrl = 1

[State ]
type = ChangeState
trigger1 = time > 6 && !movecontact
value = 1901
ctrl = 0

[StateDef 1901]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1901
ctrl = 0

[State ]
type = posadd
trigger1 = !time
x = 103

[State ]
type = Playsnd
trigger1 = time = 1
value = f5,155
volumescale = 200

[State ]
type = HitDef
triggerall = enemy,authorname != "Boss"
triggerall = enemy,stateno != [1810,1811]
trigger1 = !movecontact
attr = S,NA
hitflag = MAD
damage = 240,50
guardflag = HL
pausetime = 2,2
priority = 1,hit
sparkno = -1
hitsound = 5,21
guardsound = 5,14
ground.type = High
ground.slidetime = 24
guard.ctrltime = 24
guard.slidetime = 24
ground.hittime  = 24
ground.velocity = -3,-11
air.velocity = -3,-11
air.hittime = 17
ground.cornerpush.veloff = 0
guard.dist = 90
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
p2stateno = 1902
p2facing = 1
hitonce = 1

[State ]
type = HitDef
triggerall = enemy,authorname != "Boss"
triggerall = enemy,stateno = [1810,1811]
trigger1 = !movecontact
attr = S,NA
hitflag = MAD
damage = 240,50
guardflag = HL
pausetime = 2,2
priority = 1,hit
sparkno = -1
hitsound = 5,21
guardsound = 5,14
ground.type = High
ground.slidetime = 24
guard.ctrltime = 24
guard.slidetime = 24
ground.hittime  = 24
ground.velocity = -3,-11
air.velocity = -3,-11
air.hittime = 17
ground.cornerpush.veloff = 0
guard.dist = 90
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
;p2stateno = 1502
p2facing = 1
hitonce = 1

[State ]
type = HitDef
triggerall = enemy,authorname = "Boss"
trigger1 = !movecontact
attr = S,NA
hitflag = MAF
damage = 240,50
guardflag = HL
pausetime = 2,2
priority = 1,hit
sparkno = -1
hitsound = 5,21
guardsound = 5,14
ground.type = High
ground.slidetime = 24
guard.ctrltime = 24
guard.slidetime = 24
ground.hittime  = 24
ground.velocity = -3,-11
air.velocity = -3,-11
air.hittime = 17
ground.cornerpush.veloff = 0
guard.dist = 90
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
p2stateno = 21238
p2facing = 1
hitonce = 1

[State ]
type = Helper
triggerall = enemy,stateno != [1810,1811]
trigger1 = movehit
ID = 30
stateno = 28
pos = 70,-117
postype = p1
persistent = 0
ignorehitpause = 1

[State ]
type = targetvelset
trigger1 = moveguarded && target,hitover = 0
x = -2.5
ignorehitpause = 1

[State ]
type = EnvShake
trigger1 = Movecontact
time = 24
freq = 75
ampl = 2
persistent = 0

[State ]
type = posadd
trigger1 = animelem = 9
x = -103

[State ]
type = PlaySnd
trigger1 = animelem = 9
value = 4,19
volumescale = 100
persistent = 0

[State ]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1

[StateDef 1902]
type    = S
movetype= H
physics = N
velset = 0,0
anim = 21238
ctrl = 0

[State ]
type = changestate
trigger1 = Pos Y != var(57)
trigger1 = !time
value = 21240

[State ]
type = VelSet
trigger1 = time > 0
x = -3

[State ]
type = PlaySnd
trigger1 = time = 1
value = 4,1
channel = 3

[State ]
type = StopSnd
trigger1 = !animtime
channel = 3

[State ]
type = VelSet
trigger1 = !animtime
x = -1.5

[State ]
type = ChangeState
trigger1 = !animtime
value = 5050
ctrl = 0

;==============================================================
Last Edit: February 14, 2021, 08:15:46 pm by mugenfan89
Re: Char goes through another char when he attacks
#2  February 14, 2021, 06:44:10 am
  • ***
    • Vietnam
    • sites.google.com/view/vinnie-mugen-projects/home
The problem should be solved by itself once you put a collision box to the animation.
Re: Char goes through another char when he attacks
#3  February 14, 2021, 05:40:18 pm
  • avatar
  • *
    • USA
The problem should be solved by itself once you put a collision box to the animation.


There is one already but I believe it must have something to do with the code, rather than the collision box.
Re: Char goes through another char when he attacks
#4  February 14, 2021, 06:17:16 pm
  • ******
[State ]
type = posadd
trigger1 = !time
x = 103

[State ]
type = posadd
trigger1 = animelem = 9
x = -103

you already have velsets, you should work with those more.
Having big posadds like those will make the character go past the enemy.
Re: Char goes through another char when he attacks
New #5  February 14, 2021, 07:13:05 pm
  • avatar
  • *
    • USA
[State ]
type = posadd
trigger1 = !time
x = 103

[State ]
type = posadd
trigger1 = animelem = 9
x = -103

you already have velsets, you should work with those more.
Having big posadds like those will make the character go past the enemy.

Thank you, I lowered both x=103 and x = -103 to 53, and it does seem to work properly now
Last Edit: February 14, 2021, 08:27:08 pm by mugenfan89