YesNoOk
avatar

Problems With Redirecting to Guard State (Read 1919 times)

Started by Afterthought, June 29, 2018, 01:56:23 pm
Share this topic:
Problems With Redirecting to Guard State
#1  June 29, 2018, 01:56:23 pm
  • avatar
  • **
This one is a bit to sift through; please bear with me.

Using a certain part of code from montana's Suija, in which his Engetsu allows him to redirect to the guard states when he is encased in a bubble. Copying the technique the author used isn't working for my character, however.

Variables used:
var(10) is used to determine input.
var(22) is the switch used to utilize the custom code in the guard states.
var(23) determines which states to go to from the guard states.

Attack state:
Spoiler, click to toggle visibilty

Guard state being used:
Spoiler, click to toggle visibilty

States to redirect to after guard:
Spoiler, click to toggle visibilty

The big issue is that upon inputting the attack, my character cuts from the initial state (1000) straight into the falling state after an air guard. I have no doubt the code is in fact being read, but something I'm missing is preventing it from changing as it should instead of being skipped altogether.

If anyone has any input as to what could be done, I'd really love to hear it. In the meantime I will be attempting to fix it on my own. Thank you in advance!
Last Edit: June 29, 2018, 02:15:07 pm by Afterthought
Re: Problems With Redirecting to Guard State
#2  July 01, 2018, 09:02:43 am
  • *****
  • Shame on you!
    • USA
It seems like you have a lot of redundancy. Like your Var(10) and Var(23) seem to be exactly the same thing.
All of this 
Spoiler, click to toggle visibilty
Becomes this
[State 130, 円月弱]
type = ChangeState
triggerall = var(22) =1
;triggerall = var(23) =1
trigger1 = time = 1
value = floor(1010+Var(10)) ;Var 10 = 0, 1, or 2. So you'll get 1010, 1011, 1012 for X, Y, or Z

Because Var(10) = 0 equals Var(23) = 1 and 10=1 equals 23=2 and 10=2 equals 23=3

Also, your changestates in state 1010, you may want to include
'trigger1 = command != "holdback"' and the like to the last 3.
value = 1032, 1033, 1034
because if you only have the 1 trigger, it can activate.
Like your changestate for 1030 could activate your changestates for both 1032 and 1034. You need to exclude that possibility. Just make sure those last three changestates can only happen if you're not holding the other directions.

Code:
[State 1000, 円月アニメ]
type = ChangeAnim
triggerall = var(22) =1
trigger1 = var(23) =1
trigger2 = var(23) =2
trigger3 = var(23) =3
value = 1016
^^^ Can this be any other way? Also, with changeanims you want to only switch to the animation if the current animation isnt the one you want.
So add a
triggerall = anim != 1016
Without that, you'll be stuck on the first frame of the animation over and over because mugen will switch to the animation every single tic the state is active. This may be your entire problem. I'm not seeing anything that jumps out as a change to the falling state.

Use debug to see what state numbers pop up. I like to use F12 to take snap shots when things switch super fast. Pause button on the keyboard helps to. But I tap F12 like 15x fast as I can while the move is working. It'll take 15 snapshots and I check them with Irfanview and watch all the info in the debug.
Ctrl+D for debug.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#3  July 01, 2018, 06:37:36 pm
  • avatar
  • **
Use debug to see what state numbers pop up. I like to use F12 to take snap shots when things switch super fast. Pause button on the keyboard helps to. But I tap F12 like 15x fast as I can while the move is working. It'll take 15 snapshots and I check them with Irfanview and watch all the info in the debug.
Ctrl+D for debug.

I understand that you're trying to help and I appreciate it, but checking debug isn't new to me, I know how to do that already. I wouldn't have come to ask for assistance if I weren't doing this in the first place. Hell I probably wouldn't be doing this at all if I weren't utilizing debug. However I can possibly utilize Irfanview at some point, but right now I find it isn't necessary, I can tell just fine via debug without having to pause rapidly that what I'm attempting isn't working at the moment.

With that said, after rereading, I agree that obviously var(10) and var(23) essentially serve the same purpose at this point; I only mentioned it as var(10) is being used in more code than just this. I'm not a wizard so using floor is still foreign to me; nevertheless it'll be something I look more into.

As for everything else, I find that while it is credible, montana was able to make this attack work for their Suija without what you suggested, which is frustrating as I was hoping I'd have the same luck. I'm gonna attempt to amend with your suggestions and see what it gets me.
Re: Problems With Redirecting to Guard State
#4  July 01, 2018, 09:23:15 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Just to be clear you are saying (as far as you can tell) the move works fine except for that it doesn't enter stateno 1010, 1011 or 1012, correct?

