06-04-2016, 08:05 PM
I'm trying to make it so when the player walks into an area, a sound plays but it's not working. Here's the script I'm using:
void OnStart()
{
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("OpenDoor", "LevelKey1", "LevelDoor1", "UseKeyOnLevelDoor", true);
AddEntityCollideCallback("Player", "OpenScare", "SoundCheck", false, 1);
}
void SoundCheck(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "notice.snt", "OpenScare", 1.0f, false);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", "asEntity", 0, false);
RemoveItem(asItem);
}
void UseKeyOnLevelDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}
void OnLeave()
{
}
Also, is there anything I have to do with the area besides the name?
void OnStart()
{
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("OpenDoor", "LevelKey1", "LevelDoor1", "UseKeyOnLevelDoor", true);
AddEntityCollideCallback("Player", "OpenScare", "SoundCheck", false, 1);
}
void SoundCheck(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "notice.snt", "OpenScare", 1.0f, false);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", "asEntity", 0, false);
RemoveItem(asItem);
}
void UseKeyOnLevelDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}
void OnLeave()
{
}
Also, is there anything I have to do with the area besides the name?