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 question
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#1
sound question

Okay guys, I created a script where a head will appear upon picking up a key. My question is how do I make the scream sound? I imagine it would be similar to this...


PlaySoundAtEntity("secretkey", "21_scream10.ogg", "player", 1, false);


but I am unsure if this is correct. Soundname would be the object the player has to interact with right?
(This post was last modified: 07-31-2012, 04:02 AM by Soverain.)
07-31-2012, 01:08 AM
Find
ksnider Offline
Junior Member

Posts: 9
Threads: 0
Joined: Jul 2012
Reputation: 0
#2
RE: sound question

The sound name is the internal name of the sound. You can name it whatever you want.

Also, I think you can remove the .ogg extension. I only use it when I play music.

Creator of Pewdie's Revenge
(This post was last modified: 07-31-2012, 02:04 AM by ksnider.)
07-31-2012, 01:59 AM
Find
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#3
RE: sound question

(07-31-2012, 01:59 AM)ksnider Wrote: The sound name is the internal name of the sound. You can name it whatever you want.

Also, I think you can remove the .ogg extension. I only use it when I play music.
Didn't quite work...to be more clear I want the scream to happen as the head appears if that makes any sense
(This post was last modified: 07-31-2012, 02:07 AM by Soverain.)
07-31-2012, 02:06 AM
Find
ksnider Offline
Junior Member

Posts: 9
Threads: 0
Joined: Jul 2012
Reputation: 0
#4
RE: sound question

(07-31-2012, 02:06 AM)Soverain Wrote: Didn't quite work...to be more clear I want the scream to happen as the head appears if that makes any sense

In the function where you set the head active, place:

PlaySoundAtEntity("secretkey", "21_scream10", "Player", 1, false);

I think forgetting to capitalize "Player" can cause an error.

Creator of Pewdie's Revenge
07-31-2012, 02:10 AM
Find
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#5
RE: sound question

(07-31-2012, 02:10 AM)ksnider Wrote:
(07-31-2012, 02:06 AM)Soverain Wrote: Didn't quite work...to be more clear I want the scream to happen as the head appears if that makes any sense

In the function where you set the head active, place:

PlaySoundAtEntity("secretkey", "21_scream10", "Player", 1, false);

I think forgetting to capitalize "Player" can cause an error.
It didn't work=/
07-31-2012, 02:47 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#6
RE: sound question

"21_scream10" can't be used in this function. The string used for the sound name must be a .snt (sound configuration) file. The only available .snt file that includes that specific sound (as well as 11 others the .snt chooses at random) is "21_screams". Your function should be:

PlaySoundAtEntity("secretkey", "21_screams", "Player", 1, false);


Hope that helped.

Also, you don't need an internal name unless you intend to use a function like StopSound or FadeInSound (both of which only use the internal name, not the actual name of a .snt file). You can leave it blank ("") if you'd like.

I rate it 3 memes.
(This post was last modified: 07-31-2012, 02:59 AM by Adny.)
07-31-2012, 02:55 AM
Find
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#7
RE: sound question

(07-31-2012, 02:55 AM)andyrockin123 Wrote: "21_scream10" can't be used in this function. The string used for the sound name must be a .snt (sound configuration) file. The only available .snt file that includes that specific sound (as well as 11 others the .snt chooses at random) is "21_screams". Your function should be:

PlaySoundAtEntity("secretkey", "21_screams", "Player", 1, false);


Hope that helped.

Also, you don't need an internal name unless you intend to use a function like StopSound or FadeInSound (both of which only use the internal name, not the actual name of a .snt file). You can leave it blank ("") if you'd like.
I'm afraid the sound is still not working when the head appears...

my entire script


////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("smash", "break", "FUNC", true, 0);
AddUseItemCallback("", "secretkey", "door1", "UsedKeyOnDoor", true);
PlayMusic("25_amb.ogg", true, 1, 1, 0, false);
SetEntityCallbackFunc("secretkey", "scream");
SetEntityConnectionStateChangeCallback("shelf", "func_shelf");
}

void FUNC(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door", 0.0f);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("secretkey");
}
void scream(string &in asEntity, string&in type)
{
PlaySoundAtEntity("", "21_screams", "player", 1, false);
SetEntityActive("head",true);
}

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}


void LockedDoor(string &in entity)
{
if(GetSwingDoorLocked("door") == true)
{
SetMessage("Messages","msg",0);
}
}

void DoorLocked(string &in entity)
{
if(GetSwingDoorLocked("door1") == true)
{
SetMessage("Messages","locked",0);
}
}

void obstacle(string &in entity)
{
if(GetSwingDoorLocked("door2") == true)
{
SetMessage("Messages","block",0);
}
}


////////////////////////////
// Run when entering map
void OnLeave()
{

}
07-31-2012, 03:44 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#8
RE: sound question

void scream(string &in asEntity, string&in type)

Syntax is wrong, it should be:

void scream(string &in asEntity, string &in asType)


Also, you still didn't capitalize the first letter of "Player" in the PlaySoundAtEntity function. If you fix that, it should work.

I rate it 3 memes.
(This post was last modified: 07-31-2012, 03:50 AM by Adny.)
07-31-2012, 03:50 AM
Find
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#9
RE: sound question

(07-31-2012, 03:50 AM)andyrockin123 Wrote: void scream(string &in asEntity, string&in type)

Syntax is wrong, it should be:

void scream(string &in asEntity, string &in asType)


Also, you still didn't capitalize the first letter of "Player" in the PlaySoundAtEntity function. If you fix that, it should work.
Thanks, it now works Smile
07-31-2012, 04:01 AM
Find




Users browsing this thread: 2 Guest(s)