YesNoOk
avatar

Code Snippet Archive (Read 334127 times)

Started by aokmaniac13, May 28, 2005, 01:48:59 am
Share this topic:
Code Snippet Archive
New #1  May 28, 2005, 01:48:59 am
  • ******
  • Just a butcher on a mission
    • www.justnopoint.com/lbends
Angled projectile
This code will make any projectile face the direction it's going
Make sure the projectile was facing down to begin with.

Code:
[State 3001, blah]
type = AngleSet
trigger1 = time
value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

[State 3001, blah]
type = AngleDraw
trigger1 = 1

Spoiler, click to toggle visibilty
Last Edit: November 11, 2016, 12:24:09 pm by Odb718
Simplified Command Buffer
#2  May 28, 2005, 01:49:41 am
  • ******
  • Just a butcher on a mission
    • www.justnopoint.com/lbends
A simple command buffering system

In the CMD file before any and all commands:
Code:
[State -1, Buffer]
type = VarSet
triggerall = command = "??" ;Change this to a command you want to buffer
trigger1 = (var(5):=7)? ;This sets the amount of time to hold the buffer
v = 4
value = ? ;Change this to a unique ID for each command


[State -1, Unbuffer]
type = VarSet
trigger1 = !(var(5):=var(5)-1)
v=4
value = 0


;How to use the buffer
;Let's say we have punch=1 and kick=2

;Attack
[State -1, Attack]
type = ChangeState
value = 240
triggerall = statetype != A
triggerall = ctrl
trigger1 = command = "kick"
trigger2 = time <= 1
trigger2 = var(4) = 2

;Attack
[State -1, Attack]
type = ChangeState
value = 200
triggerall = statetype != A
triggerall = ctrl
trigger1 = command = "punch"
trigger2 = time <= 1
trigger2 = var(4) = 1
Last Edit: December 28, 2007, 04:37:04 pm by Picard
Flying Debris on getHit
#3  May 28, 2005, 01:50:21 am
  • ******
  • Just a butcher on a mission
    • www.justnopoint.com/lbends
Flying Debris on getHit

Code:
[State -3, Place Decider]
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(guarded) = 0
trigger1 = MoveType = H
v = 59
value = GetHitVar(groundtype)
IgnoreHitPause = 1


[State -3, Sparks]
type = VarAdd
trigger1 = Time = 0
trigger1 = GetHitVar(guarded) = 0
trigger1 = MoveType = H
v = 57
value = floor(GetHitVar(damage)/8) ;Change this to get more or less
IgnoreHitPause = 1

;Three helper sctrls, one for hi,medium, and low
[State -3, Helper]
type = Helper
triggerall = Var(57) > 0
trigger1 = Var(57) > 0&&var(57) := var(57) - 1
trigger1 = Var(59) = 1
helpertype = normal
name = "Spark"
postype = p1
pos = 1,-76
facing = 1
stateno = 4000
ownpal = 0
IgnoreHitPause = 1

[State -3, Helper]
type = Helper
triggerall = Var(57) > 0
trigger1 = Var(57) > 0&&var(57) := var(57) - 1
trigger1 = Var(59) = 2
helpertype = normal
name = "Spark"
postype = p1
pos = 5,-55
facing = 1
stateno = 4000
ownpal = 0
IgnoreHitPause = 1

[State -3, Helper]
type = Helper
triggerall = Var(57) > 0
trigger1 = Var(57) > 0&&var(57) := var(57) - 1
trigger1 = Var(59) = 3
helpertype = normal
name = "Debris"
postype = p1
pos = 9,-15
facing = 1
stateno = 4000 ;Change this to whatever, this will be the state of the chunk/debris
ownpal = 0
IgnoreHitPause = 1


;Hit sounds optional.
[State -3, Hit Sound1]
type = PlaySnd
triggerall = Time = 0
trigger1 = GetHitVar(guarded) = 0
trigger1 = GetHitVar(animtype) = 0||GetHitVar(animtype) = 3
trigger1 = MoveType = H
value = 10000, 0
IgnoreHitPause = 1

[State -3, Hit Sound2]
type = PlaySnd
triggerall = Time = 0
trigger1 = GetHitVar(guarded) = 0
trigger1 = GetHitVar(animtype) = 1||GetHitVar(animtype) > 3
trigger1 = MoveType = H
value = 10000, 1
IgnoreHitPause = 1

[State -3, Hit Sound3]
type = PlaySnd
triggerall = Time = 0
trigger1 = GetHitVar(guarded) = 0
trigger1 = GetHitVar(animtype) = 2
trigger1 = MoveType = H
value = 10000, 2
IgnoreHitPause = 1
Last Edit: December 28, 2007, 04:37:44 pm by Picard
Win/Lose/Draw sound
#4  May 28, 2005, 01:50:58 am
  • ******
  • Just a butcher on a mission
    • www.justnopoint.com/lbends
Win/Lose sound

In your win state
Code:
[State #, WIN]
type = PlaySnd
trigger1 = TeamSide = 1
trigger1 = MatchOver = 1
trigger1 = AnimElem = 4 ;Change this to whatever, you can even get rid of it
persistent = 0
value = 3000,4 ;Change this to the win sound

[State #, LOSE]
type = PlaySnd
trigger1 = TeamSide = 2
trigger1 = MatchOver = 1
trigger1 = AnimElem = 4 ;Change this to whatever, you can even get rid of it
persistent = 0
value = 3000,7 ;Change this to the lose sound

Draw sound

In state 175 (draw state)
Code:
[State 175, DRAW]
type = PlaySnd
trigger1 = TeamSide = 1
persistent = 0
value = 3000,7 ;Change this to the draw sound
Last Edit: December 28, 2007, 04:38:40 pm by Picard
Full Powerbar on First Attack
#5  May 28, 2005, 01:52:14 am
  • ******
  • Just a butcher on a mission
    • www.justnopoint.com/lbends
Full powerbar on first attack? (special thanks to Messatsu for designing the trigger)

Code:
[State -2]
type = null
trigger1 = (movetype = H && (stateno != [120,155])) || (target, movetype = H && (target, stateno != [120,155]))
trigger1 = !var(0)
trigger1 = var(0):= movetype = H - target, movetype = H

[State -2]
type = poweradd
trigger1 = var(0)= -1
trigger1 = var(0):= 1
value = 1000
Last Edit: December 28, 2007, 04:39:37 pm by Picard

Blackshinobi

Flight Shin Boutoden styled
#6  May 29, 2005, 03:43:35 am
This is not to be confused with Flying.? Air movementis a type of dashing that is continuous and able to be done while in the air.

WARNING: THIS CODE WILL OVERRIDE YOUR CHARACTERS DIRECTIONAL JUMPING!
? ?
To prevent this (if you want to) add this to the following code? were it is marked ";PREVENT"...

&& (stateno = 50)



1.) Open your character's CMD file with any text editor.

2.) Add this list of commands right ABOVE the [Statedef -1] state definition, making sure they do not have the same name as another command.

It should look a lot like this:

Code:
;------Air Movement Commands--------
;Air Movement
[Command]
name = "uf"
command = /UF
time = 1

;Air Movement
[Command]
name = "ub"
command = /UB
time = 1

;Air Movement
[Command]
name = "df"
command = /DF
time = 1

;Air Movement
[Command]
name = "db"
command = /DB
time = 1

;Air Movement
[Command]
name = "up"
command = /U
time = 1

;Air Movement
[Command]
name = "down"
command = /D
time = 1

;Air Movement
[Command]
name = "fow"
command = /F
time = 1

;Air Movement
[Command]
name = "back"
command = /B
time = 1

3) Place this UNDERNEATH the [Statedef -1] state definition, making
sure they do not have the same stateno (State Number) as another state.

It should look a lot like this:

Code:
;Air Movement
[State -1]
type = ChangeState
value = 101
triggerall = Var(2) = 0
trigger1 = (command = "fow") && (statetype = A) && (ctrl = 1)

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 102
triggerall = Var(2) = 0
trigger1 = (command = "back") && (statetype = A) && (ctrl = 1) ;PREVENT

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 103
triggerall = Var(2) = 0
trigger1 = (command = "uf") && (statetype = A) && (ctrl = 1) ;PREVENT

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 104
triggerall = Var(2) = 0
trigger1 = (command = "ub") && (statetype = A) && (ctrl = 1) ;PREVENT

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 106
triggerall = Var(2) = 0
trigger1 = (command = "down") && (statetype = A) && (ctrl = 1)

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 107
triggerall = Var(2) = 0
trigger1 = (command = "df") && (statetype = A) && (ctrl = 1)

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 108
triggerall = Var(2) = 0
trigger1 = (command = "db") && (statetype = A) && (ctrl = 1)

;---------------------------------------------------------------------------
;Air Movement
[State -1]
type = ChangeState
value = 109
triggerall = Var(2) = 0
trigger1 = (command = "up") && (statetype = A) && (ctrl = 1) ;PREVENT

4) Place this in your characters CNS file UNDERNEATH the [Statedef -2]
state definition, making sure it does not have the same Var number as
a previously used VarSet.
Code:
[State -2, AIR MOVEMENT]
type=VarSet
trigger1=life = 0
v=2
value=1

5) Place this in your characters CNS file, making sure they do not have the
same Statedef as a previously used state.

It should look a lot like this:
Code:
;-------------------
;AIR MOVEMENT Forward
[Statedef 101]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = 12,0 ;Change this to fit your character
ctrl = 1
anim = 101 ;Change this to fit your character

[State 101 , 1]
type = VelAdd
y = -0.45 ;Change this to fit your character
trigger1 = Time >= 0
trigger1 = Time <= 28

