YesNoOk
avatar

Destroy a Helper with a projectile and have it continue on its way. (Read 5711 times)

Started by vlad_alucard, August 04, 2022, 08:55:50 pm
Share this topic:
Destroy a Helper with a projectile and have it continue on its way.
#1  August 04, 2022, 08:55:50 pm
  • **
    • Argentina
I have some chars that use tracker projectile helpers, it's fine when this is neutralized with a normal projectile. But when it collides with a higher priority projectile like the ones I use on my chars' level 1 supers it still neutralizes them even if they have a priority of 10 or higher.

I've tried using a hidden projectile that shields the main from helpers but sometimes it hits an opponent mid-jump and throws them back causing the real projectile to miss. I've tried various grounds and air velocity to work around that problem but it's only a temporary fix. I would like to know if there is any way that the helper does not neutralize my high priority projectiles.

This is the code of the helpers

Code:
;-------------------------------------------------------------------------------
;Tsuiseki Helper1
[Statedef 1203]
type=S
movetype=A
physics=S
anim=1203
[State 1203]
type=PosSet
trigger1=Pos Y>-52
y=-52
[State 1203]
type=HitDef
trigger1=Time=0
attr=S,SA
damage=40,10
getpower=0
givepower=0
hitflag=MAFD
guardflag=MA
pausetime=5,5
sparkxy=0,0
sparkno=s6002
guard.sparkno=s6002
hitsound=F0,2
guardsound=F1,0
ground.type=Trip
ground.slidetime=10
ground.hittime=15
ground.velocity=-1.5
air.velocity=-1.2,-3
guard.velocity=-5
fall=1
[State 1203]
type=velset
trigger1=P2Dist X<0
x=-5
[State 1203]
type=velset
trigger1=P2Dist X=0
x=0
[State 1203]
type=velset
trigger1=P2Dist X>0
x=5
[State 1203]
type=velset
trigger1=P2Dist Y<0
y=-3
[State 1203]
type=velset
trigger1=P2Dist Y=0
y=0
[State 1203]
type=velset
trigger1=P2Dist Y>0
y=3
[State 1203]
type=NotHitBy
trigger1=time>=0
value=,AA,AT
[State 1203]
type=HitOverride
trigger1=time=0
attr=SCA,NP,SP,HP,AP,NA,SA,HA,NT,ST,HT
stateno=1204
time=-1
[State 1203]
type=ChangeState
trigger1=movecontact=1
value=1204
ctrl=0
[State 1203]
type=DestroySelf
trigger1=time=800
;-------------------------------------------------------------------------------
;Tsuiseki Helper2
[Statedef 1204]
type=S
movetype=A
physics=S
juggle=2
poweradd=0
ctrl=0
anim=1203
[State 1204]
type=VelSet
trigger1=time=0
x=0
y=0
[State 1204]
type=Explod
trigger1=time=0
trigger1=var(23)=1
anim=6002
pos=floor(P2BodyDist X),floor(P2BodyDist Y)
postype=p1
removetime=-2
vel=0.7,0
ontop=1
[State 1204]
type=DestroySelf
trigger1=time=0

And this is the one of the Level1 Supers

