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
Swing door message
XeOnTricks Offline
Junior Member

Posts: 27
Threads: 12
Joined: Feb 2017
Reputation: 0
#1
Swing door message

while creating my level i was thinking about adding a message to a locked swing door when you try to open it and it saing something along the lines of "this door requires a key"
how exactly do i do that?
03-01-2017, 01:55 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Swing door message

The SetMessage script is the one you want to use to display the message. Combine that with a player interact callback, and you should get the result you want.

First, set the callback in OnStart()
PHP Code: (Select All)
SetEntityPlayerInteractCallback("Door""MyFuncName"false); 
Note: If you want this to happen only once, set the false to be true.

Next, set up the callback event:

PHP Code: (Select All)
void MyFuncName(string &in asEntity)
{
    
SetMessage("MessageCategory""MessageEntry", -1.0f);


Here, the MessageCategory refers to a category in your extra_english.lang file. The MessageEntry refers to an entry within that category. The last float number determines how long it should last (but I've set it to auto).

Lastly you need your lang file to respect this. If you haven't worked much with your lang file, this may be a bit tricky, but you need to add the category and entry you specified.

PHP Code: (Select All)
<CATEGORY Name="MessageCategory">
    <
Entry Name="MessageEntry">This door requires a key</Entry>
</
CATEGORY

03-01-2017, 09:23 AM
Find
XeOnTricks Offline
Junior Member

Posts: 27
Threads: 12
Joined: Feb 2017
Reputation: 0
#3
RE: Swing door message

(03-01-2017, 09:23 AM)Mudbill Wrote: The SetMessage script is the one you want to use to display the message. Combine that with a player interact callback, and you should get the result you want.

First, set the callback in OnStart()
PHP Code: (Select All)
SetEntityPlayerInteractCallback("Door""MyFuncName"false); 
Note: If you want this to happen only once, set the false to be true.

Next, set up the callback event:

PHP Code: (Select All)
void MyFuncName(string &in asEntity)
{
    
SetMessage("MessageCategory""MessageEntry", -1.0f);


Here, the MessageCategory refers to a category in your extra_english.lang file. The MessageEntry refers to an entry within that category. The last float number determines how long it should last (but I've set it to auto).

Lastly you need your lang file to respect this. If you haven't worked much with your lang file, this may be a bit tricky, but you need to add the category and entry you specified.

PHP Code: (Select All)
<CATEGORY Name="MessageCategory">
    <
Entry Name="MessageEntry">This door requires a key</Entry>
</
CATEGORY

probably will sound stupid but what is the MessageCategory?
03-01-2017, 11:51 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Swing door message

MessageCategory is a category you create in the .lang file.
The name "MessageCategory" is not important. It could have been "MesCat" or something else.

But notice that in Mudbill's script

PHP Code: (Select All)
SetMessage("MessageCategory""MessageEntry", -1.0f); 

He references the name MessageCategory because he called it the same in the .lang file.

Trying is the first step to success.
03-01-2017, 12:18 PM
Find
Traggey Offline
is mildly amused

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#5
RE: Swing door message

Moving this thread to development support.
03-03-2017, 03:53 PM
Find




Users browsing this thread: 1 Guest(s)