Frictional Games Forum (read-only)

Full Version: Need help displaying door is locked on non-exit doors.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How do you make a custom message appear when I interact with door entities that aren't exit doors?
The Exit doors have options for .lang files but there must be a way to create a object orientated category in the .lang file for any entity. Any ideas on how I could do so? The tutorials I've found aren't answering what I need.



You need to make an interact callback
PHP Code:
SetEntityPlayerInteractCallback(stringasNamestringasCallbackbool abRemoveOnInteraction); 
And then use
PHP Code:
SetMessage(stringasTextCategorystringasTextEntryfloat afTime); 
to display the message you want to appear.

Example:

Quote:void OnStart()
{
SetEntityPlayerInteractCallback("DOORNAME", "CALLBACK", RUN_CODE_EACH_TIME_YOU_INTERACT);
}

void CALLBACK(string &in asEntity)
{
SetMessage("Messages", "DoorLocked", 3.0f);
}
I did that once, problem is that you still have it after you unlock it :/
To have it not show text when it's unlocked you need to use local variables
In the callback use:
Code:
if(GetSwingDoorLocked("Door")==false) SetMessage("TxtCat", "TxtEnt", 3);

if you want to not have the message appear after the door is unlocked.
ill try that out
could you give me an example of how I would include that in my call back? My project is getting pretty huge with lots of code going on so and {} brackets are usually the death of me.
could you give me an example of how I would include that in my call back? My project is getting pretty huge with lots of code going on so and {} brackets are usually the death of me.
Do exactly as junkfood2121 said, but replace the SetMessage("Messages", "DoorLocked", 3.0f); with the command I said.
Still isn't working. This is what I have,
///CALLBACK
{
SetEntityPlayerInteractCallback("locked_door", "door_message", true);

}

///FUNCTION

void door_message(string &in asEntity)
{
if(GetSwingDoorLocked("Door")==false)
{
SetMessage("Doors", "door", 3);
}
}



Can we see your .lang file and have you named everything exactly?
Pages: 1 2