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
Sound not playing (Read if you want to have different times on looping sounds)
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#1
Sound not playing (Read if you want to have different times on looping sounds)

The sound is simply not playing.



void OnStart()
{
AddEntityCollideCallback("Player", "EnterWindOnArea", "FuncWindy", true, 1);
}

void FuncWindy(string &in asParent, string &in asChild, int alState)
{
if(asChild == "EnterWindOnArea") {
float fWind = RandFloat(0.5f,6.5f);

AddTimer("wind", 2.5f+fWind, "WindTimer");

AddEntityCollideCallback("Player", "EnterWindOffArea", "FuncWindy", true, 1);

} else {
RemoveTimer("wind");

AddEntityCollideCallback("Player", "EnterWindOnArea", "FuncWindy", true, 1);
}

}

void WindTimer(string &in asTimer)
{
int iWind = RandFloat(1, 7);
float fWind = RandFloat(4.5f,14.5f);

PlaySoundAtEntity("WindSound"+iWind, "general_wind_blow.snt", "WindSound_"+iWind, 0.0f, false);

AddTimer("wind", 5.5f+fWind, "WindTimer");

}

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 05-22-2012, 06:38 PM by i3670.)
05-21-2012, 02:16 PM
Find Reply
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#2
RE: Sound not playing

iWind? fWind? What the fuck is going on?

Signature to awesome to be displayed.
05-21-2012, 03:26 PM
Find Reply
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#3
RE: Sound not playing

Hey i3670,

I like your script, it's a bit complicated (than what I'm used to seeing on here) but it seems like it does its job efficiently.

Did you name your areas "WindSound_1", "WindSound_2", etc.?

Are you sure your timer is sounding off properly?

What I would do is add the following lines of code inside your WindTimer function:
AddDebugMessage("Firing WindTimer function", false);

(after the variables are declared)
AddDebugMessage("Playing sound WindSound_"+iWind, false);

Tell me what the results are. Make sure debug messages are enabled for your profile!

(05-21-2012, 03:26 PM)Stepper321 Wrote: iWind? fWind? What the fuck is going on?

He's creating variables to randomize the time and area at which the sounds are played. "fWind" is a float, while "iWind" is an integer; floats are floating point numbers (decimals) while integers are 1, 2, 3, etc.

(This post was last modified: 05-21-2012, 03:46 PM by Putmalk.)
05-21-2012, 03:44 PM
Find Reply
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#4
RE: Sound not playing

(05-21-2012, 03:44 PM)Putmalk Wrote: Hey i3670,

I like your script, it's a bit complicated (than what I'm used to seeing on here) but it seems like it does its job efficiently.

Did you name your areas "WindSound_1", "WindSound_2", etc.?

Are you sure your timer is sounding off properly?

What I would do is add the following lines of code inside your WindTimer function:
AddDebugMessage("Firing WindTimer function", false);

(after the variables are declared)
AddDebugMessage("Playing sound WindSound_"+iWind, false);

Tell me what the results are. Make sure debug messages are enabled for your profile!

(05-21-2012, 03:26 PM)Stepper321 Wrote: iWind? fWind? What the fuck is going on?

He's creating variables to randomize the time and area at which the sounds are played. "fWind" is a float, while "iWind" is an integer; floats are floating point numbers (decimals) while integers are 1, 2, 3, etc.
A.K.A. Some pretty nice(and possibly)advanced scripting Big Grin

05-21-2012, 03:48 PM
Find Reply
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#5
RE: Sound not playing

(05-21-2012, 03:48 PM)Datguy5 Wrote:
(05-21-2012, 03:44 PM)Putmalk Wrote: Hey i3670,

I like your script, it's a bit complicated (than what I'm used to seeing on here) but it seems like it does its job efficiently.

Did you name your areas "WindSound_1", "WindSound_2", etc.?

Are you sure your timer is sounding off properly?

What I would do is add the following lines of code inside your WindTimer function:
AddDebugMessage("Firing WindTimer function", false);

(after the variables are declared)
AddDebugMessage("Playing sound WindSound_"+iWind, false);

Tell me what the results are. Make sure debug messages are enabled for your profile!

(05-21-2012, 03:26 PM)Stepper321 Wrote: iWind? fWind? What the fuck is going on?

He's creating variables to randomize the time and area at which the sounds are played. "fWind" is a float, while "iWind" is an integer; floats are floating point numbers (decimals) while integers are 1, 2, 3, etc.
A.K.A. Some pretty nice(and possibly)advanced scripting Big Grin
Yup, I'll be using that technique in my custom story at some point (when I start to script random events like wind blowing or voice hearing and other stuff). It's a pretty nifty skill to have.

05-21-2012, 03:52 PM
Find Reply
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#6
RE: Sound not playing

(05-21-2012, 03:44 PM)Putmalk Wrote: Hey i3670,