I would guess this chunk of code is either the problem or another change state is triggering before these can.
Code:
[State 130, XX]
type = ChangeState
triggerall = var(22) =X
triggerall = var(23) =X
trigger1 = time = 1
value = XX

Have you tried trigger1 = time = 0 instead of time = 1?

Re: Problems With Redirecting to Guard State
#5  July 01, 2018, 10:50:16 pm
  • *****
  • Shame on you!
    • USA
As for everything else, I find that while it is credible, montana was able to make this attack work for their Suija without what you suggested, which is frustrating as I was hoping I'd have the same luck. I'm gonna attempt to amend with your suggestions and see what it gets me.
If you have access to the other character check the length of the animations involved. Also check if the last frames have a -1 as the time. The -1 or not having it -1 can mess up certain chunks of code. AnimTime = 0 is one of them.

If you're using var(10) to check the button press and it's used in other states make sure it's value is reset at time = 0 in the states it's used. This could be causing the hiccup too. I use 1 var for some of my characters' button press checks. Sometimes I just switch animations and use that value to adjust velocities n whatever else. Have you set up displaytoclipboard to watch the 2 var's values get set and change?
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#6  July 01, 2018, 10:55:19 pm
  • avatar
  • **
Forget state 130; I went so far as to change how var(22) was activated in state 1000; I simply made trigger1 = 1 in the VarSet. I did a little more digging around in the original character, copied over some more necessary code, and I got closer to making it work as I needed; still no dice, however, as my character would actually reach the guard state as I needed, and then get stuck in it.

Then I made the unfortunate discovery that I'm still a rookie; vars 22 and 23 were being used elsewhere. I established new variables and now the attack works as I needed; however, as per the code, whenever the character is sent to state 150, he returns to 130 as required, but the timer for the state restarts (obviously).

I need to make it so it doesn't, and the time is carried over so to speak; regardless of how many hits are blocked, and regardless of what state ny character is currently in (be it 130, 150 or 151), I need an absolute state change at a certain point in time (depending on input - stronger strength = longer shield). Would another variable need to be used to realize this?

@Odb718: Yes I did use DisplaytoClipboard. Helped me realize the variables were incorrect. I unfortunately think of the proper solutions when I'm too far down the road.
Re: Problems With Redirecting to Guard State
#7  July 01, 2018, 11:06:25 pm
  • *****
  • Shame on you!
    • USA
Yeah you can use a variable and statedef -2 as a timer.
More often you'll set the variable at the high value and subtract to it. Once it's 0 you have it. For you, I'd suggest the other way around. Start at 0 and count up.
Make sure you use your new Var(23) value as a check. Otherwise statedef -2 will keep adding to the new var and switch states.
Use a check like
TriggerAll = Var(718) > 0
in the timer. This way when you set it back to 0 it wont trigger.

There's also a method with an explod. You spawn the explod and when it reaches a certain time it destroys itself. The states look to see if the explod is on or off. I'd say use the var for now.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#8  July 02, 2018, 12:04:46 am
  • avatar
  • **
Using var(42) as my timer, but VarAdd doesn't seem to work; as long as var(40) (new var(22)) is equal to 1, it'll only ever add 1 to var(42). Using time or gametime doesn't change anything. Any other trigger suggestions?
Last Edit: July 02, 2018, 12:13:31 am by Afterthought
Re: Problems With Redirecting to Guard State
#9  July 02, 2018, 12:13:21 am
  • *****
  • Shame on you!
    • USA
So if it's adding when your var is on, what's the problem again? When does it turn off?
As long as you dont set var 42 above 0 you may only need the 1 check.

[State -2]
type=varadd
trigger1 = var(42) > 0
;trigger1 = var(40) != 0
var(2) = 1
ignorehitpause= 1

Changestate goes here
trigger1 = var(42) >= 300 ; your time

[State -2]
type=varset
trigger1 = var(42) >= 300  ;this is your time you need
var(2) = 0
ignorehitpause= 1
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#10  July 02, 2018, 12:17:34 am
  • avatar
  • **
Turns off when var(40) = 0, as it should. Where did you get var(2) from?

I need the amount for var(42) to go up as long as var(40) = 1, or until var(42) = 38.
Re: Problems With Redirecting to Guard State
#11  July 02, 2018, 02:12:54 am
  • *****
  • Shame on you!
    • USA
lol may just have missed typing the 4. my bad.

[State -2]
type=varadd
triggerAll = var(40) = 1
triggerAll = var(42) > 0
trigger1 = var(42) <= 38
var(42) = 1
ignorehitpause= 1

38 will be 38tics. So a little over half a second. The more triggeralls you have in statedef -2, the faster mugen can skip it if it doesn't work.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#12  July 02, 2018, 02:45:11 am
  • avatar
  • **
Oh I was worried for a sec. It's all good.

