Frictional Games Forum (read-only)
Script to add message to a locked swing door - 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 to add message to a locked swing door (/thread-13088.html)



Script to add message to a locked swing door - Ninami - 02-04-2012

Hey guys, been searching quite a while for a solution but I can't find it.

I have a swing door in a room which is locked. When you try to open it I want a message to appear, something like "The door is locked".

I tried the "SetLevelDoorLockedText" but I learned that it only works on level doors.

What do I script in order to do the exact same thing, but on swing doors?

Cheers Ninami
Now I tried adding:

SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);


void LockedDoor(string &in asEntity)
{
SetMessage("Messages", "DoorLocked", 2);
}

But nothing happens when I interact with the door.

AND, if this would work, it still would show the message even though the door was unlocked...right?


RE: Script to add message to a locked swing door - SilentStriker - 02-04-2012

(02-04-2012, 11:14 AM)Ninami Wrote: Hey guys, been searching quite a while for a solution but I can't find it.

I have a swing door in a room which is locked. When you try to open it I want a message to appear, something like "The door is locked".

I tried the "SetLevelDoorLockedText" but I learned that it only works on level doors.

What do I script in order to do the exact same thing, but on swing doors?

Cheers Ninami
Now I tried adding:

SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);


void LockedDoor(string &in asEntity)
{
SetMessage("Messages", "DoorLocked", 2);
}

But nothing happens when I interact with the door.

AND, if this would work, it still would show the message even though the door was unlocked...right?
Here's the one i use it's for a level door but i guess it will work the same Smile

Code:
void OnStart()
{
    SetLocalVarInt("DoorLocked", 1);
    SetEntityPlayerInteractCallback("NAMEOFDOORHERE", "TextLockedDoor", false);
}

void TextLockedDoor(string &in asEntity)
{
    if(GetLocalVarInt("DoorLocked") == 1){
        SetMessage("Message", "NAMEOFENTRY", 3);
    }
}




RE: Script to add message to a locked swing door - Ninami - 02-04-2012

Yeah I did this recently:

Code:
SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);
void LockedDoor(string &in asEntity)    {        if(GetSwingDoorLocked("Door_1") == true)        {            SetMessage("Messages", "DoorLocked", 2);        }    }


But it wont work, it doesn't show any message, I think something else is wrong.


RE: Script to add message to a locked swing door - SilentStriker - 02-04-2012

(02-04-2012, 12:58 PM)Ninami Wrote: Yeah I did this recently:

Code:
SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);
void LockedDoor(string &in asEntity)    {        if(GetSwingDoorLocked("Door_1") == true)        {            SetMessage("Messages", "DoorLocked", 2);        }    }


But it wont work, it doesn't show any message, I think something else is wrong.
Have you named the door Door_1 and checked so everything is correct?





RE: Script to add message to a locked swing door - Ninami - 02-04-2012

Yeah I've checked it more than 5 times haha Tongue

The door name is "Door_1". I just don't have a single clue what's wrong...


RE: Script to add message to a locked swing door - SilentStriker - 02-04-2012

(02-04-2012, 12:58 PM)Ninami Wrote: Yeah I did this recently:

Code:
SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);
void LockedDoor(string &in asEntity)    {        if(GetSwingDoorLocked("Door_1") == true)        {            SetMessage("Messages", "DoorLocked", 2);        }    }


But it wont work, it doesn't show any message, I think something else is wrong.
and use my script for the door instead of the one you wrote because GetSwingDoorLocked isn't working




RE: Script to add message to a locked swing door - Ninami - 02-04-2012

Tbh I don't really understand your code, is it really complete?

I mean, if the door is locked then the VAR is 1, but if it gets unlocked, it's still 1, right?

Don't I need another code for when I unlock the door AddLocalVarInt("DoorLocked", 1); so when it's unlocked it doesn't show the message?

Maybe I'm totally wrong, I just don't understand otherwise :/


RE: Script to add message to a locked swing door - SilentStriker - 02-04-2012

(02-04-2012, 01:13 PM)Ninami Wrote: Tbh I don't really understand your code, is it really complete?

I mean, if the door is locked then the VAR is 1, but if it gets unlocked, it's still 1, right?

Don't I need another code for when I unlock the door AddLocalVarInt("DoorLocked", 1); so when it's unlocked it doesn't show the message?

Maybe I'm totally wrong, I just don't understand otherwise :/
oh yea i forgot one part Tongue put this in a code when it's going to unlock SetLocalVarInt("DoorLocked", 0);

I totally forgot that i used that in a puzzle xD




RE: Script to add message to a locked swing door - Ninami - 02-04-2012

Haha I'm just impressed that I understood xD

But still wont work, since the .lang file or whatever is fucked up somehow, like I said on the other thread Sad