Frictional Games Forum (read-only)
Music issue - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Music issue (/thread-13696.html)



Music issue - jessehmusic - 03-02-2012

Hello all i got a issue with my Amnesia storie when i go to next level the background sound comes but if i leave and enter again the sound is gone...what should i do if you want to see the hps here it is



void OnStart()
////CALLBACKS START
{
AddUseItemCallback("", "Study Key", "sutdy door", "KeyOnDoor", true);
AddUseItemCallback("", "Room Key1", "Room_1", "KeyOnDoor1", true);
AddUseItemCallback("", "Room Key2", "Room_2", "KeyOnDoor2", true);
AddUseItemCallback("", "Room Key3", "Room_3", "KeyOnDoor3", true);
AddEntityCollideCallback("Player", "text_1", "Text", true, 1);
AddEntityCollideCallback("Player", "Ghost_area", "Horror1", true, 1);
AddEntityCollideCallback("Player", "MusicStart_1", "Music1", true, 1);
SetEntityPlayerInteractCallback("Note_Dead1" ,"Text_1" , true);
SetEntityPlayerInteractCallback("Note_Dead2" ,"Text_2" , true);
SetEntityPlayerInteractCallback("Note_Dead3" ,"Text_3" , true);
SetEntityPlayerInteractCallback("Note_Dead4" ,"Text_4" , true);
SetEntityPlayerInteractCallback("Note_Dead5" ,"Text_5" , true);
}
////CALLBACKS ENDS

////KEY ON DOORS
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("sutdy door", false);
PlaySoundAtEntity("", "unlock_door", "sutdy door", 0, false);
RemoveItem("Study Key");
}

void KeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Room_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Room_1", 0, false);
RemoveItem("Room Key1");
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Room_2", false, true);
PlaySoundAtEntity("", "unlock_door", "Room_2", 0, false);
RemoveItem("Room Key2");
}

void KeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Room_3", false, true);
PlaySoundAtEntity("", "unlock_door", "Room_3", 0, false);
RemoveItem("Room Key3");
}
////KEY ON DOORS END
////HORROR EVENTS
void Horror1(string &in asParent, string &in asChild, int alState)
{
AddTimer("T2", 1.0f, "Timer_2");
AddTimer("T3", 1.5f, "Timer_3");
}

void Timer_2(string &in Timer)
{
SetEntityActive("alexander_2", true);
PlayGuiSound("react_pant.snt", 22.4f);
PlayGuiSound("enemy_hallucination_disappear.snt", 15.5f);
}

void Timer_3(string &in Timer)
{
SetEntityActive("alexander_2", false);
PlaySoundAtEntity("", "react_pant.snt", "Player", 0.0f, false);
AddTimer("timerReleasePlayer", 1, "timerReleasePlayer");
}
void timerReleasePlayer(string &in asTimer)
{
SetMessage("Messages", "what", 2);
}
////HORROR EVENTS END
////MUSIC EVENTS
void Music1(string &in asParent, string &in asChild, int alState)
{
PlayMusic("ambience_voice.ogg", true, 0.8f, 1, 0, true);
}

void StopMusic(string &in asParent, string &in asChild, int alState)
{
StopMusic(1 , 0);
}
////MUSIC EVENTS END
////Text START

void Text_1(string &in asEntity)
{
AddTimer("timerReleasePlayer1", 1, "timerReleasePlayer1");
}
void timerReleasePlayer1(string &in asTimer)
{
SetMessage("Messages", "what1", 2);
}

void Text_2(string &in asEntity)
{
AddTimer("timerReleasePlayer2", 1, "timerReleasePlayer2");
}
void timerReleasePlayer2(string &in asTimer)
{
SetMessage("Messages", "what2", 2);
}

void Text_3(string &in asEntity)
{
AddTimer("timerReleasePlayer3", 1, "timerReleasePlayer3");
}
void timerReleasePlayer3(string &in asTimer)
{
SetMessage("Messages", "what3", 2);
}

void Text_4(string &in asEntity)
{
SetEntityActive("Ghost_1", true);
AddTimer("timerReleasePlayer4", 1, "timerReleasePlayer4");
}
void timerReleasePlayer4(string &in asTimer)
{
SetMessage("Messages", "what4", 2);
}

void Text_5(string &in asEntity)
{
AddTimer("timerReleasePlayer5", 1, "timerReleasePlayer5");
}
void timerReleasePlayer5(string &in asTimer)
{
SetMessage("Messages", "what5", 10);
}


////TEXT END
void OnEnter()
{
}
void OnLeave()
{
AddEntityCollideCallback("Player", "MusicStop", "StopMusic", true, 1);
}


RE: Music issue - Strembitsky - 03-02-2012

Try a simple StopMusic function on OnLeave instead of what you have.


RE: Music issue - flamez3 - 03-02-2012

If that doesn't work, just try and tick FullGameSave on the level door you exit the level from.


RE: Music issue - jessehmusic - 03-02-2012

Still dosnt work :/


RE: Music issue - flamez3 - 03-02-2012

Move
AddEntityCollideCallback("Player", "MusicStop", "StopMusic", true, 1); from void OnLeave to void OnEnter


RE: Music issue - Stepper321 - 03-02-2012




Code:
void OnEnter()
{    AddEntityCollideCallback("Player", "MusicStop", "StopMusic", true, 1);
}
void OnLeave()
{
    
}


Here you go, what was wrong is that it would make the collide event enabled when you leave it. Just copy it and replace it from the down of the code.


RE: Music issue - jessehmusic - 03-02-2012

(03-02-2012, 02:13 PM)Stepper321 Wrote:
Code:
void OnEnter()
{    AddEntityCollideCallback("Player", "MusicStop", "StopMusic", true, 1);
}
void OnLeave()
{
    
}


Here you go, what was wrong is that it would make the collide event enabled when you leave it. Just copy it and replace it from the down of the code.
Still dosn't work


RE: Music issue - Acies - 03-02-2012

huh? The questioni confuses me.

AddEntityCollideCallback("Player", "MusicStart_1", "Music1", false, 1);