Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script to add message to a locked swing door
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#1
Script to add message to a locked swing door

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?
(This post was last modified: 02-04-2012, 01:43 PM by Ninami.)
02-04-2012, 11:14 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Script to add message to a locked swing door

(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

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

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


02-04-2012, 12:55 PM
Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#3
RE: Script to add message to a locked swing door

Yeah I did this recently:

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.
02-04-2012, 12:58 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: Script to add message to a locked swing door

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

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?



02-04-2012, 01:00 PM
Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#5
RE: Script to add message to a locked swing door

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...
02-04-2012, 01:01 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#6
RE: Script to add message to a locked swing door

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

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


02-04-2012, 01:04 PM
Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#7
RE: Script to add message to a locked swing door

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 :/
02-04-2012, 01:13 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#8
RE: Script to add message to a locked swing door

(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


02-04-2012, 01:33 PM
Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#9
RE: Script to add message to a locked swing door

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
02-04-2012, 01:42 PM
Find




Users browsing this thread: 1 Guest(s)