Author |
Message |
smithno13
Joined: Sun May 18, 2008 5:47 am Posts: 265
|
Lua to play a sound?
How would I go about making Lua play a sound that is not affected by lag like gun sounds are, and stop the current music from playing?
|
Sat May 16, 2009 11:10 pm |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua to play a sound?
Not sure about one, but two: Code: AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/bossfight.ogg", 0, -1);
|
Sat May 16, 2009 11:35 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Lua to play a sound?
I dunno about not being affected by lag, since that's part of the sim time setup. But you can have a sound play automatically by creating an emitter that plays the sound. See the teleporter modules for an example.
|
Sat May 16, 2009 11:49 pm |
|
|
smithno13
Joined: Sun May 18, 2008 5:47 am Posts: 265
|
Re: Lua to play a sound?
Well I already have the sound playing as the firing sound with my gun, but it is part of a song and the lag (Atleast on my computer) ruins it.
|
Sat May 16, 2009 11:54 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Lua to play a sound?
If you play the sound the same way as music, it won't be affected by lag.
|
Sat May 16, 2009 11:56 pm |
|
|
smithno13
Joined: Sun May 18, 2008 5:47 am Posts: 265
|
Re: Lua to play a sound?
Will playing the sound with PlayMusic stop the current song?
|
Sat May 16, 2009 11:58 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Lua to play a sound?
I'm not sure. StopMusic stops the music, but whether this just adds another buffer or not I don't know.
|
Sat May 16, 2009 11:59 pm |
|
|
smithno13
Joined: Sun May 18, 2008 5:47 am Posts: 265
|
Re: Lua to play a sound?
Hmm. I should probably learn lua before I try any of this Yea, what do I need to put before that to make it play? I do understand coding languages, and can read and understand Lua, but I dont know the specifics. Do I need something like "for actor in MovableMan.Actors do" but for sound?
|
Sun May 17, 2009 12:17 am |
|
|
|