Code:
;===============================================================================
;GekiretsuKodan
[Statedef 2000]
type=S
movetype=H
physics=S
poweradd=-1000
juggle=1
anim=2000
ctrl=0
velset=0,0
[State 2520]
type=Explod
trigger1=Time=1
anim=2010
ID=2010
pos=7,-52
postype=P1
removeongethit=1
removetime=17
scale=1,1
sprpriority=0
ontop=1
removeongethit=1
[State 2000]
type=PlaySnd
trigger1=AnimElem=1
value=S5,2
[State 2000]
type=PlaySnd
trigger1=AnimElem=2
value=F3,1
[State 2000] ;AntiHelperProjectile
type=Projectile
trigger1=AnimElem=2
Projanim=2533
projpriority=1
offset=44,-55
velocity=15,0
remvelocity=.7,0
velmul=1,1
attr=S,NP
animtype=Medium
guardflag=MA
sparkno=-1
guard.sparkno=-1
ground.type=Low
air.type=low
ground.slidetime=0
ground.hittime=0
ground.velocity=-12,-4
air.velocity=-2.5,-5.5
[State 2000]
type=Projectile
trigger1=AnimElem=2
Projanim=2015
projsprpriority=10
ProjHitAnim=6003
ProjRemAnim=6003
projpriority=15
offset=40,-55
velocity=15,0
remvelocity=.7,0
velmul=1,1
attr=S,NP
animtype=Medium
damage=150,5
guardflag=MA
pausetime=20,12
sparkno=-1
guard.sparkno=-1
sparkxy=0,0
hitsound=F0,3
guardsound=F1,0
ground.type=Low
ground.slidetime=15
ground.hittime=9
ground.velocity=-12,-4
air.type=low
air.velocity=-2.5,-5.5
air.juggle=3
fall=1
down.bounce=1
[State 2000]
type=ChangeState
trigger1=power=0
value=5300
ctrl=1
[State 2000]
Type=ChangeState
trigger1=time=50
value=0
ctrl=1
Help me i can't change profile picture!!!! D:
Last Edit: August 06, 2022, 07:13:11 pm by vlad_alucard
Re: Destroy a Helper with a projectile and have it continue on its way.
#2  August 05, 2022, 01:39:16 am
  • **
The priority of a projectile only works against other projectiles with the projectile sctrl, so in your case since your tracking projectile only uses the Hitdef sctrl, it isn't classified as an actual 'projectile' and won't interact the same way.

You could either use a projectile sctr for your tracking helper and set a lower priority for it or make your lv1 super a 2-hit projectile by setting projhit = 2. Should work for what you want.
Re: Destroy a Helper with a projectile and have it continue on its way.
#3  August 05, 2022, 02:26:11 am
  • **
  • Don't copy code if you don't understand it.
    • USA
    • a13rown@hotmail.com

Ok, so "tracking helper" means that it follows P2? 
Next, your saying that the super projectile is still being destroyed by the "projectile helper" no matter how high the
propriority is?  Just trying to make sure I am following you correctly.

Steel Hammer is correct, the HitDef must be coded for what happens after it collides into a projectile. Or, in other words the helper needs a HitBy sctrl for projectiles.

I had to experiment with this lately.  I had to recode all of the helper projectiles in my game to hitdefs in order for Lei-Lei reflection move to look right. 



But yea, if you want to continue to Use the Hitdef for the projectile, like steel hammer said, it won't work unless coded properly.  If I am reading your question right lol.
Re: Destroy a Helper with a projectile and have it continue on its way.
#4  August 05, 2022, 03:26:29 am
  • **
    • Argentina
The priority of a projectile only works against other projectiles with the projectile sctrl, so in your case since your tracking projectile only uses the Hitdef sctrl, it isn't classified as an actual 'projectile' and won't interact the same way.

You could either use a projectile sctr for your tracking helper and set a lower priority for it or make your lv1 super a 2-hit projectile by setting projhit = 2. Should work for what you want.

It makes a lot of sense but how would I make the Tracking Helper projectile chase P2? And that the helper does not destroy the superprojectiles with which it contacts?




Ok, so "tracking helper" means that it follows P2? 
Next, your saying that the super projectile is still being destroyed by the "projectile helper" no matter how high the
propriority is?  Just trying to make sure I am following you correctly.

Steel Hammer is correct, the HitDef must be coded for what happens after it collides into a projectile. Or, in other words the helper needs a HitBy sctrl for projectiles.

I had to experiment with this lately.  I had to recode all of the helper projectiles in my game to hitdefs in order for Lei-Lei reflection move to look right. 
[youtube]https://www.youtube.com/watch?v=QdXp0UHKFu4[/youtube]


But yea, if you want to continue to Use the Hitdef for the projectile, like steel hammer said, it won't work unless coded properly.  If I am reading your question right lol.

About the video isnt not my case but you are right

Another workaround I tried was to make the helper disappear when the p2 fires a super level 1 or 2 projectile. Since they are quite fast it seems that the projectile makes them disappear but it's just an illusion.
Help me i can't change profile picture!!!! D:
Re: Destroy a Helper with a projectile and have it continue on its way.
#5  August 05, 2022, 04:06:46 am
  • **
  • Don't copy code if you don't understand it.
    • USA
    • a13rown@hotmail.com
