YesNoOk
avatar

Code Snippet Archive (Read 334132 times)

Started by aokmaniac13, May 28, 2005, 01:48:59 am
Share this topic:
Attack Damage Display
#41  May 29, 2005, 08:40:05 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This was inspired by Ragnarok Online. When you attack the opponent, the amount of damage done is displayed as numbers as part of the hitspark. It is also done in many other RPG games, such as the Final Fantasy series.

In all of your character's attack states, add these 2 pieces in. If the attack is a projectile, a throw, or does multiple hits, you will need to change the trigger accordingly.

Code:
[State ****: VarSet]
type = VarSet
trigger1 = (MoveHit)
var(0) = (EnemyNear, GetHitVar(Damage))
persistent = 0
ignorehitpause = 1

[State ****: Helper]
type = Helper
trigger1 = (MoveHit)
helpertype = Normal
name = "DamageDisplay"
id = ****
pos = 0,0
postype = p1
facing = 1
stateno = ****
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
persistent = 0
ignorehitpause = 1

Now you create the Helper's state, where the effect is created. Please note that Helpers use their own set of variables, so you don't need to change any variables here.

Code:
[Statedef ****]
anim = **** ;Invisible anim

This is the equation to set the current value. Maximum value is 9999.

Code:
[State ****: Null]
type = Null
trigger1 = (!Time)
trigger1 = (Var(1) := (Parent, Var(1)))
trigger2 = (Var(2) = Floor(Var(1)/1000)) && (Var(3) = Gloor(Var(1)/100 - Var(2) * 10))
trigger3 = (Var(4) := Floor(Var(1)/10 - Var(2) * 100 - Var(3) * 10)) && (Var(5) = Floor(Var(1)/1 - Var(2) * 1000 - Var(3) * 100 - Var(4) * 10))

You should adjust the Explod X positions here. In this example, the Explods are spaced out by every 4 pixels. The Y position of all Explods should be the same.

Also, animations should be organized in sequence, for example:

9000: 0
9001: 1
9002: 2
9003: 3
9004: 4
9005: 5
9006: 6
9007: 7
9008: 8
9009: 9


Code:
[State ****: Explod]
type = Explod
trigger1 = (!Time) && (Var(1) >= 1000)
anim = 9000 + var(2)
id = ****
pos = 0,-30
postype = p2
facing = IfElse((Parent, Facing = EnemyNear, Facing),Facing,(Facing * -1))
vfacing = 1
bindtime = 1
vel = 0,-1
accel = 0,0
random = 0,0
removetime = -1
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 0
ontop = 1
shadow = 0,0,0
ownpal = 1
removeongethit = 0
persistent = 0
ignorehitpause = 1

[State ****: Explod]
type = Explod
trigger1 = (!Time) && (Var(1) >= 100)
anim = **** + var(3)
id = ****
pos = IfElse((Parent, Facing = EnemyNear, Facing),(Facing * 4),(Facing * -4)),-30
postype = p2
facing = IfElse((Parent, Facing = EnemyNear, Facing),Facing,(Facing * -1))
vfacing = 1
bindtime = 1
vel = 0,-1
accel = 0,0
random = 0,0
removetime = -1
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 0
ontop = 1
shadow = 0,0,0
ownpal = 1
removeongethit = 0
persistent = 0
ignorehitpause = 1

[State ****: Explod]
type = Explod
trigger1 = (!Time) && (Var(1) >= 10)
anim = **** + var(4)
id = ****
pos = IfElse((Parent, Facing = EnemyNear, Facing),(Facing * 8),(Facing * -8)),-30
postype = p2
facing = IfElse((Parent, Facing = EnemyNear, Facing),Facing,(Facing * -1))
vfacing = 1
bindtime = 1
vel = 0,-1
accel = 0,0
random = 0,0
removetime = -1
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 0
ontop = 1
shadow = 0,0,0
ownpal = 1
removeongethit = 0
persistent = 0
ignorehitpause = 1

[State ****: Explod]
type = Explod
trigger1 = (!Time) && (Var(1) >= 1)
anim = **** + var(5)
id = ****
pos = IfElse((Parent, Facing = EnemyNear, Facing),(Facing * 12),(Facing * -12)),-30
postype = p2
facing = IfElse((Parent, Facing = EnemyNear, Facing),Facing,(Facing * -1))
vfacing = 1
bindtime = 1
vel = 0,-1
accel = 0,0
random = 0,0
removetime = -1
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 0
ontop = 1
shadow = 0,0,0
ownpal = 1
removeongethit = 0
persistent = 0
ignorehitpause = 1

This is used to destroy the Helper, after a certain period of time.

Code:
[State ****: DestroySelf]
type = DestroySelf
trigger1 = (Time > 40) && (NumExplod(****) = 0)
Last Edit: April 10, 2009, 09:43:49 am by Cyanide
Random Explod Dispersal/Explosion
#42  May 29, 2005, 08:43:33 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
If you want to create some nifty disperse effects, for an Explod, a SuperPause, or even a hit spark, this is one way to accomplish it.

Although it is simply just a bunch of Explods going off in random directions, I use a Helper to create the effect; It reduces redundancy if you choose to use the effect for more than one move. That way, you can just call the Helper whenever you want to create the effect.

Code:
[State ****: Helper]
type = Helper
trigger1 = [Insert trigger here.]
helpertype = Normal
name = "DisperseEffect"
id = ****
pos = *,*
postype = p1
stateno = ****
keyctrl = 0
ownpal = 1

In the helper state, you can add in a bunch of Explods. This example shows 3 particles going off in random directions at random speeds.

Code:
[Statedef ****]
anim = **** ;Invisible anim.

[State ****: Explod]
type = Explod
trigger1 = (!Time)
anim = ****
id = ****
pos = 0,0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = (IfElse(Random <= 499,Random/85,Random/(-85))),(IfElse(Random <= 499,Random/85,Random/(-85)))
accel = 0,0
random = 0,0
removetime = 40
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State ****: Explod]
type = Explod
trigger1 = (!Time)
anim = ****
id = ****
pos = 0,0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = (IfElse(Random <= 499,Random/85,Random/(-85))),(IfElse(Random <= 499,Random/85,Random/(-85)))
accel = 0,0
random = 0,0
removetime = 40
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State ****: Explod]
type = Explod
trigger1 = (!Time)
anim = 9001
id = ****
pos = 0,0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = (IfElse(Random <= 499,Random/85,Random/(-85))),(IfElse(Random <= 499,Random/85,Random/(-85)))
accel = 0,0
random = 0,0
removetime = 40
supermove = 0
supermovetime = 0
pausemovetime = 0
scale = 1,1
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

Destroy the Helper when it has done its job.

