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
#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


Messages In This Thread
Footsteps problem - by Ge15t - 05-08-2011, 08:19 AM
RE: Footsteps problem - by ferryadams10 - 05-08-2011, 09:39 AM
RE: Footsteps problem - by Ge15t - 05-08-2011, 10:09 AM



Users browsing this thread: 1 Guest(s)