YesNoOk
avatar

hitdef sparkxy pos problem/question (Read 30657 times)

Started by Odb718, February 12, 2013, 12:48:56 pm
Share this topic:
hitdef sparkxy pos problem/question
#1  February 12, 2013, 12:48:56 pm
  • *****
  • Shame on you!
    • USA
I've noticed a lot of my hit sparks just dont line up where I'd prefer over and over. I edit them and they look good depending on the positions of the 2 characters. Change the overall position of the 2 and they look like crap again.

I know that the sparkxy is relative on both p1 and p2. I dont like this option at all. I feel it'd be a lot easier if it was relative to p1 completely. Is there an easy way to do this?
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#2  February 12, 2013, 01:39:12 pm
  • avatar
  • ******
    • Thailand
Yeah, use an explod or a helper.
Re: hitdef sparkxy pos problem/question
#3  February 12, 2013, 02:09:29 pm
  • ******
  • Limited time to use Infinite power !
    • France
    • network.mugenguild.com/cybaster/
Explod in the attack state is not the best way though, as you'll trigger it on movehit/movecontact/moveguarded (depending on what you want), and if your character is hit the exact same moment he hits the opponent, the hitspark won't appear.

To do this, you have to code the explod/helper in state-2. If you're interested in this, open POTS' characters, as they have the piece of code to do that, with the variables, helpers and all.
Re: hitdef sparkxy pos problem/question
#4  February 12, 2013, 09:55:51 pm
  • *****
  • Shame on you!
    • USA
So all of those options suck in my opinion. No offense to anyone. Thank you for the insight.
 I had to come up with this...

sparkxy = floor(P2Dist X-(217*fvar(14))), floor(-217*fvar(14))

fvar(14) is used for the scale of my character. Some people dont like her as tall, some people want her taller.
With this set up I can change the -217,-217 and position it just like an explod.

Do you guys know of any draw backs to doing it this way?
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#5  February 12, 2013, 10:07:47 pm
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Have you found any drawbacks?

The components of sparkxy work as follows

X = p2's frontedgebodydist. A negative value will send it towards them. A positive value will send it towards you. This really should look OK pretty much all of the time
Y = Your Y axis. Generally placed at height of contact.

Where these look bad is aerial attacks. Mostly Y axis. The X one with a simple -10 or so will be good enough to look like you've hit pretty much anything including chibi characters.


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.
Re: hitdef sparkxy pos problem/question
#6  February 13, 2013, 06:18:32 am
  • *****
  • Shame on you!
    • USA
Sa far the only drawback I've found happens with the normal set up. I'm used to using 1 hitdef to cover, say, 3 frames of my animation(s). Because I place the 1 hitspark X/Y position, depending on the frame that actually connects, it wont be in the perfect position.

I'm not satisfied with the exact set up as I have it. The original reason I looked into do it this way was having the hitsparks be around Samus' elbow when her arm is thru the character. It just didnt look right. Now it's where her hand connects all the time. So if the hand is thru the body then it wont look right either.

I might try to come up with a generic varset code block and paste it into every attack state.

I have PotS' Lei-Lei I tightened up from a while back. I might have a look if she has the code for the hitsparks.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#7  February 13, 2013, 07:00:35 am
  • avatar
  • ******
    • Thailand
p = position you want your spark

cond(p2dist x < p, p2dis xt, p)

Will make it so the spark won't go through your opponent. Ever further so it won't go behind your own character:

cond(p2dist x < 0, 0, cond(p2dist x < p, p2dist x, p))


If you're looking for something that doesn't look ugly, in your hitdefs, just add the following lines of code to the sparkno, sparkxy values (could be anywhere on the hitdef, but placing them there is more logical):

sparkno = -1 + 0 * (var(0) := [statedef/anim of hitspark]);
sparkxy = -1 + 0 * (var(1) := X), -1 + 0 * (var(2) := Y);

Then, in your statedef -2, have a helper or explod trigger during movehit. You will need to limit the sparks from triggering more than once, and there are multiples ways to do that, so I'll leave that up to you.

[state - 2, Spark]
type = explod
trigger1 = once per hit
trigger1 = var(0) >= 0
ID = var(0)
anim = var(0)
postype = p1
pos = cond(p2dist x < 0, 0, cond(p2dist x < var(1), p2dist x, var(1))), var(2)
ignorehitpause = 1

Reset the variables when there are no active hitdefs or when your character is hit. You'll have to reset them to something below zero.
Last Edit: February 13, 2013, 07:05:01 am by Rajaa
Re: hitdef sparkxy pos problem/question
#8  February 16, 2013, 09:15:07 am
  • *****
  • Shame on you!
    • USA
I've been messing around with how I'd like this idea of mine to operate. As I'm refining the code I'm seeing a problem.