Code:
[State ****: DestroySelf]
type = DestroySelf
trigger1 = (NumExplod(****) = 0) && (Time)
Last Edit: April 10, 2009, 09:44:22 am by Cyanide
Button Mash Escape
#43  May 29, 2005, 09:01:38 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is a custom gethit state, you can place it in your character's CNS or tweak it a bit if you are making a game. This code allows the player to mash the buttons for faster recovery, just like the SF games. This is the dizzy state itself, I recommend a previous state (shaking from the hit) and a recover state.

You can combine this code with Ragnarok's Stun Meter for better results. You use only one state and one Var. If you use it on a game engine, you will have to use a SysVar instead of a Var, so you can't overwrite any of player2's Vars.

In this example, state 5300 is recommended for use. Remember, physics must be N.

Code:
[Statedef 5300]
type = S
ctrl = 0
physics = N
velset = 0,0,0
anim = 5300

This is the "Button mash counter." Use any Var number you need, Or use a SysVar if you are working on common1.cns. In this case you must press 21 times any button.

Code:
[State 5300: VarSet]
type = VarSet
trigger1 = (!Time)
var(0) = 21

Every time you press a button you substract 1 from Var(0). Have in mind that you can press multiple buttons at once, try not to make the Var value too low or you will recover too easily.

Code:
[State 5300: VarAdd]
type = VarAdd
trigger1 = (Command = "a") || (Command = "b") || (Command = "c")
trigger2 = (Command = "x") || (Command = "y") || (Command = "z")
var(0) = -1

Every time you press a button you will blink green. Change it to your pleasure. You can also add in your own special effects, like sounds.

Code:
[State 5300: PalFX]
type = PalFX
trigger1 = (Command = "a") || (Command = "b") || (Command = "c")
trigger2 = (Command = "x") || (Command = "y") || (Command = "z")
time = 3
add = 0,54,0

When Var(0) reaches zero, or when three seconds pass, you will go to state 0. You can make it go any state, for instance a recover state with a custom animation. Make sure to use a SelfState if you use the dizzy as a custom state, you can use ChangeState in common1.cns.
Last Edit: April 10, 2009, 09:44:57 am by Cyanide
KoF Evasion
#44  May 29, 2005, 09:53:23 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is KOF's evade system, where your character roll/slides forward, dodging most attacks. You can also use this ability to go behind your opponent if he/she is close enough to you.

The speed and duration of this move varies from character, so it's recommended that you adjust those 2 attributes.

This is a generic evade state for moving forward, but you can also create another state for moving back if you want.

Code:
[Statedef ****]
type = S
movetype = I
physics = N
anim = ****
velset = 0,0
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 0
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 0

If you want the character to go behind the opponent as he/she moves passes it, add in this piece.

Code:
[State ****: SprPriority]
type = SprPriority
trigger1 = (Vel X != 0)
value = -2

This is used for the temporary invulnerability during this move. The character can only be hit by throws. This invulnerability varies from character to character.

Code:
[State ****: NotHitBy]
type = NotHitBy
trigger1 = (Time < 20)
value = , NA, SA, HA, NP, SP, HP

This moves the character forward.

I use the trigger "Time = 5", to give a slight delay before the character actually moves. The speed is however you see fit.

Code:
[State ****: VelSet]
type = VelSet
trigger1 = (Time = 5)
x = *

You'll want something to stop your character's movement after a while.

Code:
[State ****: VelSet]
type = VelSet
trigger1 = (Time = 30)
x = 0

You'll need this piece to be able to move pass the opponent, if you're close.

Code:
[State ****: PlayerPush]
type = PlayerPush
trigger1 = (Vel X != 0)
value = 0

If you want, you can add in some AfterImages. This is optional though, but recommended. ^^ Adjust AfterImage values to your preferences.

Code:
[State ****: AfterImage]
type = AfterImage
trigger1 = (Vel X != 0)
time = 25
timegap = 2
framegap = 4
length = 15
paladd = 0, 0, 0
palmul = .50, .50, .50
palcontrast = 100,100,100
trans = add
persistent = 0

These next pieces are also optional; It's the ability to dodge while guarding in KOF. These are used for the flashy effects in the move, as well as using 1 level of power.

Code:
[State ****: SuperPause]
type = SuperPause
triggerall = (!Time)
trigger1 = (PrevStateNo = 150) || (PrevStateNo = 152)
time = 10
anim = ****
pos = *,*
movetime = 0
darken = 1
poweradd = -1000
unhittable = 1

[State ****: EnvColor]
type = EnvColor
triggerall = (!Time)
trigger1 = (PrevStateNo = 150) || (PrevStateNo = 152)
value = 255,255,255
time = 2
under = 1

Be sure to make the appropriate changes to the CMD file too, if you decide to add the previous codes mentioned:

Code:
[State -1]
type = ChangeState
value = ****
triggerall = (Command = "evade")
trigger1 = (StateType = S) && (Ctrl)
trigger2 = ((StateNo = 150) || (StateNo = 152)) && (Power >= 1000) ;Add this new trigger!

And in the CNS file... the move has ended.

Code:
[State ****: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0)
value = 0
ctrl = 1
Last Edit: April 10, 2009, 09:45:24 am by Cyanide
Homing Projectiles/Helpers
#45  May 29, 2005, 10:45:06 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This creates a projectile that follows the opponent where ever they go.

To accomplish this, a Helper must be used. If you wish to add any Projectile Effects, simply add them to this state.

Code:
[Statedef ****]
type = A
movetype = A
physics = N
anim = ****

This is needed, so that the projectile cannot be hit, and turn into a copy of the main character. This is what I use, but alternatively, you can put in a HitOverride, or just forget about the Clsn2 boxes. =)

