YesNoOk
avatar

Common1.cns - Basic (Read 2437 times)

Started by recruta42, October 19, 2007, 01:19:02 am
Common1.cns - Basic
New #1  October 19, 2007, 01:19:02 am
  • **
  • Call me Private42.
Here I will put descriptions of the basic part of the common1.cns. This part is located in the beggining of the common1.cns and I did it to serve in general for all chars. If needed to be modified can be programmed inside basic.cns or using -2 states.

State 0 - Stand
State 5 - Turn
State 10 - Stand to crouch
State 11 - Crouching
State 12 - Crouch to stand
State 20 - Walk
State 40 - Jump start
State 50 - Jump up
State 51 - Jump Down
State 52 - Jump Land


;---------------------------------------------------------------------------
;This state is the normal idle state for all chars.
;Through the state 0 it is possible to change into 4 different animations depending on the situation. Var(1) is responsable to say if
;you are armed (var(1) = 0) or disarmed (var(1) = 1). So if you are armed you will enter is anim 0 for stand and 5 for turn and if you
;are disarmed 1 for stand and 7 for turn.
;Var(39) is responsable to indicate, while playing in Tag team mode, if you are player 1 (var(39)=1) or player 2 (var(39)=2).
;The control of player 2 (var(39)=2) is totally removed on state[0,1] when entering in this statedef to make it possible to control
;both players during tag team since his control will be transfered to player 1 on the right conditions.
;State[0,6] is responsable for changing player 2, during tag team battle, to state 5 (turn) when the distance from P2 is negative
;(other side) since there is no special state to program the turn state.
;State[0,3,4,5] sctrls are responsable to set player 2 vel X, Y and por Y to zero when entering on this state to prevent the char
;from floating above the floor when coming from an aereal state.
;[State 0, 7]  sends you to a die state if are killed!
;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S

[State 0, 0]
type = ChangeAnim
trigger1 = Anim != (0 + 1*(var(1)!=0 && AnimExist(1))) && Anim != (5 + 2*(var(1) != 0 && AnimExist(7)))
trigger2 = Anim = (5 + 2*(var(1) != 0 && AnimExist(7))) && AnimTime = 0
value = (0 + 1*(var(1)!=0 && AnimExist(1)))

[State 0, 1]
type = CtrlSet
triggerall = var(39) = 2
trigger1 = time =0
value =0

[State 0, 2]
type = CtrlSet
trigger1 = RoundState =3
value =1

[State 0, 3]
type = posset
trigger1 = Time = 0
y = 0

[State 0, 4]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 0, 5]
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0, 6]
type = ChangeState
triggerall = var(39) = 2
trigger1 = P2Dist X <0
value = 5

[State 0, 7]
type = ChangeState
trigger1 = !alive
value = 5400

;---------------------------------------------------------------------------
;Turn

[Statedef 5]
type    = S
physics = S
anim = (5 + 2*(var(1) != 0 && AnimExist(7)))
ctrl = 0
velset = 0,0
sprpriority = 3

[State 11, 1]
type = CtrlSet
triggerall = var(39) = 1 || NumPartner = 0
trigger1 = time = 0
value = 1

[State 11, 1]
type = CtrlSet
triggerall = var(39) = 2
trigger1 = time = 0
value = 0

[State 5, turn]
type = Turn
trigger1 = Time = 0
trigger1 = P2Dist X < 0

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

;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
physics = C
anim = 10 + 3*(var(1)!=0 && AnimExist(13))
velset = 0,0
sprpriority = 3

[State 10, changestate 1]
type = ChangeState
triggerall = var(39)= 1 || NumPartner = 0
trigger1 = command != "holddown"
value = 0
ctrl = 1

[State 10, changestate 1]
type = ChangeState
triggerall = var(39)= 2
trigger1 = partner,command != "holddown"
value = 0
ctrl = 1

