News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

"Binding" Helper to Parent (not actual binding)

Started by altoiddealer, August 26, 2014, 04:56:57 PM

Previous topic - Next topic

altoiddealer

Is it possible to have a helper that overlays Player 1, but that can be pushed by Player 2?

If so, could someone please shed some light on how to do it?  I can't even get the helper to be pushed at all - it just keeps floating in one spot (I can't use BindToParent, as outlined below)


BACKSTORY:

As I've demonstrated in this video, I want to have a helper as my character's face, that changes anims as it is moving up and down, along with my character, so that the eyes are following P2's movement.

This is only for a few different poses... the face will be drawn on most of my character's anims, and the helper destroyed during them.

My main issue is that I can't figure out how to have the face bind to my character when he is being pushed, because like all characters (to my knowledge), mine uses the same anim for standing and being pushed (typically anim 0).  The helper is coded to be destroyed when Jailbot goes into any other state, so I'm really just having trouble with player pushing.

I think the best solution would be if I could have the helper behave as if he is a clone of my character - that the helper will be pushed simultaneously.

-BindToParent works to a degree, but the face trails more or less depending on how fast my character is being pushed.
-Destroying the helper, and switching to a "drawn face" stand anim when p2bodydist <= 1 works, but there is a noticeable flickering.


Алексей

Hmm, BindToParent shouldn't allow any trailing. Are you setting the time appropriately? What's your trigger1 look like, "1?"

Alternatively, you could use an Explod and use ModifyExplod to set the position of where you need it. I've used this and it does't trail as the object in question moves.

-[Все слова это только слова.]-

altoiddealer

#2
Quote from: Алексей on August 26, 2014, 05:40:55 PM
Hmm, BindToParent shouldn't allow any trailing. Are you setting the time appropriately? What's your trigger1 look like, "1?"

Alternatively, you could use an Explod and use ModifyExplod to set the position of where you need it. I've used this and it does't trail as the object in question moves.

Yeah, I used trigger1 = 1 for the BindToParent.  When the player is pushed lightly it trails by 1px, and a hard push makes it trail a little more.

Thanks for the suggestion, I'll try to set it up as an Explod instead, but I get the feeling it will be so much more code.  If you watched the video, every time the eyes move there is a ChangeAnim occuring in the Helper.

Does anyone else have an idea?


altoiddealer

I'm going to try it, but I have a feeling that spawning the face as an Explod, and using ModifyExplod to "bind" it will result with the same issue as using a Helper with BindToParent.

So corect me if I'm wrong but the code would be:
type = ModifyExplod
trigger1 = 1
id = face
pos = 0,0
postype = p1


Алексей

Yes, that's correct. I would add ignorehitpause=1 to it, so you don't get any weirdness when getting hit either. "face" would be the ID of your Explod. You could also try a PosFreeze in combination, but I've never had any success with this controller. Using PosSet or PosAdd would most likely do what you don't want, but binding should do exactly what you want.

You mentioned that you thought the best way to handle it would be to make a clone of your helper. This is very possible, but you'd still need to have the face somewhere, maybe as a third helper, maybe as an explod. See, the clone helper would use whatever animation the root was in, have an AssertSpecial to keep it invisible, and have PlayerPush active.

If none of this works and you're really desperate, you could make separate sprites and just use ChangeAnim like you are with the helper, but in State 0.

-[Все слова это только слова.]-

altoiddealer

#5
Quote from: Алексей on August 26, 2014, 07:26:03 PM
Yes, that's correct. I would add ignorehitpause=1 to it, so you don't get any weirdness when getting hit either. "face" would be the ID of your Explod. You could also try a PosFreeze in combination, but I've never had any success with this controller. Using PosSet or PosAdd would most likely do what you don't want, but binding should do exactly what you want.

You mentioned that you thought the best way to handle it would be to make a clone of your helper. This is very possible, but you'd still need to have the face somewhere, maybe as a third helper, maybe as an explod. See, the clone helper would use whatever animation the root was in, have an AssertSpecial to keep it invisible, and have PlayerPush active.

If none of this works and you're really desperate, you could make separate sprites and just use ChangeAnim like you are with the helper, but in State 0.

What I'm saying might be best is if the face helper can just behave as if it was a clone (aside from the sprite/animation).

So, instead of needing "BindToParent", the helper can just be pushed at the same time that Jailbot gets pushed.

