#------------------------------------------------------------------------------- # 2. State entry # -------------- # This is where you define what commands bring you to what states. # # Each state entry block looks like: # #Command-attack ;Change Label to any name you want to use to # ;identify the state with. #Before, there were triggers to dictate what should happen for a #command to work. Now, it can be expressed as following #Triggerall = stateType!=A #trigger1 = ctrl #trigger2 = var(1) # #becomes the following #if stateType!=A && #(ctrl||var(1)) # # # changeState{ ;Don't change this # value : new_state_number} # # - new_state_number is the number of the state to change to # - command_name is the name of the command (from the section above) # - Useful triggers to know: # - statetype # S, C or A : current state-type of player (stand, crouch, air) # - ctrl # 0 or 1 : 1 if player has control. Unless "interrupting" another # move, you'll want ctrl = 1 # - stateno # number of state player is in - useful for "move interrupts" # - movecontact # 0 or 1 : 1 if player's last attack touched the opponent # useful for "move interrupts" # # Note: The order of state entry is important. # State entry with a certain command must come before another state # entry with a command that is the subset of the first. # For example, command "fwd_a" must be listed before "a", and # "fwd_ab" should come before both of the others. # # For reference on triggers, see CNS documentation. # # Just for your information (skip if you're not interested): # This part is an extension of the CNS. "State -1" is a special state # that is executed once every game-tick, regardless of what other state # you are in. # This is used to calculate the zones for the EO (Easy Operation) stick. # You may divide this into as many arbitrary zones as you wish by changing # the numZones parameter. [function getEOStickZone(vx, vy, numZones) zone] let zone = -1; # Decrement our leeway timer (to prevent specials from triggering too soon) if map(EOBufferTime) > 0 { map(EOBufferTime) := map(EOBufferTime) - 1; } else if map(EOBufferTime) = 0 { let cs = GameOption(Input.ControllerStickSensitivity); if $vx != 0 || $vy != 0 { let angleRad = atan2($vy, $vx); let fcr = 2 * pi; if $angleRad < 0 { let angleRad = $angleRad + $fcr; } let zoneSizeRad = $fcr / $numZones; let zone = floor($angleRad / $zoneSizeRad); } # Nullify the buffer time so it can get set next execution. map(EOBufferTime) := -1; # Set the initial buffer timer. } else { map(EOBufferTime) := 1; } # Gets how deep we are into the EO stick zone. [function getThrowDepth(vx, vy) depth] let depth = (($vx*$vx + $vy*$vy)**0.5); if $depth > 1.0 { let depth = 1.0; } # Don't remove the following line. It's required by the CMD standard. #=============================================================================== # command code #=============================================================================== [StateDef -1] let RDEADBAND = 0.20; #Deadband for right analog stick let HVY_DEPTH = 0.90; #This controls the heavy range for the EO stick. H: [HVY_DEPTH,1.0] let MED_DEPTH = 0.30; #This controls the light and medium range for the EO stick. L: (0.0,MED_DEPTH), M: [MED_DEPTH,HVY_DEPTH) #This processes analog movement if map(AnalogEnabled) > 0 { map(vector_x) := Analog(LeftX); map(vector_z) := Analog(LeftY); let cs = GameOption(Input.ControllerStickSensitivity); #Some deadzone for D-Pads mapped to axes if map(vector_x) != [-$cs,$cs] { if map(vector_x) < 0 { sysVar(1) := -1; } else { sysVar(1) := 1; } } else if command = "holdfwd" || command = "holdback" { sysVar(1) := (command = "holdfwd" - command = "holdback"); } else { sysVar(1) := 0; } #Process EO stick behavior let numSpecialsAndSupers = 7; let rx = map(right_x) := Analog(RightX); let ry = map(right_y) := Analog(RightY); let zone = -1; if $rx != [-$RDEADBAND,$RDEADBAND] || $ry != [-$RDEADBAND,$RDEADBAND] { let zone = call getEOStickZone($rx, $ry, $numSpecialsAndSupers); } map(EOZone) := $zone; let depth = call getThrowDepth($rx, $ry); # Don't set anything if EOEnabled is disabled. if map(EOEnabled) <= 0 { map(EOZone) := -1; let depth = 0; } } else { map(vector_x) := map(vector_z) := 0; map(EOZone) := -1; } #------------------------------------------------------------------------------- #ADC (Analog to Digital Converter) - This is used so that specials can function #for the new analog inputs let vx = 0; let vz = 0; ignorehitpause { let vx = map(vector_x)*Facing; let cs = GameOption(Input.ControllerStickSensitivity); if $vx != 0 { # Forward if $vx > $cs { AssertInput{ flag: F; } # Back } else if -$vx > $cs { AssertInput{ flag: B; } } } let vz = map(vector_z); if $vz != 0 { # Down if $vz > $cs { AssertInput{ flag: D; } # Up } else if -$vz > $cs { AssertInput{ flag: U; } } } } #This is not a move, but it sets up the map "cancombo" to be 1 if #conditions are right for a combo into a special move (used below). #Since a lot of special moves rely on the same conditions, this reduces #redundant logic. ignoreHitPause { mapSet{map: "cancombo"; value: 0} if stateType != A && (ctrl || ((stateNo = [200, 299] || stateNo = [400, 499]) && stateNo != 440 && moveContact) || #!= 440: Except for sweep kick (stateNo = 1310 || stateNo = 1330)) { #From blocking mapSet{map: "cancombo"; value: 1} } } #============|IF roundState = 2|================================================ if roundState = 2 { #prevent attacks outside of fight state #=============================================================================== # #------------------------------------------------------------------------------- #Smash Kung Fu Upper (uses one super bar) if (command = "SmashKFUpper" || map(EOZone) = 6) && power >= 1000 && stateType != A && (ctrl || (hitDefAttr = SC, NA, SA, HA && stateNo != [3050, 3099] && moveContact) || (stateNo = 1310 || stateNo = 1330)) { #From blocking changeState{value: 3050} } #------------------------------------------------------------------------------- #Triple Kung Fu Palm (uses one super bar) if (command = "TripleKFPalm" || map(EOZone) = 5) && power >= 1000 && stateType != A && (ctrl || (hitDefAttr = SC, NA, SA, HA && stateNo != [3000, 3049] && moveContact) || (stateNo = 1310 || stateNo = 1330)) { #From blocking changeState{value: 3000} } #------------------------------------------------------------------------------- #Fast Kung Fu Knee (1/3 super bar) if (command = "FF_ab" || (map(EOZone) = 3 && $depth >= $HVY_DEPTH)) && power >= 330 && map(cancombo) { #Use combo condition (above) changeState{value: 1070} } #------------------------------------------------------------------------------- #Fast Kung Fu Upper (1/3 super bar) if (command = "upper_xy" || (map(EOZone) = 1 && $depth >= $HVY_DEPTH)) && power >= 330 && map(cancombo) { changeState{value: 1120} } #------------------------------------------------------------------------------- #Fast Kung Fu Zankou if (command = "QCF_ab" || (map(EOZone) = 4 && $depth >= $HVY_DEPTH)) && power >= 330 && map(cancombo) { changeState{value: 1420} } #------------------------------------------------------------------------------- #Fast Kung Fu Palm (1/3 super bar) if (command = "QCF_xy" || (map(EOZone) = 0 && $depth >= $HVY_DEPTH)) && power >= 330 && map(cancombo) { changeState{value: 1020} } #------------------------------------------------------------------------------- #Fast Kung Fu Blow (1/3 super bar) if (command = "QCB_xy" || (map(EOZone) = 2 && $depth >= $HVY_DEPTH)) && power >= 330 && map(cancombo) { changeState{value: 1220} } #------------------------------------------------------------------------------- #Strong Kung Fu Knee if (command = "FF_b" || (map(EOZone) = 3 && $depth >= $MED_DEPTH)) && map(cancombo) { changeState{value: 1060} } #------------------------------------------------------------------------------- #Light Kung Fu Knee if (command = "FF_a" || (map(EOZone) = 3 && $depth < $MED_DEPTH)) && map(cancombo) { changeState{value: 1050} } #------------------------------------------------------------------------------- #Strong Kung Fu Upper if (command = "upper_y" || (map(EOZone) = 1 && $depth >= $MED_DEPTH)) && map(cancombo) { changeState{value: 1110} } #------------------------------------------------------------------------------- #Light Kung Fu Upper if (command = "upper_x" || (map(EOZone) = 1 && $depth < $MED_DEPTH)) && map(cancombo) { changeState{value: 1100} } #------------------------------------------------------------------------------- #Strong Kung Fu Zankou if (command = "QCF_b" || (map(EOZone) = 4 && $depth >= $MED_DEPTH)) && map(cancombo) { changeState{value: 1410} } #------------------------------------------------------------------------------- #Light Kung Fu Zankou if (command = "QCF_a" || (map(EOZone) = 4 && $depth < $MED_DEPTH)) && map(cancombo) { changeState{value: 1400} } #------------------------------------------------------------------------------- #Strong Kung Fu Palm if (command = "QCF_y" || (map(EOZone) = 0 && $depth >= $MED_DEPTH)) && map(cancombo) { changeState{value: 1010} } #------------------------------------------------------------------------------- #Light Kung Fu Palm if (command = "QCF_x" || (map(EOZone) = 0 && $depth < $MED_DEPTH)) && map(cancombo) { changeState{value: 1000} } #------------------------------------------------------------------------------- #Strong Kung Fu Blow if (command = "QCB_y" || (map(EOZone) = 2 && $depth >= $MED_DEPTH)) && map(cancombo) { changeState{value: 1210} } #------------------------------------------------------------------------------- #Light Kung Fu Blow if (command = "QCB_x" || (map(EOZone) = 2 && $depth < $MED_DEPTH)) && map(cancombo) { changeState{value: 1200} } #------------------------------------------------------------------------------- #Kung Fu Blocking (High) if command = "blocking" && !map(crouchinput) && ((ctrl && stateType != A) || ((stateNo = 1310 || stateNo = 1330) && time > 0)) { changeState{value: 1300} } #------------------------------------------------------------------------------- #Kung Fu Blocking (Low) if command = "blocking" && map(crouchinput) && ((ctrl && stateType != A) || ((stateNo = 1310 || stateNo = 1330) && time > 0)) { changeState{value: 1320} } #------------------------------------------------------------------------------- #Kung Fu Blocking (Air) if command = "blocking" && !map(crouchinput) && command != "holdup" && ((ctrl && stateType = A) || (stateNo = 1350 && time > 0)) { changeState{value: 1340} } #=============================================================================== # #------------------------------------------------------------------------------- #Run Fwd if command = "FF" && stateType != A && ctrl { changeState{value: 100} } #------------------------------------------------------------------------------- #Run Back if command = "BB" && stateType != A && ctrl { changeState{value: 105} } #------------------------------------------------------------------------------- #Run Up if command = "UU" && stateType != A && ctrl { changeState{value: 110} } #------------------------------------------------------------------------------- #Run Down if command = "DD" && stateType != A && ctrl { changeState{value: 115} } #------------------------------------------------------------------------------- #Kung Fu Throw if command = "y" && stateType != A && ctrl && stateNo != 100 && (p2StateType = S || p2StateType = C) && p2MoveType != H && abs(p2BodyDist Z) <= 4 && p2BodyDist X < 6 && (command = "holdfwd" || command = "holdback" || command = "holdup" || command = "holddown") { changeState{value: 800} } #=============================================================================== # #------------------------------------------------------------------------------- #Stand Light Punch if command = "x" && !map(crouchinput) && ((stateType != A && ctrl) || (stateNo = 200 && animElemTime(3) > 0)) { changeState{value: 200} } #------------------------------------------------------------------------------- #Stand Strong Punch if command = "y" && !map(crouchinput) && ((stateType != A && ctrl) || ((stateNo = 200 || stateNo = 230) && animElemTime(3) > 0)) { changeState{value: 210} } #------------------------------------------------------------------------------- #Stand Light Kick if command = "a" && !map(crouchinput) && ((stateType != A && ctrl) || ((stateNo = 200 || stateNo = 230) && animElemTime(3) > 0)) { changeState{value: 230} } #------------------------------------------------------------------------------- #Standing Strong Kick if command = "b" && !map(crouchinput) && ((stateType != A && ctrl) || ((stateNo = 200 || stateNo = 230) && animElemTime(3) > 0)) { changeState{value: 240} } #------------------------------------------------------------------------------- #Taunt if command = "start" && !map(crouchinput) && stateType != A && ctrl { changeState{value: 195} } #------------------------------------------------------------------------------- #Crouching Light Punch if command = "x" && map(crouchinput) && stateType != A && ctrl { changeState{value: 400} } #------------------------------------------------------------------------------- #Crouching Strong Punch if command = "y" && map(crouchinput) && ((stateType != A && ctrl) || (stateNo = 400 && animElemTime(2) > 0) || (stateNo = 430 && moveContact && animElemTime(3) > 0)) { changeState{value: 410} } #------------------------------------------------------------------------------- #Crouching Light Kick if command = "a" && map(crouchinput) && ((stateType != A && ctrl) || (stateNo = 400 && animElemTime(2) > 0) || (stateNo = 430 && moveContact && animElemTime(3) > 0)) { changeState{value: 430} } #------------------------------------------------------------------------------- #Crouching Strong Kick if command = "b" && map(crouchinput) && ((stateType != A && ctrl) || (stateNo = 400 && animElemTime(2) > 0) || (stateNo = 430 && moveContact && animElemTime(3) > 0)) { changeState{value: 440} } #------------------------------------------------------------------------------- #Jump Light Punch if command = "x" && ((stateType = A && ctrl) || (stateNo = 600 && animElemTime(2) > 0) || stateNo = 1350) { #Air blocking changeState{value: 600} } #------------------------------------------------------------------------------- #Jump Strong Punch if command = "y" && ((stateType = A && ctrl) || ((stateNo = 600 || stateNo = 630) && moveContact) || #jump_x or jump_a stateNo = 1350) { #Air blocking changeState{value: 610} } #------------------------------------------------------------------------------- #Jump Light Kick if command = "a" && ((stateType = A && ctrl) || stateNo = 1350) { #Air blocking changeState{value: 630} } #------------------------------------------------------------------------------- #Jump Strong Kick if command = "b" && ((stateType = A && ctrl) || ((stateNo = 600 || stateNo = 630) && moveContact) || #jump_x or jump_a stateNo = 1350) { #Air blocking changeState{value: 640} } #------------------------------------------------------------------------------- #Crouch override if map(crouchinput) && stateType = S && ctrl { changeState{value: 10} } #------------------------------------------------------------------------------- #Jump override if command = "z" && stateType = S && ctrl { changeState{value: 40} } #------------------------------------------------------------------------------- #Air Jump override if command = "z" && stateType = A && ctrl && stateNo = 50 && prevStateNo = 40 && pos y <= -const(movement.airjump.height) { changeState{value: 45} } #------------------------------------------------------------------------------- #Z-axis walk let cs = GameOption(Input.ControllerStickSensitivity); if (command = "holdup" || command = "holddown" || (map(vector_z) != [-$cs,$cs])) && stateType = S && ctrl { if stateNo != 100 { changeState{value: 20} } } #End of file: roundState = 2 #=============================================================================== }