;-------OPTI0NAL-----------;Change this to fit your character
[State 101 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTIONAL-----------;Change this to fit your character


[State 101 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Back
[Statedef 102]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = -12,-1 ;Change this to fit your character
ctrl = 1
anim = 105 ;Change this to fit your character

[State 102 , 1]
type = VelAdd
y = -0.43 ;Change this to fit your character
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 102 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character


[State 102 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Up/Forward
[Statedef 103]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = 12,-12 ;Change this to fit your character
ctrl = 1
anim = 101 ;Change this to fit your character

[State 103 , 1]
type = VelAdd
y = -0.43 ;Change this to fit your character
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 103 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character

[State 103 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Up/Back
[Statedef 104]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = -12,-12 ;Change this to fit your character
ctrl = 1
anim = 105 ;Change this to fit your character

[State 104 , 1]
type = VelAdd
y = -0.43 ;Change this to fit your character
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 104 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character

[State 104 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Down
[Statedef 106]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = 0,24 ;Change this to fit your character
ctrl = 1
anim = 41 ;Change this to fit your character

[State 106 , 1]
type = VelAdd
y = -1
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 106 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character

[State 106 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Down/Forward
[Statedef 107]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = 12,12 ;Change this to fit your character
ctrl = 1
anim = 106 ;Change this to fit your character

[State 106 , 1]
type = VelAdd
y = -0.43 ;Change this to fit your character
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 107 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character

[State 107 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Down/Back
[Statedef 108]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = -12,12 ;Change this to fit your character
ctrl = 1
anim = 108 ;Change this to fit your character

[State 108 , 1]
type = VelAdd
y = -0.43 ;Change this to fit your character
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 108 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character

[State 108 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;AIR MOVEMENT Up
[Statedef 109]
type? ? = A
movetype= I
physics = A
juggle? = 0
velset = 0,-24 ;Change this to fit your character
ctrl = 1
anim = 41 ;Change this to fit your character

[State 106 , 1]
type = VelAdd
y = -1
trigger1 = Time = [0,28]

;-------OPTI0NAL-----------;Change this to fit your character
[State 106 , 1]
type = AfterImage
trigger1 = time = 0
time = 32
TimeGap? = 1
FrameGap = 4
length = 15
trans = add
PalContrast =? 200, 200, 200
PalBright = 0,0,0
;-------OPTI0NAL-----------;Change this to fit your character

[State 106 , 3]
type = ChangeState
trigger1 = AnimTime = 50
value = 50
ctrl = 1


For any questions regarding this code, feel free to
contact me at blackshinobi@yahoo.com
Last Edit: April 10, 2009, 09:41:03 am by Cyanide

The Necromancer

MvC Chaining
#7  May 29, 2005, 03:59:16 am
Anyone who has played "Marvel VS Capcom 2" knows what
this system is. This is a different combo system as oppose to most, where the
medium attack buttons are eliminated as "On-Demand" commands, but are used
during chain combos.

Please note: This is not a code, but a simple explanation as how it is done.

To begin, your character must have all of his/her basic attacks, with all the
required chain combo triggers. (movecontact)

FOR STRONG ATTACKS:

1.) In the CMD file, make a copy of the move's state entry. Example:
Code:
;Stand Strong Kick
[State -1: SSK]
type = ChangeState
value = 250
triggerall (command = "c") && (command != "holddown")
trigger1 = (statetype = S && ctrl)
trigger2 = (stateno = 200 && movecontact) || (stateno = 210 && movecontact) || (stateno = 220 && movecontact) || (stateno = 230 && movecontact)
trigger3 = (stateno = 240 && movecontact) || (stateno = 400 && movecontact) || (stateno = 410 && movecontact) || (stateno = 430 && movecontact)
trigger4 = (stateno = 440 && movecontact)
(Make the copy of the state entry)
Code:
;Stand Strong Kick
[State -1: SSK]
type = ChangeState
value = 250
triggerall (command = "c") && (command != "holddown")
trigger1 = (statetype = S && ctrl)
trigger2 = (stateno = 200 && movecontact) || (stateno = 210 && movecontact) || (stateno = 220 && movecontact) || (stateno = 230 && movecontact)
trigger3 = (stateno = 240 && movecontact) || (stateno = 400 && movecontact) || (stateno = 410 && movecontact) || (stateno = 430 && movecontact)
trigger4 = (stateno = 440 && movecontact)
2.) Leave the 1st state entry (The one which was copied) untouched. As for the 2nd
state entry, remove any "On-Demand" triggers, such as "Ctrl":
Code:
;Stand Strong Kick
[State -1: SSK]
type = ChangeState
value = 250
triggerall (command = "c") && (command != "holddown")
trigger1 = (statetype = S && ctrl) ;<-- REMOVE THIS ENTIRE LINE
trigger2 = (stateno = 200 && movecontact) || (stateno = 210 && movecontact) || (stateno = 220 && movecontact) || (stateno = 230 && movecontact)
trigger3 = (stateno = 240 && movecontact) || (stateno = 400 && movecontact) || (stateno = 410 && movecontact) || (stateno = 430 && movecontact)
trigger4 = (stateno = 440 && movecontact)
3.) Make the necessary command trigger changes, and change the move command to one
level lower. If the command was "z", change it to "y". Example:
Code:
;Stand Strong Kick: Alternate Command
[State -1: SSK]
type = ChangeState
value = 250
triggerall (command = "b") && (command != "holddown")
trigger1 = (stateno = 200 && movecontact) || (stateno = 210 && movecontact) || (stateno = 220 && movecontact) || (stateno = 230 && movecontact)
trigger2 = (stateno = 240 && movecontact) || (stateno = 400 && movecontact) || (stateno = 410 && movecontact) || (stateno = 430 && movecontact)
trigger3 = (stateno = 440 && movecontact)
You should now have something like this:
Code:
;----------------------------------------------------------------------------
;Stand Strong Kick
[State -1: SSK]
type = ChangeState
value = 250
triggerall (command = "c") && (command != "holddown")
trigger1 = (statetype = S && ctrl)
trigger2 = (stateno = 200 && movecontact) || (stateno = 210 && movecontact) || (stateno = 220 && movecontact) || (stateno = 230 && movecontact)
trigger3 = (stateno = 240 && movecontact) || (stateno = 400 && movecontact) || (stateno = 410 && movecontact) || (stateno = 430 && movecontact)
trigger4 = (stateno = 440 && movecontact)

;Stand Strong Kick: Alternate Command
[State -1: SSK]
type = ChangeState
value = 250
triggerall (command = "b") && (command != "holddown")
trigger1 = (stateno = 200 && movecontact) || (stateno = 210 && movecontact) || (stateno = 220 && movecontact) || (stateno = 230 && movecontact)
trigger2 = (stateno = 240 && movecontact) || (stateno = 400 && movecontact) || (stateno = 410 && movecontact) || (stateno = 430 && movecontact)
trigger3 = (stateno = 440 && movecontact)

FOR MEDIUM ATTACKS:

The same "Copy and Paste" method from strong attacks is used, except that the
original state entry is removed after this is done.

The original state entry has the "On-Demand" trigger, such as "Ctrl".

Last Edit: April 10, 2009, 09:41:43 am by Cyanide

SorrowEdge

Super Armour/Hyper Armour
#8  May 29, 2005, 04:05:38 am
The increase of a character's resistance. This particular code also gives the character a special trait: He/She will not be able to be knocked down as easily, giving some sort of a "brick wall" feel.

This will require several things:

1.) In the StateDef of all of your character's states, (excluding getting hit states) add in:

velset = (prevstateno = 9000)* X,(prevstateno = 9000)* Y

X is the character's horizontal velocity, and Y is the character's Y velocity.

facep2 = !(prevstateno = 9000)

facep2 causes your character to face the opponent at the beginning of the state.

ctrl = 1

The ctrl parameter is only required in state 0, (standing state) and in state 11, (crouching state) as you want to retain control when getting hit.

2.) Next, the required animation parameter:

[State ***, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0 && Anim != ***
value = ***


3.) The required -2/-3 states:
Code:
;The armor effect only occurs when your character not in his/her basic states. 
(standing, walking, etc...)
[State -3, VarSet]
type = VarSet
trigger1= (StateNo >= 200) && (MoveType != H)
var(0) = StateNo

[State -3, Armor2]
type = HitOverride
trigger1= (StateNo >= 200) && (MoveType != H)
time = 1
slot = 2
attr = SCA, AA
stateno = 9000
4.) Lastly, the armor state!
Code:
[Statedef 9000]
MoveType = H?

[State 9000, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 9000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, AA, AP
time = 1

[State 9000, LifeAdd]
type = LifeAdd
trigger1 = Time = 0
value = - floor(gethitvar(damage) / 2)

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time < floor(gethitvar(hittime) * 0.8)
value = Anim
elem? = AnimElemNo(0)

[State 9000, End]
type = ChangeState
trigger1 = Time >= floor(gethitvar(hittime) * 0.8)
value = Var(0)
Last Edit: April 10, 2009, 09:42:12 am by Cyanide
Back Dash (Continuous)
#9  May 29, 2005, 04:12:07 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
By default, characters do not have a back dash, but a back hop. This is a very simple code that creates the back dash effect.

You may either re-write state 105, or simply make your own. (Which will take precedence over the default codes.)

This is the new run back state:

[Statedef 105]
type? ? = S
physics = N
ctrl = 0
anim = 105

[State 105, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

[State 105, 2]
type = CtrlSet
trigger1 = Time = 2
value = 1

[State 105, 3]
type = ChangeState
trigger1 = command != "holdback"
value = 106
Last Edit: November 07, 2007, 11:39:48 pm by DavidGee
Custom BG Music
#10  May 29, 2005, 04:18:59 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Custom BG Music -- Ever want to play a song against a particular character? Or a BG Music change during the 3rd match? This code shows how you can play your own BG music.

1.) First, create the BG Music activation. A variable is required for
this effect.

The trigger can be something like:
RoundNo = 3
Matcho = 9

etc...

[Statedef -3]
type = VarSet
trigger1 = (whatever)
v = 0
value = 1

Also, you'll need to create the helper. Even if music is not going to play, the helper will be available to be ready when the effect occurs.

;Custom music creator
[State -3: Helper]
type = Helper
trigger1 = NumHelper(9000) = 0
helpertype = Normal
name = "CustomBGMusic"
id = 9000
pos = 0,0
postype = p1
facing = -1
stateno = 9000
keyctrl = 0
ownpal = 1
supermovetime = 999999999
pausemovetime = 999999999
2.) Now, create a helper. This helper will be reponsible for creating this effect. (With no interruptions.)

;Custom Music Creator
[Statedef 9000];etc...

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

[State 9000: AssertSpecial]
type = AssertSpecial
trigger1 = Parent, Var(0) = 1
flag = NoMusic

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

[State 9000: PlayerPush]
type = PlayerPush
trigger1 = 1
value = 1

;The "loop = 1" is VERY important, to keep the music playing at all times.
[State 9000: PlaySnd]
type = PlaySnd
trigger1 = Parent, Var(0) = 1
value = *,*
loop = 1
abspan = 0
persistent = 0
Imporant Note: Be sure your music files are small! (Don't want to take up too much memory, heh heh...)

Last Edit: November 07, 2007, 11:37:38 pm by DavidGee
Guard Crush
#11  May 29, 2005, 04:27:11 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Guard Crush is a system that prevents a character from "turtling." This limits how much the character can block attacks and becomes stunned after this limit has been reached.

We'll need to create the counter for this system. The first part is this system to is to decrease the gauge whenever your character successfully guarded an attack.

[State -3, VarAdd]
type = Varadd
triggerall = (GetHitVar(HitShakeTime) = 5)
trigger1 = (StateNo = 150) || (StateNo = 152)
var(0) = 1
ignorehitpause = 1

[State -3, VarAdd]
type = VarAdd
triggerall = (GetHitVar(HitShakeTime) = 10)
trigger1 = (StateNo = 150) || (StateNo = 152)
var(0) = 2
ignorehitpause = 1

[State -3, VarAdd]
type = Varadd
triggerall = (GetHitVar(HitShakeTime) = 15)
trigger1 = (StateNo = 150) || (StateNo = 152)
var(0) = 3
ignorehitpause = 1

This is used, to recover from the effect if the character is not blocking, or getting hit by an attack...

[State -3, VarAdd]
type = VarAdd
triggerall = (Var(0) > 0) && (!Time) && (StateNo = 5000) && (Alive)
trigger1 = (Anim = 5000) || (Anim = 5001) || (Anim = 5010) || (Anim = 5011)
var(0) = -3
ignorehitpause = 1

...and this is used when the character has reached his/her limit.

[State -3, VarAdd]
type = VarAdd
triggerall = (Var(0) > 0) && (!Time) && (StateNo = 5010) && (Alive)
trigger1 = (Anim = 5020) || (Anim = 5021)
var(0) = -3
ignorehitpause = 1

[State -3, VarAdd]
type = VarAdd
triggerall = (Var(0) > 0) && (!Time) && (StateNo = 5000) && (Alive)
trigger1 = (Anim = 5002) || (Anim = 5012)
var(0) = -6
ignorehitpause = 1

[State -3, VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0) && (!Time) && (StateNo = 5010) && (Alive) && (Anim = 5022)
var(0) = -6
ignorehitpause = 1

[State -3, VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0) && (!Time) && (StateNo = 5100) && (Alive)
var(0) = -9
ignorehitpause = 1
 
A code is needed, to recover from the effect if the character is not blocking, nor getting hit by an attack.

[State -3, VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0) && ((GameTime%5) = 0) && (MoveType != H) && (StateNo != [130,160])
var(0) = -1
ignorehitpause = 1

[State -3, ChangeState]
type = ChangeState
trigger1 = var(0) >= 100
value = 9000
ctrl = 0
ignorehitpause = 1

This is the state where the character is opened for an attack (A GetHit State). You can create your own variation of the effect. This is just one example:

[Statedef 9000]
type = S
movetype = H
physics = S
anim = 9000
ctrl = 0

[State 9000, VarSet]
type = VarSet
trigger1 = (!Time)
v = 0
value = 0

[State 9000, NotHitBy]
type = NotHitBy
trigger1 = (Time < 10)
value = SCA

[State 9000, VelSet]
type = VelSet
trigger1 = (!Time)
x = -5

[State 9000, ChangeState]
type = ChangeState
trigger1 = (Time = 15)
value = 0


Add any special effects in this state, like in SFA3 (flash effects).
Last Edit: November 07, 2007, 11:37:22 pm by DavidGee
Haste
#12  May 29, 2005, 04:31:21 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
A feature uncommon in fighting games, where your character's speed is increased. This is a fairly small piece of code, and can be easily implemented into your character.

;Haste/V-ism
[State -3, Speed]
type = ChangeAnim
triggerall = (RoundState = 2) && (MoveType != H)
trigger1 = AnimElemTime(AnimElemNo(0) + 1) < 0
trigger1 = AnimElemTime(AnimElemNo(0)) > floor ((AnimElemTime(AnimElemNo(0)) - AnimElemTime(AnimElemNo(0) + 1))/2)
ignorehitpause = 1
value = anim
elem = AnimElemNo(0) + 1
Last Edit: November 07, 2007, 11:39:13 pm by DavidGee
Text and Custom Intros
#13  May 29, 2005, 04:37:48 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Text intros can be used to simulate a conversation between fighters before a fight, to tell back story, or just to add flare to your character. They normally consist of a special intro triggered when fighting certain opponents that contains several explode "text box" statements.

1.) Triggering the custom Intro

This should be in your intro (Statedef 191) state. Notice the Pos triggers: these are used to determine whether your character is on the left or right side. This is important because without two states your text boxes can appear reversed when he/she is on the right.

[State 191, 1] ;If P1 is on the left
type = ChangeState
trigger1 = (Time = 0) && (P2Name = "Whomever you want the intro with") && (Pos X < 0)
value = 1990

[State 19 , 1] ;If P1 is on the right
type = ChangeState
trigger1 = (Time = 0) && (P2Name = "Whomever you want the intro with") && (Pos X > 0)
value = 1991

2.) Custom Intro, left side.

[Statedef 1990]
type = S
ctrl = 0
physics = N
anim = 191 ;Whatever animation number your intro is in the air file

[State 1990, 1]
type = AssertSpecial
trigger1 = Time <= 510 ;Make sure this is enough time for your intro to be displayed
flag = Intro
flag2 = NoBarDisplay

[State 1990, 2] ;This box is above P1
type = Explod ;These explod statements are in pairs, this one displays a transparent background for the text
trigger1 = Time = 26
anim = 8300
pos = -210,170
postype = right
id = 8300
sprpriority = 2
removetime = 115
ownpal = 0

[State 1990, 2b] ;And this one displays the text. Make sure both display long enough for the text to be read.
type = Explod
trigger1 = Time = 30
anim = 8322
pos = -210,170
postype = right
id = 8322
sprpriority = 3
removetime = 110
ownpal = 0

[State 1990, 3] ;This box is above P2
type = Explod ;This is the box
trigger1 = Time = 140
anim = 8300
pos = -105,170
postype = right
id = 8300
sprpriority = 2
removetime = 115
ownpal = 0

[State 1990, 3b]
type = Explod ;This is the text
trigger1 = Time = 144
anim = 8323
pos = -105,170
postype = right
id = 8323
sprpriority = 3
removetime = 110
ownpal = 0

[State 1990, 4] ;This box is above P1
type = Explod ;This is the box
trigger1 = Time = 255
anim = 8300
pos = -210,170
postype = right
id = 8300
sprpriority = 2
removetime = 115
ownpal = 0

[State 1990, 4b]
type = Explod ;This is the text
trigger1 = Time = 260
anim = 8324
pos = -210,170
postype = right
id = 8324
sprpriority = 3
removetime = 110
ownpal = 0

[State 1990, 5] ;This box is above P2
type = Explod ;This is the box
trigger1 = Time = 370
anim = 8300
pos = -105,170
postype = right
id = 8300
sprpriority = 2
removetime = 115
ownpal = 0

[State 1990, 5b]
type = Explod ;This is the text
trigger1 = Time = 374
anim = 8325
pos = -105,170
postype = right
id = 8325
sprpriority = 3
removetime = 110
ownpal = 0


For the right side custom intro (statedef 1991) us the same code but switch the explod pos attributes, so P1 would have
pos = -105,170

and P2 would have
pos = -210,170
Last Edit: November 07, 2007, 11:40:32 pm by DavidGee
Invisibility
#14  May 29, 2005, 04:52:34 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
You probably remember characters such as Mortal Kombat's "Reptile", or Killer Instint 2's "Fulgore" as some of the few to have such an ability.

Quite unique, isn't it? =P

1.) First, the move itself.