How can I find out the current width of P2? I'd like to be able to track it at will but if it takes "target," that's fine also.
 
Right now I'm using p2bodydist x +const(size.ground.front) to find the front of P2 from P1's X axis. But p2bodydist x doesnt update when P2's width changes. P2bodydist x just takes const(size.ground.front) and target,const(size.ground.front) and subtracts them from p2dist x. Is there anything that monitors the distance between the character's active widths?

Rajaa, thanks for the cond(*) idea and the link.

The whole idea of what I'm doing is to try to make the hitsparks as close to where I'm actually connecting on P2.  Like facing Dhalsim, if you connect his outstretched leg the hitspark appears back at his base. This is just crap.  Obviously Dhalsim's width doesnt extend his hole arm/leg length, but the active width is usually changed when the character's center of gravity changes. If the width changes it's usually because the player's mass shifts. This should reflected in the hitsparks IMHO.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#9  February 16, 2013, 09:22:38 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Per dhalsim. No, you cannot fix that unless the opponent has changed their width in the attack. And most of the time that's done to push either player or edge. As dhalsims stretches don't do either of those things you will not be able to replicate this at all.


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.
Re: hitdef sparkxy pos problem/question
#10  February 16, 2013, 09:24:26 am
  • avatar
  • ******
    • Thailand
In my opinion, you're putting too much thought into hitsparks. The method I posted above is how things work. Play with Necro in SF3 and do his long range attacks up close. Then do some cross ups with whoever.

Also, no, you can't get width besides by adding groundback and groundfront from the constants.

The method I gave above won't make hitsparks appear at the base of the character if you hit them from far away.
Re: hitdef sparkxy pos problem/question
#11  February 16, 2013, 11:06:08 am
  • *****
  • Shame on you!
    • USA
Cyanide, I know that. That's basically my point/problem. a normal sparkxy = -10,Y is going to put it back at Dhalsim's core. If youre the screen apart it looks like crap. My code would have it at the end of Samus' attack. Unless Samus is close. Then I dont want the spark going out of the back of P2.

Rajaa, I want to get the code refined a little more. I can "debug" the values I need for X position.
But I'd like to make a system I can update all of my 718 characters. Right now P2dist doesnt work, P2bodydist doesnt work.
p2bodydist x +const(size.ground.front) works OK but needs to be a little better. I cant just open the animations and see/set the minimum and maximum X values. The values of the animations do not transfer over to the constants using any of the triggers I can read right now. As in, state 200, is her light punch. I need the hitsparks to appear at 210 - 300. I just cant put that into the default code I have now because of the values I can find. The math doesnt work.

Am I going to have to use target,FrontEdgeBodyDist with target,Pos X to find the player's width?

The problem is this. If Samus is standing face to face with Samus, p2dist x = 0, p2bodydist x = 160; Ryu, p2dist x = 0, p2bodydist x = 140.
Both the 0 and the 160/140 are useless when figuring out where the front of the character is at. On top of that, moves that DO change the width because they take more horizontal space makes it worse.

I can deduce P2's ground.front at the start of the round using  (p2dist x - p2bodydist x - const(size.ground.front) ) But I'd prefer working with the active width. It's going to give me a more accurate position of P2's hitbox than p2bodydist x + const(size.ground.front).

I dont care how ugly the code is. As long as it works the way I need it. The user never sees it.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#12  February 16, 2013, 11:17:04 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
ifelse(p2bodydist X> distance of attack, some value that looks basically right, equation to place on p2)

And it'll still be ugly.


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.
Re: hitdef sparkxy pos problem/question
#13  February 16, 2013, 01:05:41 pm
  • avatar
  • ******
    • Thailand
And you'll still have to edit every character.

You're looking for something that every character can use? But every character has different attacks that go different distances. There's no way you're going to make a universal code for 718 characters that's going to look right for all of their individual attacks.

And, once again, the code I posted covers the issue you're talking about. You can get p2front by using enemynear,const(size.ground.front), no need to subtract their distance from their body distance. That still won't help you, though.

Quit making this more complicated than it needs to be!

Re: hitdef sparkxy pos problem/question
#14  February 16, 2013, 10:20:08 pm
  • *****
  • Shame on you!
    • USA
Cyanide, I'm not putting the hitspark on P2!
Rajaa, I meant MY characters. Not 718 of them :P
I dont plan on making ONE hitspark location and think it's going to look proper for each individual attack.
What I want is a way to look in the animations, get the minimum X value and the maximum X value, and input those two values into a varset. Then use that var to set the sparkxy.

The image on the left is both Samus' all the way to the right of the stage. The right image is both in the center with the left Samus hitting the outstretched leg of the right, after the attack is open. The hitspark is not based off of P2's X axis. If it was the hitspark would be around the shoulder of the green Samus like in the left image.
Which would look similar to this.

