YesNoOk
avatar

custom guard state (Read 531 times)

Started by sgn15, July 03, 2012, 08:24:34 am
Share this topic:
custom guard state
#1  July 03, 2012, 08:24:34 am
  • ***
so i have a char with a "transformation", but it is not really a standard one, so i did not involve the common1.cns in transformation. instead, i made new states for new form's stance, walk, jump, 1 damage state, plus attack states.

i would like to make a custom guard state. I would like to make the guard state work like standard guard state. I looked at common1.cns guard states and i found no special codes there that make it work like how it works. i coded so far the changestate to go to guard state (conditions are: when enemy is near and attacking, i am holding back, and in guard distance), those are how a char goes into guard state, right?

problem is, the guard state is just as hittable as any of its other states. so what makes a guard state work any different than other states and work like how a real guard works?
Re: custom guard state
#2  July 03, 2012, 08:52:18 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Guarding is hardcoded into the engine. You can't make a custom guard state, you have to use the standard states for it.
Guard states work like this :
1. When the character is in guard distance, has control and back is held, it will enter the guard start state (120), this is hardcoded, but can be done using a changestate.
2. When the character takes an attack in any guard states (120-155), they will be moved into the appropriate guard hit state(150-155) and the attack will count as guarded. This cannot be replaced by a changestate or hitoverride.
Re: custom guard state
#3  July 03, 2012, 08:55:52 am
  • ***
so if i made a custom guard state, there is no way to make it any less hittable  than other states? assuming all have blue clsn boxes?
Re: custom guard state
#4  July 03, 2012, 09:01:02 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
No. And to get full guard functionality, show guardsparks/take guard damage you must be in the 120-155 state set. Otherwise it's treated as a regular hit.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: custom guard state
#5  July 03, 2012, 01:09:26 pm
  • ****
    • UK
    • strides2glory.com/
You can try using a reversals state and include the hitsparks on movehit, movecontact how ever you like. You can also add a follow up state that will occur as a result of contact that can show p1 reeling back from p2 contact as if the move was guarded. Not only that but you can use  a lifeadd= feature to scale the amount of damage received from the guard.  You can also set hitflag properties of moves that will trigger the guard and moves that will bypass it. So there are other ways to get around that.
Re: custom guard state
#6  July 03, 2012, 04:42:05 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
Not only that but you can use  a lifeadd= feature to scale the amount of damage received from the guard.
Unless it's for a full game, I wouldn't do that. Sure, most usually the guarded damage of attacks is a fraction of the normal damage, but there are plenty of exceptions and all of those exceptions will not work as intended. Spammable attacks with 0 guarded damage suddenly become a threat, supers that specialize in high guarded damage will be near useless, etc...
However, if it is a full game, you can take the correct amount of guarded damage by using gethitvar(chainID) to identify the attack that's hitting you instead of "scaling" (guessing) the amount.

But regardless, the easiest solution is to override the standard guard states and display the transformed character animation when you are transformed instead of the normal. If you really want guarding to work the exact same way, you don't need new states.
Re: custom guard state
#7  July 07, 2012, 06:11:35 pm
  • ***
sorry for late reply, was busy with a few things. anyway, i never really understood the gist of a reversaldef from mugen docs' explanation, can someone explain to me?

for standard guard states, my problem is that i have flying modes, i want the guard to stay in air, not go back down to ground.

I thought of an idea, but I have not tried it yet. Can I use an invisible hittable helper (in front of p1) to receive the attack and therefore, p1 is "guarding" against the attack ?
Re: custom guard state
#8  July 07, 2012, 06:38:44 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
for standard guard states, my problem is that i have flying modes, i want the guard to stay in air, not go back down to ground.
Use the Air guard states when transformed. Make sure you change physics to none when you are guarding while transformed, to turn off gravity, and adjust velocities as necessary. You can use the Statetypeset controller for this.
Quote
I thought of an idea, but I have not tried it yet. Can I use an invisible hittable helper (in front of p1) to receive the attack and therefore, p1 is "guarding" against the attack ?
No. Helpers can't guard, not even when using the standard guard states. So they would take unguarded damage/knockback/etc, meaning you will still not know what the attack was supposed to do to your character when guarded. That technique is useful for superarmor, but not for guarding. Also, unless you make your character invincible, and take the damage by measuring it through the helper and using lifeadd, it serves no purpose even that way. The attack can still hit you at the same time, or even after hitting the helper. Most attacks can hit any number of targets.
Re: custom guard state
#9  July 09, 2012, 08:22:01 am
  • ***