[Statedef 9000]
type = S
movetype = I
physics = S
anim = **** ;<---if character has an animation making him/her invisible
ctrl = 0

[State 9000, VarSet]
type = VarSet
trigger1 = AnimTime = 0
v = 0
value = 1

[State 9000, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
[/code]

2.) Now, the -3 states.

[code];The invisibility part.
[State -3, AssertSpecial]
type = AssertSpecial
trigger1 = Var(0) = 1
flag = Invisible

;If hit, returns to visible...
[State -3, VarSet]
type = VarSet
trigger1 = (MoveType = H) || (RundState = 3)
v = 0
value = 0
Last Edit: November 07, 2007, 11:41:18 pm by DavidGee
Life Persistency
#15  May 29, 2005, 05:04:00 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
One of KOF's unique features, was the persistentcy of life values between rounds. This is particularly useful if you are creating a 3 on 3 type character just as in KOF.

This feature was also present in games such as KI, where you have one round fights.

This code requires one persistent variable.

1.) To begin, insert this code into statedef -2:

;Life Persistency between rounds.
[State -2: VarSet]
type = VarSet
trigger1 = Win
v = 0
value = Life

2.) Now, in state 180, or your win state, add in this code. This is used to add in half of your current life, just as in the original KOF games. Of course, this is optional.

[State 180: LifeAdd]
type = LifeAdd
trigger1 = Time = 0
value = (Life/2)
absolute = 1

3.) Finally, in state 5900, add this code in. This is what keeps the life values between rounds.

[State 5900: LifeSet]
type = LifeSet
trigger1 = (Time = 0) && (RoundNo > 1) && (Var(0) > 0)
value = Ceil(Var(0))

Alternatively, you may use this code instead, if your character does not use it's own common1.cns file.

[State -2: LifeSet]
type = LifeSet
trigger1 = (RoundState = 1) && (Time = 0) && (RoundNo > 1) && (Var(0) > 0)
value = Ceil(Var(0))
Last Edit: November 07, 2007, 11:42:08 pm by DavidGee
Morph
#16  May 29, 2005, 05:12:27 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
The ability to change one's fighting style, appearance, or adds in a special feature. Can be used to create many new moves.

[Statedef 9000]
Type? ? = S
movetype= A
physics = S
juggle? = 4
velset = 0,0
anim = *** ;Animation for transformation
ctrl = 0

;This sets the variable for the effect. Sets Var(0) to a value of 1.
[State 9000, ChangeMode]
Type = VarSet
trigger1 = (whatever)
var(0) = 1


Next, the effect. Use the trigger "Var(0) = 1" for any effects you may want to add. For a general effect, such as an increase in strength, use a -2 state. Example:

;Used for normal strength. (Very important)
[State -2, AttackMulSet1]
type = AttackMulSet
trigger1 = Var(0) != 1
value = 1

;Effect from transformation.
[State -2, AttackMulSet2]
type = AttackMulSet
trigger1 = Var(0) = 1
value = * ; Strength value, multiplied by 1.

Last Edit: November 07, 2007, 11:43:56 pm by DavidGee
Move Interrupt Bonus (Counter)
#17  May 29, 2005, 05:17:46 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
SNK came up with this great concept, and it has been copied in some form or another in almost every fighting game thereafter.

First, some prerequistes:
Write down the state numbers for any attack that puts p2 in a custom state.

Now, put this in Statedef -2. It's a hack-around for p2prevmovetype(the trigger doesn't exist).

[state -2, A]
type = VarSet
trigger1 = var(2) = 0
ignorehitpause = 1
var(13) = ifelse(p2movetype = A, 1, 0)

