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
Need some help with floors.
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#3
RE: Need some help with floors.

Place 7 script areas and let the sounds play.

Name the areas Steps_1, Steps_2 and so on till Steps_7

Now create an area which activates the footsteps called StartSteps and an area where when the player enters the footsteps stop, called StopSteps.

Maybe you don't even need the StopSteps. It was a long time ago i made this script.

This function lets the sounds randomly play at one of the Steps_1 to Steps_7 areas.

void OnStart()
{
AddEntityCollideCallback("Player", "StartSteps", "FuncCreakHorrors", true, 1);
}
void FuncCreakHorrors(string &in asParent, string &in asChild, int alState)
{
    if(asChild == "StartSteps") {
        float fCreak = RandFloat(0.5f,6.5f);
    
        AddTimer("creak", 2.5f+fCreak, "FuncCreakTimer");
        
        AddEntityCollideCallback("Player", "StopSteps", "FuncCreakHorrors", true, 1);
        
    } else {
        RemoveTimer("creak");
        
        AddEntityCollideCallback("Player", "StartSteps", "FuncCreakHorrors", true, 1);
    }
    
    /*DEBUG
     */
    AddDebugMessage("Player in/out creak: "+asChild, true);
}

void FuncCreakTimer(string &in asTimer)
{
    int iCreak = RandFloat(1, 7);    
    float fCreak = RandFloat(4.5f,14.5f);
    
    CreateParticleSystemAtEntity("creakPS"+iCreak, "ps_dust_falling_small_thin.ps", "Steps_"+iCreak, false);
    
    PlaySoundAtEntity("creakSound"+iCreak, "scare_wood_creak_mix.snt", "Steps_"+iCreak, 0.0f, false);
    
    AddTimer("creak", 5.5f+fCreak, "FuncCreakTimer");
    
    /*DEBUG
     */
    AddDebugMessage("Now creaking in area: "+iCreak+" Next creak in: "+(5.5f+fCreak), true);
}
//Edit: I just realised that i totally misread what you wrote. But feel free to use this anyway <.<

[Image: 18694.png]
(This post was last modified: 08-24-2012, 08:43 PM by Ongka.)
08-24-2012, 08:42 PM
Find


Messages In This Thread
Need some help with floors. - by Melvin - 08-24-2012, 08:31 PM
RE: Need some help with floors. - by Adny - 08-24-2012, 08:37 PM
RE: Need some help with floors. - by Melvin - 08-25-2012, 09:47 AM
RE: Need some help with floors. - by Ongka - 08-24-2012, 08:42 PM
RE: Need some help with floors. - by Melvin - 08-24-2012, 11:10 PM
RE: Need some help with floors. - by Adny - 08-25-2012, 09:57 AM
RE: Need some help with floors. - by Adny - 08-25-2012, 10:51 AM



Users browsing this thread: 8 Guest(s)