help with a code for adding sound to certain projectile

Started by kakkoii superhero, November 30, 2009, 12:03:12 AM

Previous topic - Next topic

kakkoii superhero

I have a projectile as a mine, being set on the ground for 999ticks
when the opponent stepped on it goes BOOM (no problem in that)
by the end of its life it also goes BOOM (I can't make the sound plays for this)
I have tried to put the playsnd in the statedef-2 and -3 triggered by anim + animelem but it doesn't work... :-\
make we wonder if this trigger only valid for character's anim played or whatever anim played (including explod, helper and projectiles)
any helps thanks?

The Aboriginal One

#1
Trigger1 = ProjContactXXXX = 0, = 999  The Projectile with ID number XXXX has not made any contact for 999 ticks.

Put that in your SD -1.
Accusare nemo se debet nisi coram Veridis
DYNOMITE

Cyanide

You'll need to play the sound 1 tick before it's actually removed and add

numproj(XXXX) = 1

for that to run OK.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.


kakkoii superhero

now, the sound play as soon as I set the mine....


here is my mine code

Quote;-------------------------------------------------------------------------
; mine planting
[Statedef 6024]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 30
ctrl = 0
velset = 0,0
anim = 6024
sprpriority = 2

[State 6024, snd]
type = PlaySnd
trigger1 = animTime = 0
value = 1000, 16

[State 6024, 1]
type = projectile
trigger1 = Animtime = 0 && var (10) <= 5
projanim = 6004
ownpal = 1
projremanim = 6015
attr = S, SA
animtype  = diagup
projedgebound = 300
offset = 20,0
damage    = ifelse(var(1),200,80)
affectteam = B
hitflag = HALFD
guardflag = LA
guard.dist = 10
pausetime = 12,12
sparkno = S6015
sparkxy = 0,0
hitsound   = s1000,41
guardsound = s1000,41
guard.sparkno = S6015
ground.type = high
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -2.2,-8.2
air.velocity = -2.2,-8.2
airfall = 1
fall = 1
fall.recover = 1
projID = 6004 + var (10)
projremovetime = 1010
projpriority = 4
fall.damage = 10             
fall.envshake.ampl = 6       
fall.envshake.freq = 178
fall.envshake.time = 15
palfx.time = 20
palfx.mul = 256,256,256
palfx.add = -61,-51,41
palfx.invertall = 1
palfx.sinadd = 31,0,0,5
palfx.color = 60
envshake.time = 20               

[State 6024, 2]; mines depletion
type = varadd
trigger1 = time = 0
v = 10
value = 1

[State 6024, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 12
ctrl = 1
;------------------------------------------------------------------------
-


and here is the sound code for the expired mine boom

Quote;---------------------------------------------------------------------------
[Statedef -2]
[State 1000, mine Sound]
type = PlaySnd
triggerall = numprojID (6004 + var (10)) = 1
trigger1 = projcontact 6004 + var (10) = 0, = 1009
value = 1000, 41
;-------------------------------------------------------------------------


what's the problem here, I tried to put it at statedef -1  -2 and -3 but the result is the sound played as soon as I planted the mine  :S

Cyanide

Helper would be OH so much easier.

Remove the spaces please. Mugen can be funny about those

projcontactID No spaces between contact and ID. Bracket it like you did on the one above.

I'm going to guess it's also that you've used = 1009, try >= 1009


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

kakkoii superhero

#6
 :'(
it doesn't work, so I tried using helper
it play sound correctly by the time the animation is over
the problem now is

how to filter out the already blownup mines so it doesn't play sound.

Quote;---------------------------------------------------------------------------
; mine helper
[Statedef 6025]
type    = S
movetype= I
physics = N
velset = 0,0
anim = 4002   

[State 6024, snd]
type = PlaySnd
trigger1 = Time = 0 ; setting up sound
value = 1000, 16

[state 3004, 0]
type = projectile
trigger1 = time = 0
projanim = 6004
ownpal = 1
projremanim = 6015
attr = S, SA
animtype  = diagup
projedgebound = 300
offset = 20,0
damage    = ifelse(var(1),200,80)
affectteam = B
hitflag = HALFD
guardflag = LA
guard.dist = 10
pausetime = 12,12
sparkno = S6015
sparkxy = 0,0
hitsound   = s1000,41
guardsound = s1000,41
guard.sparkno = S6015
ground.type = high
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -2.2,-8.2
air.velocity = -2.2,-8.2
airfall = 1
fall = 1
fall.recover = 1
projID = 6004
projremovetime = 999
projpriority = 4
fall.damage = 10            
fall.envshake.ampl = 6      
fall.envshake.freq = 178
fall.envshake.time = 15
palfx.time = 20
palfx.mul = 256,256,256
palfx.add = -61,-51,41
palfx.invertall = 1
palfx.sinadd = 31,0,0,5
palfx.color = 60
envshake.time = 20      

[State 6024, snd]
type = playsnd   ; expiration boom
trigger1 = time = 998
value = 1000, 41

[State 3004, 1]
type = DestroySelf
trigger1 = animtime = 0
trigger2 = projcontacttime(6004) = 1

trigger2 = projcontacttime(6004) = 1 this trigger doesn't work maybe only work for command related statedef-1 , is there anyway to kill the helper as soon as the projectile hit its target? so the expiration sound doesn't get triggered.  
well since she can set up multiple mines, I hope the parallel coexisting of helpers with same ID won't interfere each other too...

I tried setting up 2 mines, and I made the 2nd mine hit the target. while the 1st is still active waiting its expiration time, the 1st expired with a BOOM, and then the 2nd also BOOM (while it is already blown by the opponent) o_O

Byakko

Why do you use a projectie if you have a helper ? The helper IS the projectile. It displays the projectile animation with clsn1, it has velocities, it has a hitdef. You don't want a type = projectile in your helper.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

kakkoii superhero

#8
Quote;---------------------------------------------------------------------------
; mine planting
[Statedef 6024]
type    = S
movetype= I
physics = S
juggle  = 4
poweradd= 30
ctrl = 0
velset = 0,0
anim = 6024
sprpriority = 2

[State 6024, helper]
type = helper
trigger1 = Animtime = 0 && var(10) <= 5
helpertype = normal
id = 6025
name = "mine"
postype = p1
pos = 20,0
stateno = 6025

[State 6024, 2]; mines depletion
type = varadd
trigger1 = animtime = 0
v = 10
value = 1

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

;---------------------------------------------------------------------------
; mine helper
[Statedef 6025]
type    = S
movetype= A
physics = N
velset = 0,0
anim = 6004   

[State 6025, snd]
type = PlaySnd
trigger1 = Time = 0
value = 1000, 16

[state 6025, 1]
type = hitdef
trigger1 = time = 0
attr = S, SA
animtype  = diagup
damage    = ifelse(var(1),200,80)
affectteam = E
hitflag = HALFD
guardflag = LA
guard.dist = 10
pausetime = 12,12
sparkno = S6015
sparkxy = 0,0
hitsound   = s1000,41
guardsound = s1000,41
guard.sparkno = S6015
ground.type = high
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -2.2,-8.2
air.velocity = -2.2,-8.2
airfall = 1
fall = 1
fall.recover = 1
fall.damage = 10            
fall.envshake.ampl = 6      
fall.envshake.freq = 178
fall.envshake.time = 15
palfx.time = 20
palfx.mul = 256,256,256
palfx.add = -61,-51,41
palfx.invertall = 1
palfx.sinadd = 31,0,0,5
palfx.color = 60
envshake.time = 20      

[state 6025, boom]
type = changeanim
trigger1 = movecontact
trigger2 = time = 998
value = 6015

[State 6025, snd]
type = playsnd
trigger1 = anim = 6015 && animelemtime(1) = 0
value = 1000, 41

[State 6025, exit]
type = DestroySelf
trigger1 = anim = 6015 && animtime = 0
trigger2 = movecontact

;---------------------------------------------------------------------------

OH WOW, it works, thank you Abo, Cyanide & Byakko for all the helps

Cyanide

Projectiles are always owned by the root, it makes them a bit annoying to use inside helpers.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.