[state -2, B]
type = VarSet
trigger1 = var(2) = 1
ignorehitpause = 1
var(1) = ifelse(p2movetype = A, 1, 0)

[state -2, C]
type = VarSet
trigger1 = 1
var(2) = ifelse(var(2) = 1, 0, 1)
ignorehitpause = 1


Then, in state -3 (remember to put the state nums you wrote down as exclusions here):

[state -3, TargetState]
type = TargetState
trigger1 = (numtarget > 0) && (ifelse(var(2), var(0), var(1))) && (target, stateno != 9000)
;trigger1 = stateno != 1000
;trigger1 = stateno != [4020, 4045]
;trigger1 = stateno != [500,510] ;hitdefattr != SCA, NT, ST, HT
value = 9000
ignorehitpause = 1

What it does is it puts p2 in a custom state if p2's previous movetype was attack, unless p2 is already in the custom state, or p1 is throwing p2. If anyone can improve the throw detection here, I'd greatly appreciate it(hitdefattr doesn't work for some reason).

Finally, the custom state itself:

;Counter!
[Statedef 9000]
movetype = H

[State 9000, LifeAdd]
type = LifeAdd
trigger1 = time = 0
value = - floor(gethitvar(damage) / 2)
ignorehitpause = 1
absolute = 0

[State 9000, Envcolor]
type = Envcolor
trigger1 = time = 0
ignorehitpause = 1
time = 1
value = 255,0,0

[state 9000, 5]
type = SelfState
trigger1 = time = 0
ignorehitpause = 1
value = prevstateno

Now, for customization. If you want to give an extra hit or let p2 stagger longer like in KOF or that pause thingy in SFA3, just add some custom states and send p2 there in the above state. For displaying the words "counter" or other effects, I guess you'll need a var to trigger it.
Last Edit: November 07, 2007, 11:44:43 pm by DavidGee
Guarding Disable
#18  May 29, 2005, 05:21:39 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
I've never seen this effect in any game before. But hey, it can sure come in handy! >=D

This version of the code is a projectile type attack.

1.) The attack itself...

[Statedef 9000]
type = S
movetype= A
physics = S
ctrl = 0

[State 9000, Projectile]
type = Projectile
trigger1 = (whatever)
projid = 9000
;etc...

[State 9000, VarSet]
type = VarSet
trigger1 = ProjHit9000 = 1 ;Triggers the variable when the projectile hits.
v = 0
value = *** ; <-- Timer! How many game ticks opponent is unable to block for. (Adjust as you wish.)

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

2.) The required -3 states.

;The timer for the character to become unguardable.
[State -3, VarAdd]
type = VarAdd
trigger1 = Var(0) > 0
v = 0
value = -1
ignorehitpause = 1

[State -3, AssertSpecial]
type = AssertSpecial
trigger1 = Var(0) > 0 ;<--- if the var timer is above 0, it keeps the opponent unable to block.
flag = UnGuardable
Last Edit: November 07, 2007, 11:45:17 pm by DavidGee
Power Up
#19  May 29, 2005, 05:26:51 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
The ability to gain power at a fixed rate. This move is popular amongst DBZ and KOF games.

The same logic in this code can be used for life gain, etc...

Part 1 of the code. (Powering up)

[Statedef 9000]

[State 9000, PowerAdd]
type = PowerAdd
trigger1 = ((GameTime%5) = 0) && (command = "holdx") && (command = "holda")
value = 1

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = (whatever)
channel = 1
value = *,*

[State 9000, End]
type = ChangeState
trigger1 = (command != "holdx") || (command != "holda")
value = 9001


Part 2 of the code. (End move)

[Statedef 9001]

[State 9001, StopSnd]
type = StopSnd
trigger1 = Time = 0
channel = 1

[State 9001, End]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

Last Edit: November 07, 2007, 11:46:05 pm by DavidGee
Projectile Charge (Non Mobile Version)
#20  May 29, 2005, 05:30:45 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This feature isn't very common, as with the Mobile version, but it's a great way to increase a projectile's power.

Characters such as Ryu from SF3 have this feature.

1.) In your character's charging state, have a VarSet AND a VarAdd. Example:

;Charge reset at the beginning.
[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0
var(0) = 0

;Charge addition when holding the button.
[State 9000, VarAdd]
type = VarAdd
trigger1 = Time > 0
var(0) = 1

2.) Have several changestate parameters. Each with a different var trigger. The higher the variable's value, the more powerful the attack should be. Examples:

[State 9000, 1]
type = ChangeState
triggerall = command != "holdx" ;When you release the button.
trigger1 = var(0) <= 20 ;Held the button for less than 20 ticks.
value = * ;Weak projectile state

[State 9000, 2]
type = ChangeState
triggerall = command != "holdx" ;When you release the button.
trigger1 = var(0) = [21,40] ;Held the button between 21 and 40 ticks.
value = * ;Medium projectile state

etc...

Last Edit: November 07, 2007, 11:46:59 pm by DavidGee
Projectile Critical
#21  May 29, 2005, 05:45:26 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
A "secret" feature in the original Super Boutuden games, you can cause extra damage to your opponent, by pressing any button the moment your character's projectile makes contact.

This is a fairly simple piece of code. All you need is to add this under statedef -2:

[State -2, Projectile]
type = Projectile
triggerall = ((ProjContactTime(9000) != -1) && (ProjContactTime(9000) < 5))
trigger1 = command = (whatever)
projid = 9001
projanim = -1
projhitanim = -1
projremanim = -1
projcancelanim = -1
;(etc...)

Simply add in your preferences for your projectile's HitDef attributes.

Please note, this example triggers a projectile with an ID of 9000. Change it to suit your character.
Last Edit: November 07, 2007, 11:47:52 pm by DavidGee
Projectile Repel
#22  May 29, 2005, 05:51:10 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Uncommon in most fighting games, but VERY common for the DBZ genre, this ability allows your character to redirect the opponent's projectile back at him/her.

This example shows how the "Hajiku" move of the Super Boutuden games is made.

Notes:
  • 3 Vars are required for this move.
  • Var(0): Opponent's projectile damage value
  • Var(1): Records the number of taps pressed.
  • Var(2): The number of taps required. (Equation: Opponent damage divided by 30)
  • Var(0) and Var(1) are reset whenever the character goes into his/her recovery state. (After the projectile has been repelled/destroyed.)
  • Var(2) is resetted at the beginning of the projectile repel attempt state.

;Hajiku - Stance
[Statedef 9000]
type? = S
movetype = I
physics = S
anim = 9000 ;A blocking type animation

[State 9000: HitOverride]
type = HitOverride
trigger1 = 1
slot = 1
attr = SCA, AP
stateno = 9001
time = 1

[State 9000: ChangeState]
type = ChangeState
trigger1 = (Command != "holdb") || (Command != "holdc")
value = 0
ctrl = 1

;Hajiku - Repel Attempt
[Statedef 9001]
type = S
movetype = H
physics = S
anim = 9001 ; A blocking type animation
sprpriority = -2

[State 9001: HitOverride]
type = HitOverride
trigger1 = 1
slot = 0
attr = SCA, AP
stateno = 9001
time = 1

;Used for projectile damage in state 9002. (If successfuly repelled.)
[State 9001: VarAdd]
type = VarAdd
trigger1 = Time = 0
v = 0
value = Ceil(GetHitVar(Damage)*(-1))

;Used for "tapping" feature. (3 taps for every 100 points of damage of the opponent's projectile.)
[State 9001: VarSet]
type = VarSet
trigger1 = Time = 1
v = 1
value = Floor(Var(0)/30)*(-1)

;Used for number of taps made. (Reset at start)
[State 9001: VarSet]
type = VarSet
trigger1 = Time = 0
v = 2
value = 0

;Used for number of taps made. (Add tap value)
[State 9001: VarAdd]
type = VarAdd
triggerall = Time <= 100
trigger1 = (Command = "x") || (Command = "y") || (Command = "z") || (Command = "a") || (Command = "b") || (Command = "c")
v = 2
value = 1

;Get pushed by the opponent's projectile. (Divided by 2.)
[State 9001: VelSet]
type = VelSet
trigger1 = Time = 0
x = IfElse(Facing = 1,(GetHitVar(XVel)/2),(GetHitVar(XVel)/2*(-1)))
y = 0

;Projectile explod animation (On character)
[State 9001: Explod]
type = Explod
trigger1 = Time = 0
anim = (whatever)
id = (whatever)
pos = (Position of projectile)
postype = p1
bindtime = -1
removetime = -1
ontop = 1
ownpal = 1
removeongethit = 1

;Remove projectile explod animation.
[State 9001: RemoveExplod]
type = RemoveExplod
trigger1 = AnimTime = 0
id = (whatever)

;If projectile was successfully tapped, go to projectile repel state.
[State 9001: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0) && (Var(2) > Var(1))
value = 9002

;If projectile was not successfully tapped, go to get hit state. (Projectile will explod on character in next state.)
[State 9001: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0) && (Var(2) <= Var(1))
value = 9003[/code]

Code:
;Hajiku - Proj Cancel Success
[Statedef 9002]
type = S
movetype = I
physics = S
anim = 9002 ;Animation to repel projectile, or a blocking type animation.
velset = 0,0
ctrl = 0

;Recovery: Lose no life from the opponent's original projectile.
;Note: This equation applies only if the LIFE setting in Mugen is set to default. (100%)
[State 9002: LifeAdd]
type = LifeAdd
trigger1 = Time = 0
value = Ceil(Var(0)*(-1))

;VarSet: Reset the tapping values.
[State 9002: VarSet]
type = VarSet
trigger1 = Time = 0
v = 1
value = 0

;VarSet: Rest the opponent's projectile value. (Must be AFTER the projectile has been released.)
[State 9002: VarSet]
type = VarSet
trigger1 = AnimTime = 0
v = 0
value = 0

[State 9002: Projectile]
type = Projectile
trigger1 = (whatever)
projid = (whatever)
projanim = (whatever)
projhitanim = (whatever)
projremanim = (whatever)
projcancelanim = (whatever)
projremove = 1
projremovetime = 100
velocity = *,*
projpriority = 9
projsprpriority = 4
projedgebound = 1000
projstagebound = 1000
projheightbound = -1000,1
offset = *,* ;Must be the same offset as the projectile explod animation.
postype = p1
;------------------
attr = S, HP
hitflag = MAFP
guardflag = MA
animtype = Heavy
priority = 1, Hit
damage = Ceil(Var(0)*(-1)),(Var(0)*(-1))/2
; (etc...)

[State 9002: ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[code];Hajiku - Proj Cancel Failed
[Statedef 9003 ]
type = S
movetype = I
physics = S
anim = 9003 ;Blocking type animation, or get hit animation.

;VarSet: Reset the tapping values.
[State 9003: VarSet]
type = VarSet
trigger1 = Time = 0
v = 1
value = 0

;VarSet: Rest the opponent's projectile value. (Must be AFTER the projectile has been released.)
[State 9003: VarSet]
type = VarSet
trigger1 = AnimTime = 0
v = 0
value = 0

;Projectile explosion animtion.
[State 9003: Explod]
type = Explod
trigger1 = Time = 0
anim = (whatever)
id = (whatever)
pos = 0,0
postype = p1
bindtime = 1
removetime = -2
ontop = 1
ownpal = 1

If dies, go to custom KOed? state.
[State 9003: ChangeState]
type = ChangeState
trigger1 = Life <= 0
value = *

;Ends the move.
[State 9003: ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
Last Edit: November 07, 2007, 11:48:50 pm by DavidGee
Random Combos
#23  May 29, 2005, 05:52:59 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This code is universal, and can be used on any character, based on his/her basic attacks. This example shows how an 8 hit combo is done.

[Statedef 9000]

;The 1st animtion:

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 0) && (HitCount = 0) && (Random <= 999 / 6)
value = * ;Weak Punch

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 0) && (HitCount = 0) && (Random <= 999 / 6 + 166)
value = * ;Medium Punch

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 0) && (HitCount = 0) && (Random <= 999 / 6 + 166 * 2)
value = * ;Strong Punch

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 0) && (HitCount = 0) && (Random <= 999 / 6 + 166 * 3)
value = * ;Weak Kick

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 0) && (HitCount = 0) && (Random <= 999 / 6 + 166 * 4)
value = * ;Medium Kick

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 0) && (HitCount = 0) && (Random <= 999 / 6 + 166 * 5)
value = * ;Strong Kick

