Frictional Games Forum (read-only)
Setting a message when interacting with a door - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Setting a message when interacting with a door (/thread-9399.html)



Setting a message when interacting with a door - JenniferOrange - 07-26-2011

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?


RE: Setting a message when interacting with a door - Dizturbed - 07-26-2011

SetEntityPlayerInteractCallback.

Then use Setmessage. =)


RE: Setting a message when interacting with a door - JenniferOrange - 07-26-2011

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.


RE: Setting a message when interacting with a door - Tanshaydar - 07-26-2011

(string &in asParent, string &in asChild, int alState)
is wrong. It should be: (string &in entity)

void Locked(string &in entity)


RE: Setting a message when interacting with a door - JenniferOrange - 07-26-2011

But it still doesn't work. >:c


RE: Setting a message when interacting with a door - Tanshaydar - 07-26-2011

Awww, you didn't write the entity's name.


RE: Setting a message when interacting with a door - JenniferOrange - 07-26-2011

where do I put that..? xD
SetEntityPlayerInteractCallback("cellar_1", "Locked", true); ?


RE: Setting a message when interacting with a door - MrCookieh - 07-26-2011

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>



RE: Setting a message when interacting with a door - JenniferOrange - 07-26-2011

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


RE: Setting a message when interacting with a door - Tanshaydar - 07-26-2011

(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.