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
How i can reload script area when i die ? And how to create loopable sounds ?
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#9
RE: How i can reload script area when i die ? And how to create loopable sounds ?

PlaySoundAtEntity uses .snt files, not .ogg files (at least not directly). You're probably better off using random integers to generate a random time to play, as well as a random sound. Try using this instead:


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Zavalenie", true, 1);
}

void Zavalenie(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("explosion_rock_large.ogg", 0.8f);
StopMusic( 0, 50);
SetEntityActive("kamen1", true);
SetEntityActive("zombik", false);
StartScreenShake(0.5f, 1, 1, 0);

AddTimer("", RandInt(30, 60), "ambients");
AddTimer("", RandInt(30, 60), "ambients2");
}

void ambients(string &in asTimer)
{
PlaySoundAtEntity("", "scare_male_terrified"+RandInt(1, 3), "Player", 0.5f, false);
AddTimer("", RandInt(30, 60), "ambients");
}
void ambients2(string &in asTimer)
{
PlaySoundAtEntity("", "scare_wall_stomp", "Player", 0.5f, false);
AddTimer("", RandInt(30, 60), "ambients2");
}

This script will randomly choose a time between 30 and 60 seconds to play a random noise at.

Hope that helped!

I rate it 3 memes.
07-31-2012, 11:16 PM
Find


Messages In This Thread
RE: How i can reload script area when i die ? And how to create loopable sounds ? - by Adny - 07-31-2012, 11:16 PM



Users browsing this thread: 1 Guest(s)