;The animations thereafter...

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (AnimTime = 0) && (HitCount > 0) && (HitCount < 8) && (Random <= 999 / 6)
value = * ;Weak Punch

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (AnimTime = 0) && (HitCount > 0) && (HitCount < 8) && (Random <= 999 / 6 + 166)
value = * ;Medium Punch

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (AnimTime = 0) && (HitCount > 0) && (HitCount < 8) && (Random <= 999 / 6 + 166 * 2)
value = * ;Strong Punch

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (AnimTime = 0) && (HitCount > 0) && (HitCount < 8) && (Random <= 999 / 6 + 166 * 3)
value = * ;Weak Kick

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (AnimTime = 0) && (HitCount > 0) && (HitCount < 8) && (Random <= 999 / 6 + 166 * 4)
value = * ;Medium Kick

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = (AnimTime = 0) && (HitCount > 0) && (HitCount < 8) && (Random <= 999 / 6 + 166 * 5)
value = * ;Strong Kick

As for ending the move, it can be anything, so I'll leave you to finish that. =)
Last Edit: November 07, 2007, 11:49:49 pm by DavidGee
Recovery Roll
#24  May 29, 2005, 05:55:22 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
From the VS games, it is used to get up, and roll toward your opponent, or out of the way. In any case, you will make it more difficult for the opponent to hit you while you are down.

To begin, we first put the following code in the CMD:

;Recovery - Roll
[State -1]
type = VarSet
trigger1 = (Var(0) = 0) && (MoveType = H) && (command = (whatever))
v = 0
value = 1

[State -1]
type = VarSet
trigger1 = ((Var(0) = 1) && (MoveType != H)) || (Lose)
v = 0
value = 0

This is used to set the recovery while your character is in a hit state. If your character does not fall, then the variable is reset.

Next, the CNS part. Your character is required to use his/her own common1.cns file.

In state 5100: (Add and replace states)

(replace state 5100, 12)

[State 5100, 12]
type = ChangeState
trigger1 = (Var(0) = 0) && (AnimTime = 0)
value = 5101

(add state 5100, 14)

[State 5100, 14]
type = ChangeState
trigger1 = (Var(0) = 1) && (AnimTime = 0)
value = 9000 ;Recovery Roll

And in state 5120

(replace state 5120, 7)

[State 5120, 7]
type = ChangeState
trigger1 = (Var(0) = 0) && (AnimTime = 0)
value = 0
ctrl = 1

(add state 5120, 8)

[State 5120, 8]
type = ChangeState
trigger1 = (Var(0) = 1) && (AnimTime = 0)
value = 9000 ;Recovery Roll

Finally, the Recovery Roll! (Modify as you wish)

; Recovery Roll
[Statedef 9000]
type = L
movetype = I
physics = S
ctrl = 0
anim = 9000
velset = 0,0

[State 9000, VelSet]
type = VelSet
trigger1 = Time >= 0
x = 12

[State 9000, PlayerPush]
type = PlayerPush
trigger1 = Time >= 0
value = 0

[State 9000, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
value = SCA

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0
v = 0
value = 0

[State 9000, End]
type = ChangeState
trigger1 = (P2Dist X <= -25) || (FrontEdgeBodyDist <= 10)
value = 11
ctrl = 1
Last Edit: November 07, 2007, 11:50:38 pm by DavidGee
Resurrection
#25  May 29, 2005, 06:00:05 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
The ability to revive if your character is defeated. Gill from SF3 is one character with such an ability. (Heck, it's his signature move!)

This helper keeps the round from ending when you lose the match:

[State -3, Helper]
type = Helper
trigger1 = (RoundState = 2) && (NumHelper(9000) = 0)
helpertype = Player
name = "Resurrection Super"
id = 9000
postype = p1
stateno = 9000
ignorehitpause = 1
pausemovetime = 999999999999999999999
size.ground.back = 1
size.ground.front = 1
size.air.back = 1
size.air.front = 1

Next, you have to override State 5150. If your character uses its own common states file, then add the two states to State 5150 (the two states are numbered 10 and 11):

; HIT_LIEDEAD
[Statedef 5150]
type? ? = L
movetype= H
physics = N
sprpriority = -3

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5150, 4] ;Match over anim
type = ChangeAnim
persistent = 0
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 7] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

[State 5150, 9]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 5150, 10]
type = ChangeState
trigger1 = Life > 0
value = 5120

[State 5150, 11]
type = ChangeState
trigger1 = (Life <= 0) && (Var(0) = 0) && (NumHelper(9000) > 0) && (Power >= 1000)
value = 9000

Now, add this to your AIR file. If you change the action number, make sure to change it in the Resurrection super states:
 
;Used for projectiles...
[Begin Action 9010]
Clsn2: 1
 Clsn2[0] = -23,-640, 19,? 0
0,-1, 0,0, -1

The Resurrection super states:

;===================
; Resurrection Super
;===================

[Statedef 9000]
type = S
movetype = I
velset = 0,0
anim = 0
ctrl = 0
poweradd = -1000
sprpriority = 2

;This var keeps the Resurrection Super from being used twice in the same round.
[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0
v = 0
value = 1

;This NotHitby allows the player to recover at least 10% of their life. The formula used in the trigger goes like this:
;life * 10% / 5 (value used in the lifeadd) * 2 (value that is "modding" the time in the lifeadd)

[State 9000, NotHitBy]
type = NotHitBy
trigger1 = Time <= const(data.life) * 0.10 / 5 * 2
;trigger1 = life >= const(data.life) * 0.10? ;An alternate trigger
value = SCA

[State 9000, Width]
type = Width
trigger1 = 1
player = 45

; The reverse vacuum pushes the player away.
[State 9000, Reverse Vacuum]
type = Helper
trigger1 = (Time%3) = 0
name = "Reverse Vacuum"
pos = 0, 0
postype = p1
stateno = 9015
helpertype = normal
facing = 1 ;ifelse(random >= 500, 1, -1)
ignorehitpause = 1
size.ground.back = 1
size.ground.front = 1
size.air.back = 1
size.air.front = 1

[State 9000, Reverse Vacuum]
type = Helper
trigger1 = (Time%3) = 0
name = "Reverse Vacuum"
pos = 0, 0
postype = p1
stateno = 9015
helpertype = normal
facing = -1 ;ifelse(random >= 500, 1, -1)
ignorehitpause = 1
size.ground.back = 1
size.ground.front = 1
size.air.back = 1
size.air.front = 1

[State 9000, LifeAdd]
type = LifeAdd
trigger1 = (Time%2) = 0
value = 5

; This "invisible" projectile will "slow down" any projectiles. Thanks to [E] for the suggestion.
[State 9000, Projectile]
type = Projectile
trigger1 = (Time&25) = 0
projanim = 9010
offset = 0,0
velocity = 1, 0
projpriority = 1
projremovetime = 25
; HitDef part of projectile info
attr = S, HP
sparkno = -1
guard.sparkno = -1

[State 9000, ChangeState]
type = ChangeState
trigger1 = life = const(data.life)
value = 0
ctrl = 1

;===========================
; Resurrection Helper States
;===========================

[Statedef 9010]

[State 9010, Invisible]
type = AssertSpecial
trigger1 = 1
flag = invisible

[State 9010, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 9010, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 9010, Bind]
type = BindToParent
trigger1 = 1

[State 9010, DestroySelf]
type = DestroySelf
triggerall = parent, life <= 0
trigger1 = (parent, power < 1000) || (parent, var(0) = 1)

;===============
; Reverse Vacuum
;===============

[Statedef 9015]
;type? ? = A
anim = 9015

[State 9015, VarRandom]
type = VarRandom
trigger1 = Time = 0
v = 8
range = 1,5

[State 9015, VelSet]
type = VelSet
trigger1 = Time = 0
x = 5 * (3 * var(8)) + 10? ;30

[State 4015, PlayerPush]
type = PlayerPush
trigger1 = p2bodydist X >= 1
value = 1

[State 9015, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 9015, DestoySelf]
type = DestroySelf
trigger1 = Time > 20
Last Edit: November 07, 2007, 11:51:36 pm by DavidGee
Rotation Effect
#26  May 29, 2005, 06:22:36 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This can be used for various purposes, such as Spiral's knives, or Strider's Oroboros.

This simply shows the basic equations required to create the rotation effect.

[StateDef 9000]
; (etc...)



1.) This VAR indicates the helper's location relative to its parent. (angle)

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0 ;Adjust as you wish.
fv = 0
value = 0

0 radians in case you are using multiple helpers (eg, Spiral's knives) you can use the following expresion:

value = IfElse(p1name="helper1",0,pi)

Where "helper1" is the name of the current active helper.

You can "nest" more IfElse expresions, for more helpers. Obviously, giving every helper a diferent name on the helper calling state.


2.) This VAR is the rotation speed (So, you will be able to accelerate, or decelerate the rotation ratio.)

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0 ;Adjust as you wish.
fv = 1
value = .2

The value is given on radians. You can increase the speed by using other VarSet or expresions, like:

