YesNoOk
avatar

Street Fighter 4 Focus Attack / Saving Attack (Read 17722 times)

Started by Rolento, January 28, 2010, 12:47:18 am
Share this topic:
Street Fighter 4 Focus Attack / Saving Attack
#1  January 28, 2010, 12:47:18 am
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
Gentlemen, I have worked out the code necessary to recreate SF4's novelty feature, the focus attack. Sadly, the amusement gotten from this is somewhat short lived, as it dawned on me shortly afterward that I have no real practical use for this snippet of code myself. To justify the time I wasted in making this code, I am going to post it here with the detailed notes I made to clear up what does exactly what. Let us begin.

What this code does
This code lets you recreate the Focus Attack/Saving Strike command move from the Street Fighter 4 series. For those unfamiliar with what a focus attack is, it's a command move you charge up by holding both mid attack buttons, with the resulting attack doing more damage on higher levels and even becoming unblockable at max power. You can also cancel out of the attack by dashing backwards or forwards.
When charging, your character can absorb 1 non-throw hit without being knocked out of the move. As long as you don't get hit again after either finishing the attack or dash canceling, you can actually slowly regain the health lost from the one allowed hit. If you hit again while still charging though, there is no change to gain back health at all though.
The code itself is broken up into 3 main states for p1: 2 charging states for before and after getting hit once, and the last state for the actual attack portion. There are also portions that need to be placed within the negative states
For p2, there is the one custom crumple state that they are forced into if they get hit with a max power focus attack. As there's no standard collapse animation, it just makes use of standing and crouching gethit frames before going into liedown and returning control to p2.

List of Vars used in example
var(20): Reserved for Focus Attack part A  (Keeps track of single hit)
var(21): Reserved for Focus Attack part B (Lost life from hit)
var(22): Reserved for Focus Attack part C (Keeps track of animelem for charge anim)
fvar(9): Used for Focus Attack charge value

Remember that if you change the var numbers in your own case, be sure that you make those changes in all instances of that var.

Command entries used (aka put these in the command file in the appropriate places.)
[Command]
name = "hold-b"
command = /$b
time = 1

[Command]
name = "hold-y"
command = /$y
time = 1

;Focus strike
[State -1, focus]
type = ChangeState
value = 900
trigger1 = command = "y" && command = "b" && statetype = S && ctrl

Animation Entries used
Note: These entries are just the examples I used. You can easily change these to suit your needs, although you'll need to adjust the statedef -3 stuff for animelem recording if you add extra frames.

;Focus attack charge
[Begin Action 900]
Clsn2Default: 2
  Clsn2[0] = -12, -110, 11, -82
  Clsn2[1] = -22, -89, 24, 1
900,0, 0,0, 10
900,1, 0,0, 18
900,2, 0,0, -1

;Focus Attack itself
[Begin Action 901]
Clsn2: 2
  Clsn2[0] = -17, -91, 21, 2
  Clsn2[1] = -12, -110, 11, -87
900,3, 0,0, 3
Clsn2: 2
  Clsn2[0] = -19, -87, 24, -21
  Clsn2[1] = -12, -109, 11, -86
900,4, 0,0, 4
Clsn2: 2
  Clsn2[0] = -17, -95, 28, -28
  Clsn2[1] = -14, -115, 9, -92
900,5, 0,-6, 3
Clsn2: 2
  Clsn2[0] = -6, -75, 42, -22
  Clsn2[1] = -17, -117, 27, -71
900,6, 0,-10, 3
Clsn1: 1
  Clsn1[0] = 13, -77, 80, -38
Clsn2: 2
  Clsn2[0] = -18, -120, 38, -66
  Clsn2[1] = -5, -78, 80, -29
900,7, 0,-12, 5
Clsn2: 2
  Clsn2[0] = -15, -116, 12, -89
  Clsn2[1] = -23, -92, 26, -27
900,8, 0,-8, 4
Clsn2: 2
  Clsn2[0] = -23, -86, 20, -22
  Clsn2[1] = -13, -112, 13, -82
900,9, 0,-4, 6

;Focus Attack p2 crumple
[Begin Action 902]
Clsn2Default: 1
  Clsn2[0] = -26, -95, 20, 1
