Frictional Games Forum (read-only)

Full Version: Setting a message when interacting with a door
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know that there's a script function thing for level doors, but I'm talking about swing doors. You go up to the door and try and open it, and a message displays. (saying something like "I'm locked down here.")

I've already tried using AddEntityCollideCallback so when the Player collides with the door the message is displayed, but it didn't work.. any help?
SetEntityPlayerInteractCallback.

Then use Setmessage. =)
I just tried that, and it didn't work. -.-
I looks like this:

{
SetEntityPlayerInteractCallback("", "Locked", true);
}

void Locked(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "locked", 0);
}

anything wrong?
EDIT: Just noticed I didn't change (string &in asParent, string &in asChild, int alState) to (string &in asEntity). Lol, oops.
(string &in asParent, string &in asChild, int alState)
is wrong. It should be: (string &in entity)

void Locked(string &in entity)
But it still doesn't work. >:c
Awww, you didn't write the entity's name.
where do I put that..? xD
SetEntityPlayerInteractCallback("cellar_1", "Locked", true); ?
Code:
void OnStart(){
SetEntityPlayerInteractCallback("door", "showlockedmessage", false);
}

void showlockedmessage(string &in asEntity){
SetMessage("Message", "door", 0);
}

in your .lang file:

Code:
<CATEGORY Name="Message">
<Entry Name="door">The door is locked</Entry>
</CATEGORY>
Thanks MrCookieh.
I found a thing under the Entity tab of my door that said PlayerInteractCallback and wrote the name of my function (Locked) under there and it worked. Smile
btw- how do you delete a thread you've made..? xD
(07-26-2011, 07:03 PM)JenniferOrange Wrote: [ -> ]where do I put that..? xD
SetEntityPlayerInteractCallback("cellar_1", "Locked", true); ?

Yes, and what MrCookieh said. But it should be
Code:
<CATEGORY Name="Messages">
<Entry Name="locked">The door is locked</Entry>
</CATEGORY>

--
Anyway it's solved.
However, if you set in LevelEditor it will be there for default in map start. You might wanna add it later so scripting it might be better in some occasions.