actually the helper method is meant to take the attack, and instead i am fine with not "receiving" the guard parameters of the hitdef that I "guard" thru "helper getting hit instead of me"

anyway, I scrapped that idea and went back to the original guard states.

I did not changed the content of the guard states but I added these on top of the original content. the physics and anim does not work still.

my char has a semi-bird transformation
1120 - guard in air
1620 - guard in ground
var(15) = 1 is var for transformation
1130 - custom damage state for my semi-bird form

I put this in state -3 or -2, both have the same result
; fly guard
[State 0, ChangeState]
type = ChangeState
Triggerall = var(15) = 1
trigger1 = p2movetype = A
trigger1 = Movetype != A
trigger1 = inguarddist
trigger1 = command = "holdback"
value = 120
ctrl = 1

I put this in all guard states
Spoiler, click to toggle visibilty

so what should i fix?

EDIT:
the anim shown is from the normal mode then it goes to show new form guard anim, then when in air, physics is air then goes to ground.
Last Edit: July 09, 2012, 08:37:23 am by sgn15
Re: custom guard state
#10  July 09, 2012, 11:20:42 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Code: (mugen)
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(15) = 1
trigger1 = anim != 1620
trigger1 = statetype = S
value = 1620
;elem = 1
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(15) = 1
trigger1 = anim != 1120
trigger1 = statetype = A
value = 1120
;elem = 1
;ignorehitpause =
;persistent =

[State 0, StateTypeSet]
type = StateTypeSet
triggerall = var(15) = 1
trigger1 = anim = 1120
trigger1 = statetype = A
physics = S     

[State 0, StateTypeSet]
type = StateTypeSet
triggerall = var(15) = 1
trigger1 = anim = 1620
trigger1 = statetype = C
statetype = S

[State 0]
triggerall = var(15) = 1
Type=Velset
Trigger1=Statetype=A
Y=0

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 1130
time = 1
forceair = 0
;ignorehitpause =
;persistent =
I think this should work. Make sure you place it at the bottom of each state to make sure it is executed after any changeanims/statetypesets originally present there. (or add var(15)!=1 to non-transformed changeanims and statetypesets)
Re: custom guard state
#11  July 09, 2012, 03:00:28 pm
  • ***
yeah it works now. but it goes back to fall state (50) after guarding. so i have to make another set of changestates as well? i looked at the states and they have multiple changestates per state. some to 52, some goes back to 130,etc....

in which states should i make another set of changestates and in which states are it not necessary?

EDIT:

I made another set of changestates for the changestates to goes to state 52 (in states 155 and 132, i might have overlooked others)

[State 155, 7]
type = ChangeState
triggerall = var(15) != 1
trigger1 = sysvar(0)
value = 52

[State 155, 7]
type = ChangeState
triggerall = var(15) = 1
trigger1 = sysvar(0)
value = 1000

so far, they still go to state 50 when i am transformed while guarding

1000 is my stance for semi bird form
Last Edit: July 09, 2012, 03:12:55 pm by sgn15
Re: custom guard state
#12  July 09, 2012, 04:09:40 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
State 52 is the landing state, it's not what you are looking for. The character changes into that when reaching the ground, which shouldn't happen while transformed.

State 140 is the guard end state, you should put a changestate there to return to your transformed normal state, because that is the state that puts you into state 51 after you finish guarding in air.
Re: custom guard state
#13  July 11, 2012, 09:24:07 am
  • ***
ok i did that and undid what i did (wrong changestate edited previously)


in state 140

[State 0, ChangeState]
type = ChangeState
triggerall = var(15) = 1
trigger1 = p2movetype != A
value = 1000
ctrl = 1
;anim =
;ignorehitpause =
;persistent =

