YesNoOk
avatar

Creating Helpers during a custom state? (Read 709 times)

Started by Ricepigeon, May 26, 2009, 05:54:00 am
Share this topic:
Creating Helpers during a custom state?
#1  May 26, 2009, 05:54:00 am
  • *****
  • Gaps? Where we're going, we don't need gaps...
    • USA
    • ricepigeon.neocities.org
Just out of curiosity I was wondering if it was possible if p1 puts p2 into a custom state which makes p2 create a helper in say stateno 8000, would the helper use p1's state 8000 or p2's? If it uses p2's, is it possible to use p1's?

I was thinking of using this to sort of create a type of projectile reflection where the reflected projectiles hit the original parent while retaining its animation & scaling and whatnot, since the reflected projectile is put into the following state:

Code:
;----------------------
; Deflected Projectile
;----------------------
[Statedef 910]
movetype = A
physics = N
ctrl = 0

[State 910, T]
type = turn
trigger1 = time = 0

[State 910, VelS]
type = velset
trigger1 = !time
x = -(vel x)
y = (vel y)

[State 195, Attack]
type = helper
trigger1 = time = 0
helpertype = normal
name = "Attackbox" ;<-- basically an invisible helper with the same animation as the projectile with its own hitdef
ID = 911
pos = 0,0
postype = p1
stateno = 911
ownpal = 1

[State 910, VelS]
type = velset
trigger1 = time
x = vel x
y = vel y

[State 910, HOR]
type = hitoverride
trigger1 = !time
attr = SCA,AA,AP,AT
slot = 7
stateno = -1
time = 999999

[State 910]
type = selfstate
trigger1= !ishelper
value = 50

[State 910]
type = selfstate
trigger1=time
trigger1=ishelper
value = prevstateno
ignorehitpause = 1

[State 910, Zeeky]
type = destroyself
trigger1 = frontedgedist < -20
trigger2 = pos y > 120
trigger3 = pos y < -300

And since a new hitdef wont do any good since the original hitdef will replace it once it goes back to its original state, I thought this idea might work.

Come to think of it, maybe this would be possible with a regular Projectile SCTRL instead?
Re: Creating Helpers during a custom state?
#2  May 26, 2009, 03:34:47 pm
  • **
It wont work, it will give you a warning "changed to invalid state" and the helper will go to state 0.

I got the same problem and my workaround was this:
Make a two tick hitdef that creates a clone of the enemy in the first tick and in the second it traps the clone in your custom state.

I dont know if this is a proper solution to your specific problem though.
Latest Creation: SSBB Assist Trophies