value = (time/60)+1 ;This makes the rotation, accelerate even more as time passes.

Or, as used on Yoshi...

value = IfElse((Time/180)%2,-.2,.2) ;This makes the direction of the rotation change from clockwise to counterclockwise every 3 seconds.


3.) This is the Y stretch of the move,in case you don't want a perfect circle. (Oval shaped effect.)

[State 9000, VarSet]
type = VarSet
trigger1 = 1
fv = 2
value = 1 ;Can be .5, .2, or even an expresion.

;This is the X stretch of the move.
[State 9000, VarSet]
type = VarSet
trigger1 = 1
fv = 3
value = 1

What's the use of vars here? Well, you can make the stretch change over time, or when certain conditions are met. You are not going to change their value, then better use constant numerical values. (eg. 3, .5, etc..)


4.) Pos setting routine, and drawing:

;This adds the angle to the current one
[State 9000, VarAdd]
type = VarAdd
trigger1 = Time > 0 ;Adjust as you wish.
fv = 0
value = FVar(1)

;This sets the helper's position, relative to its parent.
[State 9000, BindToParent]
type = BindToParent
trigger1 = 1
facing = 1
time = 1
pos = Cos(FVar(0)) *FVar(3), Sin(FVar(0)*FVar(2)

The "Pos" equation is the basic concept, but won't look very good. But if we were to use this instead:

pos = Cos(FVar(0)) *FVar(3),(-Sin(FVar(0)-(size.mid.pos.y/2))*FVar(3)

The helper rotates around half the player's height.

;Just in case you want the helper to spin itself as well:
[State 9000, AngleSet]
type = AngleSet
trigger1 = 1
Value = FVar(0)*2pi ;Angle must be given on degrees.

[State 9000, AngleDraw]
type = AngleDraw
trigger1 = 1

Use this IF you want the helper to be shown behind, then on front of the parent. In this case, on half of the rotating move, the helper will be on top of the parent, and the other half it will be behind.

[State 9000, SprPriority]
type = SprPriority
trigger1 = 1
value = IfElse((Fvar(0)/Pi)%2,3,-1)

;Use this to release the helper, in case you need to..
[State 9000, ChangeState]
type = Changestate
trigger1 = Parent, Command = "release"
value = 9001

In state 9001, it can be anything that you make the helper do, so I'll leave you at that. =)

Last Edit: November 07, 2007, 11:52:52 pm by DavidGee
High Jump (SNK Style)
#27  May 29, 2005, 06:30:38 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
There are basically 2 types of high jumps: The VS style of Capcom, where the characters jump more vertical rather than horizontal, and the SNK style, which is somewhat the opposite.

This code will show how the SNK Style high jump is done.

In state 40, add this code in:

[State 40, ChangeState]
type = ChangeState
trigger1 = (Command = "High Jump") && (AnimTime = 0)
value = 9000

State 9000 will be your character's high jump state:

[Statedef 9000]
type = A
movetype = I
physics = A

[State 9000, VelSet]
type = VelSet
trigger1 = Time = 0
x = * ;Length of high jump (Must be greater than Y)
y = * height of high jump (Must be lesser than X)

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0
value = IfElse((Vel x) = 0, 41, IfElse((Vel X) > 0, 42, 43))

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = Vel Y > -2 && SelfAnimExist(Anim + 3)
persistent = 0
value = Anim + 3

[State 9000, ChangeState]
type = ChangeState
trigger1 = Pos Y >= 1
value = 52
Last Edit: November 08, 2007, 12:12:55 am by DavidGee
Special KO Effect
#28  May 29, 2005, 06:52:07 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Popular in many games, this creates a special effect if the opponent was KO'ed by a special move.

This code requires one variable.

;Special KO Effect Switch OFF
[State -2: VarSet]
type = VarSet
trigger1 = !WinKO
v = 0
value = 0
ignorehitpause = 1

;Special KO Effect Switch ON
[State -2: VarSet]
type = VarSet
trigger1 = (WinKO) && (Var(0) = 0) && (StateNo >= 700) ;Adjust as you wish.
v = 0
value = 1
ignorehitpause = 1

;Special KO Effect timer. (To prevent repetiveness)
[State -2: VarAdd]
type = VarAdd
trigger1 = Var(0) > 0
v = 0
value = 1
ignorehitpause = 1

This is one example of how a special KO effect can be done.

;Remove life bars during effects.
[State -2: AssertSpecial]
type = AssertSpecial
trigger1 = (Var(0) = 1) && (StateNo >= 700) ;Adjust as you wish.
flag = NoBarDisplay
flag2 = NoFG
ignorehitpause   = 1

;The effect itself
[State -2: Explod]
type = Explod
trigger1 = (Var(0) = 2) && (NumExplod(9000) = 0) && (StateNo >= 700) ;Adjust as you wish.
id = 9000
ignorehitpause = 1
; (etc...)
Last Edit: November 07, 2007, 11:54:22 pm by DavidGee
Self Dizzy State (Stun Meter)
#29  May 29, 2005, 07:00:07 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Non-intrusive Dizzy Mode -- you can put opponents into this special state, pound the buttons to get out of it, and it won't overwrite the opponent's variables. Also included is the code that makes the character dizzied by long strings of attacks (A sort of Stun Meter).


This is the character's dizzy state.


[Statedef 9000]
type = S
physics = S
movetype = H
ctrl = 0

[State 9000, Change Animation]
type = ChangeAnim
trigger1 = Time = 0
value = 5300

[State 9000, Button Jam]
type = ChangeState
triggerall = Random <= 500
trigger1 = (command = "a") || (command = "b") || (command = "c")
trigger2 = (command = "x") || (command = "y") || (command = "z")
value = 9001

[State 9000, Next]
type = ChangeState
trigger1 = Time = 30
value = 9001


Next dizzy state.


[Statedef 9001]
type = S
physics = S
movetype = H
ctrl = 0

[State 9001, Flash]
type = PalFX
trigger1 = Time = 0
time = 2
add = 50,50,50
mul = 300,300,300

[State 9001, Button Jam]
type = ChangeState
triggerall = Random <= 500
trigger1 = (command = "a") || (command = "b") || (command = "c")
trigger2 = (command = "x") || (command = "y") || (command = "z")
value = 9002

[State 9001, Next]
type = ChangeState
trigger1 = Time = 30
value = 9002

...and the next.


[Statedef 9002]
type = S
physics = S
movetype = H
ctrl = 0

[State 9002, Flash]
type = PalFX
trigger1 = Time = 0
time = 2
add = 50,50,50
mul = 300,300,300

[State 9002, Button Jam]
type = ChangeState
triggerall = Random <= 500
trigger1 = (command = "a") || (command = "b") || (command = "c")
trigger2 = (command = "x") || (command = "y") || (command = "z")
value = 9003

[State 9002, Next]
type = ChangeState
trigger1 = Time = 30
value = 9003

This is the last dizzy state, where the character can regain control.

You should create more copies of the dizzy states, to further increase the amount of time needed to recover. (Around 5-6 more.)

[Statedef 9003]
type = S
physics = S
movetype = H
ctrl = 0

[State 9003, Flash]
type = PalFX
trigger1 = (!Time)
time = 2
add = 50,50,50
mul = 300,300,300

[State 9003, Button Jam]
type = ChangeState
triggerall = (Random <= 500)
trigger1 = (Command = "a") || (Command = "b") || (Command = "c")
trigger2 = (Command = "x") || (Command = "y") || (Command = "z")
value = 0

[State 9003, Undizzy]
type = SelfState
trigger1 = (Time = 30)
value = 0
ctrl = 1

Being dizzied. (Self only: The following code can all be omitted if you don't want the character to succumb from Stun Dizzies.)

[Statedef 9010]
type = S
movetype = H
physics = N
ctrl = 0

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

[State 9010: VarSet]
type = VarSet
trigger1 = (!Time)
v = 10
value = 0

[State 9010: ChangeState]
type = ChangeState
trigger1 = (HitShakeOver)
value = 9011

This is the character's state where he/she is being knocked out when the stun meter has reached it's limit.

[Statedef 9011]
type = A
movetype = H
physics = N
anim = 9011
ctrl = 0
velset = -3, -4

[State 9011: VelAdd]
type = VelAdd
trigger1 = (Pos Y < 0)
y = 0.35

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

[State 9011: ChangeState]
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 9012

This is the character's getting up state when being knocked out. He/She will end up dizzy.

[Statedef 9012]
type = S
movetype = H
physics = S
anim = 5110
ctrl = 0

[State 9012: VelSet]
type = VelSet
trigger1 = (!Time)
Y = 0

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

[State 9012: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 25)
value = 5120

[State 9012: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0) && (Anim = 5120)
value = 9000

Now, the -3 states. This is very important, and is needed for the stun meter itself. You can also add in a graphical stun meter along with this code, which can quite easily be implemented together.

These next 3 states are used to add to the stun meter whenever the character is hit; Weak, Medium, and Heavy attacks.

[State -3: VarAdd]
type = VarAdd
triggerall = (Time = 2)
trigger1 = ((StateNo = 5001) && (Anim = 5000)) || (StateNo = 5001) && (Anim = 5010)) || ((StateNo = 5011) && (Anim = 5020))
persistent = 0
ignorehitpause = 1
v = 0
value = 10

[State -3: VarAdd]
type = VarAdd
triggerall = (Time = 4)
trigger1 = ((StateNo = 5001) && (Anim = 5001)) || ((StateNo = 5001) && (Anim = 5011)) || ((StateNo = 5011) && (Anim = 5021))
persistent = 0
ignorehitpause = 1
v = 0
value = 40

[State -3: VarAdd]
type = VarAdd
triggerall = (Time = 6)
trigger1 = ((StateNo = 5001) && (Anim = 5002)) || ((StateNo = 5001) && (Anim = 5012)) || ((StateNo = 5011) && (Anim = 5022))
persistent = 0
ignorehitpause = 1
v = 0
value = 100

This is used to recover the stun meter when the character is not hit.

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

Finally, this is used to go into the dizzy state, when the stun meter has reached it's limit. You can adjust the "Var(0) >= 400", if you want the stun meter to be higher, or lower.

Note, that the 9003 of this trigger is the final dizzy state mentioned earlier. Change this, if you plan to add in more.

[State -3: ChangeState]
type = ChangeState
trigger1 = (Var(0) >= 400) && (StateNo != [9000,9003])
value = 9010
ignorehitpause = 1
Last Edit: November 07, 2007, 11:55:37 pm by DavidGee
Number System
#30  May 29, 2005, 05:25:05 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is for displaying numbers in mugen. Basically mathematical equations.

First of all, we need the individual digits, lets say we have a Var(0) that has the value of 359.


[State a, 0]
type = VarRangeSet
trigger1 = Time = 0
value = 0 ; Reset the Vars that we need
first = 1
last = 3

[State a, 1]
type = VarSet
trigger1 = Time = 0 && Var(0) > 99 ; Make sure Var(0) has 3 digits
Var(1) = Floor(Var(0) / 100) ; Take the integer part of the hundredth digit.

Var(1) now contains the first digit of our number, 3.


[State a, 2]
type = VarSet
trigger1 = Time = 0 && Var(0) > 9 ; make sure Var(0) has 2 digits
Var(2) = Floor(Var(0) / 10) - (Var(1) * 10) ; Take the first 2 digits and subtract the first.

Var(2) now contains the 2nd, 5.


[State a, 3]
type = VarSet
trigger1 = Time = 0
Var(3) = Var(0) - (Var(1) * 100) - (Var(2) * 10) ; Subtract the first and 2nd digits.

Var(3) now has the last digit, 9.

Now that we have all 3 digits, we can display them. First, make sure you have the number sprites in the sff. Second, make sure the AIR group numbers are proportional to the numbers, ie. if the sprite "0" has AIR group number 6000 or 7000 or 8920, then the sprite "8" would be 6008 or 7008 or 8928, respectively. Now:


[State a, 4]
type = Explod
trigger1 = (whatever)
anim = (AIR group number of sprite "0") + Var(1)
postype = (whatever)
pos = (x), (y) ; Make sure you remember this position

[State a, 5]
type = Explod
trigger1 = (whatever)
anim = (AIR group number of sprite "0") + Var(2)
postype = (whatever)
pos = (x) + (width of sprite), (y) ; display after the 1st digit

[State a, 6]
type = Explod
trigger1 = (whatever)
anim = (AIR group number of sprite "0") + Var(3)
postype = (whatever)
pos = (x) + (width of sprite) + (width of sprite), (y) ; last position
Last Edit: November 07, 2007, 11:59:39 pm by DavidGee
Projectile Charge (Mobile Version)
#31  May 29, 2005, 08:01:05 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
I'm not sure what's the "official" name of this feature, but this is VERY common in the Mega Man games.

This same feature can be used to "pump up" your character, while your he/she is still able to move.

Under statedef -3 (Since the effect should end if your character gets thrown), put this:

[State -3]
type = VarAdd
trigger1 = command = "holdx"
var(0) = 1
ignorehitpause = 1

[State -3]
type = VarSet
trigger1 = (stateno = [9000,9001]) || (stateno = [9010,9011]) || (movetype = H && command != "holdx")
var(0) = 0

[State -3]
type = ChangeState
trigger1 = (command != "holdx") && (var(0) = [0,50]) && (ctrl) && (statetype != A)
value = 9000 ;On the ground (Weak effect)

[State -3]
type = ChangeState
trigger1 = (command != "holdx") && (var(0) > 50) && (ctrl) && (statetype != A)
value = 9001 ;On the ground (Strong effect)

[State -3]
type = ChangeState
trigger1 = (command != "holdx") && (var(0) = [0,50]) && (ctrl) && (statetype = A)
value = 9010 ;In the air (Weak effect)

[State -3]
type = ChangeState
trigger1 = (command != "holdx") && (var(0) > 50) && (ctrl) && (statetype = A)
value = 9011 ;In the air (Strong effect)

Feel free to add in any effects.

Next, you create your character's move as the result of releasing the button. Because this can be anything you choose, I'll leave you at that. :)
Last Edit: November 08, 2007, 12:04:17 am by DavidGee
Teleportation
#32  May 29, 2005, 08:04:26 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
The ability to move from one place to another without physical movement.

There are two types of teleportation: Teleportation that works at a fixed position, and teleportation that works according to a particular situation (e.g., opponent's position).

1.) Fixed Teleportation

This particular code can be controlled with the directional keys.

[Statedef 9000]

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = (whatever)
value = *,*

[State 9000, PosSet]
type = PosSet
trigger1 = Pos Y > 0
y = 0

[State 9000, PosAddFwd]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = ((command = "holdfwd") || (command != "holdfwd")) && (command != "holdback") && (command != "holdup") && (command != "holddown")
x = * ;Must be a positive value.
y = 0

[State 9000, PosAddBack]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holdback") && (command != "holdfwd") && (command != "holdup") && (command != "holddown")
x = * ;Must be a negative value.
y = 0

[State 9000, PosAddUp]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holdup") && (command != "holdfwd") && (command != "holdback") && (command != "holddown")
x = 0
y = * ;Must be a negative value.

[State 9000, PosAddDown]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holddown") && (command != "holdfwd") && (command != "holdback") && (command != "holdup")
x = 0
y = * ;Must be a positive value.

[State 9000, PosAddFwdUp]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holdfwd") && (command = "holdup") && (command != "holdback") && (command != "holddown")
x = * ;Must be a positive value.
y = * ;Must be a negative value.

[State 9000, PosAddFwdDown]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holdfwd") && (command = "holddown") && (command != "holdback") && (command != "holdup")
x = * ;Must be a positive value.
y = * ;Must be a positive value.

[State 9000, PosAddBackUp]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holdback") && (command = "holdup") && (command = "holdfwd") && (command = "holddown")
x = * ;Must be a negative value.
y = * ;Must be a negative value.

[State 9000, PosAddBackDown]
type = PosAdd
triggerall = Time = *** ;Time to teleport.
trigger1 = (command = "holdback") && (command = "holddown") && (command != "holdfwd") && (command != "holdup")
x = * ;Must be a negative value.
y = * ;Must be a positive value.

[State 9000, End]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

2.) Non-Fixed Teleportation: Teleportation is determined by the opponent's position (as an example...).

