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
Script Help Triggering "stopmusic"
bestia455 Offline
Junior Member

Posts: 3
Threads: 1
Joined: May 2015
Reputation: 0
#1
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
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
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:

PHP Code: (Select All)
void PlayMusic(stringasMusicFilebool abLoopfloat afVolumefloat afFadeTimeint alPriobool 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.

PHP Code: (Select All)
void StopMusic(float afFadeTimeint alPrio); 

05-25-2015, 05:34 AM
Find
bestia455 Offline
Junior Member

Posts: 3
Threads: 1
Joined: May 2015
Reputation: 0
#3
RE: Triggering "stopmusic"

Oh man, thank you so much.
05-25-2015, 03:21 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#4
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
Find
bestia455 Offline
Junior Member

Posts: 3
Threads: 1
Joined: May 2015
Reputation: 0
#5
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
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#6
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
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#7
RE: Triggering "stopmusic"

In Spanish bestia means beast too. It comes from Latin bestia or something.

05-25-2015, 09:42 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#8
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
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
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 Tongue

05-26-2015, 01:16 AM
Find




Users browsing this thread: 1 Guest(s)