YesNoOk
avatar

How do you Faultless Defense correctly? (Read 116578 times)

Started by JasonThePhoenix, November 01, 2023, 05:08:21 am
Share this topic:
Re: How do you Faultless Defense correctly?
#21  December 03, 2023, 08:43:32 pm
  • **
    • UK
It's built up; Step by step. Right now you have a good base to expand on.
Each extra attribute you want to add has to go where it's needed.
One tiny thing I thought up about the extra push back was Width.Follow that link to learn about how it works if you're unfamiliar. But basically, you could just increase your Width to push the character back just a tiny bit extra if the Variable is active.

Basically you need to write out a check list of all the attributes this system is going to need. You already have some of it made, so you'll be able to check those off. Then you can ask specific questions about each point.
The "How's it made" question isn't 1 answer. There's almost always 3 ways to do something in Mugen/Ikemen. And once you have a system that has 4 or 5 parts that means there's 12 to 15 different answers.

As to what you and SteelHammers have been talking about, it's usually a good idea to go to a 2nd state instead of looping right back into the same state. Looping right back into the same function(s) crashes a lot of programs in general. One thing to note, if you're playing Anim 1100 in state 1101 and make it enter state 1102. If you don't change the anim, anim 1100 will continue to play without skipping a beat. So the players will never notice anything changing. The 2nd state is also useful for setting stuff up. Like you know all the triggers for the changestate fired off to get there, so setting a var can be done at time = 0. That way there's NO WAY that var can be set in State 1101.

But back to the multiple answers thing. Since I'm imagining you're going to have the barrier be an explod on screen, you could make it a helper. Then the helper can use player push instead of P1 using Width. AND that means instead of using a variable to track certain things you could use the NumHelper to track it.

Right now, I'm not exactly sure what steps you've done and what step(s) you're trying to work on. Building an "invisible" step might come before a visible step is possible. Like you'd have to make step 6 first so that 3, 4, and 5 have the foundation to make 7 work with them.

Make a bullet point style list of all the steps for this, and under each bullet describe how you did it (if you have). We can give you the ideas and direction you need to keep going

I'm sorry but my most recent attempt didn't even slightly work. I'm back at step zero: Delete it all and start over.

;BARRIER
[Statedef 2000]
type    = S
movetype= I
physics = N
ctrl    = 0
velset  = 0,0
anim    = 2000
poweradd = 0
[State 2000, 2]
type    = ChangeState
trigger1 = time = 0
trigger2 = (command="holdback")&&(command="yz")
value   = 2001
[State 2000, 3]
type    = ChangeState
trigger1 = time = 0
value   = 2002

[Statedef 2001]
type     = A
movetype = I
ctrl     = 0
[State 2001, 3]
type    = ChangeState
trigger1 = time = 0
value   = 2002

[Statedef 2002]
type     = A
movetype = I
ctrl     = 0
[State 2002, 2]
type    = ChangeState
trigger1 = time = 0
value   = 2000

controls:

[State -1, Barrier]
type = ChangeState
value = 2000
trigger1 = (command="holdback")&&(command="yz")

I deleted from my character the code for this that didn't work. My character can block attacks normally but the Barrier Block input doesn't do anything because it points to a state that doesn't exist yet.
Last Edit: December 03, 2023, 08:51:22 pm by JasonThePhoenix
Re: How do you Faultless Defense correctly?
#22  December 08, 2023, 12:51:05 pm
  • **
    • UK
I was probably asking Mugen for too much when I listed everything the meter is supposed to do to my character. Is each step of that process really something then engine allows? Altering blockstun, altering chip damage, altering pushback on block, reducing an onscreen meter's fullness when Barrier Blocking is used, and making a character take more hitstun and blockstun if that Barrier Meter is empty or refilling when empty?

I was thinking the barrier variable could be programmed to go from 500 to 400. Then upon hitting 400 or less, the barrier variable becomes 0 and refills gradually towards 100. Upon hitting 100 the barrier variable becomes 500.

That way anything that costs Barrier Variable can check if you're over 400, so you can't use the meter if your meter is refilling, and meter only refills after "running out".

The barrier bar graphic could change colour and fullness depending on the Barrier Bar's variable.

I'm sorry for bothering you. I'd do this alone if I knew how.
Re: How do you Faultless Defense correctly?
#23  December 10, 2023, 06:51:49 am
  • *****
  • Shame on you!
    • USA
