News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

PlaySnd trigger

Started by SiTHFURioN, June 11, 2012, 08:13:42 PM

Previous topic - Next topic

SiTHFURioN

Ok as you can see I got too sound effects for the punch. The punch itself an a voice sound.
But I don't want the voice to play every time like the sound effect for the punch.
is there a 'random' trigger for the sound?
I've tried searching around an I can't seem to find the right trigger for it.

[State 200, 1] ; punch sound
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, 0
channel = 0

[State 200, 2] ; voice
type = PlaySnd
trigger1 =
value = 3, 0
channel = 1

DivineWolf

Just add something like this along with the AnimElem = "X" trigger

"&& Random < 300"

A higher value will make it trigger more often but not all the time. (I.E. 500 instead of 300)

SiTHFURioN


Ricepigeon

Quote from: DivineWolf on June 11, 2012, 08:35:13 PM
"&& Random < 300"

While this works, you may want to consider using modulo division instead, something like:

random%10 < 3

This gives somewhat of a more even spread, especially if mugen's PRNG decides to stick with the higher end of the random number spectrum (instead of it returning true for values less than 300, it'll return true for values where the ones digit is 0, 1, or 2, i.e.: 200, 201, 202, 210, etc). What DW said isn't wrong, but its usually better practice to use it this way.

SiTHFURioN


Cyanide

Random is actually OK for the randomised values. varrandom under winmugen would pick the lower end 2 out of 3. 1.0 fixed that iirc.


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.