Frictional Games Forum (read-only)
sound problems - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: sound problems (/thread-5591.html)

Pages: 1 2


RE: sound problems - THE/ILL/WILL - 12-02-2010

so i rewrote all the stuff like this and now its giveing me ( errors. i think im grouping wrong anyone have some pointers?
////////////////////////////
// Run first time starting map
void OnStart()
{

{
AddUseItemCallback( "", "DoorKey_1", "Door_3", "UseKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("DoorKey_1");
}
{
[color=#FFD700]AddEntityCollideCallback("Player", "doorslam_1","Collidedoorslam", true, -1);
}
void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
PlaySoundAtEntity("", "amb_hunt01", "Player", 0, false);
}
{
AddEntityCollideCallback("Player", "Unlock_1","Room2Unlock", true, 1);
}
void Room2Unlock(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Room_2", true, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
}

}


RE: sound problems - Oscar House - 12-02-2010

Why do you have everything inside OnStart()?


RE: sound problems - Akumasama - 12-02-2010

^This.

The functions should be in onEnter(){
Code:
AddEntityCollideCallback("Player", "soundtrigger1", "soundtrigger1activate", true, 1);
Such as that.

Then in no category, you place the syntaxes with what you want it to do.
Code:
void soundtrigger1activate(string &in asParent, string &in asChild, int alState)
{
stuff that happens
for example:
PlayGuiSound("guardian_activated.snt", 1)
}

STUFF THATS WRONG:

Sound files need the ".snt" after the file you want to play. (Look in the actual folder to see if you have the right file.)
You have a function inside a function (void inside of a function), this isn't possible.

Code:
void OnStart()
{ ///STUFF TO ACTIVATE FUNCTIONS HERE
AddUseItemCallback( "", "DoorKey_1", "Door_3", "UseKeyOnDoor", true);
AddEntityCollideCallback("Player", "doorslam_1","Collidedoorslam", true, -1);
AddEntityCollideCallback("Player", "Unlock_1","Room2Unlock", true, 1);
}

///THE ACTUAL FUNCTIONS GO HERE
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlayGuiSound("unlock_door.snt", 1f);
RemoveItem("DoorKey_1");
}

void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
PlayGuiSound("amb_hunt01.snt", 1f);
}

void Room2Unlock(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Room_2", true, true);
PlayGuiSound("unlock_door.snt", 1f);
}
That would make the correct script. (There might be problems, just did this real quick.)
I just rearranged it real quick.
Also, PlayGuiSound is alot easier to use than PlaySoundAtEntity.