I like your script, it's a bit complicated (than what I'm used to seeing on here) but it seems like it does its job efficiently.

Did you name your areas "WindSound_1", "WindSound_2", etc.?

Are you sure your timer is sounding off properly?

What I would do is add the following lines of code inside your WindTimer function:
AddDebugMessage("Firing WindTimer function", false);

(after the variables are declared)
AddDebugMessage("Playing sound WindSound_"+iWind, false);

Tell me what the results are. Make sure debug messages are enabled for your profile!

(05-21-2012, 03:26 PM)Stepper321 Wrote: iWind? fWind? What the fuck is going on?

He's creating variables to randomize the time and area at which the sounds are played. "fWind" is a float, while "iWind" is an integer; floats are floating point numbers (decimals) while integers are 1, 2, 3, etc.
Yes the areas where the sound is playing is WindSound_1 to WindSound_7

Don't have the debug messages active atm. Other than that, would there be any other reason to why it wouldn't sound?

"What you think is irrelevant" - A character of our time

A Christmas Hunt
05-21-2012, 04:11 PM
Find Reply
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#7
RE: Sound not playing

(05-21-2012, 03:52 PM)Putmalk Wrote:
(05-21-2012, 03:48 PM)Datguy5 Wrote:
(05-21-2012, 03:44 PM)Putmalk Wrote: Hey i3670,

I like your script, it's a bit complicated (than what I'm used to seeing on here) but it seems like it does its job efficiently.

Did you name your areas "WindSound_1", "WindSound_2", etc.?

Are you sure your timer is sounding off properly?

What I would do is add the following lines of code inside your WindTimer function:
AddDebugMessage("Firing WindTimer function", false);

(after the variables are declared)
AddDebugMessage("Playing sound WindSound_"+iWind, false);

Tell me what the results are. Make sure debug messages are enabled for your profile!

(05-21-2012, 03:26 PM)Stepper321 Wrote: iWind? fWind? What the fuck is going on?

He's creating variables to randomize the time and area at which the sounds are played. "fWind" is a float, while "iWind" is an integer; floats are floating point numbers (decimals) while integers are 1, 2, 3, etc.
A.K.A. Some pretty nice(and possibly)advanced scripting Big Grin
Yup, I'll be using that technique in my custom story at some point (when I start to script random events like wind blowing or voice hearing and other stuff). It's a pretty nifty skill to have.

Heres a one way to make random voice hearings and stuff like that.Just place insanity area in the level editor and when the player collides with it(no scripting needed)it will trigger a random insanity effect.I usually hear someone talking and i sometimes get cockroaches in my face too Big Grin

(This post was last modified: 05-21-2012, 04:49 PM by Datguy5.)
05-21-2012, 04:48 PM
Find Reply
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#8
RE: Sound not playing

(05-21-2012, 04:48 PM)Datguy5 Wrote:
(05-21-2012, 03:52 PM)Putmalk Wrote:
(05-21-2012, 03:48 PM)Datguy5 Wrote:
(05-21-2012, 03:44 PM)Putmalk Wrote: Hey i3670,

I like your script, it's a bit complicated (than what I'm used to seeing on here) but it seems like it does its job efficiently.

Did you name your areas "WindSound_1", "WindSound_2", etc.?

Are you sure your timer is sounding off properly?

What I would do is add the following lines of code inside your WindTimer function:
AddDebugMessage("Firing WindTimer function", false);

(after the variables are declared)
AddDebugMessage("Playing sound WindSound_"+iWind, false);

Tell me what the results are. Make sure debug messages are enabled for your profile!

(05-21-2012, 03:26 PM)Stepper321 Wrote: iWind? fWind? What the fuck is going on?

He's creating variables to randomize the time and area at which the sounds are played. "fWind" is a float, while "iWind" is an integer; floats are floating point numbers (decimals) while integers are 1, 2, 3, etc.
A.K.A. Some pretty nice(and possibly)advanced scripting Big Grin
Yup, I'll be using that technique in my custom story at some point (when I start to script random events like wind blowing or voice hearing and other stuff). It's a pretty nifty skill to have.

Heres a one way to make random voice hearings and stuff like that.Just place insanity area in the level editor and when the player collides with it(no scripting needed)it will trigger a random insanity effect.I usually hear someone talking and i sometimes get cockroaches in my face too Big Grin
I think he want's more customization.

Signature to awesome to be displayed.
05-21-2012, 06:24 PM
Find Reply
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#9
RE: Sound not playing

It's more controlled to script the events, than having a random insanity event occur.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
05-21-2012, 06:58 PM
Find Reply
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#10
RE: Sound not playing

The source of the problem wasn't the script. The general_wind_blow sound was so low that I couldn't hear it. Thanks for helping anyways.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
05-22-2012, 03:44 PM
Find Reply




Users browsing this thread: 1 Guest(s)