Code:
[State ****: NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

These next pieces are needed to follow the opponent, and to turn if the opponent somehow gets behind it. The turning is not required, but it depends on the type of anim you are using for the projectile.

All the VelSet and VelAdd values should can be changed accordingly.

The triggers "Vel X > -6", "Vel Y < 6" and "Vel Y > -6" are used to limit the speed of the projectile.

Code:
[State ****: Turn]
type = Turn
trigger1 = (P2Dist X < 10)

[State ****: VelSet]
type = VelSet
trigger1 = (!Time)
x = 3

[State ****: VelAdd]
type = VelAdd
trigger1 = (P2Dist X < 0) && (Vel X > -6)
x = -0.2

[State ****: VelAdd]
type = VelAdd
trigger1 = (P2Dist X > 0) && (Vel X < 6)
x = 0.2

[State ****: VelAdd]
type = VelAdd
trigger1 = (EnemyNear, Pos Y > Pos Y) && (Vel Y < 6)
y = 0.2

[State ****: VelAdd]
type = VelAdd
trigger1 = (EnemyNear, Pos Y <= Pos Y) && (Vel Y > -6)
y = -0.2

Of course, a HitDef controller is needed. Everything here is up to you, but the "attr" parameter must be set to a projectile type. Eg "S, SP"

Code:
[State ****: HitDef]
type = HitDef
trigger1 = 1
attr = S, SP
; (etc...)

This last piece is used to destroy the Helper when it makes contact with the opponent, or when it has floating around for a period of time, to reduce cheapness.

Alternatively you can put the Projectile into another state, if you want something else to occur before it is removed.

Code:
[State ****: DestroySelf]
type = DestroySelf
trigger1 = (MoveContact) || (Time > 200)
ignorehitpause = 1
Last Edit: April 10, 2009, 09:45:55 am by Cyanide
Just Defence. Garou: Mark of the Wolves
#46  May 29, 2005, 10:48:41 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This feature was originally from Garou: Mark of the Wolves, and it occurs when you block an attack right at the last moment before it hits. When successful, you gain these benefits:

1. Recover a small amount of life.
2. Gain some power.
3. Your character's block is different; It is shorter than normal, will not cause your character to be pushed back, and you do not suffer any guard damage.

This is the CvS2 version and it is only available in K-Groove. It may or may not be exactly the same as the one in MOTW.

Put these states under StateDef -2/-3. Var(0) is used to detect when the backwards command is performed, Var(1) is used to detect if you've successfully Just Defended, and Var(2) is used to remove any guard damage.

Code:
[State -2: VarAdd]
type = VarAdd
trigger1 = (Ctrl) && (Command = "holdback") && (StateNo != [120,155])
var(0) = 1

[State -2: Null]
type = Null
trigger1 = (Command != "holdback")
trigger1 = (Var(0) := 0) && (Var(1) := 0)
trigger2 = ((StateNo = 150) || (StateNo = 152) || (StateNo = 154)) && (!Time)
trigger2 = (Var(1) := IfElse(Var(0) < 7,1,0)) && (Var(2) := GetHitVar(Damage))

This is used to disable air guarding. (Optional.)

Code:
[State -2: AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoAirGuard
ignorehitpause = 1

Add 250 points of power (14/168 in CvS2) if you successfully made a Just Defend.

Code:
[State -2: PowerAdd]
type = PowerAdd
trigger1 = ((StateNo = 150) || (StateNo = 152) || (StateNo = 154)) && (!Time) && (Var(1) = 1)
value = 250

Now, you must override your guard states: States 150, 152, and 154.

First, let's start with 150. You should find a ChangeAnim, like this:

Code:
[State 150: ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 150
Replace this with:

Code:
[State 150: ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = IfElse(Var(1) = 0,150,****)

Where **** is the Just Defend guard animation.

This is where Var(2) is used. 8 points of life (My best estimate based on CvS2 damage.) is added on top of any guard damage which is cancelled out.

Code:
[State 150: LifeAdd]
type = LifeAdd
trigger1 = (Var(1) = 1) && (!Time)
value = (Var(2)+8)

You may now add in any Just Defend effects into state 150, using (Var(1) = 1) && (!Time) as the trigger:

[PlaySnd] <--- Just Defend sound effect.
[Explod]? <--- Just Defend guard spark.
[Add anything else you want to include.]

Overriding state 151, look for a HitVelSet controller:

Code:
[State 151: HitVelSet]
type = HitVelSet
trigger1 = (!Time)
x = 1

And replace it with:

Code:
[State 151: HitVelSet]
type = HitVelSet
trigger1 = (!Time) && (Var(1) = 1)
x = 1

Next, look for a ChangeState controller:

Code:
[State 151: ChangeState]
type = ChangeState
trigger1 = (Time >= GetHitVar(HitTime))
value = 130
ctrl = 1

Replace this with:

Code:
[State 151: ChangeState]
type = ChangeState
trigger1 = (Time >= GetHitVar(HitTime))
value = IfElse(Var(1) = 1,0,130)
ctrl = 1

The same changes are made for the crouch guard:

State 152...

Code:
[State 152: ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = IfElse(Var(1) = 0,152,****)

[State 152: LifeAdd]
type = LifeAdd
trigger1 = (Var(1) = 1) && (!Time)
value = (Var(2)+8)

[PlaySnd] <--- Just Defend sound effect.
[Explod]? <--- Just Defend guard spark.
[Add anything else you want to include.]

State 153...

Code:
[State 153: HitVelSet]
type = HitVelSet
trigger1 = (!Time) && (Var(1) = 1)
x = 1

[State 153: ChangeState]
type = ChangeState
trigger1 = (Time >= GetHitVar(HitTime))
value = IfElse(Var(1) = 1,0,131)
ctrl = 1

The same changes are made for the air guard:

State 154...

Code:
[State 154: ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = IfElse(Var(1) = 0,154,****)

[State 154: LifeAdd]
type = LifeAdd
trigger1 = (Var(1) = 1) && (!Time)
value = (Var(2)+8)

[PlaySnd] <--- Just Defend sound effect.
[Explod]? <--- Just Defend guard spark.
[Add anything else you want to include.]

State 155 is not overridden, because your character is pushed back as he/she would if he/she was air guarding normally.
Last Edit: April 10, 2009, 09:46:26 am by Cyanide
Long Jump. SNK running Jump
#47  May 29, 2005, 10:50:13 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is one way to program a long jump in Mugen. It uses your character's normal jumping state.

Be sure to add in a command for the long jump, which is typically "$D, U"

In state 40, add this in:

Code:
[State 40: VarSet]
type = VarSet
trigger1 = (!Time)
var(0) = 0

[State 40: VarSet]
type = VarSet
triggerall = (Var(0) = 0)
trigger1 = ((PrevStateNo = 100) && (Command = "holdfwd")) || ((PrevStateNo = 105) && (Command = "holdback")) || (Command = "Long Jump")
var(0) = 1

And in state 50, add in these 2 states. The VelAdd is used to increase the velocities of the normal jump state, so adjust this according to your preferences.

Code:
[State 50: VelAdd]
type = VelAdd
trigger1 = (!Time) && (Var(0) = 1)
x = IfElse((Vel X) = 0,0,IfElse((Vel X) < 0,-4,4))
y = -3

[State 50: AfterImage]
type = AfterImage
trigger1 = ((!Time) && (Var(0) = 1) && (Vel X != 0))
time = 15
timegap = 4
framegap = 1
length = 10
paladd = 0, 0, 0
palmul = .50, .50, .50
palcontrast = 110,110,110
trans = add
persistent = 0
Last Edit: April 10, 2009, 09:46:54 am by Cyanide
Bar Display
#48  May 29, 2005, 10:53:03 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
In many games, any special effects that the character currently has, is displayed by either graphical bars, or numerical values.

You can implement this code into another feature, such as Ragnarok's Stun meter, or in a Timer, which can be easily done.

This tutorial shows how a graphical bar is done.

In your -2/-3 states, insert this code.

Var(0) is the meter variable. If, for example, you want to implement this into Ragnarok's Stun meter, then that variable should be used.

You must adjust the "pos" values accordingly, where:

a. TeamSide = 1; Leave unchanged
b. 1; This is the X position of the Explod if the character is on the P1 side. (Against the left wall.)
c. 319; This is the position of the Explod if the character is on the P2 side. (Against the right wall.)
d. 65; This is the Y position of both sides.

Removetime should usually be set to 1, but if your meter has flashy graphics to it, then this value should be the same as the number of ticks in the animation used in the AIR file.

**** is the animation to be used for the bar, which will be explained later.

Code:
[State -2: Explod]
type = Explod
trigger1 = (Var(0) > 0) && (NumExplod(9000) = 0)
anim = ****+Var(0)
id = 9000
pos = IfElse(TeamSide = 1,1,319),65
postype = left
bindtime = -1
removetime = 1
ontop = 1
shadow = 0,0,0
ownpal = 1
ignorehitpause = 1

Now, after inserting this piece in, you can add the animations in the AIR file. The first animation of this bar should be the same value as ****, while all other anims of the bar after it are done in sequence. Eg.

Anim 9000 in this example is where you put in anim ****.

Code:
[Begin Action ****]
9000,0, 0,0, -1,,A

All anims after **** should be organized like this.

Code:
[Begin Action 9001]
9001,0, 0,0, -1,,A

[Begin Action 9002]
9002,0, 0,0, -1,,A

[Begin Action 9003]
9003,0, 0,0, -1,,A

[Begin Action 9004]
9004,0, 0,0, -1,,A

[Begin Action 9005]
9005,0, 0,0, -1,,A

Etc...

The other other thing that you need to do now, is to put in your bar animations. You can use the? same concept for numerical values, but only recommended for use if values aren't very high.
Last Edit: April 10, 2009, 09:47:39 am by Cyanide
Screen Edge Teleport
#49  May 29, 2005, 10:56:06 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This feature was originally shown in Pac Man. When you go to one end of the screen, to see yourself moving into the opposite side.

This is all you need. Insert this under StateDef -2/-3:

Code:
[State -2: ScreenBound]
type = ScreenBound
triggerall = (StateNo != [0,12]) && (MoveType != H) && (StateNo != [120,152])
trigger1 = (BackEdgeBodyDist <= 0) || (FrontEdgeBodyDist <= 0)
movecamera = 0,1
value = 0

[State -2: PosSet]
type = PosSet
triggerall = (StateNo != [0,12]) && (MoveType != H) && (StateNo != [120,152])
trigger1 = (BackEdgeBodyDist <= -10) || (FrontEdgeBodyDist <= -10)
x = IfElse(BackEdgeBodyDist <= -10,150,-150)*(Facing)
y = Pos Y

[State -2: VelSet]
type = VelSet
triggerall = (StateNo != [0,12]) && (MoveType != H) && (StateNo != [120,152])
trigger1 = (BackEdgeBodyDist <= -10) || (FrontEdgeBodyDist <= -10)
x = Vel X
y = Vel Y
Last Edit: April 10, 2009, 09:47:59 am by Cyanide
Transformations/Morphs
#50  May 29, 2005, 11:02:19 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Morphing/Transform/Mode Change, or whatever you call it: It is the ability used in some characters, such as Gen of SFA3, where he can change from one mode to another, or in a character such as Shang Tsung of MK, who can change to another character altogether.

You have to decide on what this effect is going to do to your character. We'll assume that you want your character to change simply his/her fighting style.

Create the state that your character will go into. This is where your character changes his/her form and/or increase any stats:

Code:
[Statedef ****]
type? ? = S
movetype= A
physics = S
anim = ****
ctrl = 0

Next, you will need to decide how long the effect will last. If you want it to last for 1000 ticks for example, you give var(0) a value of 1000. But, if you want this effect to last indefinitely, simply set it to 1, to make things simple.

In any case, this variable is used to set the effect on.

Code:
[State ****: VarSet]
type = VarSet
trigger1 = [Insert trigger here.]
var(0) = 1000

This is used to end the move.

Code:
[State ****: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0)
value = 0
ctrl = 1

If you decide that the effect will last for a certain number of ticks, add this next piece under StateDef -2. Otherwise, just skip this part.

Code:
[State -2: VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0)
var(0) = -1
ignorehitpause = 1

Now, you probably want to add in the special effects as a result of the move. This tutorial shows 3 examples of an effect being added.

1. If you want your character's standing anim to change, you can override the common1.cns file, under StateDef 0. Look for this code:

Code:
[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

Remove the code as shown above entirely, and replace it with:

Code:
[State 0, 1]
type = ChangeAnim
triggerall = (Var(0) <= 0)
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State 0, 1]
type = ChangeAnim
triggerall = (Var(0) > 0)
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = ****

Where **** is the new standing anim. You use the same concept for the entire common1.cns. Although most creators use a much more efficient method of accomplishing this with the use of expressions, this will do the job just fine.

2. If you want to enable any new moves while your character is in this form, but only in this form, you simpy create the move just like any other move, with one exception; The CMD file.

This is just like any other command entry, with (Var(0) > 0) being the only new trigger added.

Code:
[State -1: ChangeState]
type = ChangeState
value = **** ;State of new move.
triggerall = (Command = "whatever") && (Var(0) > 0)
trigger1 = (StateType = A) && (Ctrl)

3. If you just want to increase the character's strength, go back to the morphing state, and add this in:

Code:
[State ****: AttackMulSet]
type = AttackMulSet
trigger1 = (!Time)
value = 1.5 ;50% increase to attack.

Be sure to insert this under StateDef -2. This is used to reset the character's strength back to normal when he/she is no longer in the mode.

Code:
[State -2: AttackMulSet]
type = AttackMulSet
trigger1 = (Var(0) <= 0)
value = 1
ignorehitpause = 1
Last Edit: April 10, 2009, 09:48:19 am by Cyanide
Parry CvS2 style
#51  May 29, 2005, 11:07:06 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This feature is was originally from SF3, and it is the ability to block an attack and immediately be given the chance to retaliate.

To perform a parry, you must press forward the moment the attack is about to hit you. Press down for low attacks.

This version is based on CvS2's version, so it does not include the additional features that were in SF3; Guard Parry, and Lower Aerial Parry.

Put these states under StateDef -2/-3. Var(0) is used for the time the parry is active, and Var(1) is used to detect the moment when you first tap the forward/down directional key to perform it.

Code:
[State -2: Null]
type = Null
trigger1 = (!Time) && (Var(1) = 0)
trigger1 = ((Command = "holdfwd") && (StateNo = 20)) ^^ ((Command = "holddown") && (StateNo = [10,11]))
trigger1 = (Var(0) := 8)
trigger2 = (Command != "holdfwd") && (Command != "holddown") && (Var(1) = 1)
trigger2 = (Var(1) := 0)
ignorehitpause = 1

[State -2: VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0)
var(0) = -1
ignorehitpause = 1

This is used for parrying in the air, while jumping and during the aerial parry. Note: ***1 is the ground parry state, ***2 is the air parry state, ***3 is the helper for air parrying, and ***4 is the parry spark.

Code:
[State -2: Helper]
type = Helper
trigger1 = ((StateNo = 50) || (StateNo = ***2)) && (Command = "holdfwd") && (NumHelper(***3) = 0)
helpertype = Normal
name = "Air Parry"
id = ***3
pos = 0,0
postype = p1
facing = 0
stateno = ***3
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
ignorehitpause = 1

The standing parry state.

Code:
[State -2: HitOverride]
type = HitOverride
triggerall = (StateType != A) && (Ctrl) && (Var(0) > 0)
trigger1 = (Command != "holddown") && (Command != "holdback")
attr = SA, AA, AP
slot = 0
stateno = ***1
ignorehitpause = 1

The crouching parry state, for low attacks.

Code:
[State -2: HitOverride]
type = HitOverride
triggerall = (StateType != A) && (Ctrl) && (Var(0) > 0)
trigger1 = (Command != "holdfwd") && (Command != "holdback")
attr = C, AA, AP
slot = 0
stateno = ***1
ignorehitpause = 1

The aerial parry state.

Code:
[State -2: HitOverride]
type = HitOverride
triggerall = ((StateNo = 50) || (StateNo = ***2)) && (Var(0) > 0)
trigger1 = (Command != "holddown") && (Command != "holdback")
attr = SCA, AA, AP
slot = 0
stateno = ***2
ignorehitpause = 1

And now, the parry states.

Code:
[Statedef ***1]
type = U
movetype = I
physics = U
anim = IfElse(StateType = S,****,****) ;<--- The first value should be the standing parry anim, 2nd being the crouching parry anim.
velset = 0,0
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 1
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2

The required stuff.

Code:
[State ***1: AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State ***1: CtrlSet]
type = CtrlSet
trigger1 = (Time > 4) && (StateType = S)
value = 1

[State ***1: NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State ***1: Pause]
type = Pause
trigger1 = (!Time)
time = 14
movetime = 14

[State ***1: VarSet]
type = VarSet
trigger1 = (!Time)
var(1) = 1

Miscellaneous special effects.

Code:
[State ***1: PalFX]
type = PalFX
trigger1 = (!Time)
time = 8
add = 0,0,0
mul = 256,256,256
sinadd = 75,100,255,8
invertall = 0
color = 256

[State ***1: EnvColor]
type = EnvColor
trigger1 = (!Time)
value = 255,255,255
time = 4

[State ***1: EnvShake]
type = EnvShake
trigger1 = (!Time)
time = 8
freq = 60
ampl = -2
phase = 90

Sound effects if needed. One for the character's voice, and another for the parry spark sound effect.

Code:
[State ***1: PlaySnd]
type = PlaySnd
trigger1 = (!Time)
value = S*,*

[State ***1: PlaySnd]
type = PlaySnd
trigger1 = (!Time)
value = S*,*

This is the parry spark.

Code:
[State ***1: Explod]
type = Explod
trigger1 = (!Time)
anim = ****
id = ****
pos = (IfElse(StateType = S,*,*)),(IfElse(StateType = S,*,*)) <--- First set of co-ordinates are used for the position of the standing parry spark, with 2nd set for the crouching.
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermove = 0
supermovetime = 0
pausemovetime = 12
scale = 1,1
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 1

And this ends the ground parry state.

Code:
[State ***1: ChangeState]
type = ChangeState
trigger1 = (!AnimTime)
value = IfElse(StateType = S,0,11)

This is the aerial parry state.

Code:
[Statedef ***2]
type = A
movetype = I
physics = N
anim = ***2
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 0
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2

[State ***2: CtrlSet]
type = CtrlSet
trigger1 = (Time > 4)
value = 1

[State ***2: NotHitBy]
type = NotHitBy
trigger1 = (Time < 14)
value = SCA

[State ***2: Pause]
type = Pause
trigger1 = (!Time)
time = 14
movetime = 14

[State ***2: VarSet]
type = VarSet
trigger1 = (!Time)
var(1) = 1

The same special effects from the ground parry state can be added here.
[PalFX]
[EnvColor]
[EnvShake]
[PlaySnd]


These are used to check the character's current jumping velocities, and save it to be used later. FVar(0) is used for the X velocity, and FVar(1) for the Y velocity.

Code:
[State ***2: Null]
type = Null
trigger1 = (!Time)
trigger1 = (FVar(0) := Vel X) && (FVar(1) := Vel Y)

The character is frozen during the parry state.

Code:
[State ***2: VelSet]
type = VelSet
trigger1 = (Time)
x = 0
y = 0
persistent = 0

But after 14 ticks, the character will resume normal jumping movement.

Code:
[State ***2: VelSet]
type = VelSet
trigger1 = (Time > 14)
x = FVar(0)
y = FVar(1)
persistent = 0

[State ***2: VelAdd]
type = VelAdd
trigger1 = (Time > 14)
y = 0.45

Parry spark can be added here.
[Explod]

And this ends the aerial parry state when the character lands.

Code:
[State ***2: ChangeState]
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 52

This is the aerial parry state helper. It should use an invisible anim, with no Clsns.

Code:
[Statedef ***3]
type = A
movetype = I
physics = N
anim = ***3
poweradd = 0
juggle = 0
facep2 = 0
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2

[State ***3: ParentVarSet]
type = ParentVarSet
trigger1 = (!Time)
var(0) = 8
ignorehitpause = 1

[State ***3: DestroySelf]
type = DestroySelf
trigger1 = (Parent, Command != "holdfwd")
Last Edit: April 10, 2009, 09:48:51 am by Cyanide
Gathering Energy Effect with Helpers
#52  May 29, 2005, 11:23:40 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This creates an effect of particles gathering to one point from random areas of a given radius. It is the opposite to Disperse Effects.

In the state where you want to accomplish the effect, create a helper like so:

Code:
[State 9000: Helper]
type = Helper
trigger1 = [Insert trigger here.]
helpertype = Normal
name = "PerseEffect"
id = 9001
pos = *,*
postype = p1
facing = 1
stateno = 9001
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0

[Statedef 9001]
type = A
movetype = I
physics = N
anim = **** ;Invisible anim

You will need 2 variables for this effect. Don't worry about assigning new variables for the helper; They use their own set of variables, so you can leave it at the current values.

These next 2 pieces are used for the radius of the effect. Adjust these to your preference.

Code:
[State 9001: VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = -120,120

[State 9001: VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = -120,120

This is used to create the particles themselves. You can change the trigger if you'd like.

Code:
[State 9001: Helper]
type = Helper
trigger1 = ((GameTime%8) = 0)
helpertype = Normal
name = "PerseEffect"
id = 9002
pos = var(0),var(1)
postype = p1
facing = 1
stateno = 9002
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
ignorehitpause = 1

This used to destroy the helper. As for when it is destroyed, is up to you. The effect will continue to happen as long as the helper is around.

Code:
[State 9001: DestroySelf]
type = DestroySelf
trigger1 = ;(Insert trigger here.)

This is the state of the particles themselves. Be sure to give the proper anim for 9002.

Code:
[Statedef 9002]
type = A
movetype = I
physics = N
anim = 9002
sprpriority = 3

This is used to move the particles toward the center of effect.

Code:
[State 9002: PosAdd]
type = PosAdd
trigger1 = 1
x = IfElse(ParentDist X <= 0,-5,5)
y = IfElse(ParentDist Y <= 0,-5,5)

This detroys the particle when it comes in range of the center of the effect. If it is already in range when it was created, it will be detroyed after 10 game ticks.

Code:
[State 9002: DestroySelf]
type = DestroySelf
trigger1 = (ParentDist X <= 5) && (ParentDist Y <= 5) && (Time > 10)
Last Edit: April 10, 2009, 09:49:33 am by Cyanide
Additional Projectile Effects
#53  May 29, 2005, 11:31:18 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is a way to create special effects in your projectiles, such as dust or afterimage effects.

In your character's move, create a projectile like normal, but in addition to this, add in a Helper parameter, something like this for example:

Code:
[State 9000: Helper]
type = Helper
trigger1 = ;[Insert trigger here.]
helpertype = Normal
name = "Projectile Effect"
id = 9000
pos = **,**
postype = p1
facing = 1
stateno = 9001
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0

State 9000 is the state where your character releases the projectile and helper, while State 9001 is the Helper itself. The "pos" parameter must be suited according to the position of the projectile released; Use the same values from the Projectile controller to this one. [Insert trigger here.] should be the same as the Projectile's trigger, as they will then be released at the same time.

You can create the Helper's state in which you can add in all the Projectile's effects:

AfterImage effects: I usually have the Helper's anim the same as the Projectile's anim, but if you wish for the AfterImages to be something else, then by all means, change it. ;)

Code:
[Statedef 9001]
type = A
movetype = I
physics = N
anim = 9001

The X/Y values of this piece must match to the X/Y velocities of your character's Projectile controller.

Code:
[State 9001: VelSet]
type= VelSet
trigger1 = (!Time)
x = *
y = *

Now, you can add in any effects of your own to the Helper. This is one example, showing how to create AfterImage effects. (Version. 041401 and under.)

You can also add in your own effects such as Dust effects, or whatever.

Code:
[State 9001: AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = Invisible
flag2 = NoShadow

[State 9001: AfterImage]
type = AfterImage
trigger1 = (!Time)
time = 20
timegap = 1
framegap = 7
length = 15
paladd = 0, 0, 0
palmul = .50, .50, .50
palcontrast = 110,110,110
trans = add

Finally, this is used to destroy the Helper when the Projectile is removed, whether it was guarded, made a successful hit, or left the screen.

The ID parameter must match to the ID of the Projectile being used.

Code:
[State 9001: DestroySelf]
type = DestroySelf
trigger1 = (Parent, NumProjID(****) = 0)
Last Edit: April 10, 2009, 09:50:07 am by Cyanide
Recovery Roll
#54  May 29, 2005, 11:33:39 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is SFA3's recovery roll feature. When your character falls to the ground, he/she can immediately roll towards your opponent as soon he/she hits the ground. Useful for surprise attacks.

The distance of the roll depends on how long you hold the forward command, although there is a minimum and maximum distance.

We're going to override a few states. Be sure to add in a command for the recovery roll, which is typically any 2 kick buttons.

First, override state 5050. Look for this:

Code:
[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE

And replace it with:

Code:
[State 5050: Null]
type = Null
trigger1 = (!Time)
trigger1 = (Var(0) := 0)
trigger2 = (Vel Y > -1) && (Alive) && (Command = "recovery roll")
trigger2 = (Var(0) := 1)

[State 5050: ChangeState]
type = ChangeState
trigger1 = (Vel Y > 0) && (Pos Y >= IfElse((Anim = [5051,5059]) || (Anim = [5061,5069]),0,25))
value = IfElse(Var(0) = 1,****,5100)

Now, override state 5071. Look for this:

Code:
[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 15
type = ChangeState
value = 5110

Replace it with this:

Code:
[State 5071: Null]
type = Null
trigger1 = (!Time)
trigger1 = (Var(0) := 0)
trigger2 = (Vel Y > -1) && (Alive) && (Command = "recovery roll")
trigger2 = (Var(0) := 1)

[State 5071: ChangeState]
type = ChangeState
trigger1 = (Vel Y > 0) && (Pos Y >= 15)
value = IfElse(Var(0) = 1,****,5110)

Now, the recovery roll state.

Code:
[Statedef ****]
type = L
movetype = I
physics = N
anim = ****
velset = 0,0
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 1
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 0

[State ****: NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State ****: PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State ****: PosSet]
type = PosSet
trigger1 = (!Time)
y = 0

[State ****: VelSet]
type = VelSet
trigger1 = (!Time)
x = 4.5
y = 0

[State ****: ChangeState]
type = ChangeState
trigger1 = ((Time > 25) && (Command != "holdfwd")) || ((Time > 35) && (Command = "holdfwd"))
value = 5120

Lastly, we add this under StateDef -2/-3. This is used to reset the recovery roll variable, just in case.

Code:
[State -2: VarSet]
type = VarSet
trigger1 = (Var(0) = 1) && (MoveType != H)
var(0) = 0
Last Edit: April 10, 2009, 09:50:27 am by Cyanide
Safe Fall
#55  May 29, 2005, 11:36:44 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is CvS2's safe fall feature. It is available under the A, N, and K grooves. It is also a common feature in the KOF games, though it may work a bit differently.

Safe fall only works against certain knock down attacks. Usually moves that knock you directly to the ground cannot be safe falled, as well as -any- super moves.

Put this under StateDef -2/-3. Var(0) is used to detect the command performed, while Var(1) is used to detect that you've been hit by a super move.

Be sure to add in a command for "safe fall" in your CMD file.

Code:
[State -2: Null]
type = Null
trigger1 = ((StateNo = 5050) || (StateNo = 5071)) && (Pos Y <= -10) && (Command = "safe fall")
trigger1 = (Var(0) := 1)
trigger2 = (MoveType != H)
trigger2 = (Var(0) := 0)
trigger3 = (MoveType = H) && (EnemyNear, HitDefAttr = SCA,HA,HP,HT)
trigger3 = (Var(1) := 1)
trigger4 = (MoveType != H)
trigger4 = (Var(1) := 0)

[State -2: ChangeState]
type = ChangeState
trigger1 = (!Time) && (StateNo = 5100) && (Var(0) = 1)
value = ****

And now, the Safe Fall state.

Code:
[Statedef ****]
type = S
movetype = I
physics = S
anim = ****
velset = 0,0
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 1
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2

[State ****: NotHitBy]
type = NotHitBy
trigger1 = (!Time)
value = SCA
time = 10

[State ****: PosSet]
type = PosSet
trigger1 = (!Time)
y = 0

[State ****: VelSet]
type = VelSet
trigger1 = (!Time)
x = -8

[State ****: ChangeState]
type = ChangeState
trigger1 = (!AnimTime)
value = 0

And that is all there is to it.
Last Edit: April 10, 2009, 09:50:49 am by Cyanide
SFA3 Recovery
#56  May 29, 2005, 11:40:43 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
By default, all characters in Mugen have a recovery system, very much like in Street Fighter Alpha 3. This is a modification to the system, so that recovering from a knock down attack will be the same as it was in SFA3.

First, your character's HitDef's: In any attack that knocks the opponent down, be sure to add in a "fall.recover = 0" paramter. Eg.

Code:
[State 9000: HitDef]
type = HitDef
trigger1 = ;[Insert trigger here.]
attr = S, NA
fall.recover = 0

Next, in your own character's states. Make sure that your character uses it's own common1.cns file before proceeding:

In State 5050, you should find these 2 state controllers. Remove them, or comment them out.

Code:
[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

You add these in the -2 states: These are used to tell both your character and the opponent when it is okay to recover; When the other character has control.

Var(0) is used to detect when the opponent has gained control, while Var(1) is used to detect when your character has gained control.

Code:
[State -2: VarSet]
type = VarSet
trigger1 = (StateNo != 5050) && (StateNo != 5071)
var(0) = 0

[State -2: VarSet]
type = VarSet
trigger1 = (Var(0) = 0) && (EnemyNear, Ctrl) && ((StateNo = 5050) || (StateNo = 5071))
var(0) = 1

[State -2: VarSet]
type = VarSet
trigger1 = (P2StateNo != 5050) && (P2StateNo != 5071)
var(1) = 0

[State -2: VarSet]
type = VarSet
trigger1 = (Var(1) = 0) && (Ctrl) && ((P2StateNo = 5050) || (P2StateNo = 5071))
var(1) = 1

[State -2: ChangeState]
type = ChangeState
triggerall = (Var(0) = 1) && ((StateNo = 5050) || (StateNo = 5071))
trigger1 = (Vel Y > 0) && (Alive) && (Command = "recovery")
value = 5200

[State -2: ChangeState]
type = ChangeState
triggerall = (Var(0) = 1) && ((StateNo = 5050) || (StateNo = 5071))
trigger1 = (Vel Y > -1) && (Alive) && (Command = "recovery")
value = 5200

[State -2: TargetState]
type = TargetState
triggerall = (Var(1) = 1) && (NumTarget > 0) && ((P2StateNo = 5050) || (P2StateNo = 5071))
trigger1 = (Target, Vel Y > 0) && (Target, Alive) && (Target, Command = "recovery")
value = 5200

[State -2: TargetState]
type = TargetState
triggerall = (Var(1) = 1) && (NumTarget > 0) && ((P2StateNo = 5050) || (P2StateNo = 5071))
trigger1 = (Target, Vel Y > -1) && (Target, Alive) && (Target, Command = "recovery")
value = 5200

This is the closest thing I can do for the SFA3 Recovery system, based on my observations while playing SFA3.
Last Edit: April 10, 2009, 09:51:10 am by Cyanide
Custom Combos. A Groove
#57  May 29, 2005, 11:53:24 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is an immitation of the cool Custom Combo of Street Fighter Zero 2. You use a state to start the mode, then proceed to walk very fast towards your enemy. The attacks are super fast, cancellable, and there is no juggle check, so large air combos are OK.

OK, in this example we are using Var(0) as the Mode Timer.

It would be a good idea to add this VelSet to every stand/crouch attack, to keep close to your enemy. Eg.

Code:
[State 200: VelSet]
type = Velset
trigger1 = Var(0) > 0
x = 4

Then, open up the CMD file. We need to make sure that all the attacks can be cancelled freely. Add the following line to the existing triggers:

Code:
;Stand Light Punch
[State -1: ChangeState]
type = ChangeState
value = 200
triggerall = (Command = "x") && (Command != "holddown")
trigger1 = (StateType = S) && (Ctrl)
trigger2 = (StateNo = 200) && (Time > 6)
trigger3 = (StateType = S) && (MoveContact) && (Var(0) > 0) ;<--------------------- This one!!!

Also, add a ChangeState to use the mode change. Here is the one I used:

Code:
[State -1: ChangeState]
type = ChangeState
value = 9000
triggerall = (Power > 1000) && (Var(0) = 0)
trigger1 = (Command = "recovery") && (StateType = S) && (Ctrl)

Now, the change mode state:

Code:
[Statedef 9000]
type = S
movetype = I
physics = S
anim = 195
ctrl = 0
velset = 0,0
sprpriority = 2

[State 9000: SuperPause]
type = SuperPause
trigger1 = [Insert trigger here.]
pos = 15, -77
anim = 100
sound = 20, 0
poweradd = -1000

[State 9000: AfterImage]
type = AfterImage
trigger1 = [Insert trigger here.]
time = 2
length = 30
palbright =? 0, 0, 0
palcontrast = 100,100,190
paladd = 0,0,30
palmul = .45,.45,.75
timegap = 1
framegap = 4
trans = add

The value assigned to Var(0) determines the length of the mode.

Code:
[State 9000: VarSet]
type = VarSet
trigger1 = (!Time)
v = 0
value = 300

[State 9000: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0)
value = 0
ctrl = 1

We need a state that makes the player walk forward, so...

Code:
[Statedef 9001]
type? ? = S
physics = S
anim = 20
sprpriority = 1

[State 9001: VelSet]
type = VelSet
trigger1 = 1
x = 6

[State 9001: AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = NoAutoTurn

[State 9001: ChangeState]
type = ChangeState
trigger1 = Var(0) = 0
value = 0
ctrl = 1

To make it work right, override State 0 by adding this state:

Code:
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

This is the new state added to the standing:

Code:
[State 0: ChangeState]
type = ChangeState
trigger1 = (Var(0) > 0)
value = 9001
ctrl = 1

And now, the -3's...

Code:
[Statedef -3]

[State -3: VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0)
v = 0
value = -1
ignorehitpause = 1

Cancel V-Ism Mode if you get hit or win the round.

Code:
[State -3: VarSet]
type = VarSet
trigger1 = (MoveType = H) || (Roundstate = 3)
v = 0
value = 0

Sorrowedge's Haste Code,? modified for faster anims.

Code:
[State -3: ChangeAnim] 
type = ChangeAnim
triggerall = (Var(0) > 0) && (RoundState = 2) && (MoveType != H)
trigger1 = AnimElemTime(AnimElemNo(0) + 1) < 0
trigger1 = AnimElemTime(AnimElemNo(0)) > floor ((AnimElemTime(AnimElemNo(0)) - AnimElemTime(AnimElemNo(0) + 1))/3)
ignorehitpause = 1
value = Anim
elem = AnimElemNo(0) + 1

PalFX's during the mode.

Code:
[State -3: PalFX]
type = PalFX
trigger1 = (Var(0) > 0) && ((GameTime%3) = 0)
time = 2
add = 0,16,132
sinadd = 5,32,164,2

This ensures that the AfterImages are displaying during mode.

Code:
[State -3: AfterImageTime]
type = AfterImageTime
trigger1 = (Var(0) > 0)
time = 2

Infinnite juggle points!

Code:
[State -3: AssertSpecial]
type = AssertSpecial
trigger1 = (Var(0) > 0)
flag = NoJuggleCheck

Tone down the damage.

Code:
[State -3: AttackMulSet]
type = AttackMulSet
trigger1 = (Var(0) > 0)
value = 0.2

Damange back to normal, when the mode is off.

Code:
[State -3: AttackMulSet]
type = AttackMulSet
trigger1 = (Var(0) = 0)
value = 1

There you are. This is the closest I could get to the SFZ2 V-Ism Mode, but I'm sure that many cool things can be done.
Last Edit: April 10, 2009, 09:51:43 am by Cyanide
Hyper Combo Finish
#58  May 29, 2005, 12:22:29 pm
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
In many games now, there is usually a special effect that occurs when you have knocked out the opponent, eg. a special background effect if you have finished the opponent with a hyper move.

Now, we're going to use a helper to create the WinKO effect. With a helper, you can neatly program everything in that state, and prevents any bugs such as repeated effects.

Insert this under StateDef -2/-3. If you want this to trigger only when you have knocked out the opponent with a special/hyper move, you can add in the appropriate triggers to do so, such as, "StateNo = 3000"

Code:
[State -2: Helper]
type = Helper
trigger1 = (WinKO) && (NumHelper(****) = 0)
helpertype = Normal
name = "WinKO"
id = ****
pos = 0,0
postype = p1
facing = 0
stateno = ****
keyctrl = 0
ownpal = 1
supermovetime = 1000
pausemovetime = 1000
ignorehitpause = 1

Next, the helper's state:

Code:
[Statedef ****]
type = S
movetype = I
physics = N
anim = **** ;Invisible anim.

This is where you may add in flashy effects, explods, or sounds. This particular example is a simple black out effect, that gradually fades the screen back to normal.

This pauses the effect for a moment.

Code:
[State ****: Pause]
type = Pause
trigger1 = (!Time)
time = 12
movetime = 12

This darkens the background for 12 ticks. It gradually goes bright during the time.

Code:
[State ****: EnvColor]
type = EnvColor
trigger1 = (Time < 12)
value = (Time*4),(Time*4),(Time*4)
time = 1
under = 1

This causes the screen to shake a bit.

Code:
[State ****: EnvShake]
type = EnvShake
trigger1 = (!Time)
time = 12
freq = 120
ampl = -3
phase = 90

And this is causes the characters and the stage to lose their colour, only to be gradually brought back as the black out ends.

Code:
[State ****: AllPalFX]
type = AllPalFX
trigger1 = (Time < 50)
time = 1
add = 0,0,0
mul = 256,256,256
sinadd = 0,0,0,1
invertall = 0
color = (Time*5)

You don't need a DestroySelf in this code, as the helper is removed when the round ends, so I'll leave it out.
Last Edit: April 10, 2009, 09:52:04 am by Cyanide
Point to Point Equation. Movement
#59  May 29, 2005, 12:27:06 pm
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Point to Point Equation

This is an equation that can be used to move an object from one point to another, according to the relative destination, ie. the opponent.

An example for such a use for this equation is to shoot a projectile directly at the opponent. This does not include homing capabilities.

This example shows how to move the character or such, to move directly to the opponent in a straight path using a VelSet.

This is used to set the velocities, where "10" is the base velocity overall.

Code:
[State ****: Null]
type = Null
trigger1 = (!Time)
trigger1 = (FVar(0) := (P2Dist X * 10) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))
trigger1 = (FVar(1) := (P2Dist Y * 10) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))

[State ****: VelSet]
type = VelSet
trigger1 = (Whatever)
x = FVar(0)
y = FVar(1)
Last Edit: April 10, 2009, 09:52:38 am by Cyanide

SyN

Code Snippet Archive
#60  June 08, 2005, 09:48:33 pm
Just something anyone could use to have a final hit dramtic finish to there character.

[State -2]
type = Pause
triggerall = var(x) = 1
trigger1 = (winko)
time = 70

[State -2 ]
type = VarAdd
triggerall = (winko)
trigger1 = time > 0
v =  x; <--whatever open value
value = 1

[State -2 ]
type = Varset
triggerall = (!winko)
trigger1 = time = 0
v =  x; <--whatever open value
value = 0

The first part of the code is the pause code that I used under statedef -2 since this happens at a certain moment of the game.
But if I just use that code alone,without the triggerall,  it will continuosly happen over and over again since anything under statedef -2 happens all of the time in mugen.(while fighting of course) To prevent the continuous pausing after a knock out, thats where the second and third  part of the code come in, creating a variable that responds at the moment when the pause trigger should activate and prevent it from continuing over and over again. Now that the varaibles are created to happen at the knockout screen, and stops after a certain period of time, you can see where the triggerall comes in at for the pause code.

I explained the above for those who dont know or could correctly understand the code above.

to spice it up some, create a bgpalfx code or/and a playsnd code with a special ko sound.  <---optional
Also if you go that route, add a triggerall = var(x) = 1 line to either code so it will happen at that moment.

Here is an example of the code in effect,

The things in this vid is just a demo

Just to give a demonstration of that code in effect.
Last Edit: June 08, 2005, 09:56:29 pm by SyN