My problem is that I can't figure out how to get the helper to be pushed.  I tried giving it CLSN, giving it size.ground.front and size.ground.back... bt it still just floats there as Jailbot gets pushed


Алексей

I understand that. In order to have a helper be pushed, it needs blue CLSNs and you need to have PlayerPush active with a trigger1=1 and ignorehitpause=1. I'm not sure if it's needed, but you can set the Width to root,const(size.ground.front) for the front and root,const(size.ground.back) for the back. Width is another controller that needs to be triggered each tick, like PlayerPush.

-[Все слова это только слова.]-

SROG SAGA

Quote from: altoiddealer on August 26, 2014, 06:27:45 PM
Quote from: Алексей on August 26, 2014, 05:40:55 PM
Hmm, BindToParent shouldn't allow any trailing. Are you setting the time appropriately? What's your trigger1 look like, "1?"

Alternatively, you could use an Explod and use ModifyExplod to set the position of where you need it. I've used this and it does't trail as the object in question moves.

Yeah, I used trigger1 = 1 for the BindToParent.  When the player is pushed lightly it trails by 1px, and a hard push makes it trail a little more.

Thanks for the suggestion, I'll try to set it up as an Explod instead, but I get the feeling it will be so much more code.  If you watched the video, every time the eyes move there is a ChangeAnim occuring in the Helper.

Does anyone else have an idea?

it would trail if your trigger1 = 1

maybe try using

BindToparent
trigger1 = time = 0
time = 9999999

that way it binds always without rebinding everytime to parent.

no expert but you could try to stop trailing that way.

altoiddealer

Quote from: SROG SAGA on August 26, 2014, 08:26:21 PM
it would trail if your trigger1 = 1

maybe try using

BindToparent
trigger1 = time = 0
time = 9999999

that way it binds always without rebinding everytime to parent.

no expert but you could try to stop trailing that way.

I'm certainly no expert, either, but I'm learning :)

Thanks, I'll try that as well!  This sounds promising


Odb718

Also something to consider, dont destroy the helper over and over. Just make it switch to a blank animation.
Another idea I had is, if you know it's always trailing by 1 tic, adjust the sprite 1 spot horizontally or vertically. Then you could have 5 images all in different spots. 1 normal, 1 up, 1 down, 1 left, 1 right. Depending on the movement, you'd switch to that sprite.

I've had the trailing by 1 tic problem before. Not sure if I gave up on it or found a complete work around. I think it was with my Ibuki. If I remember what and how I solved it I'll post back.
vVv Gouken718 vVv SabreTooth718 vVv


altoiddealer

#10
*sigh* so I tried BindToparent, trigger1 = time = 0, time = 9999999 and it still trails.

Quote from: Odb718 on August 26, 2014, 10:38:59 PMAlso something to consider, dont destroy the helper over and over. Just make it switch to a blank animation.

Yeah that's probably smarter :)  I was copying code from Capt. America but that's a more complicated character.  Speaking of which, his shield also trails, but is much less noticeable than in my scenario.

Quote from: Odb718 on August 26, 2014, 10:38:59 PM
Another idea I had is, if you know it's always trailing by 1 tic, adjust the sprite 1 spot horizontally or vertically. Then you could have 5 images all in different spots. 1 normal, 1 up, 1 down, 1 left, 1 right. Depending on the movement, you'd switch to that sprite.

I could... but what would trigger it?  I tried testing velocity as the trigger, but apparently when the player is being pushed, velocity = 0.

To further complicate the issue, when kfm is walking into my character, it trails 1px, but if kfm is running it trails by 2px.  If there is trailing, I don't think it can be fixed through compensation.


altoiddealer

#11
Quote from: Алексей on August 26, 2014, 08:24:29 PM
I understand that. In order to have a helper be pushed, it needs blue CLSNs and you need to have PlayerPush active with a trigger1=1 and ignorehitpause=1. I'm not sure if it's needed, but you can set the Width to root,const(size.ground.front) for the front and root,const(size.ground.back) for the back. Width is another controller that needs to be triggered each tick, like PlayerPush.

WHOA!  Sorry I overlooked this response, this works!  The face jitters a little bit, but it doesn't trail!  Thanks!!  I'm experiencing some bugs after receiving a hit, but I can probably work that out unless you happen to know off-hand what's making the helper disappear NotHitBy clears this up

New bug... the helper's width is identical, along with my characters CLSN... but for some reason the helper can be pushed (squished?) a little further into the wall if P2 is constantly walking.  Once p2 stops walking the face springs back where it belongs.


