Hello,

Recently, I've been giving the vans projectile reflection system and I'm able to get the projectile reflection just fine.

But here's now where I'm having trouble. For some reason, I can't get the projectile reflection to work on the **reflected projectile**. What I'm trying to do is to be able to reflect back the projectile that's reflected back at me (like ping pong)

Here's how the codes look like

**State for player popping out the projectile**

[Statedef 1000]

type = S

movetype= A

physics = N

juggle = 8

poweradd= 0

velset = 0,0

anim = 1000

sprpriority = 1

ctrl = 0

[state a]

type = playsnd

trigger1 = animelem = 5

value = 1000,0

channel = 3

[state a]

type = playsnd

trigger1 = animelem = 6

value = 1000,1

[State 1000: Helper]

type = helper

trigger1 = animelemtime(6) = 1

id = 1005

pos = 32, 0 ;50

postype = p1

facing = 1

stateno = 1005

keyctrl = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

persistent = 0

[state a]

type = changestate

trigger1 = animtime = 0

value = 0

ctrl = 1

**code for the projectile itself**

[Statedef 1005]

type = A

movetype = A

physics = N

ctrl = 0

velset = 0, 0

sprpriority = 3

juggle = 10

anim = 1005

;=======================================;

;PROJECTILE REFLECTION COMPATIBILITY ;

;飛び道具を跳ね返し行動設定 ;

;by Vans ;

;GUIDE: ;

;FOR PROJECTILE / 飛び道具で ;

;sysvar(0) = 131072 ;

;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;

;=======================================;

[State 1005, COMPATIBILITY]

type = VarSet

trigger1 = !time

sysvar(0) = 131072

[State 1005, REFLECTED STATE]

type = VarSet

trigger1 = !time

sysvar(1) = 1007

;=======================================;

[State 1402, VelSet]

type = VelSet

trigger1 = animelem = 1

x = 4

[State 7001, Assert]

type = AssertSpecial

trigger1 = 1

flag = noshadow

ignorehitpause = 1

[State 1000, projs only]

type = HitBy

trigger1 = 1

value = SCA, NP, SP, HP

ignorehitpause = 1

[State 10012, override]

type = HitOverride

trigger1 = !time

attr = SCA, AA, AP, AT

stateno = 1006

time = -1

slot = 2

ignorehitpause = 1

[State 1005, TargetDrop]

type = TargetDrop

trigger1 = root,numtarget

[State 00];

type = hitdef

trigger1 = time = 0

attr = S, SP

getpower = 25,25

givepower = 16,16

damage = ceil(65*(root,fvar(10))),10

animtype = Hard

guardflag = M

pausetime = 4,11

sparkno = -1

guard.sparkno = S7012

sparkxy = 0,-63

hitsound = S410,0

guardsound = S122,0

ground.type = Low

ground.hittime = 15

ground.slidetime = 15

ground.velocity = -11

air.velocity = -4,-4

ground.cornerpush.veloff = 0

guard.cornerpush.veloff = 0

air.cornerpush.veloff = 0

fall = 0

air.fall = 1

fall.recover = 0

air.juggle = 8

ID = 1005

persistent = 0

[State 1000, DestroySelf]

type = DestroySelf

triggerall = time > 1

trigger1 = FrontEdgeDist <= -40

[State 1005, Next]

type=changeState

trigger1 = movecontact

value= 1006

ignorehitpause = 1

**code when projectile hits**

[Statedef 1006]

type = S

physics = N

movetype = I

ctrl = 0

sprpriority = 3

velset = 0,0

anim = 1006

[State 7001, Assert]

type = AssertSpecial

trigger1 = 1

flag = noshadow

ignorehitpause = 1

[State 2002, StateTypeSet]

type = StateTypeSet

trigger1 = animelem = 1;8

movetype = I ;I,A,H

ignorehitpause = 1

[State 1106, NotHitBy]

type = NotHitBy

trigger1 = 1

value = SCA

time = 1

[State 1005, End]

type = destroyself

trigger1 = !animtime ;&& !numtarget

**Code for reflected projectile**

[Statedef 1007]

type = A

movetype = A

physics = N

ctrl = 0

velset = 0, 0

sprpriority = 4

juggle = 0

;=======================================;

;PROJECTILE REFLECTION COMPATIBILITY ;

;飛び道具を跳ね返し行動設定 ;

;by Vans ;

;GUIDE: ;

;FOR PROJECTILE / 飛び道具で ;

;sysvar(0) = 131072 ;

;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;

;=======================================;

[State 1005, COMPATIBILITY]

type = VarSet

trigger1 = !time

