Help on locking level doors? - 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: Help on locking level doors? (/thread-16889.html) Pages:
1
2
|
Help on locking level doors? - Wyz - 07-11-2012 I recently started a new CS and I want to lock a level door in the first map, but regardless of my code, the door stays unlocked. void OnStart() { SetPlayerLampOil(0); AddEntityCollideCallback("Player", "ArmorTrigger", "ArmorTriggerFunc", true, 1); } //Function to make armor's head fall in cellar void ArmorTriggerFunc(string &in asParent, string &in asChild, int alState) { AddPropForce("fallingArmor", 50, 0, 300, "World"); } //Function to set "Atrium" door locked in cellar void CellarLockedFunc(string &in asEntity) { SetLevelDoorLocked("Atrium", false); } Is there something I'm missing? RE: Help on locking level doors? - SilentStriker - 07-11-2012 I would guess that the CellarLockedFunc is called from an entity inside the level editor? and if you want to LOCK it then you should have write true instead of false. RE: Help on locking level doors? - Stepper321 - 07-11-2012 1. You haven't defined 'CellarLockedFunc' 2. Did you put locked in the entity tab of the level door? RE: Help on locking level doors? - Wyz - 07-11-2012 (07-11-2012, 03:30 PM)Stepper321 Wrote: 1. You haven't defined 'CellarLockedFunc'1. Hmm, I thought since it wasn't a collide function, then it would not need a callback. Is this true? Would I define that on start? 2. I'm sure I did, I'll double check. I got it, thank you for the replies. The SetLockedLevelDoor is only for unlocking, you set the door locked in the entity tab RE: Help on locking level doors? - SilentStriker - 07-11-2012 Everytime you are creating a new function you need something to call that function. Like a timer or a callback code RE: Help on locking level doors? - Wyz - 07-11-2012 I did not want to create a whole new thread for this, but I've got the level door locked, and when I try to use my key on it, it doesn't work and sometimes disappears before I even use it. Here's my code: AddUseItemCallback("", "OldKey", "Atrium", "AtriumDoorUnlock", true); void AtriumDoorUnlock(string &in asItem, string &in asEntity) { SetLevelDoorLocked(asEntity, false); PlaySoundAtEntity("", "unlock_door", "Atrium", 0, false); RemoveItem(asItem); } Thanks for your help. RE: Help on locking level doors? - SilentStriker - 07-11-2012 Check so everything is spelled correctly. other than that I can't find a problem, probably something I missed thought RE: Help on locking level doors? - Wyz - 07-12-2012 I've played around with the function a bit, but now the door is unlocked once I pick up the key. void AtriumDoorUnlock(string &in asItem, string &in asEntity) { SetLevelDoorLocked("Atrium", false); PlaySoundAtEntity("", "unlock_door", "Atrium", 0, false); RemoveItem("OldKey"); } RE: Help on locking level doors? - SilentStriker - 07-12-2012 are you using SetEntityPlayerInteractCallback? Since it's unlocked when you pick up the key RE: Help on locking level doors? - Wyz - 07-12-2012 I'm using a UseItem callback, if that's any help. |