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?
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#11
RE: Music problem?

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "girlsdormkey_1", "girlsdorm", "UsedKeyOnDoor_5", true);
if (GetGlobalInt("music") == 0)
{
PlayMusic("02_amb_safe.ogg", true, 100.0, 0.0, 1, true);
}
else if (GetGlobalInt("music") == 1)
{
PlayMusic("09_amb_safe.ogg", true, 100.0, 0.0, 1, true);
}
}



void UsedKeyOnDoor_5(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("girlsdormdoor", false);
    PlaySoundAtEntity("", "unlock_door", "girlsdormdoor", 0, false);
    RemoveUseItemCallback("girlsdormkey_1");
}


////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(1.0f, 1);
SetGlobalVarInt("music", 1);
}

I get an Error:
(108, 5): No Matching signatures
(112, 10) No matching signatures

I put everything in the correct place
07-07-2011, 02:47 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#12
RE: Music problem?

sorry that was my mistake, instead of GetGlobalInt it should be GetGlobalVarInt, that should work, make sure you do that for all three instances of GetGlobalVarInt, even the one in your Global.hps

07-07-2011, 12:43 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#13
RE: Music problem?

Thanks so much guys, it works! Big Grin
07-07-2011, 07:36 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#14
RE: Music problem?

Oh, I failed to mention this:
Whenever I leave a level and go back to the hub level, the music from the previous level continues to play even though I have the "StopMusic" command in the OnLeave section of the .hps file for that map

I have it set up in a particular way though:
Ex: "You interact with an entity and the music begins to play, then when you leave the map, the music continues to play even though it's not supposed to.

07-07-2011, 10:27 PM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#15
RE: Music problem?

I'm not sure how to fix that, but it may be to do with the priority levels of your music / stopmusic, try changing some of those around ( closer to 0 = higher priority ) maybe make the priority of the stopmusic = 0, if that doesn't work try adding a debug message to find out what your globalvarint is doing:
AddDebugMessage("Global Variable 'Music' = "GetGlobalVarInt("Music"));
if that doesn't work, i wont be able to help you, because ive never had that problem before.

07-08-2011, 02:01 AM
Find




Users browsing this thread: 1 Guest(s)