Frictional Games Forum (read-only)
Level Doors and Text? - 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: Level Doors and Text? (/thread-17010.html)



Level Doors and Text? - SiderealStop - 07-16-2012

I'm back with more noobish questions~
Before anyone accuses me of not looking, I have. Anything I've come across, I've either tried to understand and tested myself, or just plainly didn't understand. I've tried tutorials as well, just...really not good at following those and have ended up in errors and stuff. Hehe.

Anyway, here's my problem...or rather question:

I have a key and a level door. I need to have the level door be locked, and the key unlock it and disappear. SO simple, right? I already know how to do that with a normal swing door. That's easy enough. But I can't seem to figure out level doors.

My script so far:


void OnStart()
{
}
void OnEnter()
{
PlayMusic("WarOfTheFools.ogg", true, 2, 0, 10, true);
}



Really not sure where to put stuff, and yes I know...this is a reaaaally noobish question! O_O

One other thing is that I have two doors in that same map. One is the level door I need to unlock with a key, the other is a different level door that I want to be...sorta...locked, but only because the player can't go through without the lantern. How would I set a message to appear for both doors before they're 'unlocked' and how would I 'unlock' the one door when the person picks up the lantern?

Sorry for all the random questions! o-o Thanks in advance!


RE: Level Doors and Text? - Steve - 07-16-2012

I don't fully understand but what I think you want is this.
you want to have two doors one you open when you use a key on it and one to open when you pick up the lantern.
If I'm wrong my bad. but to do what I think you want to do you can use this:
FOR THE LEVEL DOOR
void OnStart()
{
AddUseItemCallback("", "Name_of_Key", "Name_of_Leveldoor", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Name_of_Leveldoor", false);
PlaySoundAtEntity("", "unlock_door", "Name_of_Leveldoor", 0, false);
RemoveItem("Name_of_Key");
}
||||||Also make sure you have the leveldoorlocked!!!||||||
And use this for the lantern:
void OnStart()
{
SetEntityPlayerInteractCallback("Name_Of_Lantern", "OnLanternPickUp", true);
}
void OnLanternPickUp(string &in item)
{
SetLevelDoorLocked("Name_of_Leveldoor", false);
}
But if you want to make the door open/unlocked but you can't open it you could use:
SetEntityInteractionDisabled(string& asName, bool abDisabled);

on the door. so you can't click on it I hope this helped Big Grin