Altering blockstun
altering chip damage
altering pushback on block
reducing an onscreen meter's fullness when Barrier Blocking is used
making a character take more hitstun and blockstun if that Barrier Meter is empty
refilling when empty
Block stun I'm not 100% sure of for random vs. A full game it's doable for sure.
Chip damage yes
pushback on block, probably in random. full game is doable.
reduce meter yes
more hitstun blockstun if empty, more than likely/yes. full game is doable.
refilling when empty yes

The altering Block stun off the top of my head, I dont think there's a way to know exactly how many tics of the game any random attack is going to stun you for. P2 can send that info to P1 I believe. I've never made a system like this, but I'm pretty sure there's a tried and true method for a full game.

Chip Damage may already be coded for you in Tricks and Tips or Code Library. I would think to make maybe 2 variables to record health. Then compare those values during the hit stun. Then give P1 10% of that value back or whatever value you want.

Pushback on block you can probably accomplish pretty easy. You have to multiply the
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
In the guard states. I think State 151 - 153? I believe those will be the states. But yeah you can control the velocities
stand.friction=.85
crouch.friction=.85   ;Friction coefficient when crouching
in     [Movement]  at the top of your char. You _may_ be able to adjust that value in the middle of the matches. Then you'd be able to use your variable to make life easy.

Getting the on screen HUD to update has been done plenty of times. But it'll help out if you plan your variable's value ahead of time.

Making the character take more time in hitstun seems like it'll go in the 151 - 153 states. You can just delay the changestate with the value of your variable.

Spoiler: Random State 151 (click to see content)
So in this State 151 you can see the ctrlset and the changestate both have different triggers. If you decide to make your variable work for both of those triggers ahead of time, you can make things easier. You can't just use hitover + var(x). So you'll need a way to have a variable, or something, keep track of when hitover happens and then count down. 
One method that pops up into my head is to create a clear, see-thru, blank, animation. It'll have a couple of frames. Frame one will have a -1 for the time. This makes mugen not switch to frame two. But you can make it switch to frame 2 if the animation is over. Frame 2 can be any time you want. BUT if you want the delay to be a different value, you can set multiple frames at time = 1. So say you have 16 frames. frame 1 is -1 and then you'd have 15 tics. You could changeanim to frame 14 if you wanted 3 tics of delay or frame 2 if you wanted 15 tics of delay. Then once hitover AND the animation is over, That's your changestate.

Also I think HitVelSet doesn't work any longer.

Your idea of having the variable change is good. But you can always pick different numbers. You can use negative numbers also. So you could have the value only get VarAdd if the variable is less than 0.
You could use it at 3 spots, above 0, 0, and below 0. You could use it at above 1, 1, and below 1. The "center" value and the least and highest values wont matter to mugen. So pick 3 set of numbers you can adjust the other code with easier. If you know you'll always only need 4 tics of extra hitstun, Make frame 2 four tics long and check whatever value. If the hitstun needs to be a range, you could set up the variable to make the math easier for you. Having the variable work on 3 spots be on opposite sides of 1 particular number will make life easier for you. Above, At, Below. On, Waiting, Off. Active, Waiting, Refilling. However you want to think of it.

Look up how to get the bar on the screen if you haven't already. I think the method I know moves at times so dont listen to me on how to do it. :P
Once you get the bar on the screen, get it working in all 3 "positions" the way you expect it. Even if it's only based on a timer.
If you need help with the StateDef -2 stuff for it, just ask.
vVv Gouken718 vVv
Last Edit: December 10, 2023, 06:56:06 am by Odb718
Re: How do you Faultless Defense correctly?
#24  December 14, 2023, 02:19:12 am
  • **
    • UK
Altering blockstun
altering chip damage
altering pushback on block
reducing an onscreen meter's fullness when Barrier Blocking is used
making a character take more hitstun and blockstun if that Barrier Meter is empty
refilling when empty
Block stun I'm not 100% sure of for random vs. A full game it's doable for sure.
Chip damage yes
pushback on block, probably in random. full game is doable.
reduce meter yes
more hitstun blockstun if empty, more than likely/yes. full game is doable.
refilling when empty yes

The altering Block stun off the top of my head, I dont think there's a way to know exactly how many tics of the game any random attack is going to stun you for. P2 can send that info to P1 I believe. I've never made a system like this, but I'm pretty sure there's a tried and true method for a full game.

Chip Damage may already be coded for you in Tricks and Tips or Code Library. I would think to make maybe 2 variables to record health. Then compare those values during the hit stun. Then give P1 10% of that value back or whatever value you want.

