Hmmmmmmmm.........I don't know what your "ifelse(p2bodydist y<-18,-6.8,-10)" is for.......
But, it seems normally correct to me.
I tried to use your "ifelse(p2bodydist y<-18,-6.8,-10)" with a Sagat's taunt Statedef 195 to test.
Please see my MUGEN screen shots below (I used DisplayToClipboard to see the on-changing P2BodyDist Y values):
type = S
movetype = I
physics = S
ctrl = 0
anim = 195
velset = 0
[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 4
value = s190,0
[State 195, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = ifelse(p2bodydist y < -18, 200, 210)
ctrl = 0
[State -2, Display Guard Points]
type = displaytoclipboard
trigger1 = 1
text = "p2bodydisty = %d"
params = p2bodydist y
Sagat doing a taunt:
Sagat doing light punch after a taunt while P2BodyDist Y = -82.96 (which is < -18):
Sagat doing medium punch after a taunt while P2BodyDist Y = 0 (which is > -18):
As a result, P2BodyDist Y is working with this Sagat and it seems to have nothing to do with hitting or getting hit (use ignorehitpause = 1 just in case...).
So, your "P2BodyDist Y doesn't work tough" case might have several reasons:
- the yscale and/or height in [Size] are having some incorrect values?
- some hit boxes in the AIR file are having some weird set up?
- a misuse of ScreenBound?
- forgot to round-up (Ceil) or round-off (Floor) some decimal values?
- vertical motion too fast too wide?
- some P2 custom state issue?
Well, perhaps you may want to post all the MUGEN code, that has your "P2BodyDist Y doesn't work tough" issue, here for further investigation........