sysvar(0) = 131072

[State 1005, REFLECTED STATE]

type = VarSet

trigger1 = !time

sysvar(1) = 1005

;=======================================;

[State 1007, Turn]

type = Turn

trigger1 = !time

[State 1000, Anim]

Type = ChangeAnim

Trigger1 = !Time

Value = 1005

ignorehitpause = 1

[State 1402, VelSet]

type = VelSet

trigger1 = animelem = 1

x = 4

[State 7001, Assert]

type = AssertSpecial

trigger1 = 1

flag = noshadow

ignorehitpause = 1

[State 1000, projs only]

type = HitBy

trigger1 = 1

value = SCA, NP, SP, HP

ignorehitpause = 1

[State 10012, override]

type = HitOverride

trigger1 = !time

attr = SCA, AA, AP, AT

stateno = 1006

time = -1

slot = 2

ignorehitpause = 1

[State 00];

type = hitdef

trigger1 = time = 0

attr = S, SP

getpower = 25,25

givepower = 16,16

damage = ceil(65*(root,fvar(10))),10

animtype = Hard

guardflag = M

pausetime = 4,11

sparkno = -1

guard.sparkno = S7012

sparkxy = 0,-63

hitsound = S410,0

guardsound = S122,0

ground.type = Low

ground.hittime = 15

ground.slidetime = 15

ground.velocity = -11

air.velocity = -4,-4

ground.cornerpush.veloff = 0

guard.cornerpush.veloff = 0

air.cornerpush.veloff = 0

fall = 0

air.fall = 1

fall.recover = 0

air.juggle = 8

ID = 1005

persistent = 0

affectteam = F

;=======================================;

;PROJECTILE REFLECTION COMPATIBILITY ;

;飛び道具を跳ね返し行動設定 ;

;by Vans ;

;GUIDE: ;

;FOR PROJECTILE / 飛び道具で ;

;sysvar(0) = 131072 ;

;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;

;=======================================;

id = sysvar(0)

;=======================================;

;=======================================;

;PROJECTILE REFLECTION COMPATIBILITY ;

;飛び道具を跳ね返し行動設定 ;

;by Vans ;

;GUIDE: ;

;FOR PROJECTILE / 飛び道具で ;

;sysvar(0) = 131072 ;

;sysvar(1) = REFLECTED_BEHAVIOR_STATE ;

;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで ;

;sysvar(0) = 262144 ;

;=======================================;

[State 1007, Turn]

type = Turn

trigger1 = movecontact

trigger1 = root,NumProjID(262144)

persistent = 0

ignorehitpause = 1

[State 1206, ChangeState]

type = ChangeState

trigger1 = movecontact

trigger1 = root,NumProjID(262144)

value = sysvar(1)

ctrl = 0

ignorehitpause = 1

;=======================================;

[State 1000, DestroySelf]

type = DestroySelf

triggerall = time > 1

trigger1 = FrontEdgeDist <= -40

[State 1005, fade]

type=changeState

trigger1 = movecontact

value= 1006

ignorehitpause = 1

**code for the player doing the reflector**

[Statedef 1200]

type = S

movetype= A

physics = N

juggle = 0

poweradd= 50

velset = 0,0

anim = 1200

sprpriority = 1

ctrl = 0

[state a]

type = playsnd

trigger1 = animelem = 3

value = 1200,0

channel = 3

[state a]

type = playsnd

trigger1 = animelem = 4

value = 1200,1

[State 1000, ChangeAnim]

type = ChangeAnim

trigger1 = movetype = A

trigger1 = animelemtime(4) >= 0

trigger1 = movecontact

value = 1201

persistent = 0

[State 200, StateTypeSet]

type = StateTypeSet

trigger1 = animelem = 19

trigger2 = anim = 1201

movetype = I

[State 1000: Helper]

type = helper

trigger1 = animelemtime(3) = 1

id = 1205

pos = 0,0 ;50

postype = p1

facing = 1

stateno = 1205

keyctrl = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

persistent = 0

[State 1000: Helper]

type = helper

triggerall = !numhelper(1206)

triggerall = Numhelper(1205) = 1

trigger1 = helper(1205),stateno = 1206

trigger1 = helper(1205),time = 2

id = 1206

pos = 60, 0 ;50

postype = p1

facing = 1

stateno = 1209

keyctrl = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

persistent = 0

[State 240, 2]

type = HitDef

trigger1 = time = 0

attr = S, SA

animtype = hard

damage = 60,10

priority = 3, Hit

getpower = 25,25

givepower = 16,16

hitflag = MAF

guardflag = M

pausetime = 0,14