Lol, sorry about the video. I just showing that I had to make all of my projectiles into Hitdefs.  You can make the helper chase P2.  I think the code is still in this forum in the code library.  I've used it so I'm sure it works.  Ok, so basically you can use a hitdef helper that changes back to the current state once it makes contact with a projectile. You can use a Var to keep track of how many hits you want it to have.  For example, in POTS Ryu he uses this in his shinkuu hadouken helper:

[State 3005, HitOverride];  This means if the helper makes contact with anything with the following attributes, it would go back to its current state;
type = hitoverride          ; as long as Var(2) is under 5.
trigger1 = 1
time = -1
attr = SCA, AA, AP, AT
stateno = ifelse(var(2) < 5, 3005, 3006)
ignorehitpause = 1

[State 3005, hitvar]; Sets the Var(2) to 1 when the helper is active.
type = varadd
trigger1 = !time
var(2) = 1

[State 3005, Vel]; The speed is determined by what value Var(2) is.
type = velset
trigger1 = 1
x = ifelse((time < 2 && var(2) > 1), 1, 9)
y = 0

;In the helpers hitdef, the pausetime needs to be based on Var(2) value:
pausetime = 4 * (var(2) < 5), 8

[State 3005, End];Changes State based on the Var(2) value.
type = changestate
trigger1 = movecontact
value = ifelse(var(2) < 5, 3005, 3006)

[State 3005, End];  Destroys self when it goes off screen.
type = destroyself
trigger1 = pos x != [ -240, 240]

Here is the state after Var(2) has a value greater than 5

[Statedef 3006]
type = A
physics = N
movetype = I
anim = 3006
ctrl = 0
velset = 0, 0
sprpriority = 4

[State 3006, End]
type = destroyself
trigger1 = !animtime

In other words,
- make both helper projectile attacks hitdefs
- use a variable to determine the hitcount
- make sure the helper goes back to the current state after contact(unless the numerical value is too high)
-when the variable value reaches the specific numerical value, it will go into the final state.

I hope this helps.
Re: Destroy a Helper with a projectile and have it continue on its way.
#6  August 05, 2022, 04:53:41 am
  • **
@The Jaquio: That code doesn't seem like it'll work as @vlad_alucard: is currently using a helper projectile and a standard non-helper projectile.  From what i'm reading, vlad isn't looking to make either projectiles have more than 1 hit each but at the same time, want's the lv1 to beat the helper.

So the way to work this out is to replace the hitdef sctrl in the helper with a projectile sctrl and have all the associated projectile animations.  Doing this won't affect the behaviour of the helper (it will still track) while having it gain the properties of an actual projectile to interact with your lv1 Super. 


Last Edit: August 05, 2022, 05:01:42 am by SteelHammers
Re: Destroy a Helper with a projectile and have it continue on its way.
#7  August 05, 2022, 05:05:55 pm
  • **
    • Argentina
@The Jaquio: That code doesn't seem like it'll work as @vlad_alucard: is currently using a helper projectile and a standard non-helper projectile.  From what i'm reading, vlad isn't looking to make either projectiles have more than 1 hit each but at the same time, want's the lv1 to beat the helper.

So the way to work this out is to replace the hitdef sctrl in the helper with a projectile sctrl and have all the associated projectile animations.  Doing this won't affect the behaviour of the helper (it will still track) while having it gain the properties of an actual projectile to interact with your lv1 Super. 




That's right, try making the Helper have an invisible animation and create a projectile that only lasts two ticks and stays in the Helper's position. But I only leave a trail of projectiles that disappear and worse still do not make contact with p2 and continue to destroy my LV1 supers
Help me i can't change profile picture!!!! D:
Re: Destroy a Helper with a projectile and have it continue on its way.
#8  August 06, 2022, 04:59:06 am
  • **
That's right, try making the Helper have an invisible animation and create a projectile that only lasts two ticks and stays in the Helper's position. But I only leave a trail of projectiles that disappear and worse still do not make contact with p2 and continue to destroy my LV1 supers

