julianprokop
Junior Member
Posts: 19
Threads: 7
Joined: Nov 2011
Reputation:
0
|
Need help displaying door is locked on non-exit doors.
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.
|
|
02-12-2012, 10:53 AM |
|
Linus Ågren
Senior Member
Posts: 309
Threads: 58
Joined: Jan 2011
Reputation:
5
|
RE: Need help displaying door is locked on non-exit doors.
You need to make an interact callback
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
And then use
SetMessage(string& asTextCategory, string& asTextEntry, float 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);
}
Creator of The Dark Treasure.
|
|
02-12-2012, 12:28 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Need help displaying door is locked on non-exit doors.
I did that once, problem is that you still have it after you unlock it :/
(This post was last modified: 02-12-2012, 01:14 PM by flamez3.)
|
|
02-12-2012, 01:14 PM |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
RE: Need help displaying door is locked on non-exit doors.
To have it not show text when it's unlocked you need to use local variables
(This post was last modified: 02-12-2012, 01:16 PM by SilentStriker.)
|
|
02-12-2012, 01:16 PM |
|
Juby
Senior Member
Posts: 290
Threads: 2
Joined: May 2011
Reputation:
5
|
RE: Need help displaying door is locked on non-exit doors.
In the callback use: if(GetSwingDoorLocked("Door")==false) SetMessage("TxtCat", "TxtEnt", 3);
if you want to not have the message appear after the door is unlocked.
Insanity. Static.
|
|
02-12-2012, 01:22 PM |
|
julianprokop
Junior Member
Posts: 19
Threads: 7
Joined: Nov 2011
Reputation:
0
|
RE: Need help displaying door is locked on non-exit doors.
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.
(This post was last modified: 02-12-2012, 01:42 PM by julianprokop.)
|
|
02-12-2012, 01:25 PM |
|
julianprokop
Junior Member
Posts: 19
Threads: 7
Joined: Nov 2011
Reputation:
0
|
RE: Need help displaying door is locked on non-exit doors.
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.
|
|
02-12-2012, 11:28 PM |
|
Juby
Senior Member
Posts: 290
Threads: 2
Joined: May 2011
Reputation:
5
|
RE: Need help displaying door is locked on non-exit doors.
Do exactly as junkfood2121 said, but replace the SetMessage("Messages", "DoorLocked", 3.0f); with the command I said.
Insanity. Static.
|
|
02-13-2012, 12:39 AM |
|
julianprokop
Junior Member
Posts: 19
Threads: 7
Joined: Nov 2011
Reputation:
0
|
RE: Need help displaying door is locked on non-exit doors.
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);
}
}
|
|
02-13-2012, 12:56 AM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Need help displaying door is locked on non-exit doors.
Can we see your .lang file and have you named everything exactly?
|
|
02-13-2012, 03:48 AM |
|
|