5000,20, 2,0, 2
5000,20, 0,0, 2
5000,20, 2,0, 2
5000,20, 0,0, 2
5000,20, 2,0, 2
5000,20, 2,0, 12
5010,20, 0,0, 16
5020,20, 0,0, 18

The Main Code Itself

Regular states:
;-------------------------------------------
;Focus Strike - charge state 1
;This state covers the charging aspect of the Focus Strike attack at the start.
[Statedef 900]
type = S
movetype = I
physics = S
juggle = 10
anim = 900
ctrl = 0
poweradd = 0
velset = 0,0

; These next two sctrls cover initial charge value and building it up
[State 900, starting value]
type = VarSet
trigger1 = time = 1 && var(20)
fvar(9) = 0

[State 900, adding to value]
type = VarAdd
trigger1 = time >= 1
fv = 9
value = 1
persistent = 1

; This PalFX sctrl emulates the temporary darkening of the character while charging near the start
[state 901, dark flash]
type = PalFx
trigger1 = time = 10
add = 0,0,0
sinadd = -100,-100,-100,40
time = 16

; These change states control dash cancels and moving into the attack portion
[State 900, dash cancel back]
type = ChangeState
trigger1 = time >= 8 && command = "BB"
value = 105

[State 900, dash cancel forward]
type = ChangeState
trigger1 = time >= 8 && command = "FF"
value = 100

[State 900, stopping early]
type = ChangeState
trigger1 = time >= 8 && command != "hold-b" && command !="hold-y"
value = 902

[State 900, fully charged]
type = ChangeState
trigger1 = fvar(9)>=60
value = 902

;---------------------------------------------
;Focus Strike - charge state 2
;This state covers the charging aspect of the Focus Strike attack if hit
[Statedef 901]
type = S
movetype = I
physics = S
juggle = 10
ctrl = 0
poweradd = 0
velset = 0,0

; This part covers the after effects of getting hit from earlier.
[state 901, no more saving hit]
type = varset
trigger1 = time = 1
var(20) = 0

[state 901, white flash]
type = PalFx
trigger1 = time = 1
sinadd = 128,128,128,16
time = 8

[State 901, life removal]
type = LifeAdd
trigger1 = time = 1 && !var(20)
value = -(gethitvar(damage))
kill = 1

