Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[HELP] Music Engine in 1.2b


luksamuk

Recommended Posts

That's a question I've been letting pass. But I can't handle with it anymore.

I've been working on a little secret project I've been keeping. In this project, I made a level that is a remix of Sonic 2's Death Egg Zone. The first boss (Silver Sonic) has a common boss music. But the Eggbot himself must have its own last boss music. I just can't understand properly the work of the ME's cache, so how do I add a new music on it and make it play on the last boss?

No need to explain how to make it loop tho, at least this I understand. (:

Link to comment
Share on other sites

From the current ME documentation:

Explaining [ME]:

[ME] Stands for Musical Engine. Programmed by LarkSS, it is an easy to learn and easy to use Music System. In this section, you'll learn all of the needed commands to implement when dealing with this system.

=====FUNCTIONS=====

play_music( ID, LOOP*, PRIORITY* )
ID = id value of a song
LOOP = loop amount; 0 = infinite loop
PRIORITY = higher values declare more important songs (won't be overwritten by lower priority)
* Fields are optional and default to 0 if unspecified

reset_music( ID )
ID = id value of a song

stop_music( ID* )
ID = id value of a song
* If no ID value is input ( e.g. you call "stop_music()" ), ALL music will be stopped

unqueue_music()

fadein_music()

fadeout_music( TIME )
TIME = amount of time in milliseconds for the song to fade out from its current volume level

lock_music()

unlock_music()

=====INFO=====

play_music()
This function allows you to play a song. The song you tell it to play will always play over the song
that is currently playing, but if a song IS playing that the new one goes over top of, IT IS NOT LOST!
The old song is added to a queue ( a queue is like a waiting line; think of the supermarket! ), and
when the new song is done playing, the old one will automatically resume where it left off. The third
argument allows you to give a song more priority over another, so that specific tracks will not get
interrupted by not-as-important music.

reset_music()
You may not use this as much, but it's nice to have. As the play_music() function automatically
resumes a song where it left off when it can be played again, sometimes you actually WANT it to
start AT THE BEGINNING. That's where this function comes in. It finds the song you told it to reset,
whether it be currently playing or waiting in the queue, and sets the position for it to resume
back to the beginning of the track.

stop_music()
Sometimes you need a song to stop instead of continuing after a song is finished, or maybe you want
to stop the song that is currently playing. Well now you can using this function. It will seek out
and stop any song you specify, whether it be currently playing or waiting in the queue. Also, if you
do not specify any song to stop, it will stop ALL music.

unqueue_music()
This function takes no arguments, as it only performs one deed; upon its execution, it will disable
the current music queue, which as a result will cause silence once the currently playing song finishes.


Further documentation can be found within the Functions subgroup of the Music Engine's events.[/CODE]

[b]I'll show an example of how level music is played in Delta:[/b]

The song is loaded into cache first (notice the "5" in the loop name, that is the song ID). This is located in ME's Cache group.

ME3.png

Then it is played using the play_music() function.

ME1.png

To make it easier to read, the ID is stored in a global string (see how the string with the level name has a value of "5").

ME2.png

In order to combine the global string with the function string, I had to use separate pairs of quotes and plus signs to 'glue' everything together. Also, make sure to always add 1 to the xindex of the queue array when calling a function; EVERY function, even in the SAME event.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...