after testing the char several times,  i noticed something, my char (even if in normal mode) automatically go to transformed guard mode (anim) and is not hittable in guard mode even if i use attacks with assertspecial unguardable. it does not go to the state 1130, the hitspark of enemy also shows, so it definitely hits
Re: custom guard state
#14  July 11, 2012, 09:50:18 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Sounds like a problem with state 1130. Maybe there is a changestate there that makes the character leave it as soon as it enters.
Re: custom guard state
#15  July 11, 2012, 10:25:47 am
  • ***
Spoiler, click to toggle visibilty

1131 is another hitstate
1000  is  transformed stance
Re: custom guard state
#16  July 11, 2012, 04:03:07 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
movetype= H
Quote
[State 0, LifeAdd]
type = LifeAdd
trigger1 = time = 0
value = -gethitvar(damage)
This will make the character take the damage twice. Movetype=H already means the character will take the damage that caused this state change at the end of the tick.

Quote
[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 1131
time = 1
forceair = 0
;ignorehitpause =
;persistent =
umm, why? Can't you make it stateno=1130? Do you really need a different hit state for taking a hit right after another?

Other than these, I see no problem. Does your anim 1130 exist? Is it longer than 0 ticks?
Re: custom guard state
#17  July 13, 2012, 08:22:22 am
  • ***
sorry for late reply again. I have been too busy that there are times when I don't even open FF for 2 days lol

thanks for being patient with helping me

Quote
This will make the character take the damage twice. Movetype=H already means the character will take the damage that caused this state change at the end of the tick.
i did not know that. I used movetype = H even if it is a custom state because I thought its concept being a custom hit state means I should use H instead of I.

so I need to use movetype = I?

Quote
umm, why? Can't you make it stateno=1130? Do you really need a different hit state for taking a hit right after another?
won't it result in infinite loop if i keep getting hit consecutively ? I have never tried to make a state go to itself (even using other means)

and just asking, so is my custom hit states the reason why the guard state goes to transformed mode after guarding? or do i need to add a changestate for normal form (var(15) = 0 trigger)? because that is the original problem at the moment
Re: custom guard state
#18  July 13, 2012, 09:14:26 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
so I need to use movetype = I?
No, you use Movetype=H, and don't use the Lifeadd because H type already includes taking the damage. This holds true as long as the character remains in that state for the tick it has taken damage.
Quote
won't it result in infinite loop if i keep getting hit consecutively ?
No. Your state 1130 will be processed only once/tick even if you get hit many times. Hitoverride will only make you go to that state instead of the standard one, it won't cause the state to be processed out of normal processing order.

Quote
and just asking, so is my custom hit states the reason why the guard state goes to transformed mode after guarding? or do i need to add a changestate for normal form (var(15) = 0 trigger)? because that is the original problem at the moment
From what you posted, I see no problem. Maybe the problem was in state 1131, or maybe your anim 1130 doesn't exist or has a length of 0.
...I thought the original problem was getting hit but not going to state 1130?
Re: custom guard state
#19  July 13, 2012, 10:08:10 am
  • ***
Quote
No, you use Movetype=H, and don't use the Lifeadd because H type already includes taking the damage. This holds true as long as the character remains in that state for the tick it has taken damage.
oh, i forgot that the hitoverride is for the player. so just for example a helper has a hitoverride, it should have both movetype = H and negative lifeadd?

Quote
No. Your state 1130 will be processed only once/tick even if you get hit many times. Hitoverride will only make you go to that state instead of the standard one, it won't cause the state to be processed out of normal processing order.
ok.

Spoiler, click to toggle visibilty

my anim 1130 is 15 ticks. i never changed it since long ago.

so without the lifeadd, yeah the char still takes damage but uses the custom damage state (1130) and custom damage anim (1130)

the problem still exists

Quote
From what you posted, I see no problem. Maybe the problem was in state 1131, or maybe your anim 1130 doesn't exist or has a length of 0.
...I thought the original problem was getting hit but not going to state 1130?

the problems are these:
- in normal/base mode, my char already uses the animation of the transformed guard pose (instead of normal guard anim poses) and goes to transformed stance (state 1000) after guarding. it is also not hittable even by assertspecial unguardable. (guard anim has blue clsn)
- in transform mode, also not hittable by assertspecial unguardable attacks.
-it goes to transformed stance (state 1000) after guarding (this is not a problem)
Re: custom guard state
#20  July 13, 2012, 06:42:29 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
it should have both movetype = H and negative lifeadd?
I usually ignore life in case of helpers, and use a variable to count damage if it matters.

Quote
in normal/base mode, my char already uses the animation of the transformed guard pose (instead of normal guard anim poses) and goes to transformed stance (state 1000) after guarding
That sounds like you set your transformation variable when you aren't supposed to.

Quote
it is also not hittable even by assertspecial unguardable. (guard anim has blue clsn)
-Either a Nothitby controller at the wrong place or with too long duration
-Or the character's fall flag is set and you are using an attack that doesn't hit falling characters (you need to reset the fall flag if you use hitoverride, in the hit state)
-Or the attack you try to use is custom stated (those miss completely if there is a hitoverride, this is a known engine bug for hitdefs with P2stateno.)
Re: custom guard state
#21  July 14, 2012, 01:15:39 am
  • ***
Quote
I usually ignore life in case of helpers, and use a variable to count damage if it matters.
i meant varadd then value = -gethitvar(damage) for helper, not lifeadd sorry about that
do i also need to use movetype = I for helper damage states? I have coded it this way for another char, not sure how it exactly calculates the damage

Quote
That sounds like you set your transformation variable when you aren't supposed to.
i have these varset in my state -2

var(15) = 0 - human mode (states 0 - 999)
var(15) = 1 - semi bird mode (states 1000 - 1999)
var(15) = 2 - full bird mode (states 3000 and above)

[State 0, VarSet]
type = VarSet
trigger1 = var(15) != 0
trigger1 =  stateno != [1000,1999]
trigger1 =  stateno != [3000,3999]
trigger1 =  stateno != [120,159]
trigger1 =  stateno != [200,650]
v = 15
value = 0
;ignorehitpause =
;persistent =

[State 0, VarSet]
type = VarSet
trigger1 = var(15) != 1
trigger1 =  stateno = [1000,1999]
v = 15
value = 1
;ignorehitpause =
;persistent =

[State 0, VarSet]
type = VarSet
trigger1 = var(15) != 2
trigger1 =  stateno = [3000,3999]
v = 15
value = 2
;ignorehitpause =
;persistent =

anything wrong?

Quote
-Either a Nothitby controller at the wrong place or with too long duration
-Or the character's fall flag is set and you are using an attack that doesn't hit falling characters (you need to reset the fall flag if you use hitoverride, in the hit state)
-Or the attack you try to use is custom stated (those miss completely if there is a hitoverride, this is a known engine bug for hitdefs with P2stateno.)
it is a simple physical attack with simple hitdef, just added trigger = 1 unguardable

can you elaborate more about the fall flag? I am sure I did not changed/configured anything regarding any kind of hit flag or the like for this char in general.
Re: custom guard state
#22  July 14, 2012, 09:02:52 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
can you elaborate more about the fall flag? I am sure I did not changed/configured anything regarding any kind of hit flag or the like for this char in general.
If there is fall=1 on a hitdef, then your character will be "failling" until a Hitfallset is executed to indicate that the fall is over. Until that hitfallset, hitdefs without F in their hitflag will miss.

Quote
anything wrong?
You should set the variable when you transform, only once, and not based on state numbers all the time. There might be a state in the wrong state number range you don't expect or something like that. Oh, and -2 means it activates when being hit by custom stated attacks in those state number ranges, too.
Re: custom guard state
#23  July 14, 2012, 09:54:41 am
  • ***
Quote
If there is fall=1 on a hitdef, then your character will be "failling" until a Hitfallset is executed to indicate that the fall is over. Until that hitfallset, hitdefs without F in their hitflag will miss.
i checked the hitdef of unguardable attack. I don't have a hitflag. confirming it from docs,
mugen docs said:
If omitted, this defaults to "MAF".
so that means i have F in my hitflag

update:
Quote
the problems are these:
- in normal/base mode, my char already uses the animation of the transformed guard pose (instead of normal guard anim poses) and goes to transformed stance (state 1000) after guarding. it is also not hittable even by assertspecial unguardable. (guard anim has blue clsn)
- in transform mode, also not hittable by assertspecial unguardable attacks.
i have fixed the problem in bold. now i just need to fix the unhittable part, just partially.

more details:
so when i am transformed, i guard the attack, if I get hit while guarding, i take damage, but during damage state, i cannot take a damage again.

i have a moving (velset) tornado helper attack like this:


[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = unguardable

[State 0, HitDef]
type = HitDef
trigger1 = timemod = 5,0
attr = S, NA
animtype  = Light
damage    = 20
guardflag = NA
priority = 2, Hit
pausetime = 0,2
sparkno = -1
sparkxy = -10,65
hitsound   = 5,1
guardsound = 6,0
ground.type = High
ground.slidetime = 10
ground.hittime  = 11
ground.velocity = -5,-5
air.velocity = -5,-5
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
fall = 1

that damage the enemy around 200-300 normally, but it only damages the char by 20 if the char is in transformed guard.

so the issue is the hitoverride of 1130 that goes to 1130 also. my anim 1130 has blue clsn already
i know there is no error so far for it, but i am really not digging this idea of sending a char already in state to the same state when hit.

again this is my state 1130 as of now
Spoiler, click to toggle visibilty


Quote
You should set the variable when you transform, only once, and not based on state numbers all the time. There might be a state in the wrong state number range you don't expect or something like that. Oh, and -2 means it activates when being hit by custom stated attacks in those state number ranges, too.
ok i removed all 3 varsets in state -2

btw you did not reply to the helper life (hitoverride state varadd gethitvar damage method) I mentioned. was it correct ?

edit:
this changestate is the issue why I go back to state 50 after using guard in transformed form. idk why actually. i think i need to change the triggers

[State 0, ChangeState]
type = ChangeState
triggerall = var(15) = 1
trigger1 = p2movetype != A
trigger1 = Movetype != A
trigger1 = !inguarddist
trigger1 = command != "holdback"
value = 1000
ctrl = 1
;anim =
;ignorehitpause =
;persistent =

edit2:
I am really thinking this guard thingy is a bad idea. now when i am hit sometimes while transformed, i also go back to normal form. i can't figure out the specific situation when his happens.
Last Edit: July 14, 2012, 11:01:39 am by sgn15
Re: custom guard state
#24  July 14, 2012, 01:53:48 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
There is no hitflag in that hitdef, an invalid guardflag (N is not a valid letter there), and it does cause a fall.
I still suspect that the second hit is not working due to the fall flag, but that can be easily checked by adding the hitflag=MAF line.

Additionally, add a
Type=Hitfallset
Trigger1=1
value=0
into your state 1130 to reset the fall flag.

Quote
btw you did not reply to the helper life (hitoverride state varadd gethitvar damage method) I mentioned. was it correct ?
Yes. It doesn't matter what movetype the helper has, gethitvar works.

Quote
edit2:
I am really thinking this guard thingy is a bad idea. now when i am hit sometimes while transformed, i also go back to normal form. i can't figure out the specific situation when his happens.
You are probably still setting the variable when you don't need to somewhere.
Only put varsets for var(15) into the transformation state (the move that activates/deactivates the transformation) and nowhere else.
Last Edit: July 14, 2012, 02:05:43 pm by Seravy
Re: custom guard state
#25  July 14, 2012, 07:54:38 pm
  • ***
ugh, after countless editing of codes, now it gets worse than before. can i send you the char in pm but tell me the things i need to fix? there are just too many stuff I might have jumbled over and over to the point that it is not not guarding while in a transformed stand mode and gets stuck in guard while in transformed flying guard
Re: custom guard state
#26  July 14, 2012, 08:18:53 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Ok, send it it PM. I will mark everything that is wrong and add a comment explaining why.