YesNoOk
avatar

Helper-based projectile hitting multiple vs helpers, but once vs non-helpers? (Read 1302 times)

Started by Ricepigeon, February 22, 2018, 04:16:48 pm
Share this topic:
Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#1  February 22, 2018, 04:16:48 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Alright so I've encountered this issue that, quite frankly, I haven't been able to find a solution for.

To put it simple, we have a beam projectile using helpers that should "arc" in a sweeping motion, and only hit the opponent once. While this is fine, issues start to happen once it come into contact with another projectile; the beam is set up in a way as to reset its hitdef if it comes into contact with another helper so that it can continue to hit the opponent afterward. At first glance this seems to work fine, but if the beam hits both an opposing projectile and the opponent simultaneously, the code starts to bug out, essentially resetting the hitdef again and hitting the opponent a second time when it shouldn't, which ends up leading to significantly more damage than intended. Strangely enough, this only seems to occur once and does not occur again throughout the rest of the round. I tried toying with various target trigger redirections as well as the targetdrop controller, but all documentation on these suggest that it only returns the first target found or, in the case of targetdrop, randomly selects a target to keep, thus having no control over which target you want it to check. The relevant code is below:

Spoiler, click to toggle visibilty
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#2  February 22, 2018, 06:04:10 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Did you try this parameter in the hitdef?
Quote
hitonce = hitonce_flag (boolean) If set to 1, the HitDef only affects one opponent. If the hit is successful, all other targets will be dropped. Normally defaults to 0. The exception is if the "attr" parameter is a throw type, which makes it default to 1.
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#3  February 22, 2018, 06:04:38 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
The movehit reset is constantly triggered, so it's placement (sandwiched between the 2 other controllers), makes it so Var(30) = 1 will have virtually no effect as it resets immediately.  I understand it does not have ignorehitpause, so maybe there is a delay and this isn't actually the problem...

Try adding to the HitDef
hitonce = 1

*edit* ninja'd :P

Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#4  February 23, 2018, 01:51:01 am
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Even with the hitonce parameter, it seems the problem still persists. I'm beginning to wonder if something else is causing this so I'll post the entire code

Spoiler, click to toggle visibilty
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#5  February 23, 2018, 01:26:38 pm
  • avatar
  • **
    • Singapore
Have u tried: trigger = !Target, IsHelper
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#6  February 23, 2018, 03:36:14 pm
  • ******
    • www.justnopoint.com/
I had to solve this with Piccolo as well.


1355 is my projectile state while 1356 is the state that destroys the helper
Code:
[State 1061, HitOverride]
type = HitOverride
trigger1 = !NumTarget(1355)
trigger1 = Time >= 0
slot = 1
time = 1
stateno = Cond(Var(9)>0,1355,1356)
attr = SCA, NP, SP, HP
ignorehitpause = 1

[State 1061, HitOverride]
type = HitOverride
trigger1 = NumTarget(1355)
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1356
attr = SCA, NP, SP, HP
ignorehitpause = 1

And as you can see if the projectile gains a target it will no longer hit anymore either. If it hits a helper projectile it won't gain the target.
Code:
[State 1061, Hitdef]
type = HitDef
triggerall = root, Var(18) <= 55
triggerall = !NumTarget(1676)
triggerall = !NumTarget(1355)
trigger1 = !var(41)
trigger1 = !parent, IsHelper
attr = S, SP
animtype  = hard
damage    = Cond(parent,Ishelper,31,ceil(ifElse(root,fvar(11) * 63/root,fvar(19) < 7, 7, root,fvar(11) * 63/root,fvar(19)))),Cond(parent,Ishelper,0,15)
priority  = 4,Hit
guardflag = MA
hitflag = MAF
pausetime = 0,10
guard.pausetime = 0,0
sparkno = s10030
guard.sparkno = s10000
sparkxy = 50,-86
hitsound   = s2,8
guardsound = S5,20
ground.type = high
air.type = low
ground.slidetime = 20
ground.hittime  = 20
guard.hittime = 12
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 = 1
fall.recover = 0
p1sprpriority = 3
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = Cond(p2movetype=H,Cond(parent,IsHelper,0,40),Cond(parent,IsHelper,0,140)), Cond(parent,IsHelper,0,10)
givepower = 35,35
persistent = 0
id=1355
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#7  February 24, 2018, 05:04:57 am
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
So took a look at Piccolo as you mentioned and rearranged the original code to more closely resemble what was in Piccolo's code, but the problem still persists (only posting the code for the main projectile state this time since I know there's no reason for code from the other states to interfere:

Spoiler, click to toggle visibilty

From what I can tell, it looks like the helper isnt going into state 22103 (the destructor state) when it should
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#8  February 24, 2018, 12:19:54 pm
  • ******
    • www.justnopoint.com/
I'm not good like most to solve these things just seeing code. Would you mind sending the char to me in question? For things like this I work better if I can tinker
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#9  February 24, 2018, 08:36:40 pm
  • *****
  • Shame on you!
    • USA
So I haven't looked at any of the code, but my first idea would be to set the attack to idle on the hit. You could set the idle to activate if the previous state is the state it's in, and on hit. If it cant hit, it cant hit.

Give the attack an Id and add the nochainId to the hitdef. I'm not 100% positive, but I believe the nochainId the state has to be exited and reentered for it to work with itself.

Two small ideas. I'll try looking at the code now :P


----
Try moving the safeguard below the hitdef because it uses movecontact as a trigger. It'd have to recycle through for it to activate. If it's under it _should_ set in the same tic. Same with that changestate. I'd think to put that all the way at the bottom of the state.

---- ----
trigger1 = movecontact
var(30) = 1
and you have the changestate set to fire when var(30) = 1. Add the movecontact as a 2nd trigger also. Should be more reliable.
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: February 24, 2018, 08:43:09 pm by Odb718
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#10  February 25, 2018, 02:02:25 am
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Re: Helper-based projectile hitting multiple vs helpers, but once vs non-helpers?
#11  February 26, 2018, 07:24:02 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Give the attack an Id and add the nochainId to the hitdef. I'm not 100% positive, but I believe the nochainId the state has to be exited and reentered for it to work with itself.

Kinda feel like an idiot for forgetting this parameter existed. That seems to have fixed the issue, but now I have another issue popping up; the damage proration won't activate under these circumstances. Made some changes to the file to see if it would work but no go:

https://cdn.discordapp.com/attachments/308105717271756801/417748575834079234/Reisen_RP-Supers.st