"All Attacks Detection" Algorithm Issue

Started by Fighting Toys Freak, March 04, 2019, 06:08:58 PM

Previous topic - Next topic

Fighting Toys Freak

Hey all,

I have been attempting to implement a detection algorithm that enables the player to modify its movements for dodging attacks dished out by its opponent(s). I have incorporated a reversal state controller in an effort to accomplish this goal. Furthermore, I have added the "Dodge v Dodge" string alongside the "priority =" parameter under the "HitDef" state controller to avoid opponents from being interrupted of their attacks, however to no avail. Here are examples of my algorithm:
Spoiler (click to show)


[Statedef 902]
type    = U
movetype= I
physics = N
velset = 0,0
anim=6031
sprpriority = 2

[State 0, BindToParent]
type = BindToParent
trigger1 = 1
ignorehitpause = 1

[State 0, Turn]
type = Turn
trigger1 = facing != (parent, facing)

[State 0, VarSet]
type = VarSet
trigger1 = var(3) = 1 && time = 0
v = 3
value = 0

[State 0, AttackDist]
type = AttackDist
trigger1 = 1
value = 0
ignorehitpause = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = movetype != A
trigger1 = p2movetype = A || inguarddist
movetype = A

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = movetype = A
trigger1 = p2movetype != A || !inguarddist
movetype = I

[State 620, 1]
type = HitDef
trigger1 = movetype = A
attr = S, NA ;Attribute: Standing, Normal Attack
animtype = Light ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA ;Flags on how move is to be guarded against
hitflag = MAF ;Flags of conditions that move can hit
priority = 7, Dodge v Dodge ;Attack priority: 0 (least) to 7 (most), 4 default
pausetime = 0,0 ;Time attacker pauses, time opponent shakes
sparkno = -1 ;Spark anim no (Def: set above)
sparkxy = 5, -35 ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
[State 0, ReversalDef]
type = ReversalDef
trigger1 = time = 0
reversal.attr = SCA,NA,SA,HA
sparkno = S6030
p1stateno = 904
id = 904


Spoiler (click to show)


[Statedef 904]
type    = U
movetype= I
physics = N
velset = 0,0
anim= 6030
sprpriority = 2

[State 0, BindToParent]
type = BindToParent
trigger1 = 1
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 3
value = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = time = 1
value = prevstateno


Spoiler (click to show)


[state -2, Jump AI]
Type=changestate
Triggerall = AILevel > 0 && var(1) != 0
triggerall = ctrl && statetype = A
triggerall = Const(movement.airjump.num) != 0
...
trigger4 = numhelper(901) && numhelper(902) && numhelper(903)
trigger4 = helper(901), MoveReversed = 1 ;^^ helper(903), MoveReversed = 1
value=50


How should I modify this algorithm to produce its desired effect?
UPDATE - Think of this endeavor like creating a sensory algorithm for the player: if an opponent's movetype is A and the sensory helper (invisible) does get triggered off, then the player will not react; otherwise, the player would act in defense before the attacking opponent can make contact with the player.

All suggestions will be considered.

DrKelexo

This is quite an interesting way to handle this. I'm not entirely sure I understand it, but

I'm not entirely sure what the HitDef accomplishes. However, I think it completely works at odds with the ReversalDef. Having trigger1 = time = 0 on the ReversalDef means that, as soon as the HitDef activates, the ReversalDef goes away until you reach time = 0 again. And that's even if the ReversalDef is sticking around at all, considering I think you need a Time parameter to make it last more than one frame.

I think the main answer to your problem, though, is that you're using ReversalDef and not HitOverride. ReversalDef is like a HitDef in that it only works when you're MoveType is A. HitOverride would require some different coding but would actually produce results when hit while in MoveType = I

I also just think you could scrap this entire thing and use trigger4 = enemynear,hitdefattr=SCA,NA,SA,HA && inguarddist in your AI changestate but I'll let you be the judge on whether that works for you. (Assuming that's not a version thing. I have no idea.)

Fighting Toys Freak

#2
Thanks for the advice, DrKelexo.

In regards to using the "HitOverride" state controller instead of the "ReversalDef" state controller, I cannot do that: you see, I have been attempting to prevent any opponent's attack from being interrupted by the helper because the helper will become affected by the opponent's attack rather than the player. Instead, because the helper is invisible, its "HitDef" state controller is only intended to cause the attacking opponent or opponent's helper to "dodge" their "HitDef" state controllers and, consequently, send the player's helper state to its reversal state, i.e. state #904 (see previous). Hence, the detection algorithm is not intending to interrupt the opponent's attack. This way, the attacking opponent or opponent's helper still has the chance to make contact with the actual player.

Sorry for the wall of text if you find it as confusing.

So, could anybody advise me as to how I can achieve this clarified, desire effect while maintaining the "ReversalDef" state controller?

UPDATE - Think of this endeavor like creating a sensory algorithm for the player: if an opponent's movetype is A and the sensory helper (invisible) does get triggered off, then the player will not react; otherwise, the player would act in defense before the attacking opponent can make contact with the player.

Odb718

Have you tested this against moves that use HitOnce? I feel like it'd mess some things up.

I'm honestly getting confused on what player you refer to throughout your posts. "Player's helper" is P1?? So if Player = P1 what's  "opponent's attack rather than the player" player here? And do you mean the Opponent's Helper's attack? Because the P2's attack could just be a SLP or any other basic.
vVv Gouken718 vVv SabreTooth718 vVv


Fighting Toys Freak

#4
Thanks for your questions, Odb718.

To clarify furthermore, the player's helper refers to the helper with the "ReversalDef" algorithm in question; the opponent's attack refers to the attacking opponent, and the opponent's helper...well...refers to the attacking opponent's helper. That is the extent to which I can simplify the variables at play; I hope that my explanation dispels your confusion.

Now, about testing the algorithm against an opponent's attack whose "HitDef" state controller possesses a "hitonce" parameter, ...yeah...I have already done so. The problem is that the mentioned "HitDef" state controller of the player's helper has been interrupting any attacking opponent whose moves use the "HitOnce = 1" parameter.

UPDATE - Think of this endeavor like creating a sensory algorithm for the player: if an opponent's movetype is A and the sensory helper (invisible) does get triggered off, then the player will not react; otherwise, the player would act in defense before the attacking opponent can make contact with the player.

So, could anybody suggest as to how can I prevent the interruption from happening in such instances, while implementing the desired effect(s) in question?