[State 10, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
anim = 11 + 3*(var(1)!=0 && AnimExist(14))
velset = 0,0
sprpriority = 3

[State 11, 1]
type = ChangeAnim
trigger1 = Anim = (6 + 2*(var(1)!=0 && AnimExist(8))) && AnimTime = 0
value = 11 + 3*(var(1)!=0 && AnimExist(14))

[State 0, 4]
type = Turn
triggerall = var(39)=2
trigger1 = P2Dist X <0

[State 11, 1]
type = CtrlSet
triggerall = var(39)= 1 || NumPartner = 0
trigger1 = time = 0
value = 1

[State 11, 1]
type = CtrlSet
triggerall = var(39)=2
trigger1 = time = 0
value = 0

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = S
anim = 12 + 3*(var(1)!=0 && AnimExist(15))
sprpriority = 3

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

;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 3

[State 20,0]
type = CtrlSet
triggerall = var(39) = 2
trigger1 = 1
value =0

[State 20,0];
type = VelSet
triggerall = var(39) = 2
trigger1 = partner,command = "holdfwd"
x = const(velocity.walk.fwd.x)*ifelse(prevstateno = 5,-1,1)

[State 20,0];
type = VelSet
triggerall = var(39) = 2
trigger1 = partner,command = "holdback"
x = const(velocity.walk.back.x)*ifelse(prevstateno = 5,-1,1)

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd" && (var(39) = 1 || NumPartner = 0)
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback" && (var(39) = 1 || NumPartner = 0)
x = const(velocity.walk.back.x)

[State 20, 3];Changed
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 + 2*(var(1)!=0 && AnimExist(22)) && Anim != (5 + 2*(var(1) != 0 && AnimExist(7)))
trigger2 = Anim = (5 + 2*(var(1) != 0 && AnimExist(7))) && AnimElemTime(1) >= 1
value = 20 + 2*(var(1)!=0 && AnimExist(22))

[State 20, 4];Changed
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 + 2*(var(1)!=0 && AnimExist(23)) && Anim != (5 + 2*(var(1) != 0 && AnimExist(7)))
trigger2 = Anim = (5 + 2*(var(1) != 0 && AnimExist(7))) && AnimElemTime(1) >= 1
value = 21 + 2*(var(1)!=0 && AnimExist(23))

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 3

[State 40, 1]
type = CtrlSet
triggerall = var(39)= 2
trigger1 = time = 0
value = 0

[State 40, 0]
type = turn
triggerall = time = 0
trigger1 = P2dist X < 0

[State 40, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = F0,17

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

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd" && (var(39) = 1 || NumPartner = 0)
trigger2 = partner,command = "holdfwd" && var(39) = 2
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback" && (var(39) = 1 || NumPartner = 0)
trigger2 = partner,command = "holdback" && var(39) = 2
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, explod]
type = Explod
trigger1 = Time = 0
ID = 50
anim = F50
postype = p1
pos = 0, 0
sprpriority = 5
ownpal = 1
bindtime = 1
ignorehitpause = 1
scale = .5, .5
persistent = 0

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

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

[State 50, 1]
type = CtrlSet
triggerall = var(39)= 2
trigger1 = time =0
value =0

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

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, (41 + 3*(var(1) != 0 && AnimExist(44))), ifelse((vel x)>0, (42 + 3*(var(1) != 0 && AnimExist(45))), (43+ 3*(var(1) != 0 && AnimExist(46)))))

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type    = A
physics = A

[State 51, 1]
type = Null
trigger1 = 1

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = 47 + 1*(var(1)!=0 && AnimExist(48))
sprpriority = 3

[State 52, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = F0,34

[State 52, PlaySnd]
type = PlaySnd
trigger1 = time = 0
trigger1 = name = "Zankuro"
value = F0,35

[State 52, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0 && PrevStateno = [600,799]
value = (47 + 1*(var(1) != 0 && AnimExist(48)))

[State 52, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 2 && PrevStateno != [600,799]
value = (47 + 1*(var(1) != 0 && AnimExist(48)))

[State 52, VelSet]
type = VelSet
trigger1 = Time = 0
y = 0
x = 0

[State 52, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

[State 52, explod]
type = Explod
trigger1 = Time = 0
ID = 51
anim = F51
postype = p1
pos = 0, 0
random = 30,0
sprpriority = 5
ownpal = 1
bindtime = 1
ignorehitpause = 1
scale = .5, .5
persistent = 0
[State 52, explod]
type = Explod
trigger1 = Time = 0
ID = 51
anim = F51
postype = p1
pos = 0, 0
random = 30,0
sprpriority = 5
ownpal = 1
bindtime = 1
ignorehitpause = 1
scale = .5, .5
persistent = 0
[State 52, explod]
type = Explod
trigger1 = Time = 0
ID = 51
anim = F51
postype = p1
pos = 0, 0
random = 30,0
sprpriority = 5
ownpal = 1
bindtime = 1
ignorehitpause = 1
scale = .5, .5
persistent = 0
[State 52, explod]
type = Explod
trigger1 = Time = 0
ID = 51
anim = F51
postype = p1
pos = 0, 0
random = 30,0
sprpriority = 5
ownpal = 1
bindtime = 1
ignorehitpause = 1
scale = .5, .5
persistent = 0

[State 52, 1]
type = VarSet
triggerall = Var(39) = 2
trigger1 = time = 0
var(38)=0

[State 52, 2]
type = VarSet
triggerall = Var(39)=2
trigger1 = Time > 1 && partner,command != "holdup"
trigger2 = Animtime = -1 && P2dist X >= 0
var(38)=1

[State 52, ctrl]
type = ctrlset
trigger1 = Time > 1 && command != "holdup" && (var(39) = 1 || NumPartner = 0)
trigger2 = Animtime = -1 && P2dist X >= 0 && (var(39) = 1 || NumPartner = 0)
value = 1

[State 52, changestate]
type = ChangeState
trigger1 = P2dist X < 0 && AnimTime = 0
value = 5

[State 52, changestate]
type = ChangeState
trigger1 = AnimTime = 0 && (Anim = (47 + 1*(var(1)!=0 && AnimExist(48))) || Anim = (5 + 2*(var(1)!=0 && AnimExist(7))))
value = 0
ctrl = 1
Last Edit: October 19, 2007, 01:23:13 am by recruta42