In any case, that didn't work either. I definitely understand what you've sent, but it just won't work.

Here's a vid showing what's going on currently:

https://youtu.be/mndcoPVXWdY

Last variable in debug is the one I need to increase. The quality isn't stellar, but you can see it doesn't increase at all currently. Before it would only rise to 1 and then stop until var(40) was reset back to 0.
Re: Problems With Redirecting to Guard State
#13  July 02, 2018, 06:33:58 am
  • *****
  • Shame on you!
    • USA
I can barely read it but does it switch to 1901 or 1001 when he's in that ball?
Either way, your original varset isn't firing off in the state.
Make sure you dont have any other varset changing var42 to 0 besides the one in statedef -2.

When stuff like this just wont work at all, I edit state 200. I edit my light punch so, in this case, it'd change var(42). I KNOW it has to work there. Use it to set the var and see if statedef -2 adds to it, or if it auto-switches back to 0.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#14  July 02, 2018, 02:32:17 pm
  • avatar
  • **
Definitely not 1901. Original post shows that. It's 1000, 130, 1010, 1035, in that order. (But again the quality is terrible so I can understand the confusion.)

Gonna try editing light punch to see if it'll move the variable up as I need per your suggestion, then sift through the code and see if there are any conflicts.

EDIT: Works properly with light punch. I'm not sure what would cause it to not work how I have it set up. I have var(42) within state 130, if that makes any difference. The custom animation in 130 also plays at -1 ticks; changing this to play with an actual amount of time (say, 38 ticks) doesn't make a difference; var(42) will only ever climb to 1, and then freeze there until var(40) = 0.
Last Edit: July 02, 2018, 04:08:27 pm by Afterthought
Re: Problems With Redirecting to Guard State
#15  July 03, 2018, 06:22:17 am
  • *****
  • Shame on you!
    • USA
It changes to 1 and stays there? Are you some how using a varSET?
Set var(42) in state 130 to 7 at time = 0. If it sets and goes back to 0 you've got a problem some place.
Use ctrl+f to find all instances of
var(42)
and
v = 42
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#16  July 03, 2018, 03:05:40 pm
  • avatar
  • **
Use ctrl+f to find all instances of
var(42)
and
v = 42

Again, I know how to do this. Been doing it. Trust me, I'm not sitting around waiting to be spoon-fed a solution, I'm double and triple checking everything as much as I can.

The only place var(42) is being set is in 130, and Add is beiing used in -2. I'll try setting it to 7 as you suggest and see what happens.

Re: Problems With Redirecting to Guard State
#17  July 03, 2018, 07:52:19 pm
  • *****
  • Shame on you!
    • USA
Heh, I'm not knocking you. This is such a stupid thing to be stuck on that it's going to be either extremely complex or insanely easy. I've been there plenty of times.
Make sure your placement/layout of the code works too. That's one problem I usually dont recognize super fast. Some stuff has to be above other things.
When code isn't working I usually drag it right under the Statedef. If I lay out like 3 varset/add and it's just not working right, I'll reverse the order it's read. Maybe try that?
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#18  July 03, 2018, 07:56:35 pm
  • avatar
  • **
Not gonna lie, I actually forgot to try what you suggested. I didn't think about it, but layout might very well be a problem, not sure how finicky MUGEN is when it comes to that. But let me actually try setting the var with a different value first.

EDIT:

https://youtu.be/Ob2ofJsHBuc

Setting works, addition still doesn't. Gonna see if moving some stuff around will make a difference.

Actually, the quality of this video sucks like the last one. There has to be better videocap software. But the var was set.
Last Edit: July 03, 2018, 08:06:23 pm by Afterthought
Re: Problems With Redirecting to Guard State
#19  July 03, 2018, 08:35:43 pm
  • *****
  • Shame on you!
    • USA
I use bandicam. I have two mugen.cfg files. One is for playing, the other is for recording. Comes in handy.

Try

[State -2]
type=varadd
triggerAll = var(40) = 1
triggerAll = var(42) > 0
trigger1 = var(42) <= 38
v = 42
value = 1
ignorehitpause= 1

Maybe that's just the dumb problem???
vVv Ryuko718 Updated 10/31/22 vVv
Re: Problems With Redirecting to Guard State
#20  July 03, 2018, 08:49:37 pm
  • avatar
  • **
Try

[State -2]
type=varadd
triggerAll = var(40) = 1
triggerAll = var(42) > 0
trigger1 = var(42) <= 38
v = 42
value = 1
ignorehitpause= 1

Maybe that's just the dumb problem???

You would think that. And I've tried that, still no dice.

What's frustrating is that the other Suija manages to make it work without a timer, but I cannot figure out how. Maybe there's something glaringly obvious in THAT code I'm missing.