Frictional Games Forum (read-only)

Full Version: Music OnTop??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi do anybody know how i can play 2 musics at the same time???

(SRY FOR MY TERRIBLE ENGLISH)

Here is my script:

////////////////////////////
// Run first time starting map
void OnStart()
{
PlayMusic("27_amb.ogg", true, 1, 3, 0, true);
FadeOut(0);
SetMessage("IntroCategory", "Intro1", 0);
AddTimer("", 5.0f, "Intro2Start");
AddEntityCollideCallback("Crowbar2", "BarArea", "Crush", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "BackToCorridor", true, 1);
AddUseItemCallback("PutRight", "Crowbar", "prison_section_1", "PutRight", true);
SetPlayerActive(false);
}

void PutRight(string &in asItem, string &in asEntity)
{
SetEntityActive("Crowbar2", true);
RemoveItem(asItem);
}

void Intro2Start(string &in asTimer)
{
SetMessage("IntroCategory", "Intro2", 0);
AddTimer("", 5.0f, "Intro3Start");
}

void Intro3Start(string &in asTimer)
{
SetMessage("IntroCategory", "Intro3", 0);
AddTimer("", 5.0f, "Intro4Start");
AddTimer("", 5.0f, "StartMusic");
}

void Intro4Start(string &in asTimer)
{
SetMessage("IntroCategory", "Intro4", 0);
AddTimer("", 5.0f, "StartStory");
}

void Grave(string &in asEntity, string &in asType)
{
StartEffectFlash(0.1f, 0.1f, 0.25f);
TeleportPlayer("PlayerStartArea_2");
FadeOut(0);
FadeIn(15);
PlayGuiSound("flashback_flash3.ogg", 1);
PlayMusic("21_event_pit.ogg", false, 1, 3, 0, false);
AddTimer("", 12.0f, "BackTo");
AddTimer("", 4.0f, "Cold");
}

void Cold(string &in asTimer)
{
PlayGuiSound("12_girl_cry_07.ogg", 1);
}

void BackTo(string &in asTimer)
{
PlayMusic("18_amb.ogg", true, 1, 3, 0, true);
StartEffectFlash(0.1f, 0.1f, 0.25f);
TeleportPlayer("PlayerStartArea_3");
PlayGuiSound("react_breath3.ogg", 1);
FadeOut(0);
FadeIn(15);
GiveSanityDamage(25.0f, true);
}

void StartStory(string &in asTimer)
{
SetPlayerActive(true);
FadeIn(15);
PlaySoundAtEntity("Door1", "close_gate_low.snt", "Player", 0, false);
GiveSanityDamage(1, true);
SetPlayerSanity(20);
FadePlayerFOVMulTo(1.5f, 0.5f);
AddTimer("", 4.0f, "PlayerLook1");
}

void Crush(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "BarArea", false);
PlayGuiSound("break_wood_metal3.ogg", 1);
SetEntityActive("Crowbar2",false);
SetEntityActive("Crowbar3",true);
AddPropImpulse("prison_section_2", 0, 0, 0.8f, "");
GiveSanityBoost();
SetEntityActive("prison_section_2",true);
SetEntityActive("prison_section_1",false);
}

void PlayerLook1(string &in asTimer)
{
PlayGuiSound("react_scare5.ogg", 1);
PlayGuiSound("27_break.ogg", 1);
AddTimer("", 1.0f, "StopLook1");
StartPlayerLookAt("Crowbar", 3.0f, 3.0f, "");
AddTimer("", 1.0f, "PlayerLook2");
}

void StopLook1(string &in asTimer)
{
StopPlayerLookAt();
}

void PlayerLook2(string &in asTimer)
{
AddTimer("", 1.0f, "StopLook2");
StartPlayerLookAt("sketch_mechanical01_1", 3.0f, 3.0f, "");
AddTimer("", 1.0f, "PlayerLook3");
}

void StopLook2(string &in asTimer)
{
StopPlayerLookAt();
}

void PlayerLook3(string &in asTimer)
{
AddTimer("", 1.0f, "StopLook3");
AddTimer("", 0.5f, "Glassbreak");
StartPlayerLookAt("prison_section_1", 13.0f, 13.0f, "");
PlayGuiSound("react_breath1.ogg", 1);
}

void Glassbreak(string &in asTimer)
{
AddTimer("", 1.0f, "PlayerLook4");
}

void PlayerLook4(string &in asTimer)
{
StartPlayerLookAt("Creek", 13.0f, 13.0f, "");
PlayGuiSound("react_breath1.ogg", 1);
PlayGuiSound("scare_steps_big1.ogg", 1);
AddTimer("", 1.0f, "StopLook4");
}

void StopLook4(string &in asTimer)
{
StopPlayerLookAt();
}

void StopLook3(string &in asTimer)
{
StopPlayerLookAt();
}

void StartMusic(string &in asTimer)
{
PlayMusic("amb_extra01.ogg", true, 1, 3, 0, true);
FadePlayerFOVMulTo(1, 0.1f);
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
Err, why would you want to do that though?
You can't play two music files at the same time. The music with the highest alPrio value will be the only one heard. You can play a sound, however, but I don't think the .ogg files will work with sound (not sure, I could be wrong!)
You can, you just gotta make a .snt file for it.
The reason that i want to do it is because i want to have an ambient sound in the background and some music at the same time Smile
So there's probably a .snt file for it. Just use PlaySoundAtEntity.
Ok it worked Big Grin