Frictional Games Forum (read-only)
Key Problem - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Key Problem (/thread-18767.html)



Key Problem - TheMadmaxster - 10-14-2012

Hi all!
Im working on a custom map and I'm stuck on probably one of the most simplest things: unlocking a door. Here's my script. Is there something wrong? The error I get is cellar1 is undeclared and no matching signature PlaySoundAtEntity

My .hps
Code:
void OnStart()
{
    AddUseItemCallback ("", "cellarkey", "cellar1", "Unlock1", true);
    SetEntityCallbackFunc ("cellarkey,", "OnPickup");
}

void Unlock1(string &in key1, string & in door1)
{
    SetSwingDoorLocked (cellar1, false, true);
    PlaySoundAtEntity ("", "unlock_door", cellar1, 0, false);
    RemoveItem ("cellarkey");
}

.lang
Code:
<LANGUAGE>
              <CATEGORY Name="Inventory">
        <Entry Name="ItemDesc_cellarkey">The Key For Emergencies.</Entry>
        <Entry Name="ItemName_cellarkey">The Emergency Key</Entry>
    </CATEGORY>
</LANGUAGE>



RE: Key Problem - Adny - 10-14-2012

You didn't declare "cellar1", also the callback syntax was a bit screwy:


void OnStart()
{
AddUseItemCallback ("", "cellarkey", "cellar1", "Unlock1", true);
SetEntityCallbackFunc ("cellarkey,", "OnPickup");
}

void Unlock1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked ("cellar1", false, true);
PlaySoundAtEntity ("", "unlock_door", "cellar1", 0, false);
RemoveItem ("cellarkey");
}