Frictional Games Forum (read-only)

Full Version: key not unlocking door
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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
(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
Wrong forum, moved.
SetSwingDoorLocked neither locks nor unlocks level doors; it is used for swing doors.
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
void SetLevelDoorLocked(string& asName, bool abLocked);
from the engine scripts page on the dev wiki.
Oops sorry, didn't realise it was a level door.