[Statedef 9000]

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = (whatever)
value = *,*

[State 9000, PosAdd]
type = PosAdd
trigger1 = (whatever)
x = (P2Dist X) + *
y = (P2dist Y) + *

[State 9000, End]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

The "+ *" is used, so that your character is given some room away from the opponent, rather than teleporting at the exact point of where he/she is.
Last Edit: November 08, 2007, 12:05:10 am by DavidGee
Time - Slow Down
#33  May 29, 2005, 08:08:07 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
In some fighting games, slow motion effects are used, like in SF2, when a projectile hits the opponent. The effect itself can be easily accomplished. Triggering it can vary, but I'll leave that to you. With this code, you can have bullet time in Mugen, or you could make Neo for Mugen!

In the state that you want to create the effect, add this one piece in: The trigger used should last for a number of ticks, such as "Time = [0,20]"

[State ****: Pause]
type = Pause
triggerall = (GameTime%3) = 0
trigger1 = ;[Insert trigger here.]
time = 1
movetime = 1
ignorehitpause = 1

If you want to increase the intensity of the effect, you can change the value of the "GameTime" trigger to 2 or 1. If that's not slow enough, you can increase the value of the "time" and "movetime" parameters until it suits your needs.
Last Edit: November 08, 2007, 12:10:30 am by DavidGee
Countdown Timer
#34  May 29, 2005, 08:10:38 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
A simple effect that can be used to cause a limited effect in the game. Usually done with a transformation, or used to remove a specified effect when the time runs out.

[Statedef 9000]

[State 9000, TimerSet]
type = VarSet
trigger1 = (whatever)
v = 0
value = 1000 ; Timer value

Next, the -2 state, for the count down:

[State -2, CountDown]
type = VarAdd
trigger1 = Var(0) > 0
var(0) = -1
ignorehitpause = 1
Last Edit: November 08, 2007, 12:09:55 am by DavidGee
Flying
#35  May 29, 2005, 08:13:24 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Flying: Idainaru Densetsu Style

The way flying works in Idainaru Densetsu is very simple; Pressing backward or downwards on the directional keys move your character away from the opponent, and forward or up to move towards. Your character will move in a straight path.

The startup state.

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

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

[State ****: VelSet]
type = VelSet
trigger1 = (Time > 10)
y = -6

[State ****: VelAdd]
type = VelAdd
trigger1 = (Time? > 10) && (Time, < 30) && (Vel Y < -1)
y = 0.40

[State ****: ChangeState]
type = ChangeState
trigger1 = (Time > 30)
value = ***1

The flying state, when character is idle.

[Statedef ***1]
type = A
movetype = I
physics = N
anim = ***1
velset = 0,0
ctrl = 1

[State ***1: Turn]
type = Turn
trigger1 = (P2Dist X < -1)

; This NULL is actually used to set a few variables at once, without actually having to use that many VarSets.
; (Read Elecbyte's documentation on expressions.)

; Var(0): The "You're flying" variable. You can use this to call upon when needed, such as for the CMD file.
; Var(1) and Var(2): Used for the floating effect.

[State ***1: Null]
type = Null
trigger1 = (!Time)
trigger1 = (Var(1) := 0) && (Var(0) := 1)
trigger2 = (Var(1) = -10) || (Var(1) = 10)
trigger2 = (Var(2) := IfElse(Var(1) = -10,0,1))

[State ***1: VarAdd]
type = VarAdd
trigger1 = 1
var(1) = IfElse(Var(2) = 0,1,-1)

[State ***1: VelAdd]
type = VelAdd
trigger1 = 1
y = IfElse(Var(2) = 1,0.05,-0.05)

; ***2 is the moving towards state, and ***3 for away.

[State ***1: ChangeState]
type = ChangeState
trigger1 = (Command = "holdup") || (Command = "holdfwd")
value = ***2

[State ***1: ChangeState]
type = ChangeState
trigger1 = (Command = "holddown") || (Command = "holdback")
value = ***3[/code]

Flying towards state.

[code][Statedef ***2]
type = A
movetype = I
physics = N
anim = ***2
ctrl = 1

; This is used to check the position of the enemy, and sets the appropriate values to
; move towards him/her.

; FVar(0): X velocity
; FVar(1): Y velocity

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

; Moves the character, using the variables as reference. You cannot use those expressions
; as shown above and put it directly into the VelSet. MUGEN will lock up after this is used
; a number of times.

[State ***2: VelSet]
type = VelSet
trigger1 = (Whatever)
x = FVar(0)
y = FVar(1)

; Go back to the idle state when commands are released.

[State ***2: ChangeState]
type = ChangeState
trigger1 = (Command != "holdfwd") && (Command != "holdup")
value = ***1

Flying away state.

[Statedef ***3]
type = A
movetype = I
physics = N
anim = ***3
ctrl = 1

; Disables air guarding. If you wish to add in air guarding while flying, you can
; remove this, then edit the guarding states accordingly, using Var(0) as reference.

[State ***3: AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoAirGuard
ignorehitpause = 1

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

[State ***3: VelSet]
type = VelSet
trigger1? = (Whatever)
x = (FVar(0)*(-1))
y = (FVar(1)*(-1))

[State ***3: ChangeState]
type = ChangeState
trigger1 = (Command != "holdback") && (Command != "holddown")
value = ***1
Last Edit: November 08, 2007, 12:11:44 am by DavidGee
High Jump (VS Style)
#36  May 29, 2005, 08:18:51 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
There are basically 2 types of high jumps: The VS style of Capcom, where the characters jump more vertical rather than horizontal, and the SNK style, which is somewhat the opposite.

This code will show how the VS Style high jump is done.

[Statedef 9000]
type? ? = A
physics = N
velset = 0,-11
ctrl = 0

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = *,*

[state 9000, CtrlSet]
type = CtrlSet
trigger1 = Time >= 1
value = 1

[state 9000, VelSetFwd]
type = VelSet
trigger1 = command = "holdfwd"
x = 3

[state 9000, VelSetBack]
type = VelSet
trigger1 = command = "holdback"
x = -3

[state 9000, VelAdd]
type = VelAdd
trigger1 = Time > 10
x = 0
y = .40

[state 9000, End]
type = ChangeState
trigger1 = Pos Y >= 1
value = 52
ctrl
Last Edit: November 08, 2007, 12:14:57 am by DavidGee
High Jump (VS Style)
#37  May 29, 2005, 08:21:36 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Method 2 of creating Versus super jumps:

  • Requires a variable
  • Is a bit easier and it makes for more "versus-true" velocities when you hold back or forward.

Also, I found a yaccel of .39 to be more fitting for versus characters.

1.) In the super jump move:

; Super Jump
[Statedef 9000]
type = A
physics = S
ctrl = 0
anim = 40

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0
var(10) = 1

[State 9000, VelSet]
type = VelSet
trigger1 = AnimTime = 0
x = 0
y = -11

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = AnimTime = 0
value = *,*

[State 9000, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

2.) Overridden states:

; Jump Up
[Statedef 50]
type = A
physics = A

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 50, VelAdd]
type = VelAdd
trigger1 = (Vel X < 3.25) && (Var(0) = 1) && (Command = "holdfwd") && (Command != "holdback")
x = .45

