YesNoOk
avatar

Making helper projectile "explode" if hit by another projectile? (Read 1269 times)

Started by junkerde, February 13, 2019, 07:14:24 pm
Share this topic:
Making helper projectile "explode" if hit by another projectile?
#1  February 13, 2019, 07:14:24 pm
  • avatar
  • **
Basically what I'm trying to do is, my character sends out a big dust cloud projectile, it goes halfway across the screen then stops in place somewhere and stays stagnant. And if my character or player 2 shoots any other kind of projectile at it, it will go into a state where electricity forms and shoots from inside the cloud damaging player 2 if he is in the vicinity.

So the initial cloud is harmless, once hit with a projectile it activates the electricity in it. And this only can last 7 seconds  max until it dissapears.

How would I go approaching this? Something with gethit(var) or no?
Re: Making helper projectile "explode" if hit by another projectile?
#2  February 15, 2019, 05:58:37 am
  • avatar
  • **
    • USA
I'm not 100% sure, but you should be able to use hitoverride on a helper to force it into a state that is an attack.  I feel like I'm forgetting something, but hopefully that works.
Re: Making helper projectile "explode" if hit by another projectile?
#3  February 15, 2019, 07:04:07 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
 I would use a combination of both a hitoverride and reversaldef that leads into a changestate that both go into the explosive state to be extra sure since authors tend to alternate between projectile SCTRLs and helper projectiles.

 With a reversaldef, you can even make it so that the helper projectile goes into a custom state with an immediate destroyself so that it doesn't linger on-screen even after detonating your own projectile.
Re: Making helper projectile "explode" if hit by another projectile?
#4  February 15, 2019, 07:15:48 am
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
I would use a combination of both a hitoverride and reversaldef that leads into a changestate that both go into the explosive state to be extra sure since authors tend to alternate between projectile SCTRLs and helper projectiles.

Sort of, I don't think it should matter whether it's a projectile sctrl or a helper projectile, because the P in the attr of the hitdef should be parsed the same way a projectile sctrl should. I mean, I didn't code the source (but I think helper projectiles are easier to code), but it seems like the proj. sctrl is just a way to remove the need for a helper.

The docs put it like this
Quote
The Projectile controller takes all the parameters of the HitDef controller, which control the HitDef for the projectile.

If I code my helper like this:
Code:
[statedef 1000]
type = S
movetype = A
physics = S
juggle = 0
ctrl = 0
velset = 0,0                         
anim = 1000

[State 0, helper]
type = helper
triggerall = numhelper(1001) != 1
trigger1 = animelem = 7
ID = 1001
stateno = 1001
pos = 70,-65
postype = P1  ;P2, Front, Back, Left, Right
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 1000, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[statedef 1001]
movetype = A
physics = N
ctrl = 0
anim = 1001
sprpriority = 7

...

[State 0, HitDef]
type = HitDef
trigger1 = animelem = 6
attr = S,SP       ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT

etc....

it will be parsed the same as one state with a projectile sctrl, down to parameters specified.

____
sorry i can't read my own writing

Use either hitoverride or reversaldef (I'd use hitoverride for what it's worth).
Last Edit: February 15, 2019, 07:31:23 am by Bannana
Re: Making helper projectile "explode" if hit by another projectile?
#5  February 19, 2019, 06:00:18 am
  • avatar
  • **
Thanks for the replies!!! Got it to work after some tweaking! Cheers!!!