07-19-2013, 07:59 PM
Hi, im trying to create some athmosphere regarding sound, this is what i want:
The player walks into an area trigger and activates the sound, it plays at once, then 10 seconds after it plays again and again til the player leaves the level.
From my perspective:
Onstart calls a function that tells void func sound that we're gonna loop this but the function says - not until the player walks in my area but when he do i will call the next function which plays a sound, the onstart code says we're gonna play the sound after 10 seconds again.
---
As it is now the game doesnt crash but it doesnt work either, I've followed the "For" Loop tutorial in the wiki.
What's wrong here?
Also I want to mention this is the first time I'm using loop commands.
The player walks into an area trigger and activates the sound, it plays at once, then 10 seconds after it plays again and again til the player leaves the level.
From my perspective:
Onstart calls a function that tells void func sound that we're gonna loop this but the function says - not until the player walks in my area but when he do i will call the next function which plays a sound, the onstart code says we're gonna play the sound after 10 seconds again.
---
As it is now the game doesnt crash but it doesnt work either, I've followed the "For" Loop tutorial in the wiki.
What's wrong here?
Also I want to mention this is the first time I'm using loop commands.
PHP Code:
void OnStart()
{
//Looping athmosperhic sound
{
for(int i = 0; i <4; i++)
AddTimer("S1" + i, 10 * i, "func_sound");
}
}
void func_sound (string &in asParent, string &in asChild, int alState)
{
AddEntityCollideCallback("Player", "sound_scare", "func_sound", true, 1);
}
void func_sound(string &in asTimer)
{
string x = asTimer;
if (x == "S1")
{
PlayGuiSound("door_level_cistern_open.snt", 0.5);
}
}