Pushback on block you can probably accomplish pretty easy. You have to multiply the
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
In the guard states. I think State 151 - 153? I believe those will be the states. But yeah you can control the velocities
stand.friction=.85
crouch.friction=.85   ;Friction coefficient when crouching
in     [Movement]  at the top of your char. You _may_ be able to adjust that value in the middle of the matches. Then you'd be able to use your variable to make life easy.

Getting the on screen HUD to update has been done plenty of times. But it'll help out if you plan your variable's value ahead of time.

Making the character take more time in hitstun seems like it'll go in the 151 - 153 states. You can just delay the changestate with the value of your variable.

Spoiler: Random State 151 (click to see content)
So in this State 151 you can see the ctrlset and the changestate both have different triggers. If you decide to make your variable work for both of those triggers ahead of time, you can make things easier. You can't just use hitover + var(x). So you'll need a way to have a variable, or something, keep track of when hitover happens and then count down. 
One method that pops up into my head is to create a clear, see-thru, blank, animation. It'll have a couple of frames. Frame one will have a -1 for the time. This makes mugen not switch to frame two. But you can make it switch to frame 2 if the animation is over. Frame 2 can be any time you want. BUT if you want the delay to be a different value, you can set multiple frames at time = 1. So say you have 16 frames. frame 1 is -1 and then you'd have 15 tics. You could changeanim to frame 14 if you wanted 3 tics of delay or frame 2 if you wanted 15 tics of delay. Then once hitover AND the animation is over, That's your changestate.

Also I think HitVelSet doesn't work any longer.

Your idea of having the variable change is good. But you can always pick different numbers. You can use negative numbers also. So you could have the value only get VarAdd if the variable is less than 0.
You could use it at 3 spots, above 0, 0, and below 0. You could use it at above 1, 1, and below 1. The "center" value and the least and highest values wont matter to mugen. So pick 3 set of numbers you can adjust the other code with easier. If you know you'll always only need 4 tics of extra hitstun, Make frame 2 four tics long and check whatever value. If the hitstun needs to be a range, you could set up the variable to make the math easier for you. Having the variable work on 3 spots be on opposite sides of 1 particular number will make life easier for you. Above, At, Below. On, Waiting, Off. Active, Waiting, Refilling. However you want to think of it.

Look up how to get the bar on the screen if you haven't already. I think the method I know moves at times so dont listen to me on how to do it. :P
Once you get the bar on the screen, get it working in all 3 "positions" the way you expect it. Even if it's only based on a timer.
If you need help with the StateDef -2 stuff for it, just ask.

I searched both boards but didn't find anything useful on Chip Damage in the first linked board and anything on Chip Damage in the second board.

Also making a state for this isn't working.

I experimented with putting this in -2 (what if one of the triggers was being in the existing block state, and holding an input?) but that didn't work either.

[State -2, VelSet]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger1 = stateno != [120,155]
trigger1 = (command="holdback")&&(command="yz")
stand.friction = .15
crouch.friction = .12

This didn't work either.

[State -2, VelSet]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger1 = stateno != [120,155]
trigger1 = (command="holdback")
stand.friction = .15
crouch.friction = .12

