Frictional Games Forum (read-only)
[SCRIPT] Locking Doors ,Give Item ,and Lights - 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: [SCRIPT] Locking Doors ,Give Item ,and Lights (/thread-20024.html)

Pages: 1 2 3


RE: Locking Doors ,Give Item ,and Lights - taylor23 - 01-23-2013

That is very helpful and nice ideas for opening the door.
But The more interest comes when we open by playing.



Shop Shutter


RE: Locking Doors ,Give Item ,and Lights - No Author - 01-23-2013

(01-22-2013, 02:49 PM)BeeKayK Wrote: Weird it should work. Does anything happen to the door? Does the sound play?
Does it say "Cannot use item this way"?

The sound plays but it won't open the door.
NOTE : I check the "locked" thingy in the level editor. Does that change the script or something ?


RE: Locking Doors ,Give Item ,and Lights - FlawlessHappiness - 01-23-2013

No that makes no difference.

What is the name of the door?


RE: Locking Doors ,Give Item ,and Lights - No Author - 01-23-2013

mansion_1


RE: Locking Doors ,Give Item ,and Lights - FlawlessHappiness - 01-23-2013

Then i have no idea... It should work


RE: Locking Doors ,Give Item ,and Lights - No Author - 01-23-2013

Have you test it by yourself ?


RE: Locking Doors ,Give Item ,and Lights - FlawlessHappiness - 01-23-2013

Nope... Not right now... I could do that.


RE: Locking Doors ,Give Item ,and Lights - No Author - 01-23-2013

Is there any other script ? Anyone ?


RE: Locking Doors ,Give Item ,and Lights - FlawlessHappiness - 01-23-2013

I think i know why it doesn't work...

Give me some minutes

*TESTING*

EDIT:

Ok it works to me with this function:

void UseKeyOnDoor01(string &in asItem, string &in asEntity)
{

if(GetSwingDoorLocked("mansion_1") == true)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "lock_door.snt", "mansion_1", 0, true);
return;
}

if(GetSwingDoorLocked("mansion_1") == false)
{
SetSwingDoorLocked("mansion_1", true, true);
PlaySoundAtEntity("", "lock_door.snt", "mansion_1", 0, true);
return;
}
}


RE: Locking Doors ,Give Item ,and Lights - nivramm - 01-23-2013

Maybe you could script a function for locking and one for unlocking…and add at the end of both functions
an AddUseItemCallback which calls the other function…so locking causes the unlockfunction to run if key is again used on the door and otherway round.
But then u need to delete the AddUseItemCallback after collision…for having not both active^^.
I guess there is a more proper way…but i would try it like this. Dont know if it even works, only an idea.

edit: didn't see BeeKayK's post…forget mine if the if-way works