YesNoOk
avatar

Play music when player life is at a certain level (Read 2378 times)

Started by DuckyBoi, April 23, 2022, 11:58:47 pm
Share this topic:
Play music when player life is at a certain level
#1  April 23, 2022, 11:58:47 pm
  • avatar
    • USA
I have been fiddling with this for the past hour or so and I have no idea how to get it to work. This has nothing to do with a stage, just the player's character itself. As the title suggests, I want the character to play a song when they get below a certain hp threshold. The closest I've gotten is a constant repetition of the beginning part of the song and any other sound is completely mute. If you do explain how I'd get it to work, try including some sort of example to aid my understanding of it, cuz I'm still relatively new to this stuff.
sup
Last Edit: April 24, 2022, 04:57:10 am by DuckyBoi
Re: Play music when player life is at a certain level
#2  April 24, 2022, 04:29:54 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Well youll want this in State -2 so it is always checking, can trigger at any time.

Then you need it to trigger one time only.  Easiest way to do this is to have it simultaneously set a Var.

[State -2, playmusic]
type=Playsnd
trigger1=var(1)=0
trigger1=life < (maxlife/50)
Value = 200,1

[State -2, make trigger once only]
type = Varset
trigger1=life < (maxlife/50)
Var1=1

Re: Play music when player life is at a certain level
#3  April 24, 2022, 04:51:30 am
  • avatar
    • USA
Thanks a bunch, seems to be working! Although next time if ever, please don't write that last line the way you did. It was causing a precaching error and I've been stumped for the last 10 minutes lol. Thanks again.
sup
Re: Play music when player life is at a certain level
#4  April 24, 2022, 11:57:18 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Complaining and criticizing the person who offered you assistance--> not good and will make other people think twice before helping you
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Play music when player life is at a certain level
#5  April 24, 2022, 01:59:29 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
No prob - I should have gave a disclaimer that I haven’t worked on a MUGEN project in like 5 years haha

Glad it worked, sorry about the error.

Re: Play music when player life is at a certain level
#6  April 24, 2022, 02:04:00 pm
  • ***
  • 하나뿐인 한국인 대표
  • Ambassador of MugenRevival
    • South Korea
    • sites.google.com/view/kolossoni-mugen
Thanks a bunch, seems to be working! Although next time if ever, please don't write that last line the way you did. It was causing a precaching error and I've been stumped for the last 10 minutes lol. Thanks again.

It seems like it was a mistake. People can forget that you need brackets for varsets.

That being said, you don't seem to be that good at choosing your words. "The last line causes a precaching error, was it a mistake?" Would suffice.
Re: Play music when player life is at a certain level
#7  April 24, 2022, 02:57:18 pm
  • avatar
    • USA
Didn't really mean to sound that way, completely apologize. I guess I was frustrated more at myself for not being able to do it myself and projected a bit. No excuse for replying that way to someone who helped me with a code I'd been stumped on for hours. Won't happen again.


sup