oscar1007
Member
Posts: 64
Threads: 24
Joined: Oct 2011
Reputation:
0
|
How do i play music on a level?
Yes i have tried many times but it just doens't seem to work.
Can someone here please tell me how to script the thing?
Thanks!
|
|
10-03-2011, 09:28 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: How do i play music on a level?
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
|
|
10-03-2011, 09:31 AM |
|
oscar1007
Member
Posts: 64
Threads: 24
Joined: Oct 2011
Reputation:
0
|
RE: How do i play music on a level?
(10-03-2011, 09:31 AM)Tanshaydar Wrote: 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 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);"
?
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:36 AM |
|
Gamemakingdude
Senior Member
Posts: 470
Threads: 82
Joined: Nov 2010
Reputation:
9
|
RE: How do i play music on a level?
Do you have a function for when you want to play the music?
|
|
10-03-2011, 09:59 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
|
10-03-2011, 10:01 AM |
|
oscar1007
Member
Posts: 64
Threads: 24
Joined: Oct 2011
Reputation:
0
|
RE: How do i play music on a level?
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()
{
}
|
|
10-03-2011, 11:23 AM |
|
oscar1007
Member
Posts: 64
Threads: 24
Joined: Oct 2011
Reputation:
0
|
RE: How do i play music on a level?
someone?
|
|
10-03-2011, 03:24 PM |
|
Obliviator27
Posting Freak
Posts: 792
Threads: 10
Joined: Jul 2011
Reputation:
66
|
RE: How do i play music on a level?
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);
}
|
|
10-03-2011, 03:40 PM |
|
oscar1007
Member
Posts: 64
Threads: 24
Joined: Oct 2011
Reputation:
0
|
RE: How do i play music on a level?
(10-03-2011, 03:40 PM)Obliviator27 Wrote: 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);
} Thank you!
One more question. how much volume should i set it at?
nevermind. i will just try stuff out.
(This post was last modified: 10-03-2011, 04:03 PM by oscar1007.)
|
|
10-03-2011, 03:59 PM |
|
Prelauncher
Senior Member
Posts: 451
Threads: 11
Joined: May 2011
Reputation:
13
|
RE: How do i play music on a level?
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);
}
Socialism (noun): A great way to run out of other people's money.
|
|
10-03-2011, 05:11 PM |
|
|