Frictional Games Forum (read-only)
Unlocking a level door with a key error? - 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: Unlocking a level door with a key error? (/thread-20660.html)



Unlocking a level door with a key error? - Hailfiretank - 03-07-2013

Me again...

My problem now is that I want to unlock a level door with a key (not to remove the key from inventory though).

When I use the key on the door, it makes the unlocking sound, but does not unlock the door :/

I've been through all the scripting tutorials, and its not a problem connecting the two maps, as it works when the door is unlocked.

Here is my script for the map:

void OnStart()

{
SetEntityConnectionStateChangeCallback("secret_lever", "func_shelf");
AddEntityCollideCallback("Player", "door_slam", "slam", true, 1);
AddEntityCollideCallback("Player", "brute_spawn", "MonsterFunction1", true, 1);
AddEntityCollideCallback("brute_1", "brute_spawn", "NewPath", true, 1);
SetEntityCallbackFunc("key_kirk", "OnPickup");
AddUseItemCallback("", "key_kirk", "colonade", "Unlock", true);
}

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret_door",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

void slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_5", true, true);
SetSwingDoorLocked("castle_5", true, true);
PlaySoundAtEntity("", "react_pant.snt", "castle_5", 0, false);
PlaySoundAtEntity("", "00_laugh.snt", "castle_5", 0, false);
}

void OnPickup(string &in asEntity, string &in type)
{
PlayMusic("10_puzzle01.ogg", false, 1, 0.1, 10, false);
}

void MonsterFunction1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("brute_1", true);
AddEnemyPatrolNode("brute_1", "PathNodeArea_1", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_2", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_3", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_4", 4, "");
}

void NewPath(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("brute_1", "PathNodeArea_5", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_6", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_7", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_8", 4, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_9", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_10", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_11", 0.01, "");
}

void Unlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("colonade", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "colonade", 0.0f, false);
}

void OnEnter()
{
PlayMusic("02_amb_strange", true, 1, 5, 0, true);
}

The level door is named 'colonade', and the key is names 'key_kirk'.

Any help would be a appreciated. Sorry for all these different threads I keep making :/


RE: Unlocking a level door with a key error? - ExpectedIdentifier - 03-07-2013

Give me a minute


RE: Unlocking a level door with a key error? - No Author - 03-07-2013

Use "SetLevelDoorLocked". "SetSwingDoorLocked" is for regular door only, not for level doors.


RE: Unlocking a level door with a key error? - ExpectedIdentifier - 03-07-2013

PHP Code:
SetLevelDoorLocked("colonade"false); 

Use that instead of

PHP Code:
SetSwingDoorLocked("colonade"falsetrue); 





Dang, too slow Tongue
Should of refreshed the page first. Haha.


RE: Unlocking a level door with a key error? - No Author - 03-08-2013

(03-07-2013, 11:55 PM)sonataarctica Wrote:
PHP Code:
SetLevelDoorLocked("colonade"false); 

Use that instead of

PHP Code:
SetSwingDoorLocked("colonade"falsetrue); 





Dang, too slow Tongue
Should of refreshed the page first. Haha.

Lol.


RE: Unlocking a level door with a key error? - Hailfiretank - 03-08-2013

Thanks guys! Big Grin