YesNoOk
avatar

[SOLVED] How do I play a sound just once based on enemy life (Read 219 times)

Started by Noctis, September 28, 2011, 02:08:53 am
Share this topic:
[SOLVED] How do I play a sound just once based on enemy life
New #1  September 28, 2011, 02:08:53 am
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
I want a sound to play just once when my enemies' life falls below 50%.
Also, I want a sound to play just once when my hitcount breaks 15. What I mean is, when my combo ends and it's past 15 hits and I'm not in my attacking movetype anymore.
"There is nothing either good or bad, but thinking makes it so."
Last Edit: September 28, 2011, 06:25:55 am by Noctis
Re: How do I play a sound just once based on enemy life
#2  September 28, 2011, 02:14:59 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
The first one is slightly annoying. You can either use a variable, or use a helper.

For the variable method, in state -2 have a playsnd when p2life <= 500 (just based on 1000 life here, i'm not thinking straight for math) and also have the requirement that var(0) = 0, listed directly after that is a varset, with the same triggers, setting var(0) to 1.

With the helper method, spawn a helper to keep track of p2's life, play the sound and add persistent = 0 to the playsnd, then it'll only trigger once.

Second one, use a helper. Have the helper track the number of hits it's parent does when it's more than 15, set a variable. When p2movetype = I && parent, movetype = I, have the helper change state to the bit where it plays the sound. If the var is less than 15, change back with no sound, if it's 15 or more, play the sound, set the var back to 0 as well.


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.
Re: How do I play a sound just once based on enemy life
#3  September 28, 2011, 02:50:22 am
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
The first one I am having trouble with. Thanks for the help. I'll post back if I can't make it work.
"There is nothing either good or bad, but thinking makes it so."

2OS

Re: How do I play a sound just once based on enemy life
#4  September 28, 2011, 03:19:42 am
  • ****
  • Ich schicke dich zur HOELLE ! ¡ ! ¡
    • Egypt
    • deuceovspadez.webs.com/
p2life<=ceil(enemynear,lifemax*0.5)
p2life<=ceil(enemynear,lifemax/2)


[ 052012 ] Inazumachi 181/256  /  deviantART   /  2OS Grafphicsxz  Dead Anims ( Orochi/Mizuchi )  /  608's FX Volume 3
Last Edit: September 28, 2011, 05:35:57 am by 2OS
Re: How do I play a sound just once based on enemy life
#5  September 28, 2011, 05:26:09 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
you want enemynear there, lifemax will return your life, not his.


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.

2OS

Re: How do I play a sound just once based on enemy life
#6  September 28, 2011, 05:37:21 am
  • ****
  • Ich schicke dich zur HOELLE ! ¡ ! ¡
    • Egypt
    • deuceovspadez.webs.com/
and every time I type it I overlook that.

Adjusted.


[ 052012 ] Inazumachi 181/256  /  deviantART   /  2OS Grafphicsxz  Dead Anims ( Orochi/Mizuchi )  /  608's FX Volume 3