Well, this one is quite challenging. Did a little test and came up with a code for you. Worked for me so should also work if you've done everything correctly.
To make this work, you'd have to hide the actual projectile behind the helper projectile's sprite.
The steps are:

1. Your animation with the actual 'helper projectile' sprite in [statedef 1203] which is currently 1203 needs no collision boxes.
2. Make a 1 frame blank animation but have both collision boxes in it.  They should reflect the collisions that you currently used in anim=1203. This be used for your actual projectile animation
3. Have a projectile Hit animation.
4. Have a projectile cancel animation. This can be the same as the Hit animation.
5. Have a projectile remain animation. This should be a blank animation with no collision boxes.
6. You DO NOT NEED any Nothitby's, Hitoverrides or changestates as your animation shouldn't have collision boxes.

Then In your helper state [statedef 1203], Going by what you've posted,
your state should look like this (with the projectile and destroy self code):
Code:
;======================================
[Statedef 1203]
type=S
movetype=A
physics=S
anim= 1203
velset=0,0

;---YOUR PROJECTILE STATE CONTROL (these are mandatory parameters to make it work)-----
[State 1203, Projectile]
type = Projectile
triggerAll = !root,ProjContact=1,<20 ;---You can change the 20 to a higher value but leave first and see what happens. 
trigger1= !root,NumProjID(1203) && time%3=0 ;--->Only exist one at a time and only during every 3 ticks  don't change this else it will not work properly
ProjID = 1203 ;---->YOUR ID; should be set to 1203: same as this state
projanim = 1203 ;---->Use YOUR Animation Number  (must be blank anim with both collision boxes)
projhitanim = 1213 ;---->Use YOUR Hit Animation Number
projremanim = 1223 ;---->Use YOUR Animation Number (must be blank anim with no collision boxes)
projcancelanim = 1213 ;---->Use YOUR cancel Animation Number
projremovetime = 2 ;--->Must exist for 2 ticks. Don't change this value as it's used to work with time%3=0
velocity = 0,0  ;--->Doesn't move so it can move with the helper
projpriority = 2  ;--->Any value lower than your Lv1 super.
;------------------The rest is the same as your original hitdef------
attr = S,SP        ;--->Changed to S,SP as it's a projectile so don't use S,SA
damage=40,10
getpower=0
givepower=0
hitflag = MAFD       
guardflag = MA       
pausetime=5,5
sparkxy=0,0
sparkno=s6002
guard.sparkno=s6002
hitsound=F0,2
guardsound=F1,0
ground.type=Trip
ground.slidetime=10
ground.hittime=15
ground.velocity=-1.5
air.velocity=-1.2,-3
guard.velocity=-5
fall=1
ignorehitpause=1
;---------------------The tracking code can be anything, it won't affect the interaction------

[State 1203]
type=velset
trigger1=P2Dist X<0
x=-5

[State 1203]
type=velset
trigger1=P2Dist X=0
x=0

[State 1203]
type=velset
trigger1=P2Dist X>0
x=5

[State 1203]
type=velset
trigger1=P2Dist Y<0
y=-3

[State 1203]
type=velset
trigger1=P2Dist Y=0
y=0

[State 1203]
type=velset
trigger1=P2Dist Y>0
y=3

;---------------MUST HAVE THE PROJ TRIGGERS TO DESTROY THE HELPER------------------
[State 1203, DestroySelf]
type = DestroySelf
trigger1 = root,ProjContact=1, <20  ;----Destroy if makes contact with Non-projectile elements such as players/helpers
trigger2 = root,ProjCancelTime(0)=1  ;---Don't modify this or replace the (0) with anything as it should be 0.
trigger3 = FrontEdgeDist <-50  ;---Optional, this makes the helper destroy itself if goes outside of screen.
trigger4 = time =800  ;---This is your trigger
ignorehitpause = 1

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

Try this and see if it works.
Re: Destroy a Helper with a projectile and have it continue on its way.
#9  August 06, 2022, 06:46:21 am
  • **
    • Argentina
That's right, try making the Helper have an invisible animation and create a projectile that only lasts two ticks and stays in the Helper's position. But I only leave a trail of projectiles that disappear and worse still do not make contact with p2 and continue to destroy my LV1 supers

