Frictional Games Forum (read-only)

Full Version: Locking Doors ,Give Item ,and Lights
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
That is very helpful and nice ideas for opening the door.
But The more interest comes when we open by playing.



Shop Shutter
(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 ?
No that makes no difference.

What is the name of the door?
mansion_1
Then i have no idea... It should work
Have you test it by yourself ?
Nope... Not right now... I could do that.
Is there any other script ? Anyone ?
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;
}
}
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
Pages: 1 2 3