The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => MUGEN Class => Topic started by: Odb718 on September 14, 2015, 02:19:19 am

Title: MoveContact (Triggers)
Post by: Odb718 on September 14, 2015, 02:19:19 am
This trigger is valid only when the player is in an attack state. MoveContact gives a non-zero value if P2 has either been hit, or has guarded P1's attack. It gives 0 otherwise. P1 is the player, and P2 is his opponent. Typically used with the "StateNo" and "Command" triggers for detecting move-interrupts in the CMD file.

Format:
MoveContact
Arguments:
none
Return type:
int
Error conditions:
none
Example:

Code:
trigger1 = MoveContact
  True if P1's attack did not miss P2.

Code:
trigger1 = MoveContact != 0
  True from the time P1's attack came in contact with P2, until just after P1's pausetime wears off.

Details:

    On attack contact, MoveContact returns 1. After contact, MoveContact's return value will increase by 1 for each game tick that P1 is not paused (P1 gets paused on contact; see pausetime parameter in HitDef controller). The values of MoveGuarded, MoveHit and MoveReversed increment in the same fashion.

    Note 1: the values of MoveContact, MoveGuarded, MoveHit and MoveReversed are set simultaneously. For example, if one HitDef (http://mugenguild.com/forum/topics/hitdef-sctrls-169450.0.html) in a move hits successfully, MoveHit will return non-zero. If a following HitDef in the same move is guarded, MoveGuarded will return non-zero, and the other three triggers will return 0.

    Note 2: the values of the four Move* triggers reset to 0 and stop incrementing after a state transition. See "movehitpersist" (http://mugenguild.com/forum/topics/movehitpersist-cns-169292.0.html) parameter for StateDefs (CNS docs) for how to override this behavior.

Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 15, 2015, 03:00:17 pm
movecontact/movehit=1 seems to have weird issues in 1.1 I've noticed that my triggers that use that do not activate whatsoever. Any idea as to why?
Title: Re: MoveContact (Triggers)
Post by: tehdevil on September 18, 2015, 05:51:44 am
movecontact/movehit = 1 is for the dos Mugen era only. The only code that works for newer Mugen is movecontact/movehit.
Title: Re: MoveContact (Triggers)
Post by: Jesuszilla on September 18, 2015, 06:41:41 am
Uh, no? It works in 1.0.
Title: Re: MoveContact (Triggers)
Post by: Bronko on September 18, 2015, 06:57:02 am
movecontact/movehit = 1 is for the dos Mugen era only. The only code that works for newer Mugen is movecontact/movehit.

At face value this is not correct.  I'm going to assume that you tried to use movecontact/movehit as a trigger for cancelling moves, and found that it was nearly impossible to do or needed frame-perfect timing.
Is DOSmugen, movecontact and movehit were indeed boolean values, but because mugen expressions are based on the C language the true/false is actually 1/0.  In fact, any nonzero (positive? I forgot) number counts as a true value, which leads us to the current, more useful movecontact/movehit which ticks up over time.

There are plenty of good use cases for checking if movecontact/movehit are numbers other than 1 or 0, they're just not common.
Title: Re: MoveContact (Triggers)
Post by: Odb718 on September 18, 2015, 09:44:16 am
MoveHit and MoveContact are both registering fine for me in Mugen 1.0 and 1.1.
As Davod Sirloin posted the values tic up with time during which they're active.

With that being the actual case, my original thought would be,
movecontact/movehit=1
would need to become
movecontact/movehit != 0

I've edited the original post changing =1 to !=0. Please let me know if anyone runs into problems using this code.
Title: Re: MoveContact (Triggers)
Post by: Cyanide on September 18, 2015, 10:14:55 am
Writing it without a value also returns true

Trigger1 = movecontact
is the same as
Movecontact != 0
Movecontact > 0

Best to use values if you want to delay when something occurs. Movecontact = 8, therefore spawn specific helper/explod or whatever. Uncommon to some extent but useful still.

Also to be noted. Movecontact triggers on Guard OR on Hit. If you have an action, like a recoil or whatever you want to occur whether the attack hits or is guarded, you can use movecontact instead of movehit || moveguarded
Title: Re: MoveContact (Triggers)
Post by: Алексей on September 18, 2015, 02:40:48 pm
movecontact/movehit=1 seems to have weird issues in 1.1 I've noticed that my triggers that use that do not activate whatsoever. Any idea as to why?

Are you talking about literally dividing "movecontact" by "movehit=1?" If so, since "movehit=1" is an expression, wrap it in parentheses, though you'll likely be dividing by 0 at some point.

If that's not what you meant and you meant just "movecontact=1" or "movehit=1," I can't really say. I've had no such issues with them in Mugen 1.0 nor 1.1.
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 18, 2015, 03:35:22 pm
I'm not referring to actual division lol. I was saying interchangeably they weren't working. How do I know this? Well I have a null sctrl in my .cmd file for a few of my chars and they all depend on movehit=1 to be true. This happens seamlessly on 1.0 but does not happen at all on 1.1. I have not changed a single line of code. But if you want to know in specific, it's why my AI isn't nearly as strong in 1.1 as it is in 1.0.
Title: Re: MoveContact (Triggers)
Post by: Bea on September 18, 2015, 03:59:33 pm
Do those null sctrls have ignorehitpause = 1 on them?
Elecbyte likely screwed things up, as usual, when they updated their code, so now to trigger movehit = 1 or movecontact = 1 you may need to use ignorehitpause = 1.

Not sure as I don't have 1.1 here nor I plan to download it.
Title: Re: MoveContact (Triggers)
Post by: Websta on September 18, 2015, 04:11:04 pm
Well I have a null sctrl in my .cmd file for a few of my chars and they all depend on movehit=1 to be true. This happens seamlessly on 1.0 but does not happen at all on 1.1. I have not changed a single line of code. But if you want to know in specific, it's why my AI isn't nearly as strong in 1.1 as it is in 1.0.

I've never had problems like this before and I've been using 1.1 exclusively for a while. Are you sure you're not imagining things kame? :P your problem is kinda vague
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 18, 2015, 04:33:11 pm
Do those null sctrls have ignorehitpause = 1 on them?
Elecbyte likely screwed things up, as usual, when they updated their code, so now to trigger movehit = 1 or movecontact = 1 you may need to use ignorehitpause = 1.

Not sure as I don't have 1.1 here nor I plan to download it.

I use the following
Spoiler: AI route (click to see content)
I'm aware I should be using cond here and I do for anything after this char but the same problem occured.

The last time I ran my stuff in 1.1 it was using beta 4 and var(31) never changed to 93 as it should have which told me that none of these null sctrls were working as they should in this particular build.


I've never had problems like this before and I've been using 1.1 exclusively for a while. Are you sure you're not imagining things kame? :P your problem is kinda vague

I'm 100% sure I'm not imagining anything, the vars that I keep track of literally do not change. My AI does not do any of the routes its supposed to. My problem is pretty specific, when using movehit=1 or movecontact=1 in the cmd it does not work in 1.1....ok I probably should have pointed out the .cmd part but yeah.

EDIT: just watch two falcons fight each other. If they both just sit there after hitting with his dash uppercut(raptor boost) then it's not working at all.
Title: Re: MoveContact (Triggers)
Post by: Bastard Mami on September 18, 2015, 05:11:18 pm
try doing the "mugen parser is an idiot" thing and change movehit=1 to (movehit=1) as wellas  putting it in separate lines, etc...
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 18, 2015, 05:14:26 pm
That OR is there for a reason but I'll try parenthesis when I get home.
Title: Re: MoveContact (Triggers)
Post by: Алексей on September 18, 2015, 07:14:35 pm
Only thing I see that's odd here is this:
Code:
triggerall = movehit=1 || p2statetype=A && p2movetype=A

It's not clear as to what you're going for without proper parentheses here.
Code:
(movehit=1 || p2statetype=A) && p2movetype=A 
OR
movehit=1 || (p2statetype=A && p2movetype=A)

Still... you said that it's working fine in Mugen 1.0, so it's likely not that. It's more about being clear/verbose than an error, but you never know. Maybe 1.1 fucked up the way it processes lines like this without parentheses to solidify groups of expressions.
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 18, 2015, 07:26:24 pm
It's not odd even lol. It's logic: 1 OR 2 and 3 means either 1 is true or that both 2 and 3 are true. No parenthesis needed(in a world where the code works) so I'm 100% sure it's not that.

So I'd say it's pretty clear....to coders anyway. but what you have as "3" is what it does. MUGEN knows and I know in any case lol
Title: Re: MoveContact (Triggers)
Post by: Bea on September 18, 2015, 09:30:37 pm
You put way too much trust in Elecbyte programming operator precedence right...
Title: Re: MoveContact (Triggers)
Post by: Алексей on September 18, 2015, 10:39:45 pm
You put way too much trust in Elecbyte programming operator precedence right...
Yes, this is my point exactly. Maybe by some strange chance in your specific setup, the engine fails with that statement. It's mugen... trust nothing, lol.

Spoiler, click to toggle visibilty
Anyways, it's just about being verbose. Even though I know what the result would be, I'd want to make it as obvious as possible. In a world where code works we'd be able to use ternary expressions, non-number typed variables, and name our damn variables, lol.
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 18, 2015, 10:54:07 pm
OK HERES THE PROBLEM AND LIKE TOMORROW ALL OF THIS DISCUSSION SHOULD BE DUMPED CAUSE:

AIlevel......mine was set to 4
:magneto:
You may notice that on that very code same I provided it says AILEvel >6

We're done here. I'm retarded. PACK IT UP!
Title: Re: MoveContact (Triggers)
Post by: Just No Point on September 18, 2015, 11:34:05 pm
LOL I'm sure this will confuse, entertain, and educate future users all at the same time!

I'm glad you were able to get it resolved even if it wasn't something the trigger was causing. But why did it still work in 1.0 and not 1.1?

EDIT:Your 1.0 was set for 6 wasn't it?
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 19, 2015, 06:56:56 am
my 1.0 is at 8 cause I only learn from my AI beating me up.....it's also how I make sure they are competent enough to bully the average player
Title: Re: MoveContact (Triggers)
Post by: Loves Pachirisu on September 20, 2015, 06:27:52 pm
Which is better for comboing into one another and why?

From CNS
[State 600, End]
type=changestate
trigger1= command = "y" && movehit
trigger1 = var(59) = 0
value=610

From CMD
[State -1, Jumping Medium Punch]
type = ChangeState
value = 610
triggerAll = !var(59)
triggerAll = command = "y"
triggerAll = StateType = A
trigger1 = ctrl
trigger2 = var(4)
trigger3 = stateno = 600 && movehit
Title: Re: MoveContact (Triggers)
Post by: Kamekaze on September 21, 2015, 03:44:44 am
the second always. movecontact is more feasible for non AI unless it has to be on movehit