; This ctrl changes the animframe back to the last active one
[State 901, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 900
elem = var(22)

; This varset is the continuation of charging
[State 901, adding to charge]
type = VarAdd
trigger1 = time >= 1
fv = 9
value = 1
persistent = 1

; These change states control dash cancels and moving into the attack portion
[State 901, dash cancel]
type = ChangeState
trigger1 = time >= 8 && command = "BB"
value = 105

[State 901, dash cancel forward]
type = ChangeState
trigger1 = time >= 8 && command = "FF"
value = 100

[State 901, early release]
type = ChangeState
trigger1 = time >= 8 && command != "hold-b" && command !="hold-y"
value = 902

[State 901, fully charged]
type = ChangeState
trigger1 = fvar(9)>=60
value = 902

;----------------------------------------
;Focus Attack - actual attack
[Statedef 902]
type = S
movetype = A
physics = S
juggle = 10
anim = 901
ctrl = 0
velset = 0,0

;PalFX sctrls; the first removes any earlier stuff, and the second the white flash
;that appears if you have maxed out focus
[state 901, cancel earlier fx flash]
type = PalFx
trigger1 = time = 0
add = 0,0,0
time = 0

[state 901, bright flash if maxed out]
type = PalFx
triggerall =FVar(9) = 60
trigger1 = time = 1
add = 128,128,128
sinadd = -128,-128,-128,32
time = 8

; The hitdef used depends on the how long you've been charging.
; In case you are wondering why there are 2 versions of each lvl's
; hitdef, the second one has been refined to compensate for hitting
; air opponents.
;lvl 1
[State 902, 0-30]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 3 && (FVar(9) = [0,29])
attr = S, NA
damage= 40,0
animtype = Hard
guardflag = M
hitflag = M
priority = 4, Hit
pausetime = 9, 9
sparkno = 1
sparkxy = -5, -58
hitsound = 5,6
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -8.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

[State 902, 0-30]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
triggerall = p2statetype = A
trigger1 = AnimElem = 2 && (FVar(9) = [0,29])
attr = S, NA
damage= 40,0
animtype = Hard
guardflag = A
hitflag = A
priority = 4, Hit
pausetime = 9, 9
sparkno = 1
sparkxy = -5, -58
hitsound = s400,1
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -6.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

; Counter version of lvl 1: If you counterhit when at this early stage, crumple is possible it seems.
[State 902, 0-30 counter ver]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 2 && (FVar(9) = [0,29])
trigger1 = p2movetype = A && p2statetype !=A
attr = S, NA
damage= 40,0
animtype = Hard
guardflag = M
hitflag = M
priority = 6, Hit
pausetime = 9, 9
sparkno = 1
sparkxy = -5, -58
hitsound = s400,3
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -6.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 1503 ;<-- This is the p2 crumple state

;lvl 2
[State 902, 31-59]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 3 && (FVar(9) = [31,59])
attr = S, NA
damage= 60,0
animtype = Hard
guardflag = M
hitflag = M
priority = 4, Hit
pausetime = 11, 11
sparkno = 1
sparkxy = -5, -58
hitsound = 5,7
guardsound = 6, 0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 16
ground.velocity = -8.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 1503 ;<-- This is the p2 crumple state

[State 902, 31-59 b]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
triggerall = p2statetype = A
trigger1 = AnimElem = 2 && (FVar(9) = [30,59])
attr = S, NA
damage= 60,0
animtype = Hard
guardflag = A
hitflag = A
priority = 5, Hit
pausetime = 11, 11
sparkno = 1
sparkxy = -5, -58
hitsound = s400,2
guardsound = 6, 0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 16
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

[State 902, 31-59 counter]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = p2movetype = A && p2statetype !=A
trigger1 = AnimElem = 2 && (FVar(9) = [30,59])
attr = S, NA
damage= 60,0
animtype = Hard
hitflag = M
priority = 5, Hit
pausetime = 11, 11
sparkno = 1
sparkxy = -5, -58
hitsound = s400,2
guardsound = 6, 0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 16
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 1503 ;<-- This is the p2 crumple state

;lvl 3 MAX
[State 902, max-charge]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 3 && FVar(9) = 60
attr = S, NA
damage= 85,0
animtype = Hard
;guardflag = MA ;<-- Commented out as you will not be blocking this. This will hurt, and you will fall!
hitflag = MAF
priority = 4, Hit
pausetime = 14, 14
sparkno = 1
sparkxy = -5, -58
hitsound = 5,8
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 903 ;<-- This is the p2 crumple state

[State 902, max-charge]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
triggerall = p2statetype = A
trigger1 = AnimElem = 2 && FVar(9) = 60
attr = S, NA
damage= 85,0
animtype = Hard
hitflag = A
priority = 6, Hit
pausetime = 14, 14
sparkno = 1
sparkxy = -5, -58
hitsound = s400,3
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

[State 902, fvar reset]
type = VarSet
trigger1 = !AnimTime
fvar(9) = 0

;Dash Cancels upon movecontact
[State 902, dash cancel]
type = ChangeState
trigger1 = Movecontact && command = "FF"
value = 100

[State 902, dash cancel]
type = ChangeState
trigger1 = Movecontact && command = "BB"
value = 105

[State 902, end]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;----------------------------------------
;Focus Attack - p2 crumple state
[Statedef 903]
type = S
movetype = H
physics = N
ctrl = 0
velset = 0,0

;Fixes the y pos just in case.
[State 903, PosSet]
type = PosSet
trigger1 = 1
y = 0

[State 903, Change to custom crumple anim]
type = ChangeAnim2
trigger1 = time = 1
value = 902

[State 903, Hitoverride if hit by non-fall move]
type = HitOverride
trigger1 = stateno = 903
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 5020
time = 1
forceair = 1

[State 903, Return to their own states]
type = SelfState
trigger1 = anim = 1502 && !animtime
value = 5110
ctrl = 1


Negative States:
Statedef -2 stuff
; Focus attack / Saving Strike code (Part A)
;The later half of this negative coding can be found under statedef -3
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[900,901]) && ((stateno=[5000,5099]) && prevstateno != 900)
trigger2 = stateno = [100,105]
fv = 9
value = 0

