Anyway, I got it all finished and notated. I think it's pretty clear now. Feel free to add to it or make corrections.
Spoiler: Kung Fu Zankou (click to see content)
;The Kung Fu Zankou will teach you how to properly make a move that acts as a projectile reflector
;See State 1500 for details on the actual projectile
;---------------------------------------------------------------------------
; Light Kung Fu Zankou
; CNS difficulty: easy
[Statedef 1400]
type = S
movetype= A
physics = N
juggle = 4
poweradd= 50
velset = 0,0
anim = 1400
ctrl = 0
sprpriority = 2
[State 1400, 1]
type = PlaySnd
trigger1 = AnimElem = 3
value = 0, 3
[State 1400, Friction]
type = VelMul
trigger1 = 1
x = 0.5
;---------------------------------------------------
;This helper will act as a reflector
[State 1400: Helper]
type = helper
trigger1 = !NumHelper(1435);use this trigger so the helper will not be created multiple times in 1 move
trigger1 = AnimElem = 4
id = 1435
pos = 0,0 ;50
postype = p1
facing = 1
stateno = 1435
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
persistent = 0
;---------------------------------------------------
[State 1400, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype = Hard
damage = 100, 6
priority = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-65
hitsound = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime = 17
ground.velocity = -9
ground.cornerpush.veloff = -15 ;To push far away when p2 is in corner
guard.velocity = -9
air.velocity = -2,-5
airguard.velocity = -3.5,-4.5
air.fall = 1
[State 1400, 3]
type = PosAdd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 3
trigger3 = AnimElem = 4
x = 10
[State 1400, 4]
type = VelSet
trigger1 = AnimElem = 4
x = 2
[State 1400, 5]
type = PosAdd
trigger1 = AnimElem = 8
x = 10
[State 1400, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
Spoiler: Reflector Helper (click to see content)
;---------------------------------------------------------------------------
;This is the helper created in Kung Fu Zankou
;this state sets a sysvar that the projectile "talks" to and destroys
;---------------------------------------------------------------------------
;Reflector Helper
; CNS difficulty: hard
[Statedef 1435]
type = S
movetype = A
physics = N
ctrl = 0
velset = 0, 0
anim = 1430
sprpriority = 4
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで ;
;sysvar(0) = 262144 ;
;=======================================;
[State 1435, COMPATIBILITY]
type = VarSet
trigger1 = !time && !prevstateno
sysvar(0) = 262144
;=======================================;
[State 1435, REFLECTOR]
type = ReversalDef
trigger1 = time = 0
reversal.attr = SCA,NP,SP,HP
pausetime = 0,0
sparkno = -1
sparkxy = 0,0
p1stateno = 1436
p2stateno = 1437
id = 1435
numhits = 0
[State 1435, projs only]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
ignorehitpause = 1
[State 1435, override]
type = HitOverride
trigger1 = !time
attr = SCA, AA, AP, AT
stateno = 1436
time = -1
ignorehitpause = 1
[State 1435]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1
[State 1435, Assert];redundant since it wouldn't cast a shadow anyway because there is no sprite in anim 1430. You'd want this if they used an energy shield to reflect
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1
[State 1435, DestroySelf]
type = DestroySelf
trigger1 = root, StateNo = [1400,1420]
trigger1 = root, AnimElemTime(5) >=0
trigger2 = root, MoveType = H
Spoiler: Successful Reflection (click to see content)
;---------------------------
;Successful Reflection
[Statedef 1436]
type = S
movetype = I
physics = N
ctrl = 0
velset = 0, 0
anim = 1
sprpriority = 4
[State 1436, VarSet]
type = VarSet
trigger1 = numtarget
var(0) = target,ID
persistent = 0
ignorehitpause = 1
[State 1436, DEBUG]
type = DisplayToClipboard
trigger1 = 1
text = "var(0) = %d proj = %d ID = %d";Buff = %d GNDTYPE = %d"
params = var(0),numprojid(262144),gethitvar(chainid)
ignorehitpause = 1
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR PROJECTILE / 飛び道具で ;
;sysvar(0) = 131072 ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで ;
;sysvar(0) = 262144 ;
;sysvar(1) = SPECIAL ;
;=======================================;
[State 1436, VarSet]
type = VarSet
;RETURNING YOUR OWN PROJECTILE
;自分の飛び道具を跳ね返す。
trigger1 = Gethitvar(chainid)&2**17
sysvar(1) = sysvar(0)
[State 1436, ChangeState]
type = ChangeState
trigger1 = PlayerIDExist(var(0))
trigger1 = (PlayerID(var(0)),sysvar(0)=131072)
;RETURNING YOUR OWN PROJECTILE
;自分の飛び道具を跳ね返す。
trigger2 = Gethitvar(chainid)&2**17
value = 1441
ctrl = 0
;=======================================;
[State 1436, DestroySelf]
type = DestroySelf
trigger1 = time = 30
Spoiler: Reflecting A Helper projectile (click to see content)
;---------------------------
;Reflecting A Helper projectile
[Statedef 1437]
physics = N
movetype = I
ctrl = 0
[State 1437, DEBUG]
type = DisplayToClipboard
trigger1 = 1
text = "sysvar(0) = %d pao pao cafe = %d";Buff = %d GNDTYPE = %d"
params = sysvar(0),sysvar(0)&2**17
ignorehitpause = 1
[State 1437]
type = SelfState
trigger1 = sysvar(0)&2**17
value = sysvar(1)
ctrl = 0
[State 1437]
type = DestroySelf
trigger1 = IsHelper
trigger1 = time = 5
ignorehitpause = 1
[State 1437]
type = SelfState
trigger1 = !IsHelper
value = 0
ctrl = 1
[State 1437, Anim]
Type = ChangeAnim2
Trigger1 = !Time
Value = 1 ;don't forget to add this anim to your .air -1,-1, 0,0, 1
;the anim number does not have to be 1
Spoiler: Special Reflection (click to see content)
;---------------------------
;Special Reflection
[Statedef 1441]
type = S
movetype = A
physics = N
ctrl = 0
velset = 0, 0
sprpriority = 5
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで ;
;sysvar(0) = 262144 ;
;=======================================;
[State 1441, INFORMATION SHARING] ;
type = Projectile ;
trigger1 = sysvar(1)&2**18 ;
projid = sysvar(0) ;
projanim = 1 ;
projhitanim = -1 ;
projremanim = -1 ;
projremovetime = 2 ;
projscale = 0,0 ;
projpriority = 0 ;
velocity = 0,0 ;
postype = p1 ;
offset = 0,0 ;
persistent = 0 ;
ignorehitpause = 1 ;
;=======================================;
[State 1441, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 1
[State 1441, StateTypeSet]
type = StateTypeSet
trigger1 = root,movetype = H
trigger2 = cond(PlayerIDExist(var(0)),(PlayerID(var(0)),movetype=I),0)
movetype = I ;I,A,H
[State 1441, PosSet]
type = PosSet
trigger1 = !time || time
trigger1 = PlayerIDExist(var(0))
x = PlayerID(var(0)),Pos X
y = PlayerID(var(0)),Pos Y
[State 1441, DestroySelf]
type = DestroySelf
trigger1 = time > 2
trigger1 = !PlayerIDExist(var(0))
Spoiler: Board Throw (click to see content)
;---------------------------------------------------------------------------
; Board Throw
; CNS difficulty: easy
;in this state we learn how to make your character throw a projectile
;Helpers are the best way to create a projectile
;the actual Projectile controllers are far too limited
[Statedef 1500]
type = S
movetype= A
physics = S
poweradd= 60
velset = 0,0
anim = 1500
ctrl = 0
sprpriority = 2
[State 1500, Button Detect]
type = VarSet
trigger1 = !Time && !AILevel
var(2) = cond((command = "Board Throwx"), 0, 1);this sets the var depending on button pressed when using the move
[State 1500, 1]
type = PlaySnd
trigger1 = AnimElem = 3
value = 0, 4
;This is the helper that we use for the projectile. In this case a solid piece of wood
[State 1500, Helper]
type = Helper
trigger1 = AnimElem = 3
name = "Board"
ID = 1510
stateno = 1510
pos = 20,-60
postype = p1 ;p2,front,back,left,right
facing = 1
ownpal = 1
[State 1500, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
Spoiler: Board Projectile Helper (click to see content)
;---------------------------------------------------------------------------
; Board Projectile Helper
; CNS difficulty: hard
[Statedef 1510]
type = A
movetype= A
physics = N
;juggle = 6 Note that if you actually use juggle points for the helper they will only add to the helper's juggle points. Not the root's (KFM's)
anim = 1510
ctrl = 0
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR PROJECTILE / 飛び道具で ;
;sysvar(0) = 131072 ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;
;=======================================;
[State 1510, COMPATIBILITY]
type = VarSet
trigger1 = !time
sysvar(0) = 131072
[State 1510, REFLECTED STATE]
type = VarSet
trigger1 = !time
sysvar(1) = 1520 ; use the stateno your reflected projectile is located at
;If you do NOT wish for the projectile to be reflected then set it back to the original projectile state
;in this case 1510
;=======================================;
;IF this was a fireball you would use this. As a piece of wood we will allow it to cast a shadow
;[State 1510, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow
;ignorehitpause = 1
[State 1510, Button Detect]
type = VarSet
trigger1= !Time && !PrevStateNo
var(2) = Root, var(2) ;sets the helper var to be the same as the root's var
[State 1510, VelSet]
type = VelSet
trigger1 = Time >= 0
x = Cond(var(2) = 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = 0
[State 1510, Velocity]
type = VelSet
trigger1 = Movecontact ;stop moving when the board connects
x = 0
y = 0
[State 1510, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT ; The helper can't be hit by anything except Projectiles
ignorehitpause = 1
[State 1510, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP ; Only Projectiles will hit. This allows other projectiles to destroy this one
time = 1
ignorehitpause = 1
[State 1510, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1511 ; when hit the Projectile will go to this state. It's destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1
[State 1510, Hitdef]
type = HitDef
trigger1 = AnimElem = 1
id = 1510 ;set as same as stateno
attr = A, SP ; VERY IMPORTANT always remember to set your attr to NP, SP, or HP (Normal, Special, Hyper Projectile)
animtype = hard
damage = ceil(ifElse(root,fvar(11) * 20 < 7, 7, root,fvar(11) * 20)), 0
priority = 4,Hit
guardflag = MA
hitflag = MAF
pausetime = 0,10
sparkxy = 0,0
hitsound = 5,2
guardsound = 6,0
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = cond(p2movetype=H,40,140), 10 ; if P2 already in a hit state you get less power from hitting them
givepower = 35,35
[State 1510, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1
[State 1510, Fade]
type = changestate
trigger1 = movecontact ;destroyed state
value = 1511
ignorehitpause=1
[State 1520, End];this destroys the projectile when it goes too far
type = DestroySelf
trigger1 = pos x != [-200,200]
Spoiler: DESTROY Board Projectile Helper (click to see content)
;---------------------------------------------------------------------------
; DESTROY Board Projectile Helper
; CNS difficulty: easy
[Statedef 1511]
type = A
movetype= A
physics = N
anim = 1511
ctrl = 0
sprpriority = 5
;[State 1511, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow
[State 1511, Snd 1]
type = PlaySnd
trigger1 = !Time
value = F5,2
[State 1511, Snd 1]
type = PlaySnd
trigger1 = Time = 3
value = F5,3
[State 1511, DestroySelf]
type = DestroySelf
trigger1 = p2movetype != H
trigger1 = time >= 27 ;This destroys the projectile when time = 27 which is the end of the board break animation. But ONLY when P2 is NOT in a hit state. While in a hit state this will stay on the final frame so any hits that follow will add to the combo counter
Spoiler: REFLECTED Board Projectile Helper (click to see content)
;---------------------------------------------------------------------------
; REFLECTED Board Projectile Helper
; CNS difficulty: hard
[Statedef 1520]
type = A
movetype= A
physics = N
;juggle = 6 Note that if you actually use juggle points for the helper they will only add to the helper's juggle points. Not the root's (KFM's)
anim = 1510
ctrl = 0
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR PROJECTILE / 飛び道具で ;
;sysvar(0) = 131072 ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;
;=======================================;
[State 1520, COMPATIBILITY]
type = VarSet
trigger1 = !time
sysvar(0) = 131072
[State 1520, REFLECTED STATE]
type = VarSet
trigger1 = !time
sysvar(1) = 1510 ; Use the StateNo you use to fire your projectile
;=======================================;
[State 1520, Turn];turn the projectile around
type = Turn
trigger1 = !time
;IF this was a fireball you would use this. As a piece of wood we will allow it to cast a shadow
;[State 1061, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow
;ignorehitpause = 1
[State 1520, VelSet]
type = VelSet
trigger1 = Time >= 0
x = Cond(var(2) = 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = 0
[State 1520, Velocity]
type = VelSet
trigger1 = Movecontact ;stop moving when the board connects
x = 0
y = 0
[State 1520, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT ; The helper can't be hit by anything except Projectiles
ignorehitpause = 1
[State 1520, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP ; Only Projectiles will hit. This allows other projectiles to destroy this one
time = 1
ignorehitpause = 1
[State 1520, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1511 ; when hit the Projectile will go to this state. It's destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1
[State 1520, Hitdef]
type = HitDef
trigger1 = AnimElem = 1
affectteam = F ; This makes the projectile hurt your own team/char
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR PROJECTILE / 飛び道具で ;
;sysvar(0) = 131072 ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;
;=======================================;
id = sysvar(0)
;=======================================;
attr = A, SP ; VERY IMPORTANT always remember to set your attr to NP, SP, or HP (Normal, Special, Hyper Projectile)
animtype = hard
damage = ceil(ifElse(root,fvar(11) * 20 < 7, 7, root,fvar(11) * 20)), 0
priority = 4,Hit
guardflag = MA
hitflag = MAF
pausetime = 0,10
sparkxy = 0,0
hitsound = 5,2
guardsound = 6,0
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = cond(p2movetype=H,40,140), 10 ; if P2 already in a hit state you get less power from hitting them
givepower = 35,35
[State 1520, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY ;
;飛び道具を跳ね返し行動設定 ;
;by Vans ;
;GUIDE: ;
;FOR PROJECTILE / 飛び道具で ;
;sysvar(0) = 131072 ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで;
;sysvar(0) = 262144 ;
;=======================================;
[State 1520, Turn]
type = Turn
trigger1 = movecontact
trigger1 = root,NumProjID(262144)
persistent = 0
ignorehitpause = 1
[State 1520, ChangeState]
type = ChangeState
trigger1 = movecontact
trigger1 = root,NumProjID(262144)
value = sysvar(1)
ctrl = 0
ignorehitpause = 1
;=======================================;
[State 1520, Fade]
type = changestate
trigger1 = movecontact ;destroyed state
value = 1511
ignorehitpause=1
[State 1520, End]
type = DestroySelf
trigger1 = pos x != [-200,200]
Spoiler: .cmd (click to see content)
;---------------------------------------------------------------------------
;Board Throw
[State -1, Board Throw]
type = ChangeState
value = 1500
triggerall = command = "Board Throwx" || command = "Board Throwy"
trigger1 = ctrl
trigger1 = !NumHelper(1510);this prevents you from throwing more than 1 while another is alive
trigger2 = Numhelper(1510)
trigger2 = helper(1510), StateNo = 1511
trigger2 = ctrl;trigger2s allow you to throw another while the 1st board is in it's hit state
All I need to do now is make the EX Projectile that hits multiple times and test it with the reflector. Then I'll be finished with this portion. @JMorphMan: Didn't you come up with a good way to have multi hitting projectiles get destroyed in the manner they should? The reflector may need to be adapted to that as well, not sure yet.
After that I only need to add charge coding, Juggle Points, and reversed command fix and I think he'll be ready for release!