YesNoOk
avatar

Proper variable height (Read 4913 times)

Started by Jesuszilla, September 15, 2016, 04:17:38 am
Share this topic:
Proper variable height
#1  September 15, 2016, 04:17:38 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Most of us want crossups to work correctly. As such, it'd be nice to have variable height boxes. Unfortunately, MUGEN has a fixed height and uses the bottom of the CLSN2 as the push when jumping. Now, most of us who want to do something about this know about this snippet of Phantom.of.the.Server's code:

Code:
[State -3, Variable Height]
type=playerpush
triggerall= statetype=A && movetype!=H && numenemy
triggerall= p2bodydist x = [-(enemynear,const(size.ground.back) + enemynear,const(size.ground.front)), 0]
trigger1= p2statetype=S
trigger1= p2dist y >= (enemynear,const(size.height) - 22)
trigger2= p2statetype=C
trigger2= p2dist y >= (enemynear,const(size.height) - 48)
trigger3= p2statetype=L && p2stateno!=5120
trigger3= p2dist y >= 11
value=0
ignorehitpause=1

... however, after some checking, this is incorrect. Not only are these numbers pulled out of nowhere since CPS2 hitboxes weren't a thing back then, it doesn't even correctly check for lower bounds of any sort of pushbox!


This is the correct way to check for the pushboxes overlapping when the player is jumping:

Code:
[State -2, Variable Height]
type = PlayerPush
triggerall = StateType = A && NumEnemy
triggerall = P2Dist Y - Vel Y >= (EnemyNear(0), Const(Size.Height) - [pushbox_bottom])
trigger1 = StateNo = [40,50]
trigger2 = StateNo = [600,650]
triggerx = StateNo = [other air states...]
value = 0

Note the - Vel Y portion. This is basically seeing into the future if the player's position will put them into a situation where they could be pushed. As you can see, this is pretty much plug & play with the bottom of the air pushbox. Of course, you can have multiple triggers for multiple pushboxes.

Now unfortunately, there's no reliable way to check the height for any statetype other than standing, so we have to approximate something for crouch and liedown:

Code:
[State -2, Variable Height]
type = PlayerPush
triggerall = StateType = A && NumEnemy
triggerall = P2Dist Y - Vel Y >= (EnemyNear(0), Const(Size.Height) - 52)
triggerall = (StateNo = [40,50]) || (StateNo = [600,650]) || (StateNo = [other air states...] ...)
trigger1 = P2StateType = S
trigger1 = P2Dist Y - Vel Y >= (EnemyNear(0), Const(Size.Height) - [pushbox_bottom])
trigger2 = P2StateType = C
trigger2 = P2Dist Y - Vel Y >= (floor(EnemyNear(0), Const(Size.Height)*0.825) - [pushbox_bottom]) ; 0.825 is chosen because it is a nice float (bitwise) and comes from Sagat's standing pushbox height to his crouching pushbox height.
trigger3 = P2StateType = C
trigger3 = P2Dist Y - Vel Y >= (12 - [pushbox_bottom]) ; This isn't really necessary since the chance of it triggering is low, but I pulled 12 from Sagat's CvS2 liedown hurt box height
value = 0

... but this definitely is flawless for at least standing, assuming the enemy has a proper height.
Last Edit: September 15, 2016, 04:24:04 am by Jesuszilla
Re: Proper variable height
#2  September 15, 2016, 10:06:37 am
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
what values should I be inserting in [pushbox_bottom])? what do I look for?
Re: Proper variable height
#3  September 15, 2016, 07:05:37 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
If you copy the pushboxes using my script, or if you trace over the pushbox you get from the game, the bottom of the pushbox will be the rightmost value when you look at it in the .AIR file.

So Clsn3[0] = -24,-78,24,-52, -52 would be your value.
Re: Proper variable height
#4  September 15, 2016, 07:08:35 pm
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
If you copy the pushboxes using my script, or if you trace over the pushbox you get from the game, the bottom of the pushbox will be the rightmost value when you look at it in the .AIR file.

So Clsn3[0] = -24,-78,24,-52, -52 would be your value.


Oh ok thanks!

      Posted: September 16, 2016, 10:02:33 am
ok so I think I have this working correctly, by the way I had to input the push box values
like this so mugen didn't give me an error "(EnemyNear(0), Const(Size.Height) - (-32))"
instead of like the example you showed "Const(Size.Height) - [-32])"

now what I noticed while comparing it to pots code is that when I hop over my enemy, 
my char will just push back the enemy, if the clsn connects, with pots those clsn's can
overlap a big chunk of it an pass right thru the enemy, but that's the whole point of this code correct?
also it now prevents me from doing cross up attacks even experimented with a hurt box as long as in my pic
but I'm not to worried about that for now.

Last Edit: September 16, 2016, 10:03:10 am by Memo
Re: Proper variable height
#5  September 21, 2016, 03:40:36 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
You weren't supposed to literally put in the brackets. Also, I don't understand what you're doing. What's the bottom of Ryu's actual pushbox in whatever game you're getting these from? It's almost always higher than the lowest CLSN2.

You shouldn't go by the CLSN2 or it won't work.
Re: Proper variable height
#6  September 22, 2016, 04:15:05 am
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
You weren't supposed to literally put in the brackets. Also, I don't understand what you're doing. What's the bottom of Ryu's actual pushbox in whatever game you're getting these from? It's almost always higher than the lowest CLSN2.

You shouldn't go by the CLSN2 or it won't work.

Awe shit I'm confused now, so I wasn't supposed to put the values in the bracket that says push_box?  I got it to do something lol ill just wait until you release a character with this code in it so I can see an example. Whatever I did works like this, if you take a pots char and low jump over your enemy you can see the clsn overlap the enemys, whatever I did prevents that, it wont let you hop over unless your completely clear, the clsn will push instead of overlapping and passing right thru
Re: Proper variable height
#7  September 22, 2016, 04:23:33 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
You're supposed to put the bottom Y value of the pushbox, but you don't literally put the brackets there.

Here is Sagat's jumping hurtbox expressed as the standard MUGEN CLSN2:
Code:
Clsn2Default: 1
  Clsn2[0] = -28,-116,24,-40

Here is his pushbox as expressed as a theoretical CLSN3. MUGEN doesn't have this. (If it did, we wouldn't have to do this):
Code:
Clsn3: 1
  Clsn3[0] = -24,-116,24,-52

Notice how the bottom bound of his CLSN2 is at -40. His bottom bound of his CLSN3 (aka the pushbox) is at -52, which is higher than his CLSN2. This is to account for that difference. It's because his pushbox is higher up than his CLSN2 that crossups are possible in the original game.