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
Footsteps problem
Ge15t Offline
Junior Member

Posts: 48
Threads: 8
Joined: Feb 2011
Reputation: 0
#1
Footsteps problem

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
if(asTimer == "Area_step_6")
    {
    PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
    }

but this seems to not activate at all
(This post was last modified: 05-08-2011, 08:34 AM by Ge15t.)
05-08-2011, 08:19 AM
Find
ferryadams10 Offline
Senior Member

Posts: 288
Threads: 40
Joined: Apr 2011
Reputation: 19
#2
RE: Footsteps problem

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

Got a nice sofa
Please come and have a seat for a while

05-08-2011, 09:39 AM
Find
Ge15t Offline
Junior Member

Posts: 48
Threads: 8
Joined: Feb 2011
Reputation: 0
#3
RE: Footsteps problem

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:


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:
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
05-08-2011, 10:09 AM
Find




Users browsing this thread: 2 Guest(s)