[State 50, VelAdd]
type = VelAdd
trigger1 = (Vel X > -3.25) && (Var(0) = 1) && (Command != "holdfwd") && (Command = "holdback")
x = -.45

;Notice var(0) * 10000. Anims 41-43 are normal jump rise anims. Anims 10041-10043 are super jump rise anims.

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, ((var(0) * 10000) + 41), ifelse((vel x)>0, ((var(0) * 10000) + 42), ((var(0) * 10000) + 43)))

[State 50, 3]
type = ChangeAnim
trigger1 = Anim = [41,43]
trigger1 = AnimTime = 0
;trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

So that you don't retain super jump movement capabilities:


; -[ Super Jump Control ]-
[State -2]
type = VarSet
trigger1 = StateType != A
var(0) = 0

:) Enjoy.
Last Edit: November 08, 2007, 12:15:41 am by DavidGee
Tag Team
#38  May 29, 2005, 08:27:20 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
This is a feature in those cross-over games, where you choose 2 characters which alternate during the fight.

This code shows how the VS style tag team is done.

Important Note: This is incomplete. (Will be updated in the future.) [Uh, right... ;) -DavidGee]

1.) First, the tag team call move:

[Statedef 9000]
type = A
movetype = A
physics = N
anim = 9000
ctrl = 0

;Screen will iIgnore your character as the switch is made.
[State 9000, ScreenBound]
type = ScreenBound
trigger1 = Time <= 5
value = 0

;Illusionary effect: Makes your character look like he's jumping away. (He really got moved with the PosSet, see below.)
[State 9000, Helper]
type = Helper
trigger1 = Time = 0
stateno = 9001
postype = p1
pos = 0,0
ownpal = 1

;XY Position to put character into, for an illusion effect
of jumping in. (Facing to the right.)
[State 9000, PosSet]
type = PosSet
trigger1 = (Facing = 1) && (Time = 1)
x = -150
y = -75

;XY Position to put character into, for an illusion effect
of jumping in. (Facing to the left.)
[State 9000, PosSet]
type = PosSet
trigger1 = (Facing = -1) && (Time = 1)
x = 150
y = -75

;Jumping in velocity.
[State 9000, VelSet]
type = VelSet
trigger1 = Time = 1
x = 14
y = 3.5

;Adjust according to your preferences. (This is Sunboy's original values!!)
[State 9000, HitDef]
type = HitDef
trigger1 = (whatever)
attr = A, NA
animtype = Hard
damage = 30
sparkxy = 0, -24
hitflag = MAFD
guardflag = MA
pausetime = 10,10
;hitsound =
;guardsound =
ground.type = High
ground.slidetime = 8
ground.hittime = 20
ground.velocity = -.5,-8.5
air.velocity = -.5,-8.5
fall = 1

;When you land on the ground, go to your character's taunt state.
[State 9000, ChangeState]
type = ChangeState
trigger1 = Time > 2
trigger1 = Pos Y >= -10
value = 195


Finally, the helper created from this action:

; Tagging Away
[Statedef 9001]
type = A
movetype = I
physics = N
velset = -14, -3.5
anim = 9001
ctrl = 0

[State 9001, DestroySelf]
type = DestroySelf
trigger1 = AnimTime = 0

2.) As for the character animation and attributes changes, you'll need to use a variable to have your character look like the new one. (The tagged character.)

Please refer to Omniscience's Morph codes on creating this effect. (As an alternative until this reference is completed.)



Last Edit: November 08, 2007, 12:16:33 am by DavidGee
Wake-Up Attacks
#39  May 29, 2005, 08:29:04 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Reversals can be implemented in the CMD, under the moves you want your char to "wake up" with, add:

trigger(available trigger number) = stateno = 5120 && time = 6 ; SNK style

OR

trigger(available trigger number) = stateno = 5120 && time = [4, 9] ; Capcom style

For SNK style normal throws, in the throw state, changestate to the close attack of that button if you miss, ie. for forward + hard punch throws:


[State a, 0]
type = ChangeState
trigger1 = AnimTime = 0
value = (close hard punch state)

For the other stuff, I suggest you observe any properties of the moves of your character.
Last Edit: November 08, 2007, 12:18:34 am by DavidGee
Wall Jump
#40  May 29, 2005, 08:30:16 am
  • ***
  • I never really was on your side.
    • www.mugenguild.com/~davidgee
Certain characters have this unique ability, to jump off the sides of the screen. Some creators use special states to accomplish this. I just use the regular jump. =P

All you need is 2 things. First, the command to jump off the wall. Insert this in your character's CMD file:

[State -1: ChangeState]
type = ChangeState
value = 40
triggerall = (StateType = A) && (Ctrl) && (Pos Y < -30)
trigger1 = ((command = "holdup") && (command = "holdfwd") && (Vel X <= 0) && (backedgebodydist <= 10) && (backedgebodydist > -10))
trigger2 = ((command = "holdup") && (command = "holdback") && (Vel X >= 0) && (frontedgebodydist <= 10) && (frontedgebodydist > -10))
persistent = 0

The 2nd thing to add is a controller, to tell Mugen that your character is in the air during the jump start, to prevent a float bug if hit.

[State -1: StateTypeSet]
type = StateTypeSet
trigger1 = (StateNo = 40) && (Pos Y < 0)
statetype = A

If you want to use a custom anim to jump off the wall, you can add this as well.

[State -1: ChangeAnim]
type = ChangeAnim
trigger1 = (StateNo = 40) && (Pos Y < 0) && (!Time)
value = ****
Last Edit: November 08, 2007, 12:19:07 am by DavidGee
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
Helper Faces Opponent
#61  December 16, 2006, 07:33:13 am
  • ***
†his will make any projectile face the direction its going;
however, your projectile must be a helper...

put a value for "d" depending which way your projectile's sprite is facing, in the .sff
d = 0 if your projectile's sprite is facing right, d = 90 if your projectile's sprite is facing down, d = 180 if the sprite is facing left, d = 270 if the sprite is facing up.


[State 500, Angle]
type = AngleSet
trigger1 = 1
value = ((atan((-1*Vel Y)/Vel X))*(360/(2*pi))) + d

[State 500, Draw]
type = AngleDraw
trigger1 = 1
Last Edit: April 10, 2009, 09:53:19 am by Cyanide
Re: Code Snippet Archive
#62  November 20, 2011, 06:43:28 am
  • avatar
  • **
  • Nerdy artist & gamer.
Perspective Scaling
Basically, this code just adjusts the x scale of any animation of a flat object so that it fits more realistically in a perspective sense. e.g. Flat shockwaves, flat walls...
It isn't significant, but it's a cool detail, especially in 3D stages and on moving explods/projectiles/helpers.


Code:
[State 0, Perspective]
type = AngleDraw
trigger1 = 1
scale = const240p(abs(160-Screenpos X)/80)
Re: Code Snippet Archive
#63  May 15, 2012, 05:47:19 pm
  • avatar
  • **
  • Whatever.
Camera Lock
The title. Nuff' said.

Code:
[State 2700, Helper] ;Locker 1
type = helper
trigger1 = time = 0
helpertype = normal
postype = back
pos = 0,0
stateno = 2771
ID = 2771

[State 2700, Helper] ;Locker 2
type = helper
trigger1 = time = 0
helpertype = normal
postype = front
pos = 0,0
stateno = 27771
ID = 2771

;---------------------------------------------------------------------------
; Lock Left
[Statedef 2771]
type    = S
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 2771
poweradd = 0
sprpriority = 2

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = 160
y = 0

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 1,1

;---------------------------------------------------------------------------
; Lock Right
[Statedef 27771]
type    = S
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 2771
poweradd = 0
sprpriority = 2

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = -160
y = 0

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 1,1


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Code Snippet Archive
#64  May 16, 2012, 09:45:10 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
You don't need 2 helpers to achieve that, one is enough.


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: Code Snippet Archive
#65  May 16, 2012, 01:35:58 pm
  • avatar
  • **
  • Whatever.
1 helper kept the camera sliding to the right.

I think this should be hassle-free from having to code the helper generated to be exactly middle ._.


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Code Snippet Archive
#66  August 10, 2013, 01:30:45 pm
  • ******
Necrobump!

http://www.mediafire.com/download/35zjbsi2yr8v5g6/CodeDocs.zip

There are a lot of codes and stuff here.
- winkoeffect
- walljump
- stun
- slowmotion
- sfz2vism
etc. ; they are not made by me, I'm hosting them, so that they don't disappear (these are old, WinMugen era).
Who made these?
Necromancer/Flowagirl, Ragnarok, Doctor M, Chocobo etc., look at the ReadMe for details.

If they were already posted or if this is in the wrong topic, please move or delete it.