Am I even pointing to the right states? This character is Kung Fu Man but edited (I haven't finished his original sprite work yet). Where are his blocking states? When I tried adding this garbage to them for testing purposes they didn't trigger.

[State 120, VelAdd]
type = VelAdd
trigger1 = Time = 1
x = 220
y = 333
ignorehitpause = 1
;persistent =

[State 155, VelAdd]
type = VelAdd
trigger1 = Time = 1
x = 220
y = 333
ignorehitpause = 1
;persistent =

[State 130, VelAdd]
type = VelAdd
trigger1 = Time = 1
x = 220
y = 333
ignorehitpause = 1
;persistent =

[State 131, VelAdd]
type = VelAdd
trigger1 = Time = 1
x = 220
y = 333
ignorehitpause = 1
;persistent =
Last Edit: December 14, 2023, 02:30:57 am by JasonThePhoenix
Re: How do you Faultless Defense correctly?
#25  December 14, 2023, 04:21:36 pm
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
Neither stand.friction nor crouch.friction are valid VelSet parameters. Your triggers are checking if you're not in a guard state.

KFM uses the common guard states, so you'll have to copy them over from common1.cns and modify them.

Oh, I want a diagram. I fucking love diagrams.
Re: How do you Faultless Defense correctly?
#26  December 16, 2023, 10:17:48 pm
  • **
    • UK
Neither stand.friction nor crouch.friction are valid VelSet parameters. Your triggers are checking if you're not in a guard state.

KFM uses the common guard states, so you'll have to copy them over from common1.cns and modify them.

I see. What's the correct way to adjust the distance you are pushed back when blocking, and the blockstun taken when blocking, if the Faultless Defense input is correct and Variable 12 is over 0 and below 100?

Also I found the common1.cns code.
Spoiler, click to toggle visibilty

Looking at this, I had an idea. Is it possible to multiply my current velocity at the moment my character blocks an attack, if I am inputting Barrier Block? That should push me further back though it might not push my foe back.

For the other stuff is there a way other copies of my character, and characters programmed to interact with this system, can check whether my character is using Barrier Block or not with a variable and change the chip damage, pushback, blockstun and other aspects of their own attacks?

Also, you reduce BlockStun taken when Parrying attacks in Street Fighter 3, right? How did they pull this off?
Last Edit: December 17, 2023, 10:31:39 pm by Odb718
Re: How do you Faultless Defense correctly?
#27  December 16, 2023, 11:26:31 pm
  • **
    • UK
UPDATE: nope

[State -2, VelMul]
type = VelMul
trigger1 = Time = GetHitVar(slidetime)
trigger1 = stateno = [120,155]
trigger1 = command="holdback" && command="yz"
x = 2
ignorehitpause = 1
;persistent =
Re: How do you Faultless Defense correctly?
#28  December 18, 2023, 12:29:19 am
  • **
I see. What's the correct way to adjust the distance you are pushed back when blocking, and the blockstun taken when blocking, if the Faultless Defense input is correct and Variable 12 is over 0 and below 100?

Is it possible to multiply my current velocity at the moment my character blocks an attack, if I am inputting Barrier Block? That should push me further back though it might not push my foe back.

One way you can push the enemy back is with a helper outside of corners and use velset/add for cornerpush.  Probably the best velocity for barrier is to use gethitvar(xvel).  That way p2's hard hitting moves should pushed them back further.

Quote
For the other stuff is there a way other copies of my character, and characters programmed to interact with this system, can check whether my character is using Barrier Block or not with a variable and change the chip damage, pushback, blockstun and other aspects of their own attacks?
Not necessary.  If you modify the guard states directly then any chip damage would also be negated by barrier. Although Barrier will eat unblockables like ryu's denji hadouken so you'll have to code around it if you don't want it to happen.

Quote
Also, you reduce BlockStun taken when Parrying attacks in Street Fighter 3, right? How did they pull this off?
Parry uses the pause sctrl to extend p2's blockstun, not the other way around. 

I think the GG and Blazblue characters has this system so why not look into how the authors code it instead of going in blind?





Re: How do you Faultless Defense correctly?
#29  December 18, 2023, 05:15:18 am
  • *****
  • Shame on you!
    • USA
Code:
[State 153, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
 
[State 153, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

So the variable(s) you'll set up can be used in these two chunks I believe.
x=1
can become something like
x=1+1*var(718)
This way when the var = 0 it'll be 1+0.
The
GetHitVar(slidetime)
Should/could be set up in a variable. Use display to clipboard to post that value and watch it. Now. Do testing now to see it's value and learn how it's posting it's value.
It's either going to count up or down. idk. but watch it.
If it's counting up, just add to it and make a variable increase 1 every tic. Once they equal eachother, the deed is done.
If it's counting down, you can make a var ONLY subtract the 4 tics or 13 tics, or how ever long extra you want FROM 1.
Then you have another VarAdd ONLY ADDING 1 IF the var is less than, but not equal, to 0.
If you subtract from 1 it wont be 0. once it adds up to 0 then the deed is done.
vVv Gouken718 vVv
Re: How do you Faultless Defense correctly?
#30  December 22, 2023, 07:04:11 am
  • **
    • UK
I'm sorry, I don't understand. Is the Faultless Defense input going to signal to the other character to load different stats for each attack's stats? How will the visual of "Performing Faultless Defense" work, especially the visual for when you are attacked in the FD state?
Re: How do you Faultless Defense correctly?
#31  December 24, 2023, 06:38:39 pm
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
Unless this is an enclosed environment, there isn't going to be a single character out there that will know to alter their HitDefs against your character's FD. As Odb said, you should focus on getting one aspect working at a time, especially since you're new to this.

The only way to avoid taking damage is to not be the one taking the hit, like letting a Helper HitOverride the hit and passing gethit information down to the root, but that's convoluted. From what I understand, FD is its own state independent from guarding (like UNI's Shield), so first set a new state up alongside the relevant ChangeState in -1, triggered by the command you want (back + two buttons) alongside any other conditions; once you've ensured that works, you can start building the state up.

The simplest way I can immediately think of is for the root to execute a HitOverride in that FD state you created, which then sends the character to a new state wherein you use gethitvars to mimic an actual hitstate, but with modified values to suit how you want FD to work. Once the hit is over (let's say time >= (gethitvar(hittime)/2) to give an example of halved hitstun), you return to the FD state.

Negating damage is the tricky part, as you'll have to use the noko AssertSpecial flag to prevent yourself from dying and use a LifeAdd with gethitvar(damage) to regen the lost health.

The main problem with all of this, however, is you'll be working with the hit properties, not the guard ones. Not a lot you can do about that one, since the engine is hardcoded to only use those when an attack is guarded.

Oh, I want a diagram. I fucking love diagrams.
Re: How do you Faultless Defense correctly?
#32  December 24, 2023, 08:26:49 pm
  • *****
  • Shame on you!
    • USA
I've never really used
[State 0, DefenceMulSet]
type = DefenceMulSet
;trigger1 =
;value = 1
;ignorehitpause = 1
;persistent =

But I imagine it could work for blocking. Put this in your blocking states with the triggers watching your variables n such.
 
How will the visual of "Performing Faultless Defense" work, especially the visual for when you are attacked in the FD state?
The visuals will look how you want as long as you have the sprites for them. You can have your helper, or statedef -2, use explods.

What I would suggest is making your Standing Light Punch do like 400 damage on hit, and 150 damage on block. Then you have a super easy way to test if the damage dampener is working. Once everything works like normal, put the SLP's hitdef back to normal.

You can do the visuals before or after or during the underlying code. I'd personally do it after. (You'll get more satisfaction that it's complete)

What have you tried getting working so far?
vVv Gouken718 vVv
Re: How do you Faultless Defense correctly?
#33  December 27, 2023, 01:26:29 am
  • **
    • UK
I've never really used
[State 0, DefenceMulSet]
type = DefenceMulSet
;trigger1 =
;value = 1
;ignorehitpause = 1
;persistent =

But I imagine it could work for blocking. Put this in your blocking states with the triggers watching your variables n such.
 
How will the visual of "Performing Faultless Defense" work, especially the visual for when you are attacked in the FD state?
The visuals will look how you want as long as you have the sprites for them. You can have your helper, or statedef -2, use explods.

What I would suggest is making your Standing Light Punch do like 400 damage on hit, and 150 damage on block. Then you have a super easy way to test if the damage dampener is working. Once everything works like normal, put the SLP's hitdef back to normal.

You can do the visuals before or after or during the underlying code. I'd personally do it after. (You'll get more satisfaction that it's complete)

What have you tried getting working so far?

This caused me to die instantly. I blocked one attack, took the usual chip damage, blocked a second attack, and died from huge chip damage. Upon checking the attack that killed me, it had normal chip damage. I tested this with other moves and the second blocked attack always kills me no matter what attack it is.

[State -2, DefenceMulSet]
type = DefenceMulSet
trigger1 = command = "holdback"
value = 900
ignorehitpause = 1
;persistent =

Switching it to state -3 didn't help either.
Re: How do you Faultless Defense correctly?
#34  December 27, 2023, 11:10:53 am
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
Right so DefenceMulSet is a multiplier for the damage taken, not for your Defence value. Dunno why Elecbyte decided to go with that, but hey.
What your code is doing then is multiplying the damage taken by 900, not setting your Defence to 900. The reason it only kicks in starting from the second hit is because that's simply how the sctrl works, which sorta makes it useless.

Oh, I want a diagram. I fucking love diagrams.
Re: How do you Faultless Defense correctly?
#35  December 28, 2023, 09:17:20 am
  • **
    • UK
Alright, creating a new set of Special Blocking states for this system seems to be working. But the blockstun manipulation, and alteration of the attacker and defender's pushback, how do you pull that off?
Re: How do you Faultless Defense correctly?
#36  December 29, 2023, 12:13:06 am
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
Refer back to this post. You can't manipulate the attacker's pushback but you can modify your own by referencing gethitvar(xvel) as part of a VelSet.

Oh, I want a diagram. I fucking love diagrams.