Алексей

Quote from: altoiddealer on August 26, 2014, 11:37:14 PM
WHOA!  Sorry I overlooked this response, this works!  The face jitters a little bit, but it doesn't trail!  Thanks!!  I'm experiencing some bugs after receiving a hit, but I can probably work that out unless you happen to know off-hand what's making the helper disappear
How dare you ignore me! >:(

Lol, no problem. Since your helper is using your root's animations, make sure that it can't be hit using NotHitBy and a value of SCA,AA,AT,AP. If you turn on debug mode and look at the helper disappearing, is it really gone? How are you displaying the face? An Explod within the helper? Also, make sure you have ignorehitpause=1 on any controllers that are begin triggered constantly.


-[Все слова это только слова.]-

altoiddealer

#13
Yeah I think I have that covered... but I'm still having this push issue that isn't making sense.  The width.front, width.back and CLSN are now identical for the helper and Jailbot, but for some reason the helper can be pushed a few pixels further against the wall than Jailbot

I really appreciate the help!

I'm displaying the face with ChangeAnims.  There might be a more efficient way to do it, but this is working for now:
Spoiler (click to show)
;Stand Faces

[State 10000, 5]
type = ChangeAnim
trigger1 = p2dist x < 120
trigger1 = p2dist y > -40
trigger1 = p2statetype != C
value = 10000

[State 10000, 6]
type = ChangeAnim
trigger1 = p2dist x < 120
trigger1 = p2dist y < -40
value = 10001

[State 10000, 7]
type = ChangeAnim
trigger1 = p2dist x < 120
trigger1 = p2dist y < -60
value = 10002

[State 10000, 8]
type = ChangeAnim
trigger1 = p2dist x < 120
trigger1 = p2dist y < -80
value = 10003

[State 10000, 9]
type = ChangeAnim
trigger1 = p2dist x = [120,200]
trigger1 = p2dist y > -40
trigger1 = p2statetype != C
value = 10004

[State 10000, 10]
type = ChangeAnim
trigger1 = p2dist x = [120,200]
trigger1 = p2dist y < -40
value = 10005

[State 10000, 11]
type = ChangeAnim
trigger1 = p2dist x = [120,200]
trigger1 = p2dist y < -60
value = 10006

[State 10000, 12]
type = ChangeAnim
trigger1 = p2dist x = [120,200]
trigger1 = p2dist y < -80
value = 10007

[State 10000, 13]
type = ChangeAnim
trigger1 = p2dist x > 200
trigger1 = p2dist y > -40
trigger1 = p2statetype != C
value = 10008

[State 10000, 14]
type = ChangeAnim
trigger1 = p2dist x > 200
trigger1 = p2dist y < -40
value = 10009

[State 10000, 15]
type = ChangeAnim
trigger1 = p2dist x > 200
trigger1 = p2dist y < -60
value = 10010

[State 10000, 16]
type = ChangeAnim
trigger1 = p2dist x > 200
trigger1 = p2dist y < -80
value = 10011

[State 10000, 17]
type = ChangeAnim
triggerall = p2dist x < 120
trigger1 = enemy,anim = 10 || enemy,anim = 12
trigger2 = p2dist y > 20
value = 10012

[State 10000, 18]
type = ChangeAnim
triggerall = p2statetype = C
trigger1 = p2dist x < 120
trigger2 = p2dist y > 40
value = 10013

[State 10000, 19]
type = ChangeAnim
triggerall = p2dist x = [120,200]
trigger1 = enemy,anim = 10 || enemy,anim = 12
trigger2 = p2dist y > 20
value = 10014

[State 10000, 20]
type = ChangeAnim
triggerall = p2statetype = C
trigger1 = p2dist x = [120,200]
trigger2 = p2dist y > 40
value = 10015

[State 10000, 21]
type = ChangeAnim
triggerall = p2dist x > 200
trigger1 = enemy,anim = 10 || enemy,anim = 12
trigger2 = p2dist y > 20
value = 10016

[State 10000, 22]
type = ChangeAnim
triggerall = p2statetype = C
trigger1 = p2dist x > 200
trigger2 = p2dist y > 40
value = 10017


altoiddealer

#14
Here's a video showing the issue

Ignore the glitched idle animation - that's an easy fix.

I have no idea why the helper can be pushed further into the wall than my character, when they both have identical sizes and CLSN

**EDIT** I fixed this issue with using this trigger for PlayerPush:
trigger1 = backedgebodydist > 0


*sigh* I'm thinking of just giving up on this.  Allowing the helper to be pushed is not the solution either  :stars:  It still trails a little, but worse, it also screws up the friction when P2 is pushing.  Instead of P1 and the helper being pushed simultaneously, they each get pushed 1 pixel each tick, so its actually a staggered mess.

I'm going to try the Explod route now, but I'm forecasting the same result I'm getting with BindToParent

**EDIT #2** I tried some more Googling, and there might be some merit to this :)  Someone (Cyanide) said that Helpers are "drawn after the players are drawn/read" but that Explods "explod objects aren't read before players, they'll be read at exactly the same time"

I hope this works :)  Either way, Алексей, your a lifesaver and thank you everyone for trying to help me get get this face screwed on properly!


