Frictional Games Forum (read-only)

Full Version: Leveldoor 'Locked' Key not working!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
You can't use SetSwingDoorLocked script for level doors.
Use SetLevelDoorLocked(string& asName, bool abLocked);
(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
Your welcomeSmile
(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?
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);
(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?
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.
(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