10-03-2011, 09:28 AM
Pages: 1 2
10-03-2011, 09:31 AM
void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
Plays music.
asMusicFile - the music to play + extension .ogg
abLoop - determines whether a music track should loop
afVolume - volume of the music
afFadeTime - time in seconds until music reaches full volume
alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc
Simply:
PlayMusic("some_music", true or false, any float number, any float number, priority number higher is prior, true or false);
For this and more: http://wiki.frictionalgames.com/hpl2/amn..._functions
Plays music.
asMusicFile - the music to play + extension .ogg
abLoop - determines whether a music track should loop
afVolume - volume of the music
afFadeTime - time in seconds until music reaches full volume
alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc
Simply:
PlayMusic("some_music", true or false, any float number, any float number, priority number higher is prior, true or false);
For this and more: http://wiki.frictionalgames.com/hpl2/amn..._functions
10-03-2011, 09:36 AM
(10-03-2011, 09:31 AM)Tanshaydar Wrote: [ -> ]void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);I'm kind of new to scripting just so you know. so where do i insert: "void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);"
Plays music.
asMusicFile - the music to play + extension .ogg
abLoop - determines whether a music track should loop
afVolume - volume of the music
afFadeTime - time in seconds until music reaches full volume
alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc
Simply:
PlayMusic("some_music", true or false, any float number, any float number, priority number higher is prior, true or false);
For this and more: http://wiki.frictionalgames.com/hpl2/amn..._functions
?
If you could display an example of this script that would be great!
Sorry to bother you guys with these "noob" problems. like i said before. Im new to this.
Thanks again!
10-03-2011, 09:59 AM
Do you have a function for when you want to play the music?
10-03-2011, 10:01 AM
Erm, starting from here will be helpful I think.
http://wiki.frictionalgames.com/hpl2/start
An example for that could be this:
PlayMusic("entranc", true, 1, 5, 1, true);
http://wiki.frictionalgames.com/hpl2/start
An example for that could be this:
PlayMusic("entranc", true, 1, 5, 1, true);
10-03-2011, 11:23 AM
So if you would type that down below, how would it look?
Sorry about the weird insert. im new to this forum.
////////////////////////////
// Run first time starting map
void OnStart()
{
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Sorry about the weird insert. im new to this forum.
////////////////////////////
// Run first time starting map
void OnStart()
{
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
10-03-2011, 03:24 PM
someone?
10-03-2011, 03:40 PM
You would want to put it into your OnStart function. So...
void OnStart()
{
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
}
void OnStart()
{
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
}
10-03-2011, 03:59 PM
(10-03-2011, 03:40 PM)Obliviator27 Wrote: [ -> ]You would want to put it into your OnStart function. So...Thank you!
void OnStart()
{
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
}
One more question. how much volume should i set it at?
nevermind. i will just try stuff out.
10-03-2011, 05:11 PM
If you want the music to just play in sertain areas in your map, create a script area so when the player enters the music start
void OnStart()
{
AddEntityCollideCallback("Player", "YOURAREA", "MusicControl", false, 0);
}
void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("YOURMUSIC.ogg", true, 1.0f, 5, 0, true);
if(alState == -1) StopMusic(3, 0);
}
void OnStart()
{
AddEntityCollideCallback("Player", "YOURAREA", "MusicControl", false, 0);
}
void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("YOURMUSIC.ogg", true, 1.0f, 5, 0, true);
if(alState == -1) StopMusic(3, 0);
}
Pages: 1 2