Frictional Games Forum (read-only)
Leveldoor 'Locked' Key not working! - 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: Leveldoor 'Locked' Key not working! (/thread-20338.html)



Leveldoor 'Locked' Key not working! - VeNoMzTeamHysterical - 02-15-2013

So i just made key to open a door. its a level door the key is gone when i use it but it is not opening.

AddUseItemCallback("", "cryptkey", "cryptdoor", "UsedKeyOnDoor", true);

void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("cryptdoor", false, true);

PlaySoundAtEntity("", "unlock_door", "cryptdoor", 0, false);

RemoveItem("cryptkey");

}

keyname=cryptkey
doorname=cryptdoor


RE: Leveldoor 'Locked' Key not working! - No Author - 02-15-2013

You can't use SetSwingDoorLocked script for level doors.
Use SetLevelDoorLocked(string& asName, bool abLocked);


RE: Leveldoor 'Locked' Key not working! - VeNoMzTeamHysterical - 02-15-2013

(02-15-2013, 03:01 PM)No Author Wrote: You can't use SetSwingDoorLocked script for level doors.
Use SetLevelDoorLocked(string& asName, bool abLocked);

Thanks alot i didnt know Smile


RE: Leveldoor 'Locked' Key not working! - No Author - 02-15-2013

Your welcomeSmile


RE: Leveldoor 'Locked' Key not working! - VeNoMzTeamHysterical - 02-15-2013

(02-15-2013, 03:45 PM)No Author Wrote: Your welcomeSmile

So its gonna be

void UsedKeyOnDoor(string& asName, bool abLocked);

{

SetLevelDoorLocked("cryptdoor", false, true);

SetLevelDoorLockedSound("cryptdoor", "unlock_door");

RemoveItem("cryptkey");

}

if im right?


RE: Leveldoor 'Locked' Key not working! - FlawlessHappiness - 02-15-2013

no.
SetLevelDoorLocked("cryptdoor", false);

There is no effect, because it's no swingdoor.


also:
SetLevelDoorLockedSound("cryptdoor", "unlock_door");

I guess what you want is just to play the sound?


Just use:
PlaySoundAtEntity("", "unlock_door", "cryptdoor", 0, false);


RE: Leveldoor 'Locked' Key not working! - VeNoMzTeamHysterical - 02-15-2013

(02-15-2013, 03:49 PM)BeeKayK Wrote: no.
SetLevelDoorLocked("cryptdoor", false);

There is no effect, because it's no swingdoor.


also:
SetLevelDoorLockedSound("cryptdoor", "unlock_door");

I guess what you want is just to play the sound?


Just use:
PlaySoundAtEntity("", "unlock_door", "cryptdoor", 0, false);

You are a beast sir Big Grin

Why don't you make tutorials you will be a popular amnesia tutorial channel ;p

(02-15-2013, 03:49 PM)BeeKayK Wrote: no.
SetLevelDoorLocked("cryptdoor", false);

There is no effect, because it's no swingdoor.


also:
SetLevelDoorLockedSound("cryptdoor", "unlock_door");

I guess what you want is just to play the sound?


Just use:
PlaySoundAtEntity("", "unlock_door", "cryptdoor", 0, false);

Lol it does not work... i cant use the key on the level door...
It is maybe because you get a key in the map before?
Or does that not matter?


RE: Leveldoor 'Locked' Key not working! - FlawlessHappiness - 02-15-2013

Nope. Doesn't matter.

This is how the script should look (Remember you cannot have 2 void OnStart):

void OnStart()
{
AddUseItemCallback("", "cryptkey", "cryptdoor", "UsedKeyOnDoor", true);

}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "unlock_door", "cryptdoor", 0, false);

SetLevelDoorLocked("cryptdoor", false);

RemoveItem(asItem);
}


Remember to check that all names are correct with capitals!
It's important!


If it doesn't work, show us the error, and your full script.


RE: Leveldoor 'Locked' Key not working! - VeNoMzTeamHysterical - 02-15-2013

(02-15-2013, 04:05 PM)BeeKayK Wrote: Nope. Doesn't matter.

This is how the script should look (Remember you cannot have 2 void OnStart):

void OnStart()
{
AddUseItemCallback("", "cryptkey", "cryptdoor", "UsedKeyOnDoor", true);

}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "unlock_door", "cryptdoor", 0, false);

SetLevelDoorLocked("cryptdoor", false);

RemoveItem(asItem);
}


Remember to check that all names are correct with capitals!
It's important!


If it doesn't work, show us the error, and your full script.

OMG it works now you got + rep'd sir Big Grin