(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()
{
}