Page 1 of 1

Is Using LunaLua for custom music easy?

Posted: Wed Feb 24, 2016 3:23 pm
by fireflower30
Just want to know, I'm almost done with my crossover contest entry, and well, SMBX Problems.

Is there A lua?

Re: Is Using LunaLua for custom music easy?

Posted: Wed Feb 24, 2016 3:34 pm
by HenryRichard
It's easy, but The Thwomp King banned it from that contest.

Re: Is Using LunaLua for custom music easy?

Posted: Wed Feb 24, 2016 4:52 pm
by HeroLinik
You mean changing between custom music tracks? Yeah, there is a way to do it. The example given here changes the music based on a certain condition in the level.

Code: Select all

if(insert condition here) then
		Audio.SeizeStream(player.section);
		Audio.MusicOpen("music/your music here.mp3");
		Audio.MusicPlay();
end
To change back to the standard level music, use this:

Code: Select all

if(insert condition here) then
		Audio.ReleaseStream(player.section);
end

Re: Is Using LunaLua for custom music easy?

Posted: Wed Feb 24, 2016 6:43 pm
by Alagirez
Linik wrote:You mean changing between custom music tracks? Yeah, there is a way to do it. The example given here changes the music based on a certain condition in the level.

Code: Select all

if(insert condition here) then
		Audio.SeizeStream(player.section);
		Audio.MusicOpen("music/your music here.mp3");
		Audio.MusicPlay();
end
To change back to the standard level music, use this:

Code: Select all

if(insert condition here) then
		Audio.ReleaseStream(player.section);
end
I also need this code for MxW3. Thank you ^^
insert condition here
Q : what is a "condition" code in SMBX

Re: Is Using LunaLua for custom music easy?

Posted: Thu Feb 25, 2016 2:06 am
by underFlo
It's essentially a variable that's either true or false. For example, let's say you wanna change the music if the Event "musicPlay" is activated:

Code: Select all

 play = false

function onLoop()
    if play then
       Audio.SeizeStream(player.section)
       Audio.MusicOpen("music/your music here.mp3")
       Audio.MusicPlay()
    end
end

function onEvent(eventname)
    if eventname == "musicPlay" then
        play = true
    end
end

Re: Is Using LunaLua for custom music easy?

Posted: Thu Feb 25, 2016 10:33 am
by fireflower30
HenryRichard wrote:It's easy, but The Thwomp King banned it from that contest.
oh. i'll just use the standard underground music then

Re: Is Using LunaLua for custom music easy?

Posted: Thu Feb 25, 2016 10:47 am
by TheSaturnyoshi
I don't see why you wouldn't be able to just use MP3s, those are available in vanilla SMBX.

Re: Is Using LunaLua for custom music easy?

Posted: Thu Feb 25, 2016 11:02 am
by TDK
TheSaturnyoshi wrote:I don't see why you wouldn't be able to just use MP3s, those are available in vanilla SMBX.
I think he wants to use more than one custom music per section which can't be done in vanilla SMBX.

Re: Is Using LunaLua for custom music easy?

Posted: Sat Feb 27, 2016 8:34 am
by timocomsmbx2345
All you have to do is select custom on the level settings, but make sure your music is in your level and/or episode folder. Plus it has to be MP3 music.

Re: Is Using LunaLua for custom music easy?

Posted: Sat Feb 27, 2016 8:45 am
by Emral
timocomsmbx2345 wrote:All you have to do is select custom on the level settings, but make sure your music is in your level and/or episode folder. Plus it has to be MP3 music.
I suggest you caaarefully reread the topic title.

Re: Is Using LunaLua for custom music easy?

Posted: Sat Feb 27, 2016 8:59 am
by timocomsmbx2345
Enjl wrote:
timocomsmbx2345 wrote:All you have to do is select custom on the level settings, but make sure your music is in your level and/or episode folder. Plus it has to be MP3 music.
I suggest you caaarefully reread the topic title.
I use the legacy editor because it's easier.

Re: Is Using LunaLua for custom music easy?

Posted: Sat Feb 27, 2016 9:08 am
by Emral
timocomsmbx2345 wrote:
Enjl wrote:
timocomsmbx2345 wrote:All you have to do is select custom on the level settings, but make sure your music is in your level and/or episode folder. Plus it has to be MP3 music.
I suggest you caaarefully reread the topic title.
I use the legacy editor because it's easier.
That's not the point of the topic.
First off, legacy editor literally breaks your levels by messing with placement order and priority.

Secondly, this topic is about how to use lunalua scripting to use multiple custom music files in the same section. There's no way to do that in vanilla.

Thirdly, legacy editor and lunalua aren't mutually exclusive.

Re: Is Using LunaLua for custom music easy?

Posted: Sat Feb 27, 2016 9:19 am
by h2643
Also I have no idea how is it easier to use legacy editor when it's a pain in the ass to work in it. The new editor is so much better than that. Sorry for being off-topic, just had to.