Problems with TargetBind

Started by Dawn de Era, November 27, 2016, 07:17:20 PM

Previous topic - Next topic

Niitris

Quote from: Odb718 on December 01, 2016, 06:28:43 PM
Subtracting from the helper would be Pos x - target,Pos x
That's subtracting from the target, that gets me every so often too. :P


[State 3002, TargetBind]
type = TargetBind
triggerall = NumTarget
triggerall = parent, Facing = 1
triggerall = target, pos x > (parent, pos x + 74) && target, pos x < (parent, pos x + 184)
trigger1 = Time%5 = 0
time = 1
pos=(target,Pos X-Pos X),(target,Pos Y-Pos Y)-1

[State 3002, TargetBind]
type = TargetBind
triggerall = NumTarget
triggerall = parent, Facing = -1
triggerall = target, pos x > (parent, pos x - 74) && target, pos x < (parent, pos x - 184)
trigger1 = Time%5 = 0
time = 1
pos=(target,Pos X+Pos X),(target,Pos Y-Pos Y)-1


The X value on top was saying to subtract the Target's PosX from itself, which is just zero. That's why the right side was fine.

The one on the bottom was saying to add Target's PosX twice, which is why the behavior was jumpy on the left.

Odb718

Wait what? Isn't this code inside the helper? and the helper has the target?

Try

[State 0, VarSet]
type = VarSet
trigger1 = 1
triggerall = numtarget
v = 10    ;fv = 10
value = floor(abs(target,pos x - pos x))

in your 220 and you'll see it doesn't = 0.
vVv Gouken718 vVv SabreTooth718 vVv


Dawn de Era

#22
Quote from: Niitris on December 01, 2016, 06:51:45 PM

[State 3002, TargetBind]
type = TargetBind
triggerall = NumTarget
triggerall = parent, Facing = 1
triggerall = target, pos x > (parent, pos x + 74) && target, pos x < (parent, pos x + 184)
trigger1 = Time%5 = 0
time = 1
pos=(target,Pos X-Pos X),(target,Pos Y-Pos Y)-1

[State 3002, TargetBind]
type = TargetBind
triggerall = NumTarget
triggerall = parent, Facing = -1
triggerall = target, pos x > (parent, pos x - 74) && target, pos x < (parent, pos x - 184)
trigger1 = Time%5 = 0
time = 1
pos=(target,Pos X+Pos X),(target,Pos Y-Pos Y)-1


Niitris, your code is the closest to working, but there is one issue.
When Pencil is too far from the target, the target doesn't lift at all.
Ex.: https://streamable.com/qdsr

EDIT: The opponent doesn't lift at all at any range when done from the left. From the right, it depends on the distance.

EDIT 2: Aaand I just realized you were chewing out faulty code. Whoops. Still, it's the closest to working.

Odb718

You REALLY need to turn on debug when you're testing/deving. CTRL+D.

Seeing this move, I would have tried to make a velset based on the P2bodydist x, and that's it. The velocity would remain the same through out the move. The bind is OK, but velset would make it smoother also. %5 is every five tics. Velset is every tic, nice and smooth.
vVv Gouken718 vVv SabreTooth718 vVv


Dawn de Era

I found the issue with the first one; for facing right.
There's this piece of redundant code in the trigger.
&& target, pos x < (parent, pos x + 184)
Now, all I have to do is adjust the rise rate, and it's good to go.

Dawn de Era

I finally did it. I finally got this to work the best it can from the right side.
Now, to do the same for the left.

Dawn de Era

#26
I've found the issue. When facing left, the y pos doesn't increase like it should, but it does when facing right.
(target,Pos Y-Pos Y)-(2.5-((parent,Pos X-target,Pos X)/125))
I don't know how to solve this, though.
EDIT: Or it could be something regarding the other aspects of the code, since the opponent rises when the attack lands the hit really closely.
[State 3002, TargetBind]
type = TargetBind
triggerall = NumTarget
triggerall = target, pos x > (parent, pos x - 74)
triggerall = parent, Facing = -1
trigger1 = Time%5 = 0
time = 1
pos=(target,Pos X-Pos X),(target,Pos Y-Pos Y)-(2.5-((parent,Pos X-target,Pos X)/125))

Dawn de Era

My apologies for the thread bump, but I'm still unable to get this piece of code to function correctly. I have tried many things messing with the pos, yet nothing improves. If anyone at all can supply me with an estimated solution, please do so.

Odb718

What values are you getting in debug?
vVv Gouken718 vVv SabreTooth718 vVv


Dawn de Era

Error-wise, value-wise or other?

Odb718

you probably want to set up 4 or 6 values,
enemy,Pos X
enemy,Pos Y
Pos X
Pos Y
parent,Pos X   ;dont use in root
parent,Pos Y   ;dont use in root

I'd have the displaytoclipboard inside your helper also. This way you can read your values live and see why/how your math is messing up.
vVv Gouken718 vVv SabreTooth718 vVv


Dawn de Era

Nevermind, I was able ot fix it by making the x negative and having the target x subtract from the parent x.