sparkno = 3

sparkxy = -15,-73

hitsound = s410,0

guard.sparkno = s7012

guardsound = s122,0

ground.type = high

ground.slidetime = 13

ground.hittime = 13

ground.velocity = -4,-5

guard.slidetime = 13

guard.hittime = 13

guard.velocity = -4

air.velocity = -4,-5

yaccel = 0.42

fall = 1

fall.recover = 1

ground.cornerpush.veloff = 0

guard.cornerpush.veloff = 0

air.cornerpush.veloff = 0

[State 200, Damage Dampen]

type = varset

trigger1 = movehit

fvar(10) = fvar(10)*0.95

ignorehitpause = 1

persistent = 0

[State 220,2]

type = ChangeState

trigger1 = AnimTime = 0

value = 0

ctrl = 1

**code for reflector**

[Statedef 1205]

type = S

movetype = A

physics = N

ctrl = 0

velset = 0, 0

anim = 1205

sprpriority = 4

;=======================================;

;PROJECTILE REFLECTION COMPATIBILITY ;

;飛び道具を跳ね返し行動設定 ;

;by Vans ;

;GUIDE: ;

;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで ;

;sysvar(0) = 262144 ;

;=======================================;

[State 1005, COMPATIBILITY]

type = VarSet

trigger1 = !time && !prevstateno

sysvar(0) = 262144

;=======================================;

[State 1301, REFLECTOR]

type = ReversalDef

trigger1 = time = 0

reversal.attr = SCA,NP,SP,HP

pausetime = 0,0

sparkno = -1

sparkxy = 0,0

p1stateno = 1206

p2stateno = 1207

id = 1201

numhits = 0

[State 1000, projs only]

type = HitBy

trigger1 = 1

value = SCA, NP, SP, HP

ignorehitpause = 1

[State 10012, override]

type = HitOverride

trigger1 = !time

attr = SCA, AA, AP, AT

stateno = 1206

time = -1

ignorehitpause = 1

[State 10005]

type = BindToParent

trigger1 = 1

pos = 0,0

ignorehitpause = 1

[State 7001, Assert]

type = AssertSpecial

trigger1 = 1

flag = noshadow

ignorehitpause = 1

[State 1000, DestroySelf]

type = ChangeState

trigger1 = !animtime

trigger2 = root,stateno = 1200

trigger2 = root,movecontact

trigger3 = root,stateno != 1200

value = 1208

**code for successful reflection**

[Statedef 1206]

type = S

movetype = I

physics = N

ctrl = 0

velset = 0, 0

anim = 1

sprpriority = 4

[State 1000: Helper]

type = helper

trigger1 = 1

id = 1208

pos = 0,0 ;50

postype = p1;p1

facing = 1

stateno = 1208

keyctrl = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

persistent = 0

[State 1205, VarSet]

type = VarSet

trigger1 = numtarget

var(0) = target,ID

persistent = 0

ignorehitpause = 1

[State -2, 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 106, VarSet]

type = VarSet

;RETURNING YOUR OWN PROJECTILE

;自分の飛び道具を跳ね返す。

trigger1 = Gethitvar(chainid)&2**17

sysvar(1) = sysvar(0)

[State 1206, ChangeState]

type = ChangeState

trigger1 = PlayerIDExist(var(0))

trigger1 = (PlayerID(var(0)),sysvar(0)=131072)

;RETURNING YOUR OWN PROJECTILE

;自分の飛び道具を跳ね返す。

trigger2 = Gethitvar(chainid)&2**17

value = 1211

ctrl = 0

;=======================================;

[State 1000, DestroySelf]

type = DestroySelf

trigger1 = time = 30

**code for reflecting the projectile**

[Statedef 1207]

physics = N

movetype = I

ctrl = 0

[State -2, 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 1580]

type = SelfState

trigger1 = sysvar(0)&2**17

value = sysvar(1)

ctrl = 0

[State 1580]

type = DestroySelf

trigger1 = IsHelper

trigger1 = time = 5

ignorehitpause = 1

[State 1580]

type = SelfState

trigger1 = !IsHelper

value = 0

ctrl = 1

[State 811, Anim]

Type = ChangeAnim2

Trigger1 = !Time

Value = 1

I'm trying to code it by trying to follow the updated kfm's sample while also looking at Vans' robo athena's code at the same time.

Also, I'm trying the reflect ping pong on the same character I'm coding this as well.

Is there something along the codes I put up I might be missing that reflecting a reflected projectile ended up not working somehow?

Sorry for a huge post since I'm trying to post how I tried to put the codes together so you guys may check up on it if there's something I may be missing on