Author Topic: Making a song only play once  (Read 1417 times)

128-Up

  • Spike Dodger
  • Posts: 114
  • Lives are an antiquated concept.
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 44.0.2403.157 Chrome 44.0.2403.157
    • View Profile
  • Playstyle: Keyboard
Making a song only play once
« on: August 27, 2015, 10:40:36 AM »
I'm messing around with avoidances, and I want to know how to make it so the background music does not repeat after it's finished.

How do I do this?

klazen108

  • Administrator
  • The Kid
  • Posts: 286
  • your a kid now your a squid now
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 44.0.2403.155 Chrome 44.0.2403.155
    • View Profile
    • Delicious-Fruit
  • Playstyle: Keyboard
Re: Making a song only play once
« Reply #1 on: August 27, 2015, 11:59:10 AM »
This depends on which engine you're using.

In GM8/8.1, music is started with either the sound_play or sound_loop functions. If you were coding it yourself you could simply choose which one you wanted.
In GM8/8.1 with FMOD, you use FMODSoundPlay or FMODSoundLoop in the same way as above.
In GMS, you use audio_play_sound(song,0,0) for non-loop or audio_play_sound(song,0,1) for loop, where song is the sound resource name.

In Seph's engine or the KS engine, there is a musicFunctions script that starts the music based on the current room; you could add logic to see "is this the avoidance song, if so, do play, not loop".
In Yuuutu's engine or YoYoYo's engine, there is a playMusic object that starts the song, you could make a separate one that plays instead of loops.