Алексей

Quote from: altoiddealer on August 27, 2014, 03:20:21 AM
Here's a video showing the issue

Ignore the glitched idle animation - that's an easy fix.

I have no idea why the helper can be pushed further into the wall than my character, when they both have identical sizes and CLSN

**EDIT** I fixed this issue with using this trigger for PlayerPush:
trigger1 = backedgebodydist > 0


*sigh* I'm thinking of just giving up on this.  Allowing the helper to be pushed is not the solution either  :stars:  It still trails a little, but worse, it also screws up the friction when P2 is pushing.  Instead of P1 and the helper being pushed simultaneously, they each get pushed 1 pixel each tick, so its actually a staggered mess.

I'm going to try the Explod route now, but I'm forecasting the same result I'm getting with BindToParent

**EDIT #2** I tried some more Googling, and there might be some merit to this :)  Someone (Cyanide) said that Helpers are "drawn after the players are drawn/read" but that Explods "explod objects aren't read before players, they'll be read at exactly the same time"

I hope this works :)  Either way, Алексей, your a lifesaver and thank you everyone for trying to help me get get this face screwed on properly!

No problem man. I want to see that project of yours come to fruition. :D

-[Все слова это только слова.]-

altoiddealer

#16
I'll be damned... it works!  Really!   :laugh: :sugoi: :laugh: :sugoi: :laugh: :sugoi: :laugh: :sugoi: :laugh: :sugoi:

Interesting to learn this.  Progress may now resume!

**EDIT** One thing I figured out is a pain... ModifyExplod can't change the animation, so I have to remove/create explods constantly!  I think it will work, but I'm probably going to do it 10x over before I figure out the most efficient method.


I think what will work best is if the face is redrawn every tick.  So, I'm going to assign a Var to keep track of P2 in relation to P1... which will require probably about a dozen VarSets in State -2 for every positional difference that I'm taking into consideration.  THEN, I will just need to have one Explod per state that implements this face overlay which has, for example, anim = var(6)+10000, and removetime = 1.  Something like this.


Алексей

Quote from: altoiddealer on August 27, 2014, 04:27:54 AM
I'll be damned... it works!  Really!   :laugh: :sugoi: :laugh: :sugoi: :laugh: :sugoi: :laugh: :sugoi: :laugh: :sugoi:

Interesting to learn this.  Progress may now resume!

**EDIT** One thing I figured out is a pain... ModifyExplod can't change the animation, so I have to remove/create explods constantly!  I think it will work, but I'm probably going to do it 10x over before I figure out the most efficient method.


I think what will work best is if the face is redrawn every tick.  So, I'm going to assign a Var to keep track of P2 in relation to P1... which will require probably about a dozen VarSets in State -2 for every positional difference that I'm taking into consideration.  THEN, I will just need to have one Explod per state that implements this face overlay which has, for example, anim = var(6)+10000, and removetime = 1.  Something like this.

Awesome! I know your pain. That is the only way to change the animation of an Explod. It will be easiest if your animations are one frame long. If you have actual animations, removetime=1 won't work and you'll need to do some major tweaking. You've got the right idea though. Good luck!

-[Все слова это только слова.]-

altoiddealer

Ahhh yes, in this scenario I certainly should just make them 1 frame long :)

Thanks again, you've relieved my frustration several times now!  Thanks for all!


Алексей

Quote from: altoiddealer on August 27, 2014, 02:08:17 PM
Ahhh yes, in this scenario I certainly should just make them 1 frame long :)

Thanks again, you've relieved my frustration several times now!  Thanks for all!

Haha, you're most welcome. :D

-[Все слова это только слова.]-