Inconsistent 2-hit attack

Started by -AngelZX, August 20, 2020, 11:15:13 PM

Previous topic - Next topic

-AngelZX

Using DW's KFM, I'm trying to learn how to code an attack that hits twice. I kinda made it, but the second hit is weirdly inconsistent.

It hits if the first attack misses in any situation. For example, if the opponent was crouching or jumping during the first attack, or they walk in after the first attack.

It doesn't hit if the first attack hits, or if it's blocked or parried.

Here's the code:

Spoiler (click to show)
[Statedef 220]
type    = S
movetype= A
physics = S
poweradd= 30 * !var(20)
ctrl = 0
velset = 0,0
anim = 220
sprpriority = 2
facep2 = 1

Spoiler (click to show)
[State 220, HitDef]
type = HitDef
trigger1 = !var(16) && var(15) < 1
trigger1 = AnimElem = 3
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = M         ;HLA
animtype = Hard          ;light,medium,hard,back,up,diagup
priority = 4, Hit   ;Hit,Miss,Dodge
damage = ceil(ifElse(fvar(11) * 84 < 7, 7, fvar(11) * 84)), 0
ID = 200
getpower = ifElse(!var(13), 150, 75)*!var(20), 30 * !var(20)
givepower = 30, 30
pausetime = 12, 12
guard.pausetime = 12, 12
sparkNo = -1 + 0 * (var(33) := 8012)
guard.sparkNo = -1 + 0 * (var(34) := 8000)
sparkXY = -10 + 0 * (var(35) := 80), var(36) := -70
hitsound = s2,2
guardsound = s130, 0
air.animType = Back
fall.animType = Back
ground.type = Low      ;Low,Trip,None
air.type = Low
ground.slidetime = 18 + 4*var(9)
ground.hittime = 18 + 4*var(9)
guard.hittime = 18
air.hittime = 120
ground.velocity = -6
guard.velocity = -6
air.velocity = -5.25,-6
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .58
fall = 0
fall.recover = 1
fall.recovertime = 120
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48

[State 220, HitDef]
type = HitDef
trigger1 = !var(16) && var(15) < 1
trigger1 = AnimElem = 11
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = M         ;HLA
animtype = Hard          ;light,medium,hard,back,up,diagup
priority = 4, Hit   ;Hit,Miss,Dodge
damage = ceil(ifElse(fvar(11) * 84 < 7, 7, fvar(11) * 84)), 0
ID = 200
getpower = ifElse(!var(13), 150, 75)*!var(20), 30 * !var(20)
givepower = 30, 30
pausetime = 12,12
guard.pausetime = 12, 12
sparkNo = -1 + 0 * (var(33) := 8012)
guard.sparkNo = -1 + 0 * (var(34) := 8000)
sparkXY = -10 + 0 * (var(35) := 80), var(36) := -70
hitsound = s2,2
guardsound = s130, 0
air.animType = Back
fall.animType = Back
ground.type = Low      ;Low,Trip,None
air.type = Low
ground.slidetime = 18 + 4*var(9)
ground.hittime = 18 + 4*var(9)
guard.hittime = 18
air.hittime = 120
ground.velocity = -9
guard.velocity = -9
air.velocity = -5.25,-6
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .58
fall = 0
fall.recover = 1
fall.recovertime = 120
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48

Spoiler (click to show)
[State 220, StateTypeSet: Idle]
type = StateTypeSet
trigger1 = AnimElemTime(9) >= 0
moveType = I

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

I was going to upload a video demonstration but I don't think it's needed, it's probably a dumb problem, right?

Cyanide

You make the movetype idle before the second attack is initiated.


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.

-AngelZX

Quote from: Cyanide on August 21, 2020, 12:45:54 AM
You make the movetype idle before the second attack is initiated.

A dumb problem indeed.

Fixed. Thanks a ton.