[State -2, life return removed if hit while refilling]
type = VarSet
trigger1 = var(21) && stateno !=901 && movetype = H
var(21) = 0

[State -2, Life return if left alone]
type = LifeAdd
trigger1 = (stateno != [901,902]) && var(21) && (Gametime%6)=1
value = 1
absolute = 0

[State -2, life return if left alone]
type = VarAdd
trigger1 = (stateno != [901,902]) && var(21) && (Gametime%6)=1
v = 21
value = -1

Statedef -3 stuff

; Focus attack / Saving Strike code (Part B)
;-----------------------------
[state -3, animelem set frame 1]
type = varset
trigger1 = stateno = 900 && time = 1
var(22) = 1

[state -3, animelem set frame 2]
type = varset
trigger1 = stateno = 900 && animelem = 2
var(22) = 2

[state -3, animelem set frame 3]
type = varset
trigger1 = stateno = 900 && animelem = 3
var(22) = 3

[State -3, Change to second state]
type = HitOverride
trigger1 = stateno = 900
attr = SCA,NA,SA,HA,NP,SP,HP
slot = 0
stateno = 901
time = 1
forceair = 0
ignorehitpause = 1
persistent = 1

[state -3, varset for first state]
type = varset
trigger1 = stateno = 900
var(20) = 1

[state -3, varset for second state]
type = varset
trigger1 = stateno = 901
var(20) = 0

[state -3, lost health tally in second state]
type = varset
trigger1 = stateno = 901 && time = 0
var(21) = (gethitvar(damage))

[State -3, health removal in second state]
type = LifeAdd
trigger1 = stateno = 901
value = -(gethitvar(damage))
kill = 1

Altered Run Code (Now Dash Forward):

; Dash forward
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1

And that's all she wrote when it comes to the Focus attack barring any typos I missed. Tune in next time as I talk about a quick and dirty way of tackling the SF4 Ultra bar; not because I have any use for it, but because the one example I have seen uses an absurd 70+ animations to pull off the green alone when you could really do the same in 3 animations or so with the right code. That is absurd! If you can make use of the code, just remember to toss in a credit somewhere. If you really appreciate it, please feel free to visit the link in my signature and visit the paypal donate page. Hah! (Seriously though, if you can spare a bit, it would be appreciated.)

Well, that ultra bar code won't write itself; good .\/. to you all and catch you later.

[Edit] Most recent edit has revised and additional hitdefs in the final state to better emulate the behaviour when the attack hits an airborne enemy.
Last Edit: February 04, 2010, 05:25:57 pm by Rolento

GT

Re: Street Fighter 4 Focus Attack / Saving Attack
#2  January 28, 2010, 02:16:43 am
  • *****
    • USA
    • Skype - gt_ruby
This is much appreciated Rolento. :)
Yeah Titiln, in fact, You Made Him
Re: Street Fighter 4 Focus Attack / Saving Attack
#3  January 28, 2010, 02:26:40 am
  • ***
  • 我が名は 「ハクメン」、押して参る!
I've also developed my own focus attack codes, it's shorter but it works fine. But this one looks much more consistent, so I might borrow bits and pieces of the code to fine tune my own, thanks :sugoi:
Re: Street Fighter 4 Focus Attack / Saving Attack
#4  January 29, 2010, 02:16:10 am
  • ***
  • It's over! We won!
    • SITE BANNED
thanks, maybe rei will remake his sf4 chars based on this code


someone should email him, I would but I don't know his email
SITE BANNED DUE TO ADFLY USE
Re: Street Fighter 4 Focus Attack / Saving Attack
#5  February 04, 2010, 12:14:47 am
  • ****
  • Now your gonna feel my hooks! OH YEAH!!
Wow, Thanks!! I'll try this when I get home. I didn't implement it because I got stuck trying to figure out which state to put P2 in his crumple state and make him juggleable/hittable for a few frames.
Re: Street Fighter 4 Focus Attack / Saving Attack
#6  February 04, 2010, 10:49:19 am
  • ****
    • UK
    • www.nnaajjmugen.tumblr.com/