Well, this one is quite challenging. Did a little test and came up with a code for you. Worked for me so should also work if you've done everything correctly.
To make this work, you'd have to hide the actual projectile behind the helper projectile's sprite.
The steps are:

1. Your animation with the actual 'helper projectile' sprite in [statedef 1203] which is currently 1203 needs no collision boxes.
2. Make a 1 frame blank animation but have both collision boxes in it.  They should reflect the collisions that you currently used in anim=1203. This be used for your actual projectile animation
3. Have a projectile Hit animation.
4. Have a projectile cancel animation. This can be the same as the Hit animation.
5. Have a projectile remain animation. This should be a blank animation with no collision boxes.
6. You DO NOT NEED any Nothitby's, Hitoverrides or changestates as your animation shouldn't have collision boxes.

Then In your helper state [statedef 1203], Going by what you've posted,
your state should look like this (with the projectile and destroy self code):
Code:
;======================================
[Statedef 1203]
type=S
movetype=A
physics=S
anim= 1203
velset=0,0

;---YOUR PROJECTILE STATE CONTROL (these are mandatory parameters to make it work)-----
[State 1203, Projectile]
type = Projectile
triggerAll = !root,ProjContact=1,<20 ;---You can change the 20 to a higher value but leave first and see what happens. 
trigger1= !root,NumProjID(1203) && time%3=0 ;--->Only exist one at a time and only during every 3 ticks  don't change this else it will not work properly
ProjID = 1203 ;---->YOUR ID; should be set to 1203: same as this state
projanim = 1203 ;---->Use YOUR Animation Number  (must be blank anim with both collision boxes)
projhitanim = 1213 ;---->Use YOUR Hit Animation Number
projremanim = 1223 ;---->Use YOUR Animation Number (must be blank anim with no collision boxes)
projcancelanim = 1213 ;---->Use YOUR cancel Animation Number
projremovetime = 2 ;--->Must exist for 2 ticks. Don't change this value as it's used to work with time%3=0
velocity = 0,0  ;--->Doesn't move so it can move with the helper
projpriority = 2  ;--->Any value lower than your Lv1 super.
;------------------The rest is the same as your original hitdef------
attr = S,SP        ;--->Changed to S,SP as it's a projectile so don't use S,SA
damage=40,10
getpower=0
givepower=0
hitflag = MAFD       
guardflag = MA       
pausetime=5,5
sparkxy=0,0
sparkno=s6002
guard.sparkno=s6002
hitsound=F0,2
guardsound=F1,0
ground.type=Trip
ground.slidetime=10
ground.hittime=15
ground.velocity=-1.5
air.velocity=-1.2,-3
guard.velocity=-5
fall=1
ignorehitpause=1
;---------------------The tracking code can be anything, it won't affect the interaction------

[State 1203]
type=velset
trigger1=P2Dist X<0
x=-5

[State 1203]
type=velset
trigger1=P2Dist X=0
x=0

[State 1203]
type=velset
trigger1=P2Dist X>0
x=5

[State 1203]
type=velset
trigger1=P2Dist Y<0
y=-3

[State 1203]
type=velset
trigger1=P2Dist Y=0
y=0

[State 1203]
type=velset
trigger1=P2Dist Y>0
y=3

;---------------MUST HAVE THE PROJ TRIGGERS TO DESTROY THE HELPER------------------
[State 1203, DestroySelf]
type = DestroySelf
trigger1 = root,ProjContact=1, <20  ;----Destroy if makes contact with Non-projectile elements such as players/helpers
trigger2 = root,ProjCancelTime(0)=1  ;---Don't modify this or replace the (0) with anything as it should be 0.
trigger3 = FrontEdgeDist <-50  ;---Optional, this makes the helper destroy itself if goes outside of screen.
trigger4 = time =800  ;---This is your trigger
ignorehitpause = 1

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

Try this and see if it works.


Thanks you a lot I will try it tomorrow
Help me i can't change profile picture!!!! D:
Re: Destroy a Helper with a projectile and have it continue on its way.
#10  August 06, 2022, 07:11:52 pm
  • **
    • Argentina
@SteelHammers Thank you it works pefectily!!!
Help me i can't change profile picture!!!! D: