Helper Type Projectile using only 1 channel hit sounds.

Started by Sheng Long, January 26, 2011, 11:26:09 PM

Previous topic - Next topic

Sheng Long

So I'm doing some experimenting. I've come up with a near-perfect working example of multiple helper type projectiles using only 1 channel for hit sounds. Similar to that effect in most Street Fighter games. Though it might have some minor issues with team vs mode. Other than that, it seems to work fine.

Normally, if you create multiple helper type projectiles, they each have their own sound channels. So if a hit contact sound was being played by a projectile, they won't ever get interrupted (to my knowledge, anyway).

Here's what I've come up with. Using helper(1500) as an example. This one uses only 1 variable.
This code tested, works very well. :)
[Statedef 1500]

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveHit
ignorehitpause = 1
persistent = 0
v = 5
value = 1

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveGuarded
ignorehitpause = 1
persistent = 0
v = 5
value = 10


[Statedef -2]

[State -2, Hit]
type = PlaySnd
trigger1 = Var(5) = 1
ignorehitpause = 1
value = 2, 3
channel = 3

[State -2, Guard]
type = PlaySnd
trigger1 = Var(5) = 10
ignorehitpause = 1
value = 2, 0
channel = 3

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(5) > 0
ignorehitpause = 1
v = 5
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = (Var(5) = [5,10])
trigger2 = (Var(5) = [15,20])
ignorehitpause = 1
v = 5
value = 0


Same idea as above, except this code uses 2 variables instead of 1.
This code tested, also works very well. :)
[Statedef 1500]

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveHit
ignorehitpause = 1
persistent = 0
v = 5
value = 1

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveGuarded
ignorehitpause = 1
persistent = 0
v = 6
value = 1


[Statedef -2]

[State -2, Hit]
type = PlaySnd
trigger1 = Var(5) = 1
ignorehitpause = 1
value = 2, 3
channel = 3

[State -2, Guard]
type = PlaySnd
trigger1 = Var(6) = 1
ignorehitpause = 1
value = 2, 0
channel = 3

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(5) > 0
ignorehitpause = 1
v = 5
value = 1

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(6) > 0
ignorehitpause = 1
v = 6
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) >= 5
ignorehitpause = 1
v = 5
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = Var(6) >= 5
ignorehitpause = 1
v = 6
value = 0

What happens here is, if a character throws/creates multiple projectiles toward an opponent with the same statedef type movement (or the same id, 1500), the hit sound should get interrupted by the other. Now that the hit sounds have a channel defined in statedef -2, the hit sound from the first projectile will be interrupted by the hit sound of the second projectile.

If anyone has an idea how they could improve on this method, I'm open to suggestions. Currently experimenting this method on a 'test' character. ;)

"You must defeat my flaming
dragon punch to stand a chance."

-True-

I see no need to use the -2,why not use that target?

Como Hacia Hitler Mijo

Sheng Long

Because The root character does not, or would not have a target in certain conditions. If I use a target trigger code inside the helper projectile state, it would play the sound in its own statedef. Therefore, the sound would not be interrupted as it should.

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 06:02:16 AM
Because The root character does not, or would not have a target in certain conditions. If I use a target trigger code inside the helper projectile state, it would play the sound in its own statedef. Therefore, the sound would not be interrupted as it should.
mmm... the helpers and players have same channels

EDIT: i test and channels are differents wtf , i remember in one hyper i used playsnd in helper, trigger1 = Gametime%10=1 and channel -1. the channels are sold out for help and player wait...

Later in the afternoon,I thought of this :D
but if the bullet hits very fast (for HitDef trigger1 = 1) and are 2 helpers while sticking sometimes fails ,or it may be the effect of the channel

this var is for type persistent for sound,as the persistent = 0 does not work very well in the -2

[State -2,              VarSet]
type                    = VarSet
trigger1                = Var(10)>=3
v                       = 10
value                   = 0
ignorehitpause          = 1

[State -2,              VarAdd]
type                    = VarAdd
trigger1                = Var(10)=1||Var(10)=2
v                       = 10
value                   = 1
ignorehitpause          = 1

[State -2,              VarSet]
type                    = VarSet
triggerall              = Var(10)=0
triggerall              = NumHelper(1021)=0;also recommend that there is only one ID for each Helper
trigger1                = (Helper(1021),MoveHit=1)||(Helper(1021),MoveGuarded=1)
v                       = 10
value                   = 1
ignorehitpause          = 1

[State -2,              PlaySnd]
type                    = PlaySnd
trigger1                = ((var(10)=1)&&(Helper(1021),MoveHit=1))
value                   = S2,2
channel                 = 3
ignorehitpause          = 1

[State -2,              PlaySnd]
type                    = PlaySnd
trigger1                = ((var(10)=1)&&(Helper(1021),MoveGuarded=1))
value                   = S2,10
channel                 = 3
ignorehitpause          = 1

Como Hacia Hitler Mijo

Sheng Long

I still don't see how using helper(1500), movehit will work here. If for example, there are 5 or 10 projectiles being shot. If helper(1500), movehit was used as trigger, it would have some trouble looking for which one of the projectiles have hit the opponent, and which projectiles have not hit the opponent yet.

So far, while my code works fine on modes like arcade, and 1-on-1 vs. Unfortunately, it still has some conflict issues with simultaneous team modes.  Too bad there's no triggers for things like p2movehit, or p2pausetime, p2hitshakeover. I would've imagined these would have a different effect then using something like enemynear, hitshakeover. :S

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 07:02:00 AM
I still don't see how using helper(1500), movehit will work here. If for example, there are 5 or 10 projectiles being shot. If helper(1500), movehit was used as trigger, it would have some trouble looking for one of the projectiles to see which one has hit the opponent, which opens haven't hit yet.

So far, while my code works fine on modes like arcade, 1-on-1 vs, it still has some issues with simultaneous team modes.  Too bad there's no triggers for things like p2movehit, or p2pausetime, p2hitshakeover. I would've imagined these would have a different effect then using something like enemynear, hitshakeover. :S
read this line
triggerall              = NumHelper(1021)=0;also recommend that there is only one ID for each Helper
you can add ifelse in id for helper, for example id = ifelse(numhelper(1021)=1,1022,1021)
and the p2 is enemynear,both look for the nearest player,cause problems :'(

edit: or Id = ((1021)+(Numhelper(1021))

Como Hacia Hitler Mijo

Sheng Long

But using NumHelper(1500) = 0 totally defeats the purpose.

If it helps as to what's going on, when the projectile hits the opponent (whether its hit or guarded), it goes into a different/new statedef first before being destroyed. Sort of like a disappearing animation. When the disappear animation is done, then it gets destroyed.
So I don't think using NumHelper(1500) = 0 will work in this situation..... Unless the helper projectile creates a new helper that plays the disappearing animation. But I really don't see the point of this if there is already a projectile there that just hit the opponent to play the disappearing animation. :-/

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 07:14:49 AM
But using NumHelper(1500) = 0 totally defeats the purpose.

If it helps as to what's going on, when the projectile hits the opponent (whether its hit or guarded), it goes into a different/new statedef first before being destroyed. Sort of like a disappearing animation. When the disappear animation is done, then it gets destroyed.
So I don't think using NumHelper(1500) = 0 will work in this situation..... Unless the helper projectile creates a new helper that plays the disappearing animation. But I really don't see the point of this if there is already a projectile there that just hit the opponent to play the disappearing animation. :-/
hyper fail for me  :sugoi:
remove =0, sorry XD

[State -2,              VarSet]
type                    = VarSet
trigger1                = Var(10)>=3
v                       = 10
value                   = 0
ignorehitpause          = 1

[State -2,              VarAdd]
type                    = VarAdd
trigger1                = Var(10)=1||Var(10)=2
v                       = 10
value                   = 1
ignorehitpause          = 1

[State -2,              VarSet]
type                    = VarSet
triggerall              = Var(10)=0
triggerall              = NumHelper(1021);also recommend that there is only one ID for each Helper
trigger1                = (Helper(1021),MoveHit=1)||(Helper(1021),MoveGuarded=1)
v                       = 10
value                   = 1
ignorehitpause          = 1

[State -2,              PlaySnd]
type                    = PlaySnd
trigger1                = ((var(10)=1)&&(Helper(1021),MoveHit=1))
value                   = S2,2
channel                 = 3
ignorehitpause          = 1

[State -2,              PlaySnd]
type                    = PlaySnd
trigger1                = ((var(10)=1)&&(Helper(1021),MoveGuarded=1))
value                   = S2,10
channel                 = 3
ignorehitpause          = 1
I forgot to remove it, I was just testing some things

Como Hacia Hitler Mijo

Sheng Long

And what's different about your code that is an improvement over mine? Still looks like Helper, MoveHit and Helper, MoveGuarded are still being used here. As I said before, if there are like 5 or more helper projectiles on the screen, your code won't be able to determine which projectile hit an opponent. Whether the second projectile hits first, or the third one hits first, the first projectile hits second.

Maybe I should show you, or upload a video of what's happening on my side to understand what's going on?

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 07:44:36 AM
And what's different about your code that is an improvement over mine? Still looks like Helper, MoveHit and Helper, MoveGuarded are still being used here. As I said before, if there are like 5 or more helper projectiles on the screen, your code won't be able to determine which projectile hit an opponent. Whether the second projectile hits first, or the third one hits first, the first projectile hits second.

Maybe I should show you, or upload a video of what's happening on my side to understand what's going on?
because I tested your code but not work  :'(,so it occurred to me that
update XD

wait wait wait... edit xd

edit : ideas sold out  :'(

Como Hacia Hitler Mijo

Sheng Long

The dude on the left. ;)
Not a serious creation. I'm just doing some goofing off with this.

Yea...... If I ever release this, if I don't change the code from what I've posted above, you'll see what I mean. I may eventually do a new mugen video sometime. If I get around to it.

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 08:37:15 AM
The dude on the left. ;)
Not a serious creation. I'm just doing some goofing off with this.

Yea...... If I ever release this, if I don't change the code from what I've posted above, you'll see what I mean. I may eventually do a new mugen video sometime. If I get around to it.
I went back to using your code, this time it works, maybe I did something wrong the first time you use it
i test for hitoverride and works,maybe the problem is enemynear,because they seek the nearest enemy player
maybe if you use enemy and moved varset to helper,and change varset to parenvarset work better
:-\, I forgot the varset,not controlled playsnd

Como Hacia Hitler Mijo

Sheng Long

#12
Okay, the parentvarset method seems to work.

[Statedef 1500]

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveHit
ignorehitpause = 1
persistent = 0
v = 5
value = 1

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveGuarded
ignorehitpause = 1
persistent = 0
v = 6
value = 1

[Statedef -2]

[State -2, Hit]
type = PlaySnd
trigger1 = Var(5) = 1
value = 2, 3
channel = 3

[State -2, Guard]
type = PlaySnd
trigger1 = Var(6) = 1
value = 2, 0
channel = 3

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(5) > 0
ignorehitpause = 1
v = 5
value = 1

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(6) > 0
ignorehitpause = 1
v = 6
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) >= 5
ignorehitpause = 1
v = 5
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = Var(6) >= 5
ignorehitpause = 1
v = 6
value = 0


The problem now is, there seems to be a 1 game tick delay of the sound being played than what my old sound code played the sound right away.
The other problem is that there is no 'rootvarset' in case a projectile creates another projectile in itself. If this was the case, the parentvarset would not work correctly.

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 07:36:45 PM
Okay, the parentvarset method seems to work.

[Statedef 1500]

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveHit
ignorehitpause = 1
persistent = 0
v = 5
value = 1

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveGuarded
ignorehitpause = 1
persistent = 0
v = 6
value = 1

[Statedef -2]

[State -2, Hit]
type = PlaySnd
trigger1 = Var(5) = 1
value = 2, 3
channel = 3

[State -2, Guard]
type = PlaySnd
trigger1 = Var(6) = 1
value = 2, 0
channel = 3

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(5) > 0
ignorehitpause = 1
v = 5
value = 1

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(6) > 0
ignorehitpause = 1
v = 6
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) >= 5
ignorehitpause = 1
v = 5
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = Var(6) >= 5
ignorehitpause = 1
v = 6
value = 0


The problem now is, there seems to be a 1 game tick delay of the sound being played than what my old sound code played the sound right away.
The other problem is that there is no 'rootvarset' in case a projectile creates another projectile in itself. If this was the case, the parentvarset would not work correctly.
i can not detected by 1 Tick,may be because you put the playsnd above variables, but it is necessary
and can used helper(),var but again the same  :-\
but could use as in the first strike affect this variable, and will work to root ,I'm not sure if there is a delay

Como Hacia Hitler Mijo

Sheng Long

#14
Yea, after more testing, I found that the delay occurs when the character is in an attack state. If the character is idle or standing, the sound seems to trigger right away. More noticeable if you pause mugen, and keep hitting the Scroll Lock key to move one frame tick forward in mugen.

I'll update the first post with the new code, just in case.

"You must defeat my flaming
dragon punch to stand a chance."

-True-

I did but the sound is just as it hits
Spoiler (click to show)

wait, you forgot the ignorehitpause in playsnd  :o

ignorehitpause = 1

Como Hacia Hitler Mijo

Sheng Long

No. I'm pretty sure its right. The player isn't hitting the opponent, the projectile is. So an 'ignorehitpause = 1' really isn't necessary, is it? I have an 'ignorehitpause = 1' used on the parentvarset, so i think it should work.

Also, here's another idea. In case a character needs one more variable available for them, I've combined the hit & guard variables as one variable.

[Statedef 1500]

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveHit
ignorehitpause = 1
persistent = 0
v = 5
value = 1

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveGuarded
ignorehitpause = 1
persistent = 0
v = 5
value = 6

[Statedef -2]

[State -2, Hit]
type = PlaySnd
trigger1 = Var(5) = 1
value = 2, 3
channel = 3

[State -2, Guard]
type = PlaySnd
trigger1 = Var(5) = 6
value = 2, 0
channel = 3

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(5) > 0
ignorehitpause = 1
v = 5
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) >= 3
trigger1 = Var(5) < 6
trigger2 = Var(5) >= 10
ignorehitpause = 1
v = 5
value = 0


"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 09:06:15 PM
No. I'm pretty sure its right. The player isn't hitting the opponent, the projectile is. So an 'ignorehitpause = 1' really isn't necessary, is it? I have an 'ignorehitpause = 1' used on the parentvarset, so i think it should work.

Also, here's another idea. In case a character needs one more variable available for them, I've combined the hit & guard variables as one variable.

[Statedef 1500]

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveHit
ignorehitpause = 1
persistent = 0
v = 5
value = 1

[State 1500, ParentVarSet]
type = ParentVarSet
trigger1 = MoveGuarded
ignorehitpause = 1
persistent = 0
v = 5
value = 6

[Statedef -2]

[State -2, Hit]
type = PlaySnd
trigger1 = Var(5) = 1
value = 2, 3
channel = 3

[State -2, Guard]
type = PlaySnd
trigger1 = Var(5) = 6
value = 2, 0
channel = 3

[State -2, VarAdd]
type = VarAdd
trigger1 = Var(5) > 0
ignorehitpause = 1
v = 5
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) >= 3
trigger1 = Var(5) < 6
trigger2 = Var(5) >= 10
ignorehitpause = 1
v = 5
value = 0

true, i test.
can also use this expression [,]
for example
[State -2, VarSet]
type = VarSet
trigger1 = Var(5) >= 3
trigger1 = Var(5) < 6
ignorehitpause = 1
v = 5
value = 0

use expression

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) = [3,5]
ignorehitpause = 1
v = 5
value = 0

Como Hacia Hitler Mijo

Sheng Long

First post updated with 1 variable code. Also

Quote from: -True- on January 27, 2011, 09:12:26 PM
use expression

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) = [3,5]
ignorehitpause = 1
v = 5
value = 0

Why the [#,#]? What's the difference? If Var(5) = [3,5], does that mean it will trigger if the #'s are 3, 4, 5? Or just 3 and 5 only? If it triggers if #'s are 3, 4, 5, I wouldn't see a difference if a trigger was something like trigger1 = Var(5) >= 3 && Var(5) < 6.

"You must defeat my flaming
dragon punch to stand a chance."

-True-

Quote from: N-Mario on January 27, 2011, 09:25:55 PM
First post updated with 1 variable code. Also

Quote from: -True- on January 27, 2011, 09:12:26 PM
use expression

[State -2, VarSet]
type = VarSet
trigger1 = Var(5) = [3,5]
ignorehitpause = 1
v = 5
value = 0

Why the [#,#]? What's the difference? If Var(5) = [3,5], does that mean it will trigger if the #'s are 3, 4, 5?
is easier to use,use less triggers, no have difference and yes [3,5]> 3,4,5. :)

Como Hacia Hitler Mijo