- The easiest way to play music & sound effects
First, we begin by opening up Global Code
- Thumbnail, click to enlarge
The following assumes you have the Sound Pack
- Downlaod it here
Place all of the files included in the sound pack into your Data folder
- Thumbnail, click to enlarge
Now that you've did that, place the following code in your Global Code
- Code: Select all
#define PlaySE(Cursor) PlaySound2("data/Cursor.wav", 1.000000, 1, 0.000000);
#define PlaySE(Choice) PlaySound2("data/Choice.wav", 1.000000, 1, 0.000000);
#define PlaySE(Cancel) PlaySound2("data/Cancel.wav", 1.000000, 1, 0.000000);
#define PlaySE(Buzzer) PlaySound2("data/Buzzer.wav", 1.000000, 1, 0.000000);
#define PlayBGM(Forest) PlayMusic2("data/Deep in the forest.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
#define PlayBGM(HighUp) PlayMusic2("data/High up on the machine.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
#define PlayBGM(City) PlayMusic2("data/City.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
#define PlayBGM(BossArival) PlayMusic2("data/A powerfull enemy is coming.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
#define PlayBGM(CalmingWind) PlayMusic2("data/The calming wind.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
#define PlayBGM(Shop) PlayMusic2("data/Island Shop.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
#define PlaySE(Alarm) PlaySound2("data/Alarm.wav", 1.000000, 19, 0.000000);
The PlaySE(Alarm) function is set to 19, which means it'll repeat the alarm sound 19 times. You can change the repeat time to set what you like. In order to play this forever then stop it when an action is called, replace the 19 with a variable called ALARM_REPEAT, then when you want it to stop, simply make ALARM_REPEAT equal 1.
How to use these functions
In order to use these functions, simply open a code, (rather it be Create Actor, or an event that calls the music / sound to be played) and type in PlaySE(Cursor) or what ever sound effect / music you want to play.
Example: Say you entered a new area, you want it to play the new sound effect, right? When you enter the new area, and you want it to play a new sound, what ever method you used to get to that new area (Rather by teleport or by loading a map file), also include a PlayBGM function, for example, you walk into a dark area, so you want to play something that's kinda darkish. Type PlayBGM(Forest) and the music will start playing simply.
For multiple sound effects, without having to take the extra 8 seconds to click here and there, simply type PlaySE(Cursor) or PlaySE(Choice) or any other sound that you might want to be played.
Hope this helped

Easier on the eyes
In case the code looks a bit confusing to new people, the functions that you can call with the code is these:
- PlaySE(Cursor)
PlaySE(Conferm)
PlaySE(Cancel)
PlaySE(Buzzer)
PlayBGM(Forest)
PlayBGM(HighUp)
PlayBGM(City)
PlayBGM(BossArival)
PlayBGM(CalmingWind)
PlayBGM(Shop)
PlaySE)Alarm)