Frictional Games Forum (read-only)

Full Version: Lights going on with sounds
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

I'm stucked. I want something like this: You walk trough a door and 4 lights going on with a sound. After 2 seconds, 3 more lights going on with a sound and after 2 more seconds, 3 more lights going on with a sound. My problem is the sound. I thought, I place the sounds on the map with the leveleditor and let them enable with timers. But it doesn't work. When the maps starts, you immediately hear the sounds. Here's my script:

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "startarea", "areastart", false, 1);
    
    
     SetLightVisible("PointLight_1", false);
     SetLightVisible("PointLight_2", false);
     SetLightVisible("PointLight_3", false);
     SetLightVisible("PointLight_4", false);
     SetLightVisible("PointLight_5", false);
     SetLightVisible("PointLight_6", false);
     SetLightVisible("PointLight_7", false);
     SetLightVisible("PointLight_8", false);
     SetLightVisible("PointLight_9", false);
     SetLightVisible("PointLight_10", false);
    
    
     SetLampLit("lamp1", false, false);
     SetLampLit("lamp2", false, false);    
     SetLampLit("lamp3", false, false);    
     SetLampLit("lamp4", false, false);    
     SetLampLit("lamp5", false, false);    
     SetLampLit("lamp6", false, false);    
     SetLampLit("lamp7", false, false);    
     SetLampLit("lamp8", false, false);    
     SetLampLit("lamp9", false, false);    
     SetLampLit("lamp10", false, false);    

}


void areastart(string &in asEntity)
{
     AddTimer("spot1",1,"spottimer1");
     AddTimer("spot2",3,"spottimer2");    
     AddTimer("spot3",5,"spottimer3");    
}    

void spottimer1(string &in asTimer)
{
     SetEntityActive("Sound_1", true);
     SetLightVisible("PointLight_7", true);
     SetLightVisible("PointLight_8", true);
     SetLightVisible("PointLight_9", true);
     SetLightVisible("PointLight_10", true);

     SetLampLit("lamp1", true, false);
     SetLampLit("lamp2", true, false);    
     SetLampLit("lamp3", true, false);    
     SetLampLit("lamp4", true, false);    
}
void spottimer2(string &in asTimer)
{
     SetEntityActive("Sound_2", true);
     SetLightVisible("PointLight_4", true);
     SetLightVisible("PointLight_5", true);
     SetLightVisible("PointLight_6", true);

     SetLampLit("lamp5", true, false);    
     SetLampLit("lamp6", true, false);    
     SetLampLit("lamp7", true, false);    
}
    
void spottimer3(string &in asTimer)    
{
     SetEntityActive("Sound_3", true);
     SetLightVisible("PointLight_1", true);
     SetLightVisible("PointLight_2", true);
     SetLightVisible("PointLight_3", true);

     SetLampLit("lamp8", true, false);    
     SetLampLit("lamp9", true, false);    
     SetLampLit("lamp10", true, false);    
}    

void OnEnter()
{

}




void OnLeave()
{
    
}

Someone knows a solution? :/

Thanks Smile

BTW: Sry for my bad english Blush
Place script areas at the places you want the sounds to play, then use PlaySoundAtEntity to play the sounds at the correct time?
Hmm ok I try.
Thanks Smile