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
Script Help Sounds don't play
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#1
Sounds don't play

Hello everyone!

So, I needed to make some random wind, to add ambience. The beggining code worked pretty well, but the same sound got repeated over and over again. I made a RandInt system but the windysound_+Int don't work.


void OnStart()
{
AddTimer("", 1, "Wind");
}


void Wind (string &in asTimer)
{
AddTimer("", 0.1, "Windy");
PlaySoundAtEntity("wind_amb", "wind_amb.snt", "", 1.f, false);
}

void Windy (string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_dust_whirl", "Windy_"+RandInt(1, 7), false);
"windysound_"+RandInt(1, 3);
AddTimer("", RandInt(1.0, 7.0), "Windy");
}

void windysound_1 ()
{
PlaySoundAtEntity("", "scare_wind.snt", "Windy_"+RandInt(1, 7), 0.f, false);
}

void windysound_2 ()
{
PlaySoundAtEntity("", "scare_wind_reverse.snt","Windy_"+RandInt(1, 7), 0.f, false);
}

void windysound_3 ()
{
PlaySoundAtEntity("", "general_wind_whirl_rand.snt", "Windy_"+RandInt(1, 7), 0.f, false);
}

What could be wrong?
Thanks in advance Big Grin

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-12-2012, 09:38 PM
Find
Juby Away
Senior Member

Posts: 290
Threads: 2
Joined: May 2011
Reputation: 5
#2
RE: Sounds don't play

It might be that you have such things as:

1.f
and
0.f

in there when you are supposed to either have 1, 1.0f, 0, 0.0f

Insanity. Static.
12-12-2012, 09:57 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: Sounds don't play

(12-12-2012, 09:57 PM)Juby Wrote: It might be that you have such things as:

1.f
and
0.f

in there when you are supposed to either have 1, 1.0f, 0, 0.0f
Nope, doesn't work.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-12-2012, 10:15 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Sounds don't play

Well you might want to choose where you want the sound to play.

PlaySoundAtEntity("wind_amb", "wind_amb.snt", "", 1.f, false);



You write something like "Player". Right now it playing nowhere because you didn't put anything in there. It should look like this:


PlaySoundAtEntity("wind_amb", "wind_amb.snt", "Player", 1.f, false);

Trying is the first step to success.
12-12-2012, 10:45 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#5
RE: Sounds don't play

(12-12-2012, 10:45 PM)beecake Wrote: Well you might want to choose where you want the sound to play.

PlaySoundAtEntity("wind_amb", "wind_amb.snt", "", 1.f, false);



You write something like "Player". Right now it playing nowhere because you didn't put anything in there. It should look like this:


PlaySoundAtEntity("wind_amb", "wind_amb.snt", "Player", 1.f, false);
Yea, it worked well for the main ambience. But, I want that windysound_+Int sounds aleatorially.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-12-2012, 10:58 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Sounds don't play

(12-12-2012, 10:58 PM)The chaser Wrote: aleatorially.
What does this word mean? Smile

Trying is the first step to success.
12-13-2012, 07:02 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: Sounds don't play

(12-13-2012, 07:02 AM)beecake Wrote:
(12-12-2012, 10:58 PM)The chaser Wrote: aleatorially.
What does this word mean? Smile
In spanish, random is "Aleatorio". I thought aleatorially existed in english XD
I've made a test and it isn't that sounds don't plat, the same function isn't called. Why is that?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-13-2012, 07:48 AM
Find
JMFStorm Offline
Member

Posts: 205
Threads: 8
Joined: Aug 2011
Reputation: 28
#8
RE: Sounds don't play

void OnStart()
{
AddTimer("", 1, "Wind");
}


void Wind (string &in asTimer)
{
AddTimer("", 0.1f, "Windy");
PlaySoundAtEntity("wind_amb", "wind_amb.snt", "", 1, false);
}

void Windy (string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_dust_whirl", "Windy_"+RandInt(1, 7), false);
"windysound_"+RandInt(1, 3)(); // OR windysound_+RandInt(1, 3)(); This may be the error line
AddTimer("", RandInt(1.0f, 7.0f), "Windy");
}

void windysound_1 ()
{
PlaySoundAtEntity("", "scare_wind.snt", "Windy_"+RandInt(1, 7), 0, false);
}

void windysound_2 ()
{
PlaySoundAtEntity("", "scare_wind_reverse.snt","Windy_"+RandInt(1, 7), 0, false);
}

void windysound_3 ()
{
PlaySoundAtEntity("", "general_wind_whirl_rand.snt", "Windy_"+RandInt(1, 7), 0, false);
}

12-13-2012, 07:56 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#9
RE: Sounds don't play

(12-13-2012, 07:56 AM)JMFStorm Wrote:
void OnStart()
{
AddTimer("", 1, "Wind");
}


void Wind (string &in asTimer)
{
AddTimer("", 0.1f, "Windy");
PlaySoundAtEntity("wind_amb", "wind_amb.snt", "", 1, false);
}

void Windy (string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_dust_whirl", "Windy_"+RandInt(1, 7), false);
"windysound_"+RandInt(1, 3)(); // OR windysound_+RandInt(1, 3)(); This may be the error line
AddTimer("", RandInt(1.0f, 7.0f), "Windy");
}

void windysound_1 ()
{
PlaySoundAtEntity("", "scare_wind.snt", "Windy_"+RandInt(1, 7), 0, false);
}

void windysound_2 ()
{
PlaySoundAtEntity("", "scare_wind_reverse.snt","Windy_"+RandInt(1, 7), 0, false);
}

void windysound_3 ()
{
PlaySoundAtEntity("", "general_wind_whirl_rand.snt", "Windy_"+RandInt(1, 7), 0, false);
}
I already tried that and it cause an error: Expected ";".

Thanks for the replies Tongue

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 12-13-2012, 02:42 PM by The chaser.)
12-13-2012, 10:17 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Sounds don't play

Can you fix the error? Smile

Trying is the first step to success.
12-13-2012, 10:50 AM
Find




Users browsing this thread: 2 Guest(s)