Thank you very much Rolento. I tried this code in my character and it works superb!
Kinda strange but I woke up today and her hand was on my ass cheek
I won't suspect anything though I'll take it she was sleeping and didn't notice
you should have flipped over slowly
Re: Street Fighter 4 Focus Attack / Saving Attack
#7  February 04, 2010, 05:27:50 pm
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
Replying just to ensure that those who already installed this code earlier take notice that the hitdefs within the attack state have been updated to fix some problematic behavior.
Re: Street Fighter 4 Focus Attack / Saving Attack
#8  February 04, 2010, 05:55:34 pm
  • avatar
  • ******
    • USA
this is a keeper. thanks dude.
Re: Street Fighter 4 Focus Attack / Saving Attack
#9  February 16, 2010, 05:39:57 am
  • avatar
very nice, as is your sf4kfm in general
I was wondering if you could explain how to just get just the super armor part of the focus attack from this code, so it could be added to other moves.  As you probably know many characters have ex moves in sf4 that have the focus style super armor but not the crumple, charge etc.  Thank you in advance.
Re: Street Fighter 4 Focus Attack / Saving Attack
#10  February 16, 2010, 08:02:26 pm
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
From the sounds of it, most of what you need refers to the hitoverride sctrl and related aspects under statedef -3. That's responsible for redirecting the character into the secondary state rather than a gethit state. You'll likely want to find an alternate solution to the current var usage to keep track of animelem number, since the current code example is really only ideal for an animation that doesn't make use of a lot of frames.
Re: Street Fighter 4 Focus Attack / Saving Attack
#11  February 25, 2010, 08:50:04 pm
  • ****
  • son of sparda
    • nmowner.webs.com/
nMo new generation of mugen exposure
Re: Street Fighter 4 Focus Attack / Saving Attack
#12  March 06, 2010, 05:51:35 pm
  • ****
  • son of sparda
    • nmowner.webs.com/
I have found a problem with the coding. i need help. what seems to happen is when gouken dash cancels the max attack seems to be stored or better described as stocked away. then when you go for another charge he does full fucus attac instantly.

i have delayed goukens release until i can fix of get help on it.
nMo new generation of mugen exposure
Re: Street Fighter 4 Focus Attack / Saving Attack
#13  March 06, 2010, 06:41:23 pm
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
I did put a varset in statedef -2 that should reset the charging value if you cancel into any of the dashing states, which are usually states 100 and 105. Perhaps you are using a non standard value?
Re: Street Fighter 4 Focus Attack / Saving Attack
#14  March 07, 2010, 03:28:15 am
  • ****
  • son of sparda
    • nmowner.webs.com/
I did put a varset in statedef -2 that should reset the charging value if you cancel into any of the dashing states, which are usually states 100 and 105. Perhaps you are using a non standard value?

thanks for the responce. i will try to look in the -2 . im delaying gouken to i get this fied. rolento you did great work.
i am using state 100 and 105.
nMo new generation of mugen exposure
Last Edit: March 07, 2010, 09:50:08 am by alexlexus
Re: Street Fighter 4 Focus Attack / Saving Attack
#15  March 07, 2010, 04:08:42 pm
  • ***
  • WHAT AM I FIGHTING FOR?!
    • USA
Does it work for both WinMUGEN and MUGEN 1.0?
Current Status: N/A
Re: Street Fighter 4 Focus Attack / Saving Attack
#16  March 07, 2010, 05:40:35 pm
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
After a quick check, I'm pretty sure it is; doesn't look like I threw in any 1.0 specific sctrls or triggers.
Re: Street Fighter 4 Focus Attack / Saving Attack
#17  March 07, 2010, 07:30:13 pm
  • ****
  • son of sparda
    • nmowner.webs.com/
; Focus attack / Saving Strike code (Part A)
;The later half of this negative coding can be found under statedef -3
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[900,901]) && ((stateno=[5000,5099]) && prevstateno != 900)
trigger2 = stateno = [100,105]
fv = 9
value = 10

