Frictional Games Forum (read-only)

Full Version: Footsteps problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{

    for(int s=1;s<7;s++) AddTimer("step"+s, 1.0 * s, "CreateFootstep");
    
}

void CreateFootstep(string &in asTimer)
{

    PlaySoundAtEntity("scary"+asTimer, "scare_walk_ghost.snt", "Area_step_1", 0, false);
  
}

Ok so i finally got this working, but the problem is that the footstep noises seem to come from the player or really close by, even if i put them in another room completely.. is there a way for them to get further away sounding?

EDIT: I am also trying to get this sound to play as well with
Code:
if(asTimer == "Area_step_6")
    {
    PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
    }

but this seems to not activate at all
Could u perhaps explain me that => int s=1;s<7;s++ for a sec cause that would really be able to help me in some situations Wink
Ok so, we define an integer variable called "s" (could be any letter you want) at the start of the loop. "s" is initialised to 1, and will increment by 1 (s++) whilst "s < 11". This means AddTimer(..) is called like so:


Code:
AddTimer("step"+1, 0.8 * 1, "CreateFootstep");
AddTimer("step"+2, 0.8 * 2, "CreateFootstep");
AddTimer("step"+3, 0.8 * 3, "CreateFootstep");
...
AddTimer("step"+9, 0.8 * 9, "CreateFootstep");
AddTimer("step"+10, 0.8 * 10, "CreateFootstep");

So in human speak, for(int s=1;s<11;s++) AddTimer("step"+s, 0.8 * s, "CreateFootstep");

This means that s<11 means that the repeated sound (in my case scare_wood_creak_walk.snt) will play in each area, all the way up to Area 10 (script areas that you create and name Area_step_1 for example). So you create say 10 areas, Area_step_1, Area_step_2 etc, and the s++ means that the sound will 'move' from Area_step_1 to area 2, 10 times. AddTimer("step"+s, 0.8 * s, "CreateFootstep"); - "steps"+s I have no idea what it does, but it works, and 0.8 is the time between sounds playing from area to area (watch for overlap of sound) and "CreateFootstep" moves us to the callback function:
Code:
void CreateFootstep(string &in asTimer)
{

    PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
    if(asTimer == "Area_step_6")
{
    
    PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
    
}

"Area_step_1" is the starting point for the sound and what im TRYING to get working is the if(asTimer) statement. Hope this helps somewhat