bestia455
Junior Member
Posts: 3
Threads: 1
Joined: May 2015
Reputation:
0
|
Triggering "stopmusic"
I would like to use a script_area to trigger one song to start, AND another song to end.
I want to:
void OnEnter()
{
PlayMusic ("Edgar.ogg", true, 0.9, 1.0, 1, true);
}
and
{
PlaySoundAtEntity("sound", "Tunnels.snt", "Tunnels", 0.0, true);
}
then STOP "Edgar.ogg" from playing.
I am very new to this scripting stuff, so please forgive me if I completely overlooked the correct script on the wiki.
(This post was last modified: 05-25-2015, 04:32 AM by bestia455.)
|
|
05-25-2015, 04:31 AM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Triggering "stopmusic"
PlayMusic and StopMusic work together using a priority value. According to the script, the priority is defined at the second last argument:
void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
What the priority does is tell the game which track to play (or stop). Only 1 track can play at a time, and that will be the one with the highest priority value. To stop a track, you input the exact same priority as defined in the track you want to stop.
Your "Edgar.ogg" track has priority 1.
Use StopMusic with that priority to stop it.
void StopMusic(float afFadeTime, int alPrio);
|
|
05-25-2015, 05:34 AM |
|
bestia455
Junior Member
Posts: 3
Threads: 1
Joined: May 2015
Reputation:
0
|
RE: Triggering "stopmusic"
Oh man, thank you so much.
|
|
05-25-2015, 03:21 PM |
|
Slanderous
Posting Freak
Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation:
63
|
RE: Triggering "stopmusic"
(05-25-2015, 03:21 PM)bestia455 Wrote: Oh man, thank you so much.
Are you from Poland? 'Cause your nick sounds like our word for "beast"
|
|
05-25-2015, 06:33 PM |
|
bestia455
Junior Member
Posts: 3
Threads: 1
Joined: May 2015
Reputation:
0
|
RE: Triggering "stopmusic"
(05-25-2015, 06:33 PM)Lazzero Wrote: (05-25-2015, 03:21 PM)bestia455 Wrote: Oh man, thank you so much.
Are you from Poland? 'Cause your nick sounds like our word for "beast"
No, years ago I played a playstation 2 game called Midnight club 2, and the game featured a car called the"1971 Bestia" which was a ripoff of a late 1960's Pontiac. An old Pontiac engine was a 455 cubic inch, around this time I owned a 1967 Pontiac, you can lookup the resemblance.
|
|
05-25-2015, 08:12 PM |
|
Slanderous
Posting Freak
Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation:
63
|
RE: Triggering "stopmusic"
(05-25-2015, 08:12 PM)bestia455 Wrote: (05-25-2015, 06:33 PM)Lazzero Wrote: (05-25-2015, 03:21 PM)bestia455 Wrote: Oh man, thank you so much.
Are you from Poland? 'Cause your nick sounds like our word for "beast"
No, years ago I played a playstation 2 game called Midnight club 2, and the game featured a car called the"1971 Bestia" which was a ripoff of a late 1960's Pontiac. An old Pontiac engine was a 455 cubic inch, around this time I owned a 1967 Pontiac, you can lookup the resemblance.
Allrighty then.
|
|
05-25-2015, 09:25 PM |
|
Daemian
Posting Freak
Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation:
49
|
RE: Triggering "stopmusic"
In Spanish bestia means beast too. It comes from Latin bestia or something.
|
|
05-25-2015, 09:42 PM |
|
Slanderous
Posting Freak
Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation:
63
|
RE: Triggering "stopmusic"
(05-25-2015, 09:42 PM)Daemian Wrote: In Spanish bestia means beast too. It comes from Latin bestia or something.
Probably yep.
|
|
05-25-2015, 11:13 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Triggering "stopmusic"
(05-25-2015, 08:12 PM)bestia455 Wrote: No, years ago I played a playstation 2 game called Midnight club 2, and the game featured a car called the"1971 Bestia" which was a ripoff of a late 1960's Pontiac. An old Pontiac engine was a 455 cubic inch, around this time I owned a 1967 Pontiac, you can lookup the resemblance.
That's a pretty funny and specific origin of your username
|
|
05-26-2015, 01:16 AM |
|
|