YesNoOk
avatar

Code Snippet Archive (Read 335847 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