This looks like crap in my opinion. Sure it's how most mugen char's work, but I dont like it. The spark is no where near the point of impact. The Ryu's are bumping fists but he's getting hit in the left collar bone?? I might be making this complicated but THAT is too simplistic for me.

What I have now, works.

[State 200, VarSet]
type = VarSet
trigger1 = time%1 = 0  ;testing
;trigger1 = movecontact
fv = 15
value = cond(p2bodydist x +const(size.ground.front) < 210.0, 210.0, cond(p2bodydist x + const(size.ground.front) > 300.0,300.0, p2bodydist x + const(size.ground.front))) ;*fvar(14)
persistent = 1

and in the hitdef I have

sparkxy = floor(p2dist x - fvar(15)*fvar(14)), floor(-260*fvar(14))
my character is scaled. That's the reason for fvar(14).

I'm clearly getting multiple positions for the sparkxy's X value, but something's off. In the animations 210 is at Samus' elbow and 300 is at the end of her fist.

When it's all said and done I want to be able to plug in the 210 value and the 300 value. The varset and sparkxy will be in every attack my characters have that need it. The final code might not look pretty on paper but it will look good on screen.

I just want to be able to figure out P2's current width. Once I know how to get that value I can figure out everything else.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#15  February 16, 2013, 10:54:56 pm
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
That ryu has shit clsn boxes. Why are you basing anything on that? What you show should not happen. In any character because that fist on that frame should not have clsn2's.


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.
Re: hitdef sparkxy pos problem/question
#16  February 16, 2013, 11:38:01 pm
  • *****
  • Shame on you!
    • USA
Thought I might get a response like this. That's my Ryu.
OFF TOPIC
Spoiler, click to toggle visibilty

But like I said, the generic 2 hitbox set up is partially because of hitsparks.
Cyanide, I know youre intelligent but to argue that a character's extremities, EVERY character's extremities, shouldnt be open? Or did you mean no character should be able to punch Ryu's arm in 220?
Either way, This problem happens. We all know it happens. Dahlsim is the most obvious example of a character that can have this problem. In fact, here. Ignore my Ryu and look at this Evil Ken image.

^^^^This shouldnt happen^^^^
Speaking of not having a head covered...
Notice how the blue one isnt getting hit. See where the blue one's hitspark is. It's crap.

Now can you help me?
I feel I'm getting frustrated and I dont like coming off as rude. I just want to eliminate this "bug" from my characters.

I just like to know a technique on how to get P2's current width.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#17  February 17, 2013, 12:01:19 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
p2bodydist will direct at the FRONT of their width.

Enemynear(0), const(size.ground.front) will give you how many pixels are in front.

What you cannot do, at all, is predict where the fuck a clsn2 is. You can't do it. All you can do is guess at a point you want the clsn box to appear based on your current animation. Which is what my crappy little ifelse will do. If p2bodydist X is GREATER than the extent of your attack, but you've still hit, you ahve hit an extremity. Place with some sort of guess as to where it should be. If it's less than the extreme distance of your attack, use rajaa's equation.

This will only really work with the helper method and will be unique on a per attack basis because you can't predict a fucking clsn2.


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.
Re: hitdef sparkxy pos problem/question
#18  February 17, 2013, 12:27:15 am
  • avatar
  • ******
    • Thailand
Holy cow, dude. How many times do we have to tell you that I already posted code that would solve that issue?

If you need me to explain the code further, just ask. You're being really complicated for no reason.
Re: hitdef sparkxy pos problem/question
#19  February 17, 2013, 12:42:00 am
  • *****
  • Shame on you!
    • USA
From the extent of my testing P2bodydist X will show the distance between Enemynear(0), const(size.ground.front) and const(size.ground.front).
It doesnt take into account P2's width that's set during an animation. Enemynear(0), const(size.ground.front) doesnt update durring an animation either.


params =  pos x, fvar(15), fvar(16), p2dist x, p2bodydist x

fvar(15) has not be set because I have not activated statedef 200. It's currently the only state to use my sparkxy set up.

[state - 2, P2groundfront]
type = VarSet
trigger1 = fvar(16) = 0
fv = 16    ;fv = 10
value = p2dist x - p2bodydist x - const(size.ground.front)

As you can see Samus' width(s) change but the values do not.

Rajaa, the code you posted kinda works ok. It's better than the current system. Then I changed it to what I posted and it works a little better.
 I'm trying to refine it one more time.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#20  February 17, 2013, 12:44:07 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Once more

YOU CAN'T FIND P2'S CLSN BOXES.

And as you've established you can't find width set in an attack. That's it. End.


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.