Frictional Games Forum (read-only)
key not unlocking door - 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 not unlocking door (/thread-16390.html)



key not unlocking door - peepeeboynotreal - 06-22-2012

i use the key on a level door i loose my key but it dosen't unlock
heres my script:
void OnStart()
{
AddUseItemCallback("", "hubkey1", "portal", "portalunlock", true);
}
void portalunlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("portal", false, true);
PlaySoundAtEntity("", "unlock_door", "portal", 0, false);
RemoveItem("hubkey1");
}

my key is called hubkey1 and my door is called portal
any ideas?


RE: key not unlocking door - Mooserider - 06-22-2012

Your script seems fine to me, the only possible things I think of that would stop it from unlocking are
A) You've made a typo in the level editor and the names aren't matched up exactly, or
B) You need to delete the cache file. Delete "<mapname>.map_cache" and it should be good Smile

Edit: Also sorry but in the future you should probably post questions like this in the development support section Smile


RE: key not unlocking door - peepeeboynotreal - 06-22-2012

(06-22-2012, 07:46 AM)Mooserider Wrote: Your script seems fine to me, the only possible things I think of that would stop it from unlocking are
A) You've made a typo in the level editor and the names aren't matched up exactly, or
B) You need to delete the cache file. Delete "<mapname>.map_cache" and it should be good Smile

Edit: Also sorry but in the future you should probably post questions like this in the development support section Smile
done both of those things and its still not working.... Sad


RE: key not unlocking door - Traggey - 06-22-2012

Wrong forum, moved.


RE: key not unlocking door - Your Computer - 06-22-2012

SetSwingDoorLocked neither locks nor unlocks level doors; it is used for swing doors.


RE: key not unlocking door - SiderealStop - 06-22-2012

Quote:SetSwingDoorLocked neither locks nor unlocks level doors; it is used for swing doors.
To elaborate...If you're using a level door, one that moves you from one map to another, it does not swing open like a normal door that leads from one room to another on the same map. A normal door, I'm guessing, when 'unlocked' using SetSwingDoorLocked doesn't technically unlock it, it makes the door able to swing which makes it look like it's being 'unlocked'. I may be completely wrong there, but basically yeah - I'm pretty sure you can't unlock a level door using SetSwingDoorLocked. I'm not sure myself how to unlock a level door, so if that's what you're using then I can't help. Just wanted to elaborate on what Your Computer said. =3


RE: key not unlocking door - Cruzore - 06-22-2012

void SetLevelDoorLocked(string& asName, bool abLocked);
from the engine scripts page on the dev wiki.


RE: key not unlocking door - Mooserider - 06-23-2012

Oops sorry, didn't realise it was a level door.