YesNoOk
avatar

Reflecting projectile help (now posted a video) (Read 7692 times)

Started by krudelu, January 16, 2018, 09:09:42 am
Share this topic:
Reflecting projectile help (now posted a video)
#1  January 16, 2018, 09:09:42 am
  • **
  • (>owo)><(owo<)
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
Code:
[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
Code:
[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
Code:
[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
Code:
[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
Code:
[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
Code:
[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
Code:
[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
Code:
[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
Last Edit: January 19, 2018, 09:24:58 am by krudelu
Re: Reflecting a reflected projectile help
#2  January 17, 2018, 04:10:43 am
  • **
  • (>owo)><(owo<)
Also, while I'm on the topic of reflected projectile, I'm also having another problem regarding the reflected projectile. When the helper projectile hits, the applied explod effects on hit works.

But when the projectile gets reflected and it hits me, the explod effects on hit doesn't work.

Here's the code:

Code:
[State -2,]
type = Explod
triggerall = p2movetype = H
trigger1 = movehit
trigger1 = Random < 999
anim = 4130
pos = 0,-50
postype = p2
sprpriority = 999
bindtime = 1
random = 100,100
ownpal = 1

[State -2,]
type = Explod
triggerall = p2movetype = H
trigger1 = movehit
trigger1 = Random < 999
anim = 4135
pos = 0,-50
postype = p2
sprpriority = 999
bindtime = 1
random = 100,100
ownpal = 1

[State -2,]
type = Explod
triggerall = p2movetype = H
trigger1 = movehit
trigger1 = Random < 999
anim = 4140
pos = 0,-50
postype = p2
sprpriority = 999
bindtime = 1
random = 100,100
ownpal = 1

[State -2,]
type = Explod
triggerall = p2movetype = H
trigger1 = movehit
trigger1 = Random < 999
anim = 4145
pos = 0,-50
postype = p2
sprpriority = 999
bindtime = 1
random = 100,100
ownpal = 1

I also applied these explod codes under the state where the reflected projectile behavior is but when my own projectile hits me after getting my projectile reflected, the explod effect on hit won't work.

Is there something that I may be missing here as well?
Re: Reflecting projectile help
#3  January 19, 2018, 09:40:26 am
  • **
  • (>owo)><(owo<)
Sorry for my 3rd bump but I wanted to post a video regarding what I meant just in case I didn't get to describe the problem I'm having properly so I apologize



I put the game speed to Slow 5 iirc so you guys can catch the frames and/or hitboxes if necessary. Here in this video:

I first showed what I just noticed recently on the improved kfm, which have Vans' projectile reflect system, that he can't reflect back projectiles that's reflected back at him. Would anyone mind looking into this just in case?

For the second part, I just showed how Vans' Robo Athena is able to reflect back the projectile that's reflected back to her like a ping pong

The third part of the video is just me using Athena XI by Ahuron (one of Ahuron's old characters) that I used as a practice for implementing Vansflector. Here, I showed how if Vans' character (Robo Athena is used in this case. Also works with Rugal as well) is the ones that fires a projectile, the reflector system that I applied to Ahuron's Athena seems to be working that it can ping pong.

But when it's Ahuron's Athena, which I converted it's projectile to helper projectile, is the one that fires it, the projectile can be reflected but when I try to reflect the reflected projectile back, the reflected projectile just die. It seems to be the same case as improved kfm.

So far, to me, it seems that there may be a problem with compatibility code on the projectile themselves. I followed the tutorial by Vans and applied the appropriate headers and sysvars and I still can't get to reflect the reflected projectile back.

Is there anything else that I may be missing that may be the reason why I can't reflect back my reflected projectile?
Re: Reflecting projectile help (now posted a video)
#4  January 19, 2018, 02:00:50 pm
  • ******
    • www.justnopoint.com/
I'm actually coming back to update this code this coming week. Things you can expect. Reflection based on type: NP,SP,HP

Compatibility with chars that don't use this system. Angled reflections. And now I'll add this because I wasn't aware it was missing.
Re: Reflecting projectile help (now posted a video)
#5  January 26, 2018, 08:50:02 pm
  • ******
    • www.justnopoint.com/
Showing you I got it! Got to finish a few other things and I'll release the update.


Also if a char isn't compatible KFM will fire his own projectile. Not simply destroy the other and do nothing
Last Edit: January 26, 2018, 10:00:34 pm by Just No Point
Re: Reflecting projectile help (now posted a video)
#6  January 28, 2018, 07:39:09 am
  • **
  • (>owo)><(owo<)
okay, I'll wait until the update release and try the code out.