[State -2, life return removed if hit while refilling]
type = VarSet
trigger1 = var(21) && stateno !=901 && movetype = H
var(21) = 0

[State -2, Life return if left alone]
type = LifeAdd
trigger1 = (stateno != [901,902]) && var(21) && (Gametime%6)=1
value = 1
absolute = 0

[State -2, life return if left alone]
type = VarAdd
trigger1 = (stateno != [901,902]) && var(21) && (Gametime%6)=1
v = 21
value = -1

[State 0, PlaySnd];voice
type = PlaySnd
trigger1 = time= 1
value = 5000,0
volume = 225
channel = 2
;lowpriority = -1
freqmul = 1.0
loop = 0
pan = 0
;abspan =
;ignorehitpause =
;persistent =


[State 0, PlaySnd]; effect
type = PlaySnd
trigger1 = time= 1
value = 11000,5
volume = 225
channel = 1
;lowpriority = -1
freqmul = 1.0
loop = 0
pan = 0
;abspan =
;ignorehitpause =
;persistent =



i did the tut just like you said. would you mind taking a look at gouken? maybe its something else im not seeing,
nMo new generation of mugen exposure
Re: Street Fighter 4 Focus Attack / Saving Attack
#18  March 07, 2010, 08:10:34 pm
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
Alexlexus: No, by your own example there you are showing that you changed the value.

Code:
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[900,901]) && ((stateno=[5000,5099]) && prevstateno != 900)
trigger2 = stateno = [100,105]
fv = 9
value = 0 ;<---  what I wrote up there.

What you have:
Code:
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[900,901]) && ((stateno=[5000,5099]) && prevstateno != 900)
trigger2 = stateno = [100,105]
fv = 9
value = 10<-- Set this to zero.

Give that a whirl.
Re: Street Fighter 4 Focus Attack / Saving Attack
#19  March 07, 2010, 09:07:42 pm
  • ****
  • son of sparda
    • nmowner.webs.com/
nMo new generation of mugen exposure
Re: Street Fighter 4 Focus Attack / Saving Attack
#20  March 07, 2010, 10:28:14 pm
  • avatar
  • ****
  • Ya me dio cosa...
    • Mexico
Hum... remember me attacks from slugwanzer...
good tutorial
Re: Street Fighter 4 Focus Attack / Saving Attack
#21  March 07, 2010, 11:12:44 pm
  • ****
  • son of sparda
    • nmowner.webs.com/
Alexlexus: No, by your own example there you are showing that you changed the value.

Code:
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[900,901]) && ((stateno=[5000,5099]) && prevstateno != 900)
trigger2 = stateno = [100,105]
fv = 9
value = 0 ;<---  what I wrote up there.

What you have:
Code:
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[900,901]) && ((stateno=[5000,5099]) && prevstateno != 900)
trigger2 = stateno = [100,105]
fv = 9
value = 10<-- Set this to zero.

Give that a whirl.

i made it a zero and he doesnt do it as much but at times it still flips out a level 3 kick.
nMo new generation of mugen exposure
Re: Street Fighter 4 Focus Attack / Saving Attack
#22  March 08, 2010, 03:39:01 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Then you haven't done everything right, and are possibly initialising that variable back to 10 or whatever at a specific point. Of course, he SHOULD do a level 3 kick if you charge it to level 3 kick.

I trust your variable isn't already in use...


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: Street Fighter 4 Focus Attack / Saving Attack
#23  March 08, 2010, 03:59:03 am
  • ****
  • son of sparda
    • nmowner.webs.com/
Working 100% turns out gouken didnt have a statedef -3
so i had to make it in my character and then place the -2 in stuff in the place in my extra.cns.


no it's perfect and resets. thanks rolento.

nMo new generation of mugen exposure

vyn

Re: Street Fighter 4 Focus Attack / Saving Attack
#24  March 11, 2010, 08:32:51 pm
  • ****
    • Mexico
    • armandojc3@gmail.com
These two are awesome codings, did u ever try a kofxii counter code???
Re: Street Fighter 4 Focus Attack / Saving Attack
#25  March 11, 2010, 09:12:45 pm
  • ***
  • Figuring things out, one sprite at a time.
    • irwt.iammanyninjas.com
