Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Music starting/ending?
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#1
Music starting/ending?

How do i make music start when I play a particular map? And how do i stop it when leaving the map? I gave it a try but failed.

:Work In Progress:
Insanity
(This post was last modified: 07-16-2011, 09:26 PM by JoeBradleyUK.)
07-16-2011, 07:47 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Music starting/ending?

http://wiki.frictionalgames.com/hpl2/amn..._functions

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
void StopMusic(float afFadeTime, int alPrio);

Stops music.

afFadeTime - time in seconds until music stops
alPrio - the priority of the music that should stop



Place play music in OnEnter, and place stop music in OnExit

07-16-2011, 07:53 PM
Website Find
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#3
RE: Music starting/ending?

(07-16-2011, 07:53 PM)Tanshaydar Wrote: http://wiki.frictionalgames.com/hpl2/amn..._functions

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
void StopMusic(float afFadeTime, int alPrio);

Stops music.

afFadeTime - time in seconds until music stops
alPrio - the priority of the music that should stop



Place play music in OnEnter, and place stop music in OnExit

Do I need the void included?

:Work In Progress:
Insanity
07-16-2011, 07:55 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Music starting/ending?

Nope.

07-16-2011, 08:01 PM
Website Find
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#5
RE: Music starting/ending?

I got an error something about 'or' or something like that, here is my .hps file:

////////////////////////////
// Run when starting map
void OnStart()
{

}


void FirstDiary(string &in item, int index)
{
ReturnOpenJournal(true);
}




////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic(04_amb.ogg, true, 0.7, 0.1, 0, true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


:Work In Progress:
Insanity
07-16-2011, 08:37 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#6
RE: Music starting/ending?

PlayMusic("04_amb.ogg", true, 0.7, 0.1, 0, true);

07-16-2011, 09:14 PM
Website Find
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#7
RE: Music starting/ending?

(07-16-2011, 09:14 PM)Tanshaydar Wrote: PlayMusic("04_amb.ogg", true, 0.7, 0.1, 0, true);

Oh, thanks Big Grin

:Work In Progress:
Insanity
07-16-2011, 09:26 PM
Find




Users browsing this thread: 1 Guest(s)