YesNoOk
avatar

Helper projectile conundrum (Read 417 times)

Started by felineki, January 21, 2014, 04:08:46 am
Share this topic:
Helper projectile conundrum
#1  January 21, 2014, 04:08:46 am
  • ****
  • A frame here, a pixel there.
I'm working on a character who can fire various projectiles, which I have coded as helpers. He should only be able to fire a projectile when there isn't one already on the screen, so I've given every projectile helper the same ID and used a simple "NumHelper(ID) = 0" trigger in the cmd file. However, I've run across a problem in that combos from projectiles (i.e., the projectile hits, then something else hits) don't register on the combo hit counter. I did some searching and found a previous thread on this problem that suggested having the helper stick around in an invisible state until its target is lost rather than immediately destroy itself upon impact. However this would now mean that I have to come up with a new way to properly regulate when projectiles can and can't be fired, because the "NumHelper(ID) = 0" would now mean I can't fire another projectile right after one hits when I should be able to. I've tried to think of some way around this, but have yet to come up with anything . Any suggestions?
Re: Helper projectile conundrum
#2  January 21, 2014, 04:25:50 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
You can achieve this with a simple variable. Provided you're going to be keeping your helper projectile alive in a state, you can set a var to 1 when your projectile hits. The var will be in the root and start at 0. It will be reset at the start of your projectile's summon state, in the root, not the helper. Here's an example:

Code:
; Root projectile summon state
[State ****, Reset var(#) to disable firing it again
trigger1 = !time
v = #
value = 0

[State ****, Shoot Projectile]
type = Helper
trigger1 = animelem=3

; Projectile Helper State
; You'd also want to have this trigger right before the helper dies naturally, for example: from time.
[State ****]
type = RootVarSet
trigger1 = movecontact
v = #
value = 1

; CMD
[State -1, Shoot Projectile]
type = ChangeState
trigger1 = var(#) && command="somecomplexcommandthatsnearlyimpossibletodo"

-[Все слова это только слова.]-
Re: Helper projectile conundrum
#3  January 21, 2014, 04:32:25 am
  • ****
  • A frame here, a pixel there.
I see, thanks a lot. One thing I forgot to mention is that one particular move will fire two projectiles at once which might complicate things. After doing that, he should only be able to fire another projectile once both are gone.

Hmm, I suppose maybe in that case I could set the variable to 2 in the projectile summon state, then have each projectile subtract 1 from the variable once it makes contact or otherwise dies, correct?
Re: Helper projectile conundrum
#4  January 21, 2014, 04:48:26 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
Yes, that could work. Instead of RootVarSet you would use RootVarAdd. You've got it!

-[Все слова это только слова.]-
Re: Helper projectile conundrum
#5  January 21, 2014, 04:51:10 am
  • ****
  • A frame here, a pixel there.
Alrighty. Thanks again.  :)