Frictional Games Forum (read-only)
Another question that's probably syntax related >_< - 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: Another question that's probably syntax related >_< (/thread-7146.html)



Another question that's probably syntax related >_< - Austums - 04-01-2011

Okay, so the only thing I'm not so certain on is the SetLevelDoorLockedSound

This is my very first script made from scratch, so I apologize for the somewhat noobish post xP

Code:
void OnStart()
{
   AddTimer("CreepyMusic", 0, "CreepyMusic");
   AddUseItemCallback("CellarDoorKey1Func", "CellarDoorKey1", "CellarDoor1", "CellarDoorKey1Func", true);
}
void CreepyMusic(string &in asTimer)
{
   PlayMusic("06_amb.ogg", true, 7, 3, 0, true);
}
void SetLevelDoorLockedSound(CellarDoor1, "door_level_wood_locked.ogg");
{
}
void CellarDoorKey1Func(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("CellarDoor1", false);
    RemoveItem("CellarDoorKey1");
    PlaySoundAtEntity("unlocking", "unlock_door.snt", "Player", 0, true);
}

And I just got a really long error stating that it expected something at (1,2) I believe


RE: Another question that's probably syntax related >_< - Pandemoneus - 04-01-2011

Delete that and choose the level door in the editor, go to the entity tab and select the sound there. Tongue


RE: Another question that's probably syntax related >_< - MrBigzy - 04-01-2011

You need the onenter and onleave functions there too.

You can use either the editor or your script to put the sound. It's a matter of personal choice though; I prefer script even though it's not as simple, just because I find it so easy to overlook things I put in the level editor.

Here's an example of my script I use for a locked door.

Code:
void LockedDoor2(string &in asEntity)
{
   if (GetGlobalVarInt("Lock") == 1){ SetMessage("Entryway", "LockedDoor2", 0);
                                      PlaySoundAtEntity("locked_door", "locked_door.snt", "prison_1", 0, false);
                                    }
}

I had SetGlobalVarInt("Lock", 1); in my OnStart for the variable, as well as SetEntityPlayerInteractCallback("prison_section_1", "LockedDoor", false); for the function. So yea, like the Panda Man said (I totally just made that up, sorry Big Grin) you can use level editor if you find it harder to script that stuff.