Vyn: Don't even have KOF XII, so I am not too familiar with how the mechanic works.

vyn

Re: Street Fighter 4 Focus Attack / Saving Attack
#26  March 12, 2010, 12:45:48 am
  • ****
    • Mexico
    • armandojc3@gmail.com
aww well what to do right?? maybe if kof xiii ever comes out
Re: Street Fighter 4 Focus Attack / Saving Attack
#27  March 25, 2010, 04:35:11 pm
  • ****
  • son of sparda
    • nmowner.webs.com/
vyn im adding this code to your ryu evilxryu. your focus for terry was on point i must add. but yeah ryulento all my other sf characters will have this. im redoing ryu and ken with this.
nMo new generation of mugen exposure
Re: Street Fighter 4 Focus Attack / Saving Attack
#28  March 26, 2010, 03:44:27 pm
  • ******
  • Limited time to use Infinite power !
    • France
    • network.mugenguild.com/cybaster/
Re: Street Fighter 4 Focus Attack / Saving Attack
#29  July 21, 2010, 07:15:06 am
  • *
  • All Hail the Prince......Soul Scorher is here!
; This part covers the after effects of getting hit from earlier.
[state 901, no more saving hit]
type = varset
trigger1 = time = 1
var(20) = 0

[state 901, white flash]
type = PalFx
trigger1 = time = 1
sinadd = 128,128,128,16
time = 8

[State 901, life removal]
type = LifeAdd
trigger1 = time = 1 && !var(20)
value = -(gethitvar(damage))
kill = 1

