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 problem!
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#1
Music problem!

When I'm in a level it plays it's music but when I go in a different level which I want it not have music in it! it still plays the music that as played in the other level how can I stop this? i tried doing stopmusic but it just stops the music even in the other level!

my hps file

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
StopMusic(4, 1);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}
01-07-2014, 05:42 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#2
RE: Music problem!

(01-07-2014, 05:42 PM)Badcat5550 Wrote: When I'm in a level it plays it's music but when I go in a different level which I want it not have music in it! it still plays the music that as played in the other level how can I stop this? i tried doing stopmusic but it just stops the music even in the other level!

my hps file

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
StopMusic(4, 1);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

try to put StopMusic() in OnLeave, so that it stops the music, when you leave the map

CURRENT PROJECT:
A Fathers Secret == Just started
01-07-2014, 07:46 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#3
RE: Music problem!

(01-07-2014, 07:46 PM)Lizard Wrote:
(01-07-2014, 05:42 PM)Badcat5550 Wrote: When I'm in a level it plays it's music but when I go in a different level which I want it not have music in it! it still plays the music that as played in the other level how can I stop this? i tried doing stopmusic but it just stops the music even in the other level!

my hps file

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
StopMusic(4, 1);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

try to put StopMusic() in OnLeave, so that it stops the music, when you leave the map

I did like this

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

void OnLeave()
{
StopMusic(4, 0);
}

but it still plays the music in an other level SadHuhUndecided
(This post was last modified: 01-07-2014, 07:54 PM by Radical Batz.)
01-07-2014, 07:54 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#4
RE: Music problem!

in StopMusic try make the 0 a 1 so that it has the same priority, if that dosen't work try to set the last true in PlayMusic to false

CURRENT PROJECT:
A Fathers Secret == Just started
01-07-2014, 07:57 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#5
RE: Music problem!

(01-07-2014, 07:57 PM)Lizard Wrote: in StopMusic try make the 0 a 1 so that it has the same priority, if that dosen't work try to set the last true in PlayMusic to false

yes it worked, you are amazing thank you so much Big Grin but after I exit the level then the music won't come back
(This post was last modified: 01-07-2014, 08:07 PM by Radical Batz.)
01-07-2014, 08:01 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#6
RE: Music problem!

Put it on void OnEnter instead then.
01-07-2014, 09:23 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#7
RE: Music problem!

(01-07-2014, 09:23 PM)Neelke Wrote: Put it on void OnEnter instead then.

but then it will play in other levels too
01-07-2014, 09:33 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#8
RE: Music problem!

(01-07-2014, 09:33 PM)Badcat5550 Wrote:
(01-07-2014, 09:23 PM)Neelke Wrote: Put it on void OnEnter instead then.

but then it will play in other levels too

Edit: Ha! Didn't read thread before posting. Ignore.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 01-07-2014, 11:16 PM by i3670.)
01-07-2014, 11:15 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#9
RE: Music problem!

(01-07-2014, 09:33 PM)Badcat5550 Wrote:
(01-07-2014, 09:23 PM)Neelke Wrote: Put it on void OnEnter instead then.

but then it will play in other levels too

If you use PlayMusic in OnEnter() and Stop Music in OnLeave()

The music will start playing everytime you enter that certain map/level and stop everytime you leave that certain map/level

CURRENT PROJECT:
A Fathers Secret == Just started
01-08-2014, 12:09 AM
Find




Users browsing this thread: 1 Guest(s)