; This ctrl changes the animframe back to the last active one
[State 901, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 900
elem = var(22)

; This varset is the continuation of charging
[State 901, adding to charge]
type = VarAdd
trigger1 = time >= 1
fv = 9
value = 1
persistent = 1

; These change states control dash cancels and moving into the attack portion
[State 901, dash cancel]
type = ChangeState
trigger1 = time >= 8 && command = "BB"
value = 105

[State 901, dash cancel forward]
type = ChangeState
trigger1 = time >= 8 && command = "FF"
value = 100

[State 901, early release]
type = ChangeState
trigger1 = time >= 8 && command != "hold-b" && command !="hold-y"
value = 902

[State 901, fully charged]
type = ChangeState
trigger1 = fvar(9)>=60
value = 902

;----------------------------------------
;Focus Attack - actual attack
[Statedef 902]
type = S
movetype = A
physics = S
juggle = 10
anim = 901
ctrl = 0
velset = 0,0

;PalFX sctrls; the first removes any earlier stuff, and the second the white flash
;that appears if you have maxed out focus
[state 901, cancel earlier fx flash]
type = PalFx
trigger1 = time = 0
add = 0,0,0
time = 0

[state 901, bright flash if maxed out]
type = PalFx
triggerall =FVar(9) = 60
trigger1 = time = 1
add = 128,128,128
sinadd = -128,-128,-128,32
time = 8

; The hitdef used depends on the how long you've been charging.
; In case you are wondering why there are 2 versions of each lvl's
; hitdef, the second one has been refined to compensate for hitting
; air opponents.
;lvl 1
[State 902, 0-30]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 3 && (FVar(9) = [0,29])
attr = S, NA
damage= 40,0
animtype = Hard
guardflag = M
hitflag = M
priority = 4, Hit
pausetime = 9, 9
sparkno = 1
sparkxy = -5, -58
hitsound = 5,6
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -8.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

[State 902, 0-30]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
triggerall = p2statetype = A
trigger1 = AnimElem = 2 && (FVar(9) = [0,29])
attr = S, NA
damage= 40,0
animtype = Hard
guardflag = A
hitflag = A
priority = 4, Hit
pausetime = 9, 9
sparkno = 1
sparkxy = -5, -58
hitsound = s400,1
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -6.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

; Counter version of lvl 1: If you counterhit when at this early stage, crumple is possible it seems.
[State 902, 0-30 counter ver]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 2 && (FVar(9) = [0,29])
trigger1 = p2movetype = A && p2statetype !=A
attr = S, NA
damage= 40,0
animtype = Hard
guardflag = M
hitflag = M
priority = 6, Hit
pausetime = 9, 9
sparkno = 1
sparkxy = -5, -58
hitsound = s400,3
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -6.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 1503 ;<-- This is the p2 crumple state

;lvl 2
[State 902, 31-59]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 3 && (FVar(9) = [31,59])
attr = S, NA
damage= 60,0
animtype = Hard
guardflag = M
hitflag = M
priority = 4, Hit
pausetime = 11, 11
sparkno = 1
sparkxy = -5, -58
hitsound = 5,7
guardsound = 6, 0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 16
ground.velocity = -8.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 1503 ;<-- This is the p2 crumple state

[State 902, 31-59 b]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
triggerall = p2statetype = A
trigger1 = AnimElem = 2 && (FVar(9) = [30,59])
attr = S, NA
damage= 60,0
animtype = Hard
guardflag = A
hitflag = A
priority = 5, Hit
pausetime = 11, 11
sparkno = 1
sparkxy = -5, -58
hitsound = s400,2
guardsound = 6, 0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 16
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

[State 902, 31-59 counter]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = p2movetype = A && p2statetype !=A
trigger1 = AnimElem = 2 && (FVar(9) = [30,59])
attr = S, NA
damage= 60,0
animtype = Hard
hitflag = M
priority = 5, Hit
pausetime = 11, 11
sparkno = 1
sparkxy = -5, -58
hitsound = s400,2
guardsound = 6, 0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 16
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 1503 ;<-- This is the p2 crumple state

;lvl 3 MAX
[State 902, max-charge]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
trigger1 = AnimElem = 3 && FVar(9) = 60
attr = S, NA
damage= 85,0
animtype = Hard
;guardflag = MA ;<-- Commented out as you will not be blocking this. This will hurt, and you will fall!
hitflag = MAF
priority = 4, Hit
pausetime = 14, 14
sparkno = 1
sparkxy = -5, -58
hitsound = 5,8
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15
p2stateno = 903 ;<-- This is the p2 crumple state

[State 902, max-charge]
type = HitDef
triggerall = P2stateno != [5020,5040]
triggerall = p2stateno != [154,155]
triggerall = p2statetype = A
trigger1 = AnimElem = 2 && FVar(9) = 60
attr = S, NA
damage= 85,0
animtype = Hard
hitflag = A
priority = 6, Hit
pausetime = 14, 14
sparkno = 1
sparkxy = -5, -58
hitsound = s400,3
guardsound = 6, 0
ground.type = Low
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -4.95
guard.slidetime = 18
guard.hittime = 18
guard.ctrltime = 12
airguard.velocity = -3.5,-4
air.type = High
air.velocity = -3.5,-6
air.hittime = 9
getpower = 101,101
givepower = 21,21
ground.cornerpush.veloff = -7.25
air.cornerpush.veloff = 0
yaccel = .55
air.fall = 1
air.juggle = 15

[State 902, fvar reset]
type = VarSet
trigger1 = !AnimTime
fvar(9) = 0

that's all she wrote when it comes to the Focus attack barring any typos I missed. Tune in next time as I talk about a quick and dirty way of tackling the SF4 Ultra bar; not because I have any use for it, but because the one example I have seen uses an absurd 70+ animations to pull off the green alone when you could really do the same in 3 animations or so with the right code. That is absurd! If you can make use of the code, just remember to toss in a credit somewhere. If you really appreciate it, please feel free to visit the link in my signature and visit the paypal donate page. Hah! (Seriously though, if you can spare a bit, it would be appreciated.)

Well, that ultra bar code won't write itself; good .\/. to you all and catch you later.

[Edit] Most recent edit has revised and additional hitdefs in the final state to better emulate the behaviour when the attack hits an airborne enemy.
[/quote]
You mean That Attack that Alows you to break gaurd like SFIV? ???


              ~Dark heaven is golden~

GT

Re: Street Fighter 4 Focus Attack / Saving Attack
#30  July 21, 2010, 08:51:13 am
  • *****
    • USA
    • Skype - gt_ruby
Yup. Since the guard flag was commented/left out it's an unblockable.
Yeah Titiln, in fact, You Made Him